2010-06-09 09:14:56 +00:00
|
|
|
project( tint2 )
|
|
|
|
cmake_minimum_required( VERSION 2.6 )
|
2010-06-08 19:56:22 +00:00
|
|
|
|
2015-02-05 12:15:35 +00:00
|
|
|
option( ENABLE_BATTERY "Enable battery status plugin" ON )
|
|
|
|
option( ENABLE_TINT2CONF "Enable tint2conf build, a GTK+2 theme configurator for tint2" ON )
|
2015-07-12 15:00:16 +00:00
|
|
|
option( ENABLE_EXAMPLES "Install additional tin2rc examples" ON )
|
2015-02-05 12:15:35 +00:00
|
|
|
option( ENABLE_RSVG "Rsvg support (launcher only)" ON )
|
2015-03-20 22:49:13 +00:00
|
|
|
option( ENABLE_SN "Startup notification support" ON )
|
2015-04-17 20:23:07 +00:00
|
|
|
option( ENABLE_ASAN "Build tint2 with AddressSanitizer" OFF )
|
2015-08-08 03:49:21 +00:00
|
|
|
if( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
|
|
|
|
option( ENABLE_UEVENT "Kernel event handling support" ON )
|
|
|
|
endif( CMAKE_SYSTEM_NAME STREQUAL "Linux" )
|
2015-02-05 12:15:35 +00:00
|
|
|
|
2010-06-08 19:56:22 +00:00
|
|
|
include( FindPkgConfig )
|
2010-06-09 13:50:22 +00:00
|
|
|
include( CheckLibraryExists )
|
2010-12-02 19:02:19 +00:00
|
|
|
pkg_check_modules( X11 REQUIRED x11 xcomposite xdamage xinerama xrender xrandr>=1.3 )
|
2010-06-08 19:56:22 +00:00
|
|
|
pkg_check_modules( PANGOCAIRO REQUIRED pangocairo )
|
|
|
|
pkg_check_modules( PANGO REQUIRED pango )
|
|
|
|
pkg_check_modules( CAIRO REQUIRED cairo )
|
|
|
|
pkg_check_modules( GLIB2 REQUIRED glib-2.0 )
|
|
|
|
pkg_check_modules( GOBJECT2 REQUIRED gobject-2.0 )
|
2010-12-02 19:02:19 +00:00
|
|
|
pkg_check_modules( IMLIB2 REQUIRED imlib2>=1.4.2 )
|
2015-02-05 12:15:35 +00:00
|
|
|
pkg_check_modules( RSVG librsvg-2.0>=2.14.0 )
|
2012-07-02 16:50:30 +00:00
|
|
|
pkg_check_modules( SN libstartup-notification-1.0>=0.12 )
|
2015-01-28 14:47:39 +00:00
|
|
|
|
2010-06-12 07:45:16 +00:00
|
|
|
find_library( RT_LIBRARY rt )
|
2010-06-08 19:56:22 +00:00
|
|
|
|
2010-07-22 12:14:11 +00:00
|
|
|
if( NOT X11_FOUND OR NOT PANGOCAIRO_FOUND OR NOT PANGO_FOUND OR NOT CAIRO_FOUND OR NOT GLIB2_FOUND OR NOT GOBJECT2_FOUND OR NOT IMLIB2_FOUND )
|
2015-07-05 09:14:00 +00:00
|
|
|
message( FATAL_ERROR "Not all dependencies fulfilled. See https://gitlab.com/o9000/tint2/wikis/Install" )
|
2010-07-22 12:14:11 +00:00
|
|
|
endif( NOT X11_FOUND OR NOT PANGOCAIRO_FOUND OR NOT PANGO_FOUND OR NOT CAIRO_FOUND OR NOT GLIB2_FOUND OR NOT GOBJECT2_FOUND OR NOT IMLIB2_FOUND )
|
2010-06-15 21:38:14 +00:00
|
|
|
|
2010-06-13 13:02:53 +00:00
|
|
|
string( REPLACE ";" " " FLAGS_REPLACED "${IMLIB2_LDFLAGS}" )
|
2010-06-13 12:27:56 +00:00
|
|
|
set( CMAKE_REQUIRED_FLAGS "${FLAGS_REPLACED}" )
|
2010-06-09 13:50:22 +00:00
|
|
|
check_library_exists( "${IMLIB2_LIBRARIES}" "imlib_context_set_display" "${IMLIB2_LIBRARY_DIRS}" IMLIB_BUILD_WITH_X )
|
2010-06-09 09:14:56 +00:00
|
|
|
if( NOT IMLIB_BUILD_WITH_X )
|
2015-02-05 12:15:35 +00:00
|
|
|
message( FATAL_ERROR "Imlib is not built with X support" )
|
2010-06-09 09:14:56 +00:00
|
|
|
endif( NOT IMLIB_BUILD_WITH_X )
|
|
|
|
|
2015-07-12 15:50:59 +00:00
|
|
|
add_definitions( -D_GNU_SOURCE )
|
|
|
|
|
2010-06-09 15:31:18 +00:00
|
|
|
include_directories( ${PROJECT_BINARY_DIR}
|
|
|
|
src
|
2010-06-08 20:03:38 +00:00
|
|
|
src/battery
|
2010-06-08 19:56:22 +00:00
|
|
|
src/clock
|
|
|
|
src/systray
|
|
|
|
src/taskbar
|
2010-08-02 17:12:07 +00:00
|
|
|
src/launcher
|
2010-06-08 19:56:22 +00:00
|
|
|
src/tooltip
|
|
|
|
src/util
|
2015-07-05 09:23:57 +00:00
|
|
|
src/freespace
|
2010-06-08 19:56:22 +00:00
|
|
|
${X11_INCLUDE_DIRS}
|
|
|
|
${PANGOCAIRO_INCLUDE_DIRS}
|
|
|
|
${PANGO_INCLUDE_DIRS}
|
|
|
|
${CAIRO_INCLUDE_DIRS}
|
|
|
|
${GLIB2_INCLUDE_DIRS}
|
|
|
|
${GOBJECT2_INCLUDE_DIRS}
|
2012-07-02 16:50:30 +00:00
|
|
|
${IMLIB2_INCLUDE_DIRS}
|
2015-01-28 14:47:39 +00:00
|
|
|
${RSVG_INCLUDE_DIRS}
|
|
|
|
${SN_INCLUDE_DIRS} )
|
2010-06-08 19:56:22 +00:00
|
|
|
|
2010-06-09 09:14:56 +00:00
|
|
|
set( SOURCES src/config.c
|
|
|
|
src/panel.c
|
|
|
|
src/server.c
|
|
|
|
src/tint.c
|
|
|
|
src/clock/clock.c
|
|
|
|
src/systray/systraybar.c
|
2010-08-02 17:12:07 +00:00
|
|
|
src/launcher/launcher.c
|
2015-01-28 14:47:39 +00:00
|
|
|
src/launcher/apps-common.c
|
|
|
|
src/launcher/icon-theme-common.c
|
2010-11-07 08:44:27 +00:00
|
|
|
src/launcher/xsettings-client.c
|
|
|
|
src/launcher/xsettings-common.c
|
2010-06-09 09:14:56 +00:00
|
|
|
src/taskbar/task.c
|
|
|
|
src/taskbar/taskbar.c
|
2010-10-08 19:43:54 +00:00
|
|
|
src/taskbar/taskbarname.c
|
2010-06-09 09:14:56 +00:00
|
|
|
src/tooltip/tooltip.c
|
2015-07-05 09:23:57 +00:00
|
|
|
src/freespace/freespace.c
|
|
|
|
src/util/area.c
|
2010-06-09 09:14:56 +00:00
|
|
|
src/util/common.c
|
2015-03-28 22:38:57 +00:00
|
|
|
src/util/strnatcmp.c
|
2010-06-09 09:14:56 +00:00
|
|
|
src/util/timer.c
|
|
|
|
src/util/window.c )
|
|
|
|
|
2015-01-28 14:47:39 +00:00
|
|
|
if( ENABLE_BATTERY )
|
2015-08-07 02:31:31 +00:00
|
|
|
set( SOURCES ${SOURCES} src/battery/battery.c)
|
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set( SOURCES ${SOURCES} src/battery/linux.c)
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
|
|
|
|
set( SOURCES ${SOURCES} src/battery/freebsd.c)
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
|
|
|
|
set( SOURCES ${SOURCES} src/battery/openbsd.c)
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
|
|
|
set( SOURCES ${SOURCES} src/battery/openbsd.c)
|
|
|
|
else(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
set( SOURCES ${SOURCES} src/battery/dummy.c)
|
|
|
|
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
|
2015-01-28 14:47:39 +00:00
|
|
|
add_definitions( -DENABLE_BATTERY )
|
|
|
|
endif( ENABLE_BATTERY )
|
|
|
|
|
|
|
|
if( ENABLE_RSVG )
|
|
|
|
if( RSVG_FOUND )
|
|
|
|
add_definitions( -DHAVE_RSVG )
|
2015-02-05 12:15:35 +00:00
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "SVG support enabled yet dependency not fulfilled: librsvg-2.0" )
|
2015-01-28 14:47:39 +00:00
|
|
|
endif( RSVG_FOUND )
|
|
|
|
endif( ENABLE_RSVG )
|
|
|
|
|
2012-07-02 16:50:30 +00:00
|
|
|
if( ENABLE_SN )
|
|
|
|
if( SN_FOUND )
|
|
|
|
add_definitions( -DHAVE_SN -DSN_API_NOT_YET_FROZEN )
|
2015-02-05 12:15:35 +00:00
|
|
|
else()
|
|
|
|
message( FATAL_ERROR "Startup notification support enabled yet dependency not fulfilled: libstartup-notification-1.0" )
|
2012-07-02 16:50:30 +00:00
|
|
|
endif( SN_FOUND )
|
|
|
|
endif( ENABLE_SN)
|
2010-06-08 19:56:22 +00:00
|
|
|
|
2015-08-08 03:49:21 +00:00
|
|
|
if( ENABLE_UEVENT )
|
|
|
|
add_definitions( -DENABLE_UEVENT )
|
|
|
|
set( SOURCES ${SOURCES} src/util/uevent.c)
|
|
|
|
endif( ENABLE_UEVENT )
|
|
|
|
|
2010-06-09 13:50:22 +00:00
|
|
|
if( ENABLE_TINT2CONF )
|
2010-06-12 21:21:06 +00:00
|
|
|
add_definitions( -DHAVE_VERSION_H )
|
2010-06-08 20:18:13 +00:00
|
|
|
add_subdirectory( src/tint2conf )
|
2010-06-09 15:31:18 +00:00
|
|
|
add_dependencies( tint2conf version )
|
2010-06-09 13:50:22 +00:00
|
|
|
endif( ENABLE_TINT2CONF )
|
2010-06-08 20:18:13 +00:00
|
|
|
|
2015-04-17 20:23:07 +00:00
|
|
|
if( ENABLE_ASAN )
|
|
|
|
SET(ASAN_C_FLAGS " -O0 -g3 -gdwarf-2 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic ")
|
|
|
|
SET(ASAN_L_FLAGS " -O0 -g3 -gdwarf-2 -fsanitize=address -fno-common -fno-omit-frame-pointer -rdynamic ")
|
2015-03-18 19:54:48 +00:00
|
|
|
else()
|
2015-04-17 20:23:07 +00:00
|
|
|
SET(ASAN_C_FLAGS "")
|
|
|
|
SET(ASAN_L_FLAGS "")
|
2015-03-18 19:54:48 +00:00
|
|
|
endif()
|
|
|
|
|
2015-02-05 12:15:35 +00:00
|
|
|
set( MANDIR share/man CACHE PATH "Directory for man pages" )
|
|
|
|
set( DATADIR share CACHE PATH "Directory for shared data" )
|
|
|
|
set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
|
|
|
|
set( DOCDIR share/doc/tint2 CACHE PATH "Directory for documentation files" )
|
|
|
|
|
2015-04-24 16:45:25 +00:00
|
|
|
add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_version.sh" "\"${PROJECT_SOURCE_DIR}\"" )
|
2010-06-09 15:31:18 +00:00
|
|
|
|
2010-06-09 09:14:56 +00:00
|
|
|
link_directories( ${X11_LIBRARY_DIRS}
|
|
|
|
${PANGOCAIRO_LIBRARY_DIRS}
|
|
|
|
${PANGO_LIBRARY_DIRS}
|
|
|
|
${CAIRO_LIBRARY_DIRS}
|
|
|
|
${GLIB2_LIBRARY_DIRS}
|
|
|
|
${GOBJECT2_LIBRARY_DIRS}
|
2012-07-02 16:50:30 +00:00
|
|
|
${IMLIB2_LIBRARY_DIRS}
|
2015-01-28 14:47:39 +00:00
|
|
|
${RSVG_LIBRARY_DIRS}
|
|
|
|
${SN_LIBRARY_DIRS} )
|
2010-06-13 13:02:53 +00:00
|
|
|
add_executable(tint2 ${SOURCES})
|
2010-06-08 19:56:22 +00:00
|
|
|
target_link_libraries( tint2 ${X11_LIBRARIES}
|
|
|
|
${PANGOCAIRO_LIBRARIES}
|
|
|
|
${PANGO_LIBRARIES}
|
|
|
|
${CAIRO_LIBRARIES}
|
|
|
|
${GLIB2_LIBRARIES}
|
|
|
|
${GOBJECT2_LIBRARIES}
|
2015-08-07 18:59:06 +00:00
|
|
|
${IMLIB2_LIBRARIES} )
|
|
|
|
if( ENABLE_RSVG )
|
|
|
|
target_link_libraries( tint2 ${RSVG_LIBRARIES} )
|
|
|
|
endif( ENABLE_RSVG )
|
|
|
|
if( ENABLE_SN )
|
|
|
|
target_link_libraries( tint2 ${SN_LIBRARIES} )
|
|
|
|
endif( ENABLE_SN )
|
2010-06-12 07:45:16 +00:00
|
|
|
if( RT_LIBRARY )
|
|
|
|
target_link_libraries( tint2 ${RT_LIBRARY} )
|
|
|
|
endif( RT_LIBRARY )
|
2010-06-08 19:56:22 +00:00
|
|
|
|
2015-01-21 00:27:40 +00:00
|
|
|
target_link_libraries( tint2 m )
|
|
|
|
|
2010-06-12 09:27:18 +00:00
|
|
|
add_dependencies( tint2 version )
|
2015-04-17 20:23:07 +00:00
|
|
|
set_target_properties( tint2 PROPERTIES COMPILE_FLAGS "-Wall -fno-strict-aliasing -pthread ${ASAN_C_FLAGS}" )
|
|
|
|
set_target_properties( tint2 PROPERTIES LINK_FLAGS "-pthread -fno-strict-aliasing ${ASAN_L_FLAGS}" )
|
2010-06-09 09:14:56 +00:00
|
|
|
|
|
|
|
install( TARGETS tint2 DESTINATION bin )
|
2015-05-03 17:17:24 +00:00
|
|
|
install( FILES tint2.svg DESTINATION ${DATADIR}/icons/hicolor/scalable/apps )
|
|
|
|
install( FILES tint2.desktop DESTINATION ${DATADIR}/applications )
|
|
|
|
install( CODE "execute_process(COMMAND gtk-update-icon-cache -f -t ${DATADIR}/icons/hicolor WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX})" )
|
2010-06-09 09:14:56 +00:00
|
|
|
install( FILES sample/tint2rc DESTINATION ${SYSCONFDIR}/xdg/tint2 )
|
2010-06-09 13:50:22 +00:00
|
|
|
install( FILES default_icon.png DESTINATION ${DATADIR}/tint2 )
|
2015-05-02 11:07:26 +00:00
|
|
|
install( FILES AUTHORS ChangeLog README.md DESTINATION ${DOCDIR} )
|
2010-06-09 21:44:41 +00:00
|
|
|
install( FILES doc/tint2.1 DESTINATION ${MANDIR}/man1 )
|
2010-06-09 09:14:56 +00:00
|
|
|
if( ENABLE_EXAMPLES )
|
|
|
|
file( GLOB SAMPLEFILES sample/*.tint2rc )
|
2015-07-12 15:00:16 +00:00
|
|
|
install( FILES ${SAMPLEFILES} DESTINATION ${DATADIR}/tint2 )
|
2015-05-03 17:17:24 +00:00
|
|
|
endif( ENABLE_EXAMPLES )
|