-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
161 lines (134 loc) · 4.37 KB
/
CMakeLists.txt
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
cmake_minimum_required(VERSION 3.18.0 FATAL_ERROR)
# CMP0000: Call the cmake_minimum_required() command at the beginning of the top-level
# CMakeLists.txt file even before calling the project() command.
# The cmake_minimum_required(VERSION) command implicitly invokes the cmake_policy(VERSION)
# command to specify that the current project code is written for the given range of CMake
# versions.
project(lxqt-runner)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(CMakeDependentOption)
include(GNUInstallDirs)
option(RUNNER_MATH "Math operations support" ON)
option(RUNNER_VBOX "Virtual Box support" ON)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
option(USE_MENU_CACHE "Use libmenu-cache from LXDE to generate the app menu" OFF)
cmake_dependent_option(RUNNER_VBOX_HEADLESS
"Use headless mode instead of default window" OFF
"RUNNER_VBOX" OFF
)
# Minimum Versions
set(KF6_MINIMUM_VERSION "6.0.0")
set(LIBMENUCACHE_MINIMUM_VERSION "1.1.0")
set(LXQT_MINIMUM_VERSION "2.1.0")
set(LXQT_GLOBALKEYS_MINIMUM_VERSION "2.1.0")
set(QT_MINIMUM_VERSION "6.6.0")
set(SHELLQT_MINIMUM_VERSION "6.0.0")
find_package(Qt6Widgets ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt6Xml ${QT_MINIMUM_VERSION} REQUIRED)
find_package(Qt6LinguistTools ${QT_MINIMUM_VERSION} REQUIRED)
find_package(KF6WindowSystem ${KF6_MINIMUM_VERSION} REQUIRED)
find_package(lxqt ${LXQT_MINIMUM_VERSION} REQUIRED)
find_package(lxqt-globalkeys-ui ${LXQT_GLOBALKEYS_MINIMUM_VERSION} REQUIRED)
find_package(LayerShellQt ${SHELLQT_MINIMUM_VERSION} REQUIRED)
message(STATUS "Building with Qt${Qt6Core_VERSION}")
include(LXQtPreventInSourceBuilds)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
# Patch Version
set(LXQT_RUNNER_PATCH_VERSION 0)
set(LXQT_RUNNER_VERSION ${LXQT_MAJOR_VERSION}.${LXQT_MINOR_VERSION}.${LXQT_RUNNER_PATCH_VERSION})
add_definitions(
"-DLXQT_RUNNER_VERSION=\"${LXQT_RUNNER_VERSION}\""
)
set(QTX_LIBRARIES Qt6::Widgets Qt6::Xml)
if (USE_MENU_CACHE OR RUNNER_MATH)
find_package(PkgConfig REQUIRED)
endif ()
if (USE_MENU_CACHE)
# optionally use libmenu-cache from lxde to generate the application menu
find_package(MenuCache "${LIBMENUCACHE_MINIMUM_VERSION}" REQUIRED)
endif()
if (RUNNER_MATH)
pkg_check_modules(MUPARSER REQUIRED muparser)
endif ()
set(lxqt-runner_H_FILES
dialog.h
commanditemmodel.h
widgets.h
providers.h
yamlparser.h
configuredialog/configuredialog.h
)
set(lxqt-runner_CPP_FILES
main.cpp
dialog.cpp
commanditemmodel.cpp
widgets.cpp
providers.cpp
yamlparser.cpp
configuredialog/configuredialog.cpp
)
set(lxqt-runner_UI_FILES
dialog.ui
configuredialog/configuredialog.ui
)
set(lxqt-runner_LIBRARIES
lxqt
lxqt-globalkeys
lxqt-globalkeys-ui
${MENUCACHE_LIBRARIES}
${QTX_LIBRARIES}
${MUPARSER_LDFLAGS}
)
include(LXQtTranslate)
lxqt_translate_ts(lxqt-runner_QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES
${lxqt-runner_H_FILES}
${lxqt-runner_CPP_FILES}
${lxqt-runner_UI_FILES}
INSTALL_DIR
"${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
)
lxqt_app_translation_loader(lxqt-runner_QM_LOADER ${PROJECT_NAME})
if (RUNNER_VBOX)
list(APPEND lxqt-runner_QRC_SOURCES virtualbox-icons.qrc)
endif()
add_executable(${PROJECT_NAME}
${lxqt-runner_CPP_FILES}
${lxqt-runner_QRC_SOURCES}
${lxqt-runner_QM_FILES}
${lxqt-runner_QM_LOADER}
)
if (RUNNER_MATH)
lxqt_enable_target_exceptions("${PROJECT_NAME}" PRIVATE)
endif ()
target_include_directories(${PROJECT_NAME}
PRIVATE "$<$<BOOL:${MENUCACHE_FOUND}>:${MENUCACHE_INCLUDE_DIRS}>"
PRIVATE "$<$<BOOL:${MUPARSER_FOUND}>:${MUPARSER_INCLUDE_DIRS}>"
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE "$<$<BOOL:${RUNNER_MATH}>:MATH_ENABLED>"
PRIVATE "$<$<BOOL:${RUNNER_VBOX}>:VBOX_ENABLED>"
PRIVATE "$<$<BOOL:${RUNNER_VBOX_HEADLESS}>:VBOX_HEADLESS_ENABLED>"
PRIVATE "$<$<BOOL:${MENUCACHE_FOUND}>:HAVE_MENU_CACHE=1>"
)
target_link_libraries(${PROJECT_NAME}
${lxqt-runner_LIBRARIES}
KF6::WindowSystem
LayerShellQtInterface
)
install(TARGETS
${PROJECT_NAME}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime
)
install(FILES
man/lxqt-runner.1
DESTINATION "${CMAKE_INSTALL_MANDIR}/man1"
COMPONENT Runtime
)
add_subdirectory(autostart)