2017-03-23 16:10:45 +00:00
|
|
|
cmake_minimum_required(VERSION 3.0)
|
|
|
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
|
|
|
|
|
|
|
# Prepare Plugins
|
|
|
|
set(PLUGINS omemo;openpgp)
|
|
|
|
if(DISABLED_PLUGINS)
|
|
|
|
list(REMOVE_ITEM PLUGINS ${DISABLED_PLUGINS})
|
|
|
|
endif(DISABLED_PLUGINS)
|
|
|
|
if(ENABLED_PLUGINS)
|
|
|
|
list(APPEND PLUGINS ${ENABLED_PLUGINS})
|
|
|
|
endif(ENABLED_PLUGINS)
|
|
|
|
list(REMOVE_DUPLICATES PLUGINS)
|
|
|
|
|
|
|
|
foreach(plugin ${PLUGINS})
|
|
|
|
message(STATUS "Building plugin: ${plugin}")
|
|
|
|
set(PLUGIN_ENABLED_${plugin} "yes")
|
|
|
|
endforeach(plugin)
|
|
|
|
|
|
|
|
# Prepare instal paths
|
2017-03-30 13:29:21 +00:00
|
|
|
macro(set_path what val desc)
|
|
|
|
if(NOT ${what})
|
|
|
|
unset(${what} CACHE)
|
|
|
|
set(${what} ${val})
|
|
|
|
endif()
|
|
|
|
message(STATUS "${desc}: ${${what}}")
|
|
|
|
endmacro(set_path)
|
2017-03-23 16:10:45 +00:00
|
|
|
|
|
|
|
string(REGEX REPLACE "^liblib" "lib" LIBDIR_NAME "lib${LIB_SUFFIX}")
|
2017-03-30 13:29:21 +00:00
|
|
|
message(STATUS "Installation directory for architecture-independent files: ${CMAKE_INSTALL_PREFIX}")
|
|
|
|
set_path(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Installation directory for architecture-dependent files")
|
|
|
|
set_path(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Installation directory for read-only architecture-independent data")
|
|
|
|
|
|
|
|
set_path(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "Installation directory for user executables")
|
|
|
|
set_path(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dino" "Installation directory for dino-specific data")
|
|
|
|
set_path(DESKTOP_FILE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications" "Installation directory for .desktop files")
|
|
|
|
set_path(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "Installation directory for icons")
|
|
|
|
set_path(INCLUDE_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/include" "Installation directory for C header files")
|
|
|
|
set_path(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/${LIBDIR_NAME}" "Installation directory for object code libraries")
|
2017-04-07 09:09:47 +00:00
|
|
|
set_path(LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "Installation directory for locale files")
|
2017-04-03 12:10:17 +00:00
|
|
|
set_path(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/dino/plugins" "Installation directory for dino plugin object code files")
|
2017-03-30 13:29:21 +00:00
|
|
|
set_path(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi" "Installation directory for Vala API files")
|
|
|
|
|
2017-03-23 16:10:45 +00:00
|
|
|
set(TARGET_INSTALL LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION ${BIN_INSTALL_DIR} PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR} ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
|
|
|
|
set(PLUGIN_INSTALL LIBRARY DESTINATION ${PLUGIN_INSTALL_DIR} RUNTIME DESTINATION ${PLUGIN_INSTALL_DIR})
|
2017-03-02 14:37:32 +00:00
|
|
|
|
|
|
|
include(CheckCCompilerFlag)
|
2017-03-23 16:10:45 +00:00
|
|
|
|
|
|
|
macro(AddCFlagIfSupported flag)
|
2017-03-30 19:26:17 +00:00
|
|
|
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
|
|
|
CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag_name})
|
|
|
|
if(${COMPILER_SUPPORTS${flag_name}})
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
|
|
|
endif()
|
2017-03-02 14:37:32 +00:00
|
|
|
endmacro()
|
|
|
|
|
2017-03-23 16:10:45 +00:00
|
|
|
macro(AddValaCFlagIfSupported flag)
|
2017-03-30 19:26:17 +00:00
|
|
|
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
|
|
|
CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag_name})
|
|
|
|
if(${COMPILER_SUPPORTS${flag_name}})
|
|
|
|
set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
|
|
|
|
endif()
|
2017-03-23 16:10:45 +00:00
|
|
|
endmacro()
|
2017-03-02 14:37:32 +00:00
|
|
|
|
|
|
|
if("Ninja" STREQUAL ${CMAKE_GENERATOR})
|
|
|
|
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
|
|
|
|
endif()
|
|
|
|
|
2017-03-30 19:26:17 +00:00
|
|
|
AddCFlagIfSupported(-Wall)
|
|
|
|
AddCFlagIfSupported(-Werror=format-security)
|
|
|
|
|
2017-03-23 16:10:45 +00:00
|
|
|
AddValaCFlagIfSupported(-Wno-deprecated-declarations)
|
|
|
|
AddValaCFlagIfSupported(-Wno-incompatible-pointer-types)
|
2017-03-30 19:26:17 +00:00
|
|
|
AddValaCFlagIfSupported(-Wno-pointer-sign)
|
2017-03-23 16:10:45 +00:00
|
|
|
AddValaCFlagIfSupported(-Wno-int-conversion)
|
|
|
|
AddValaCFlagIfSupported(-Wno-discarded-qualifiers)
|
2017-03-30 13:29:21 +00:00
|
|
|
AddValaCFlagIfSupported(-Wno-unused-but-set-variable)
|
|
|
|
AddValaCFlagIfSupported(-Wno-unused-variable)
|
|
|
|
AddValaCFlagIfSupported(-Wno-unused-function)
|
|
|
|
AddValaCFlagIfSupported(-Wno-unused-label)
|
|
|
|
|
|
|
|
if($ENV{USE_CCACHE})
|
|
|
|
# Configure CCache if available
|
|
|
|
find_program(CCACHE_FOUND ccache)
|
|
|
|
if(CCACHE_FOUND)
|
|
|
|
message(STATUS "Using ccache")
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
|
|
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
|
|
|
endif(CCACHE_FOUND)
|
|
|
|
endif($ENV{USE_CCACHE})
|
2017-03-23 16:10:45 +00:00
|
|
|
|
|
|
|
if(NOT NO_DEBUG)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
|
|
|
|
set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} -g")
|
|
|
|
endif(NOT NO_DEBUG)
|
|
|
|
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
|
2017-04-23 08:01:40 +00:00
|
|
|
set(GTK3_GLOBAL_VERSION 3.22)
|
|
|
|
set(GLib_GLOBAL_VERSION 2.38)
|
|
|
|
|
2017-03-30 13:29:21 +00:00
|
|
|
if(NOT VALA_EXECUTABLE)
|
|
|
|
unset(VALA_EXECUTABLE CACHE)
|
|
|
|
endif()
|
|
|
|
|
2017-03-23 16:10:45 +00:00
|
|
|
find_package(Vala 0.30 REQUIRED)
|
2017-03-23 20:44:27 +00:00
|
|
|
if(VALA_VERSION VERSION_GREATER "0.34.90" AND VALA_VERSION VERSION_LESS "0.36.1")
|
|
|
|
# Due to a bug on 0.36.0 (and pre-releases), we need to disable FAST_VAPI
|
2017-03-23 19:06:00 +00:00
|
|
|
set(DISABLE_FAST_VAPI yes)
|
|
|
|
endif()
|
|
|
|
|
2017-03-23 16:10:45 +00:00
|
|
|
include(${VALA_USE_FILE})
|
|
|
|
include(MultiFind)
|
|
|
|
include(GlibCompileResourcesSupport)
|
|
|
|
|
|
|
|
set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --thread --target-glib=${GLib_GLOBAL_VERSION}")
|
2017-03-02 14:37:32 +00:00
|
|
|
|
|
|
|
add_subdirectory(qlite)
|
2017-03-10 16:01:45 +00:00
|
|
|
add_subdirectory(xmpp-vala)
|
2017-03-10 18:34:56 +00:00
|
|
|
add_subdirectory(libdino)
|
2017-03-11 00:29:38 +00:00
|
|
|
add_subdirectory(main)
|
|
|
|
add_subdirectory(plugins)
|
2017-03-23 16:10:45 +00:00
|
|
|
|
|
|
|
# uninstall target
|
|
|
|
configure_file("${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
|
|
|
|
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake COMMENT "Uninstall the project...")
|