1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
From 54351076f87ce2a43a87427d9c3f3e00539b9fd5 Mon Sep 17 00:00:00 2001
From: Andreas Sturmlechner <asturm@gentoo.org>
Date: Tue, 31 Aug 2021 16:48:42 +0200
Subject: [PATCH] Make WITH_KWALLET and WITH_KJS proper cmake options
Since I was asked to implement this, might as well make it real options,
not just limited to ANDROID. Even though optional find_package() call is
already being used for KF5Purpose as well.
KF5DocTools is not made required more often than not.
See also: https://invent.kde.org/graphics/okular/-/issues/61
Downstream report: https://bugs.gentoo.org/810958
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
---
CMakeLists.txt | 21 ++++++++-------------
config-okular.h.cmake | 6 ++++++
core/generator.cpp | 1 +
core/scripter.cpp | 1 +
4 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2506c3cfa..984f3695e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,12 +76,9 @@ ecm_setup_qtplugin_macro_names(
PACKAGE_SETUP_AUTOMOC_VARIABLES
)
-set(optionalComponents)
-if (ANDROID)
-# we want to make sure that generally all components are found
-
- set(optionalComponents "OPTIONAL_COMPONENTS")
-endif()
+# we want to make sure that generally all components are found
+option(WITH_KWALLET "Build with desktop-wide storage for password support" ON)
+option(WITH_KJS "Build with scripting support" ON)
find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
Archive
@@ -98,17 +95,15 @@ find_package(KF5 ${KF5_REQUIRED_VERSION} REQUIRED COMPONENTS
TextWidgets
ThreadWeaver
WindowSystem
- ${optionalComponents}
+ OPTIONAL_COMPONENTS
DocTools
- JS
- Wallet
)
-if(KF5Wallet_FOUND)
- add_definitions(-DWITH_KWALLET=1)
+if(WITH_KWALLET)
+ find_package(KF5Wallet ${KF5_REQUIRED_VERSION} REQUIRED)
endif()
-if(KF5JS_FOUND)
- add_definitions(-DWITH_KJS=1)
+if(WITH_KJS)
+ find_package(KF5JS ${KF5_REQUIRED_VERSION} REQUIRED)
endif()
if(NOT WIN32 AND NOT ANDROID)
diff --git a/config-okular.h.cmake b/config-okular.h.cmake
index 905aac9cb..00e45f77c 100644
--- a/config-okular.h.cmake
+++ b/config-okular.h.cmake
@@ -1,6 +1,12 @@
/* Defines if force the use DRM in okular */
#define OKULAR_FORCE_DRM ${_OKULAR_FORCE_DRM}
+/* Defines if the KJS framework is available */
+#cmakedefine WITH_KJS
+
+/* Defines if the kwallet framework is available */
+#cmakedefine WITH_KWALLET
+
/* Defines if the purpose framework is available */
#define PURPOSE_FOUND ${PURPOSE_FOUND}
diff --git a/core/generator.cpp b/core/generator.cpp
index 051c2c922..f675ebcb3 100644
--- a/core/generator.cpp
+++ b/core/generator.cpp
@@ -8,6 +8,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config-okular.h"
#include "generator.h"
#include "generator_p.h"
#include "observer.h"
diff --git a/core/scripter.cpp b/core/scripter.cpp
index c60645895..d5b640dbb 100644
--- a/core/scripter.cpp
+++ b/core/scripter.cpp
@@ -4,6 +4,7 @@
SPDX-License-Identifier: GPL-2.0-or-later
*/
+#include "config-okular.h"
#include "scripter.h"
#include <QDebug>
--
2.33.0
|