-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (103 loc) · 3.45 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
cmake_minimum_required(VERSION 3.7.0)
project(dockbarx-lxqt-plugin)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
include(GNUInstallDirs)
set(PLUGIN_ID "dockbarx")
set(PLUGIN_VERSION "0.9.4")
set(PLUGIN_LIB_DIR "${CMAKE_INSTALL_FULL_LIBDIR}/lxqt-panel/")
set(PLUGIN_DESKTOP_DIR "${CMAKE_INSTALL_FULL_DATAROOTDIR}/lxqt/lxqt-panel/")
set(DOCKBARX_PATH "${CMAKE_INSTALL_FULL_DATAROOTDIR}/dockbarx")
OPTION(ALLOW_SET_MAX_SIZE "Allow setting the max size of plugin (buggy, only for test)" OFF)
if(ALLOW_SET_MAX_SIZE)
add_definitions("-DENABLE_SET_MAX_SIZE")
endif()
execute_process(
COMMAND sh -c "lxqt-panel --version | grep ^Qt | sed -E 's/^Qt\\s*([0-9]+)\\..*$/\\1/' | tr -d $'\\n'"
ERROR_QUIET
OUTPUT_VARIABLE QT_VER
)
if(NOT QT_VER)
find_package(Qt6 QUIET COMPONENTS Core)
if (NOT Qt6_FOUND)
find_package(Qt5 COMPONENTS Core REQUIRED)
set(QT_VER 5)
else()
set(QT_VER 6)
endif()
message(WARNING "Can not detect Qt version from lxqt-panel. Try to build with Qt ${QT_VER}")
endif()
set(QT_COMPONENTS Core Gui DBus Widgets)
if(QT_VER EQUAL 5)
list(APPEND QT_COMPONENTS X11Extras)
endif()
find_package(Qt${QT_VER} COMPONENTS ${QT_COMPONENTS} REQUIRED)
set(QT_INCLUDE_DIRS "")
set(QT_LIBRARIES "")
foreach(temp ${QT_COMPONENTS})
list(APPEND QT_INCLUDE_DIRS "${Qt${QT_VER}${temp}_INCLUDE_DIRS}")
list(APPEND QT_LIBRARIES "${Qt${QT_VER}${temp}_LIBRARIES}")
endforeach()
include_directories(${QT_INCLUDE_DIRS})
foreach(temp ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
if (EXISTS ${temp}/lxqt/LXQt/lxqtapplication.h)
set(HAVE_LXQTAPP_HEADERS TRUE)
break()
endif()
endforeach()
if(NOT "${HAVE_LXQTAPP_HEADERS}")
message(FATAL_ERROR "LXQt header files are not found")
endif()
foreach(temp ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
if (EXISTS ${temp}/lxqt/ilxqtpanel.h AND EXISTS ${temp}/lxqt/ilxqtpanelplugin.h)
set(HAVE_LXQTPANEL_HEADERS TRUE)
break()
endif()
endforeach()
if(NOT "${HAVE_LXQTPANEL_HEADERS}")
message(FATAL_ERROR "LXQt panel header files are not found")
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
add_definitions("-DUNICODE")
configure_file(src/config.h.in config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set(PLUGIN_SRC
src/configdialog.cpp
src/dbusproxy.cpp
src/lxqtplugin.cpp
src/lxqtpluginlibrary.cpp
src/panelsettings.cpp
src/filewatcher.cpp
src/pyappletkeeper.cpp
src/dockbarcontainer.cpp
src/themeparser.cpp
src/lxqtpanel.cpp
src/lxqtpluginsettings.cpp
)
set(PLUGIN_HDR
src/configdialog.h
src/dbusproxy.h
src/lxqtplugin.h
src/lxqtpluginlibrary.h
src/panelsettings.h
src/filewatcher.h
src/pyappletkeeper.h
src/dockbarcontainer.h
src/themeparser.h
src/lxqtpanel.h
src/lxqtpluginsettings.h
)
add_library(plugin MODULE ${PLUGIN_HDR} ${PLUGIN_SRC})
target_link_libraries(plugin ${QT_LIBRARIES})
set_target_properties(plugin PROPERTIES OUTPUT_NAME ${PLUGIN_ID})
install(TARGETS plugin LIBRARY
DESTINATION ${PLUGIN_LIB_DIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/lxqt-panel-applet.py
DESTINATION ${DOCKBARX_PATH}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/dockbarx.desktop
DESTINATION ${PLUGIN_DESKTOP_DIR})