Skip to content

Commit 44ccbfa

Browse files
committed
Misc: Update CMakeLists.txt
- CMakeLists.txt: add remaining non-debugging compile-time options present in Makefile but not here: CONFIG_VSYNC_OPENGL_{FBO,VBO}, CONFIG_DBUS, and CONFIG_XSYNC. - CMakeLists.txt: Use CMakeDependentOption for option dependency. - CMakeLists.txt: Remove quotes around library CFLAGS and LDFLAGS to allow multiple values.
1 parent 03ebae4 commit 44ccbfa

File tree

1 file changed

+45
-9
lines changed

1 file changed

+45
-9
lines changed

_CMakeLists.txt

+45-9
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ add_definitions("-DCOMPTON_VERSION=${COMPTON_VERSION}")
2323

2424
# == Options ==
2525

26+
include(CMakeDependentOption)
27+
2628
option(CONFIG_REGEX_PCRE "Enable PCRE regular expression support for blacklist entries (requires libpcre)" ON)
2729
if (CONFIG_REGEX_PCRE)
2830
add_definitions("-DCONFIG_REGEX_PCRE")
@@ -49,16 +51,43 @@ if (CONFIG_VSYNC_OPENGL)
4951
list(APPEND compton_SRCS src/opengl.c)
5052
endif ()
5153

52-
option(CONFIG_VSYNC_OPENGL_GLSL "Enable GLSL" ON)
54+
CMAKE_DEPENDENT_OPTION(CONFIG_VSYNC_OPENGL_GLSL
55+
"Enable GLSL support (GLX background blur, etc.)" ON
56+
"CONFIG_VSYNC_OPENGL" OFF)
5357
if (CONFIG_VSYNC_OPENGL_GLSL)
5458
add_definitions("-DCONFIG_VSYNC_OPENGL_GLSL")
5559
endif ()
5660

61+
CMAKE_DEPENDENT_OPTION(CONFIG_VSYNC_OPENGL_FBO
62+
"Enable OpenGL FBO support (GLX multi-pass blur, etc.)" ON
63+
"CONFIG_VSYNC_OPENGL" OFF)
64+
if (CONFIG_VSYNC_OPENGL_FBO)
65+
add_definitions("-DCONFIG_VSYNC_OPENGL_FBO")
66+
endif ()
67+
68+
CMAKE_DEPENDENT_OPTION(CONFIG_VSYNC_OPENGL_VBO
69+
"Enable OpenGL VBO support (does nothing right now)" ON
70+
"CONFIG_VSYNC_OPENGL" OFF)
71+
if (CONFIG_VSYNC_OPENGL_VBO)
72+
add_definitions("-DCONFIG_VSYNC_OPENGL_VBO")
73+
endif ()
74+
5775
option(CONFIG_XINERAMA "Enable additional Xinerama features" ON)
5876
if (CONFIG_XINERAMA)
5977
add_definitions("-DCONFIG_XINERAMA")
6078
endif ()
6179

80+
option(CONFIG_DBUS "Enable D-Bus support" ON)
81+
if (CONFIG_DBUS)
82+
add_definitions("-DCONFIG_DBUS")
83+
list(APPEND compton_SRCS src/dbus.c)
84+
endif ()
85+
86+
option(CONFIG_XSYNC "Enable X Sync support (X Sync fence)" ON)
87+
if (CONFIG_XSYNC)
88+
add_definitions("-DCONFIG_XSYNC")
89+
endif ()
90+
6291
option(CONFIG_C2 "Enable matching system" ON)
6392
if (CONFIG_C2)
6493
add_definitions("-DCONFIG_C2")
@@ -85,10 +114,10 @@ macro(X11LIB_CHK lib)
85114
if (NOT X11_${lib}_FOUND)
86115
message(FATAL_ERROR "Could not find lib${lib}.")
87116
endif ()
88-
target_link_libraries(compton "${X11_${lib}_LIB}")
117+
target_link_libraries(compton ${X11_${lib}_LIB})
89118
endmacro ()
90119

91-
target_link_libraries(compton "${X11_X11_LIB}")
120+
target_link_libraries(compton ${X11_X11_LIB})
92121
X11LIB_CHK(Xcomposite)
93122
X11LIB_CHK(Xdamage)
94123
X11LIB_CHK(Xext)
@@ -102,26 +131,33 @@ endif ()
102131
# --- Find libpcre ---
103132
if (CONFIG_REGEX_PCRE)
104133
pkg_check_modules(LIBPCRE REQUIRED libpcre>=8.12)
105-
add_definitions("${LIBPCRE_CFLAGS}")
106-
target_link_libraries(compton "${LIBPCRE_LDFLAGS}")
134+
add_definitions(${LIBPCRE_CFLAGS})
135+
target_link_libraries(compton ${LIBPCRE_LDFLAGS})
107136
endif ()
108137

109138
# --- Find libconfig ---
110139
if (CONFIG_LIBCONFIG)
111140
pkg_check_modules(LIBCONFIG REQUIRED libconfig>=1.3.2)
112-
add_definitions("${LIBCONFIG_CFLAGS}")
113-
target_link_libraries(compton "${LIBCONFIG_LDFLAGS}")
141+
add_definitions(${LIBCONFIG_CFLAGS})
142+
target_link_libraries(compton ${LIBCONFIG_LDFLAGS})
114143
if (LIBCONFIG_VERSION VERSION_LESS 1.4)
115-
add_definitions("-DCONFIG_LIBCONFIG_LEGACY")
144+
add_definitions(-DCONFIG_LIBCONFIG_LEGACY)
116145
message(STATUS "libconfig-1.3* detected. Enable legacy mode.")
117146
endif ()
118147
endif ()
119148

149+
# --- Find libdbus ---
150+
if (CONFIG_DBUS)
151+
pkg_check_modules(DBUS REQUIRED dbus-1)
152+
add_definitions(${DBUS_CFLAGS})
153+
target_link_libraries(compton ${DBUS_LDFLAGS})
154+
endif ()
155+
120156
# --- Find libdrm ---
121157
if (CONFIG_VSYNC_DRM)
122158
pkg_check_modules(LIBDRM REQUIRED libdrm)
123159
# We only use its header file
124-
add_definitions("${LIBDRM_CFLAGS}")
160+
add_definitions(${LIBDRM_CFLAGS})
125161
endif ()
126162

127163
# == Install ==

0 commit comments

Comments
 (0)