forked from QtCurve/qtcurve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
204 lines (181 loc) · 6.82 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
project(QtCurve)
## Temporary
function(translate_add_sources)
endfunction()
## Setup
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake")
## Version
set(QTCURVE_VERSION_MAJOR "1")
set(QTCURVE_VERSION_MINOR "8")
set(QTCURVE_VERSION_PATCH "17")
set(QTCURVE_VERSION "${QTCURVE_VERSION_MAJOR}.${QTCURVE_VERSION_MINOR}")
set(QTCURVE_VERSION_FULL "${QTCURVE_VERSION}.${QTCURVE_VERSION_PATCH}")
## Options
function(def_compat_option new_opt old_opt)
if("${ARGC}" GREATER 2 AND "${ARGV2}")
set(reverse True)
else()
set(reverse False)
endif()
if(DEFINED "${old_opt}" AND NOT DEFINED "${new_opt}")
if(reverse)
if("${${old_opt}}")
set("${new_opt}" Off PARENT_SCOPE)
else()
set("${new_opt}" On PARENT_SCOPE)
endif()
else()
set("${new_opt}" "${${old_opt}}" PARENT_SCOPE)
endif()
endif()
endfunction()
option(ENABLE_QT4 "Building Qt4 theme." On)
option(ENABLE_QT5 "Building Qt5 theme." On)
option(ENABLE_GTK2 "Building Gtk2 theme." On)
option(ENABLE_TEST "Enable testing." Off)
option(QTC_ENABLE_X11 "Enable X11" On)
option(QTC_INSTALL_PO "Install translation files." On)
def_compat_option(QTC_QT4_ENABLE_KDE QTC_QT_ONLY True)
option(QTC_QT4_ENABLE_KDE "Building Qt4 style with KDE4 support." On)
# option(QTC_QT5_ENABLE_KDE "Building Qt5 style with KDE5 support." Off)
def_compat_option(QTC_QT4_OLD_NVIDIA_ARROW_FIX QTC_OLD_NVIDIA_ARROW_FIX)
option(QTC_QT4_OLD_NVIDIA_ARROW_FIX "Qt4 old nvidia arrow fix." Off)
option(QTC_QT5_OLD_NVIDIA_ARROW_FIX "Qt5 old nvidia arrow fix." Off)
def_compat_option(QTC_QT4_STYLE_SUPPORT QTC_STYLE_SUPPORT)
option(QTC_QT4_STYLE_SUPPORT
"Qt4 support for creating a style for each QtCurve theme." Off)
def_compat_option(QTC_QT4_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
QTC_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT)
option(QTC_QT4_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
"Qt4 support for the 'fix parentless dialogs'." Off)
option(QTC_QT5_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
"Qt5 support for the 'fix parentless dialogs'." Off)
def_compat_option(QTC_GTK2_MODIFY_MOZILLA QTC_MODIFY_MOZILLA)
option(QTC_GTK2_MODIFY_MOZILLA "Modify Mozilla Gtk2 with js and css." Off)
def_compat_option(QTC_GTK2_USE_CAIRO_FOR_ARROWS QTC_USE_CAIRO_FOR_ARROWS)
option(QTC_GTK2_USE_CAIRO_FOR_ARROWS "Using ciaro to draw arrows." Off)
option(QTC_GTK2_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT
"Gtk2 support for the 'fix parentless dialogs'." Off)
## Common settings.
# Only try to figure out what kde prefix is if not specified at command line.
if(NOT DEFINED QTC_KDE4_PREFIX)
find_package(KDE4)
find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config
PATHS "${CMAKE_INSTALL_PREFIX}/bin" ${_KDEDIRS} /opt/kde4/bin
NO_DEFAULT_PATH)
if(NOT KDE4_KDECONFIG_EXECUTABLE)
find_program(KDE4_KDECONFIG_EXECUTABLE NAMES kde4-config)
endif()
if(KDE4_KDECONFIG_EXECUTABLE)
execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --prefix
OUTPUT_VARIABLE QTC_KDE4_PREFIX)
string(STRIP "${QTC_KDE4_PREFIX}" QTC_KDE4_PREFIX)
execute_process(COMMAND "${KDE4_KDECONFIG_EXECUTABLE}" --expandvars
--install icon
OUTPUT_VARIABLE QTC_KDE4_ICONS_PREFIX)
string(STRIP "${QTC_KDE4_ICONS_PREFIX}" QTC_KDE4_ICONS_PREFIX)
else()
set(QTC_KDE4_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
endif()
if(NOT DEFINED QTC_KDE4_ICONS_PREFIX)
set(QTC_KDE4_ICONS_PREFIX "${QTC_KDE4_PREFIX}/share/icons")
endif()
## Handle options
macro(qtc_check_x11)
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
message(WARNING "Cannot find pkg-conig, disable x11 support.")
set(QTC_ENABLE_X11 Off)
return()
endif()
pkg_check_modules(QTC_X11 xcb xcb-image x11-xcb)
if(NOT QTC_X11_FOUND)
message(WARNING
"Cannot find required modules for x11, disable x11 support.")
set(QTC_ENABLE_X11 Off)
return()
endif()
endmacro()
if(QTC_ENABLE_X11)
qtc_check_x11()
endif()
if(NOT ENABLE_QT4)
set(QTC_QT4_ENABLE_KDE Off)
set(QTC_QT4_ENABLE_KWIN Off)
endif()
if(NOT ENABLE_QT5)
set(QTC_QT5_ENABLE_KDE Off)
set(QTC_QT5_ENABLE_KWIN Off)
endif()
if(NOT QTC_ENABLE_X11 AND ENABLE_GTK2)
message(WARNING "Gtk2 style require QTC_ENABLE_X11 to be enabled.")
set(ENABLE_GTK2 Off)
endif()
if(ENABLE_GTK2)
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK2 REQUIRED gtk+-2.0)
if(GTK2_THEME_PREFIX)
set(GTK2_PREIX "${GTK2_THEME_PREFIX}")
elseif(NOT GTK2_PREFIX)
set(GTK2_PREFIX "${CMAKE_INSTALL_PREFIX}")
endif()
if(NOT GTK2_LIBDIR)
set(GTK2_LIBDIR "${GTK2_PREFIX}/lib")
endif()
_pkgconfig_invoke(gtk+-2.0 GTK2 BIN_VERSION "" --variable=gtk_binary_version)
set(GTK2_THEME_DIR ${GTK2_PREFIX}/share/themes/QtCurve)
endif()
configure_file(config.h.in config.h @ONLY)
include_directories(
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}")
set(CMAKE_C_FLAGS "-Wall -Wextra ${CMAKE_C_FLAGS} -std=gnu99")
set(CMAKE_CXX_FLAGS "-Wall -Wextra ${CMAKE_CXX_FLAGS} -std=c++0x")
set(CMAKE_SHARED_LINKER_FLAGS
"-Wl,--as-needed -Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS
"-Wl,--as-needed -Wl,--no-undefined ${CMAKE_MODULE_LINKER_FLAGS}")
add_definitions("-D_GNU_SOURCE -pthread")
if(NOT DEFINED LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR lib)
endif()
add_subdirectory(qtcurve-utils)
add_subdirectory(tools)
add_subdirectory(po)
add_subdirectory(qt4)
add_subdirectory(qt5)
add_subdirectory(gtk2)
if(ENABLE_TEST)
add_subdirectory(test)
endif()
if((ENABLE_QT4 AND QTC_QT4_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT) OR
(ENABLE_QT5 AND QTC_QT5_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT) OR
(ENABLE_GTK2 AND QTC_GTK2_ENABLE_PARENTLESS_DIALOG_FIX_SUPPORT))
message(WARNING
"You have enabled support for the 'fix parentless dialogs' option. "
"This is known to BREAK some applications. Please "
"DO NOT report errors to application authors when you have "
"this enabled. Please reconsider DISABLING this option.")
endif()
if(ENABLE_GTK2 AND QTC_GTK2_MODIFY_MOZILLA)
message(WARNING
"You have enabled the option for QtCurve to modify the configuration "
"files of Mozilla applications (Firefox, Thunderbird, Seamonkey). "
"Note: This sometimes causes issues with newer versions of these "
"applications. Should such issues occur, you should recompile QtCurve "
"without this option - and you will have to remove BY HAND the changes "
"that QtCurve has made. This will entail removing lines from "
"userChrom.css that indicate 'Added by QtCurve' userChrome.css is usually "
"in a folder such as: \n"
"`~/.mozilla/firefox/xxxxxxx.default/chrome/userChrome.css` or \n"
"`~/.thunderbird/xxxxxxx.default/chrome/userChrome.css`. \n"
"where xxxxxxx is a series of random characters.")
endif()
if(ENABLE_GTK2 AND QTC_GTK2_USE_CAIRO_FOR_ARROWS)
message(WARNING
"Using cairo to draw arrows - this has been reported to fail with intel "
"Xorg driver > 2.8")
endif()