|
| 1 | +# project name |
| 2 | +project (hourglass) |
| 3 | +enable_testing () |
| 4 | + |
| 5 | +#cmake version and stuff |
| 6 | +cmake_minimum_required (VERSION 2.8) |
| 7 | +cmake_policy (VERSION 2.8) |
| 8 | +list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) |
| 9 | + |
| 10 | +#some variables |
| 11 | +set (GETTEXT_PACKAGE ${CMAKE_PROJECT_NAME}) |
| 12 | +set (EXEC_NAME ${CMAKE_PROJECT_NAME}) |
| 13 | +set (DAEMON_EXEC_NAME ${CMAKE_PROJECT_NAME}-daemon) |
| 14 | +set (DAEMON_NAME ${CMAKE_PROJECT_NAME}-daemon) |
| 15 | +set (ICON_NAME ${CMAKE_PROJECT_NAME}) |
| 16 | +set (APP_NAME "Hourglass") |
| 17 | +set (GENERIC_NAME "Timer") |
| 18 | +set (RELEASE_NAME "Freya") |
| 19 | +set (COMMENT "This clock application provides stopwatches, alarms, and timers.") |
| 20 | +set (DAEMON_COMMENT "Daemon that deals with Hourglass's alarms.") |
| 21 | +set (VERSION "1.0.1") |
| 22 | +set (VERSION_INFO "Release") |
| 23 | + |
| 24 | +#data directory stuff |
| 25 | +include (GNUInstallDirs) |
| 26 | +set (PREFIX ${CMAKE_INSTALL_PREFIX}) |
| 27 | +set (DATADIR ${CMAKE_INSTALL_PREFIX}/share) |
| 28 | +set (PKG_DATADIR ${DATADIR}/${CMAKE_PROJECT_NAME}) |
| 29 | +set (DOLLAR "$") |
| 30 | + |
| 31 | +# Add 'make dist' command for creating release tarball |
| 32 | +set (CPACK_PACKAGE_VERSION ${VERSION}) |
| 33 | +set (CPACK_SOURCE_GENERATOR "TGZ") |
| 34 | +set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}") |
| 35 | +set (CPACK_SOURCE_IGNORE_FILES "/build/;/.bzr/;/.bzrignore;~$;${CPACK_SOURCE_IGNORE_FILES}") |
| 36 | + |
| 37 | +include (CPack) |
| 38 | +add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source) |
| 39 | + |
| 40 | +#uninstall command / target |
| 41 | +configure_file( |
| 42 | + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" |
| 43 | + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" |
| 44 | + IMMEDIATE @ONLY) |
| 45 | + |
| 46 | +add_custom_target(uninstall |
| 47 | + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) |
| 48 | + |
| 49 | +#dependency variable |
| 50 | +set (SOURCE_DEPS |
| 51 | + gtk+-3.0 |
| 52 | + gee-0.8 |
| 53 | + granite |
| 54 | +) |
| 55 | + |
| 56 | +set (DAEMON_DEPS |
| 57 | + glib-2.0 |
| 58 | + gio-2.0 |
| 59 | + granite |
| 60 | + libnotify |
| 61 | + libcanberra |
| 62 | +) |
| 63 | + |
| 64 | +#configuration file |
| 65 | +configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.cmake ${CMAKE_SOURCE_DIR}/src/Config.vala) |
| 66 | +configure_file (${CMAKE_SOURCE_DIR}/data/hourglass.desktop.in ${CMAKE_SOURCE_DIR}/data/hourglass.desktop) |
| 67 | +configure_file (${CMAKE_SOURCE_DIR}/data/hourglass-daemon.desktop.in ${CMAKE_SOURCE_DIR}/data/hourglass-daemon.desktop) |
| 68 | + |
| 69 | +#some definitions |
| 70 | +add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\") |
| 71 | +add_definitions(-DVALA_VERSION="${VALA_SHORTVER}") |
| 72 | +add_definitions(-w) # Disable gcc warnings |
| 73 | + |
| 74 | +#find vala |
| 75 | +find_package (Vala REQUIRED) |
| 76 | +include (ValaVersion) |
| 77 | +ensure_vala_version ("0.28" MINIMUM) |
| 78 | +include (ValaPrecompile) |
| 79 | + |
| 80 | +#check for dependencies |
| 81 | +find_package (PkgConfig) |
| 82 | +pkg_check_modules (GTK+ REQUIRED |
| 83 | + gtk+-3.0>=3.10) |
| 84 | + |
| 85 | +pkg_check_modules (DEPS REQUIRED ${SOURCE_DEPS}) |
| 86 | +pkg_check_modules (DEPS REQUIRED ${DAEMON_DEPS}) |
| 87 | + |
| 88 | +#needed to compile properly on launchpad |
| 89 | +pkg_check_modules (LIBSOURCE REQUIRED |
| 90 | + libnotify |
| 91 | + libcanberra |
| 92 | +) |
| 93 | + |
| 94 | +#some other necessary things |
| 95 | +set(NORMAL_CFLAGS ${DEPS_CFLAGS} ${LIBSOURCE_CFLAGS} ${GCONF_CFLAGS}) |
| 96 | +set(NORMAL_LINK_DIRS ${DEPS_LIBRARY_DIRS} ${LIBSOURCE_LIBRARY_DIRS} ${GCONF_LIBRARY_DIRS}) |
| 97 | +set(NORMAL_LIBRARIES ${DEPS_LIBRARIES} ${LIBSOURCE_LIBRARIES} ${GCONF_LIBRARIES}) |
| 98 | + |
| 99 | +add_definitions (${DEPS_CFLAGS} ${LIBSOURCE_CFLAGS} ${GCONF_CFLAGS}) |
| 100 | +link_libraries (${DEPS_LIBRARIES} ${LIBSOURCE_LIBRARIES} ${GCONF_LIBRARIES}) |
| 101 | +link_directories (${DEPS_LIBRARY_DIRS} ${LIBSOURCE_LIBRARY_DIRS} ${GCONF_LIBRARY_DIRS}) |
| 102 | + |
| 103 | +#include source path |
| 104 | +include_directories(${CMAKE_BINARY_DIR}/src) |
| 105 | + |
| 106 | +#add subdirectories |
| 107 | +add_subdirectory (src) |
| 108 | +add_subdirectory (src/Daemon) |
| 109 | +add_subdirectory (schemas) |
| 110 | +add_subdirectory (po) |
| 111 | +add_subdirectory (data) |
0 commit comments