2016-10-16 10:49:17 +02:00
|
|
|
project (wdmtg C)
|
|
|
|
cmake_minimum_required (VERSION 2.8.12)
|
|
|
|
|
|
|
|
# Vala really sucks at producing good C code
|
2018-06-24 05:32:44 +02:00
|
|
|
if ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
|
2016-10-16 10:49:17 +02:00
|
|
|
set (CMAKE_C_FLAGS_RELEASE
|
|
|
|
"${CMAKE_C_FLAGS_RELEASE} -Wno-ignored-qualifiers -Wno-incompatible-pointer-types")
|
2018-06-24 05:32:44 +02:00
|
|
|
endif ("${CMAKE_C_COMPILER_ID}" MATCHES "GNU" OR CMAKE_COMPILER_IS_GNUCC)
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
# Options
|
|
|
|
option (OPTION_NOINSTALL "Only for developers; work without installing" OFF)
|
|
|
|
|
|
|
|
# Version
|
|
|
|
set (project_VERSION "0.1.0")
|
|
|
|
|
|
|
|
# Set some variables
|
|
|
|
if (OPTION_NOINSTALL)
|
|
|
|
set (project_SHARE_DIR ${PROJECT_SOURCE_DIR}/share)
|
|
|
|
elseif (WIN32)
|
|
|
|
set (project_SHARE_DIR ../share)
|
|
|
|
set (project_INSTALL_SHARE_DIR share)
|
|
|
|
else (OPTION_NOINSTALL)
|
|
|
|
set (project_SHARE_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME})
|
|
|
|
set (project_INSTALL_SHARE_DIR share/${PROJECT_NAME})
|
|
|
|
endif (OPTION_NOINSTALL)
|
|
|
|
|
|
|
|
# Gather package information
|
|
|
|
set (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
|
|
|
find_package (Vala 0.12 REQUIRED)
|
|
|
|
find_package (PkgConfig REQUIRED)
|
2020-09-23 16:58:30 +02:00
|
|
|
pkg_check_modules (dependencies REQUIRED gtk+-3.0 sqlite3 xcb xcb-sync)
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
# Precompile Vala sources
|
|
|
|
include (ValaPrecompile)
|
|
|
|
|
2020-09-23 14:12:58 +02:00
|
|
|
set (config_path "${PROJECT_BINARY_DIR}/config.h")
|
|
|
|
configure_file (${PROJECT_SOURCE_DIR}/config.h.in "${config_path}")
|
|
|
|
include_directories ("${PROJECT_BINARY_DIR}")
|
2016-10-16 10:49:17 +02:00
|
|
|
|
2016-10-18 02:06:09 +02:00
|
|
|
# I'm not sure what this was about, look at slovnik-gui for more comments;
|
|
|
|
# seems to be so that symbols are exported for GModule to see
|
2020-09-23 14:12:58 +02:00
|
|
|
set (symbols_path "${PROJECT_BINARY_DIR}/gui.def")
|
2016-10-16 10:49:17 +02:00
|
|
|
|
2020-09-23 14:12:58 +02:00
|
|
|
set (project_VALA_SOURCES gui.vala config.vapi)
|
2016-10-18 02:06:09 +02:00
|
|
|
vala_precompile (${project_VALA_SOURCES}
|
2016-10-16 10:49:17 +02:00
|
|
|
OUTPUTS project_VALA_C
|
2020-09-23 14:12:58 +02:00
|
|
|
HEADER gui.h
|
2016-10-18 02:06:09 +02:00
|
|
|
SYMBOLS ${symbols_path}
|
2020-09-23 14:12:58 +02:00
|
|
|
PACKAGES gmodule-2.0 gtk+-3.0 gee-0.8 sqlite3)
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
# Include Vala sources as header files, so they appear in the IDE
|
|
|
|
# but CMake doesn't try to compile them directly
|
|
|
|
set_source_files_properties (${project_VALA_SOURCES}
|
|
|
|
PROPERTIES HEADER_FILE_ONLY TRUE)
|
2016-10-18 02:06:09 +02:00
|
|
|
set (project_SOURCES ${project_VALA_SOURCES} ${project_VALA_C} ${symbols_path})
|
2016-10-16 10:49:17 +02:00
|
|
|
|
|
|
|
# Build the executable and install it
|
|
|
|
include_directories (${dependencies_INCLUDE_DIRS})
|
|
|
|
link_directories (${dependencies_LIBRARY_DIRS})
|
2020-09-23 16:58:30 +02:00
|
|
|
add_executable (${PROJECT_NAME}
|
|
|
|
${PROJECT_NAME}.c compound-text.c ${project_SOURCES})
|
2016-10-16 10:49:17 +02:00
|
|
|
target_link_libraries (${PROJECT_NAME} ${dependencies_LIBRARIES})
|
|
|
|
|
|
|
|
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
|
|
|
|
|
|
|
|
# CPack
|
|
|
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Activity tracker")
|
2020-09-17 09:14:05 +02:00
|
|
|
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
|
|
|
|
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
|
2016-10-16 10:49:17 +02:00
|
|
|
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
|
|
|
set (CPACK_PACKAGE_VERSION ${project_VERSION})
|
|
|
|
set (CPACK_GENERATOR "TGZ;ZIP")
|
|
|
|
set (CPACK_PACKAGE_FILE_NAME
|
|
|
|
"${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
|
|
|
|
set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
|
|
|
|
set (CPACK_SOURCE_IGNORE_FILES "/build;/\\\\.git")
|
|
|
|
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
|
|
|
|
|
|
|
|
include (CPack)
|
|
|
|
|