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.
This commit is contained in:
Richard Grenville 2015-01-11 11:01:37 +08:00
parent 03ebae4c33
commit 44ccbfab9f
1 changed files with 45 additions and 9 deletions

View File

@ -23,6 +23,8 @@ add_definitions("-DCOMPTON_VERSION=${COMPTON_VERSION}")
# == Options == # == Options ==
include(CMakeDependentOption)
option(CONFIG_REGEX_PCRE "Enable PCRE regular expression support for blacklist entries (requires libpcre)" ON) option(CONFIG_REGEX_PCRE "Enable PCRE regular expression support for blacklist entries (requires libpcre)" ON)
if (CONFIG_REGEX_PCRE) if (CONFIG_REGEX_PCRE)
add_definitions("-DCONFIG_REGEX_PCRE") add_definitions("-DCONFIG_REGEX_PCRE")
@ -49,16 +51,43 @@ if (CONFIG_VSYNC_OPENGL)
list(APPEND compton_SRCS src/opengl.c) list(APPEND compton_SRCS src/opengl.c)
endif () endif ()
option(CONFIG_VSYNC_OPENGL_GLSL "Enable GLSL" ON) CMAKE_DEPENDENT_OPTION(CONFIG_VSYNC_OPENGL_GLSL
"Enable GLSL support (GLX background blur, etc.)" ON
"CONFIG_VSYNC_OPENGL" OFF)
if (CONFIG_VSYNC_OPENGL_GLSL) if (CONFIG_VSYNC_OPENGL_GLSL)
add_definitions("-DCONFIG_VSYNC_OPENGL_GLSL") add_definitions("-DCONFIG_VSYNC_OPENGL_GLSL")
endif () endif ()
CMAKE_DEPENDENT_OPTION(CONFIG_VSYNC_OPENGL_FBO
"Enable OpenGL FBO support (GLX multi-pass blur, etc.)" ON
"CONFIG_VSYNC_OPENGL" OFF)
if (CONFIG_VSYNC_OPENGL_FBO)
add_definitions("-DCONFIG_VSYNC_OPENGL_FBO")
endif ()
CMAKE_DEPENDENT_OPTION(CONFIG_VSYNC_OPENGL_VBO
"Enable OpenGL VBO support (does nothing right now)" ON
"CONFIG_VSYNC_OPENGL" OFF)
if (CONFIG_VSYNC_OPENGL_VBO)
add_definitions("-DCONFIG_VSYNC_OPENGL_VBO")
endif ()
option(CONFIG_XINERAMA "Enable additional Xinerama features" ON) option(CONFIG_XINERAMA "Enable additional Xinerama features" ON)
if (CONFIG_XINERAMA) if (CONFIG_XINERAMA)
add_definitions("-DCONFIG_XINERAMA") add_definitions("-DCONFIG_XINERAMA")
endif () endif ()
option(CONFIG_DBUS "Enable D-Bus support" ON)
if (CONFIG_DBUS)
add_definitions("-DCONFIG_DBUS")
list(APPEND compton_SRCS src/dbus.c)
endif ()
option(CONFIG_XSYNC "Enable X Sync support (X Sync fence)" ON)
if (CONFIG_XSYNC)
add_definitions("-DCONFIG_XSYNC")
endif ()
option(CONFIG_C2 "Enable matching system" ON) option(CONFIG_C2 "Enable matching system" ON)
if (CONFIG_C2) if (CONFIG_C2)
add_definitions("-DCONFIG_C2") add_definitions("-DCONFIG_C2")
@ -85,10 +114,10 @@ macro(X11LIB_CHK lib)
if (NOT X11_${lib}_FOUND) if (NOT X11_${lib}_FOUND)
message(FATAL_ERROR "Could not find lib${lib}.") message(FATAL_ERROR "Could not find lib${lib}.")
endif () endif ()
target_link_libraries(compton "${X11_${lib}_LIB}") target_link_libraries(compton ${X11_${lib}_LIB})
endmacro () endmacro ()
target_link_libraries(compton "${X11_X11_LIB}") target_link_libraries(compton ${X11_X11_LIB})
X11LIB_CHK(Xcomposite) X11LIB_CHK(Xcomposite)
X11LIB_CHK(Xdamage) X11LIB_CHK(Xdamage)
X11LIB_CHK(Xext) X11LIB_CHK(Xext)
@ -102,26 +131,33 @@ endif ()
# --- Find libpcre --- # --- Find libpcre ---
if (CONFIG_REGEX_PCRE) if (CONFIG_REGEX_PCRE)
pkg_check_modules(LIBPCRE REQUIRED libpcre>=8.12) pkg_check_modules(LIBPCRE REQUIRED libpcre>=8.12)
add_definitions("${LIBPCRE_CFLAGS}") add_definitions(${LIBPCRE_CFLAGS})
target_link_libraries(compton "${LIBPCRE_LDFLAGS}") target_link_libraries(compton ${LIBPCRE_LDFLAGS})
endif () endif ()
# --- Find libconfig --- # --- Find libconfig ---
if (CONFIG_LIBCONFIG) if (CONFIG_LIBCONFIG)
pkg_check_modules(LIBCONFIG REQUIRED libconfig>=1.3.2) pkg_check_modules(LIBCONFIG REQUIRED libconfig>=1.3.2)
add_definitions("${LIBCONFIG_CFLAGS}") add_definitions(${LIBCONFIG_CFLAGS})
target_link_libraries(compton "${LIBCONFIG_LDFLAGS}") target_link_libraries(compton ${LIBCONFIG_LDFLAGS})
if (LIBCONFIG_VERSION VERSION_LESS 1.4) if (LIBCONFIG_VERSION VERSION_LESS 1.4)
add_definitions("-DCONFIG_LIBCONFIG_LEGACY") add_definitions(-DCONFIG_LIBCONFIG_LEGACY)
message(STATUS "libconfig-1.3* detected. Enable legacy mode.") message(STATUS "libconfig-1.3* detected. Enable legacy mode.")
endif () endif ()
endif () endif ()
# --- Find libdbus ---
if (CONFIG_DBUS)
pkg_check_modules(DBUS REQUIRED dbus-1)
add_definitions(${DBUS_CFLAGS})
target_link_libraries(compton ${DBUS_LDFLAGS})
endif ()
# --- Find libdrm --- # --- Find libdrm ---
if (CONFIG_VSYNC_DRM) if (CONFIG_VSYNC_DRM)
pkg_check_modules(LIBDRM REQUIRED libdrm) pkg_check_modules(LIBDRM REQUIRED libdrm)
# We only use its header file # We only use its header file
add_definitions("${LIBDRM_CFLAGS}") add_definitions(${LIBDRM_CFLAGS})
endif () endif ()
# == Install == # == Install ==