Add version and adjust some cmake
This commit is contained in:
parent
a4a795af33
commit
bd45fdf1e1
125
CMakeLists.txt
125
CMakeLists.txt
|
@ -1,33 +1,73 @@
|
||||||
cmake_minimum_required(VERSION 3.0)
|
cmake_minimum_required(VERSION 3.0)
|
||||||
project(Dino LANGUAGES C)
|
|
||||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||||
|
include(ComputeVersion)
|
||||||
|
if (NOT VERSION_FOUND)
|
||||||
|
project(Dino LANGUAGES C)
|
||||||
|
elseif (VERSION_IS_RELEASE)
|
||||||
|
project(Dino VERSION ${VERSION_FULL} LANGUAGES C)
|
||||||
|
else ()
|
||||||
|
project(Dino LANGUAGES C)
|
||||||
|
set(PROJECT_VERSION ${VERSION_FULL})
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Prepare Plugins
|
# Prepare Plugins
|
||||||
set(PLUGINS omemo;openpgp;http-files)
|
set(DEFAULT_PLUGINS omemo;openpgp;http-files)
|
||||||
if(DISABLED_PLUGINS)
|
foreach (plugin ${DEFAULT_PLUGINS})
|
||||||
list(REMOVE_ITEM PLUGINS ${DISABLED_PLUGINS})
|
if ("$CACHE{DINO_PLUGIN_ENABLED_${plugin}}" STREQUAL "")
|
||||||
endif(DISABLED_PLUGINS)
|
if (NOT DEFINED DINO_PLUGIN_ENABLED_${plugin}})
|
||||||
if(ENABLED_PLUGINS)
|
set(DINO_PLUGIN_ENABLED_${plugin} "yes" CACHE BOOL "Enable plugin ${plugin}")
|
||||||
list(APPEND PLUGINS ${ENABLED_PLUGINS})
|
else ()
|
||||||
endif(ENABLED_PLUGINS)
|
set(DINO_PLUGIN_ENABLED_${plugin} "${DINO_PLUGIN_ENABLED_${plugin}}" CACHE BOOL "Enable plugin ${plugin}" FORCE)
|
||||||
|
endif ()
|
||||||
|
if (DINO_PLUGIN_ENABLED_${plugin})
|
||||||
|
message(STATUS "Enabled plugin: ${plugin}")
|
||||||
|
else ()
|
||||||
|
message(STATUS "Disabled plugin: ${plugin}")
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
endforeach (plugin)
|
||||||
|
|
||||||
|
if (DISABLED_PLUGINS)
|
||||||
|
foreach(plugin ${DISABLED_PLUGINS})
|
||||||
|
set(DINO_PLUGIN_ENABLED_${plugin} "no" CACHE BOOL "Enable plugin ${plugin}" FORCE)
|
||||||
|
message(STATUS "Disabled plugin: ${plugin}")
|
||||||
|
endforeach(plugin)
|
||||||
|
endif (DISABLED_PLUGINS)
|
||||||
|
|
||||||
|
if (ENABLED_PLUGINS)
|
||||||
|
foreach(plugin ${ENABLED_PLUGINS})
|
||||||
|
set(DINO_PLUGIN_ENABLED_${plugin} "yes" CACHE BOOL "Enable plugin ${plugin}" FORCE)
|
||||||
|
message(STATUS "Enabled plugin: ${plugin}")
|
||||||
|
endforeach(plugin)
|
||||||
|
endif (ENABLED_PLUGINS)
|
||||||
list(REMOVE_DUPLICATES PLUGINS)
|
list(REMOVE_DUPLICATES PLUGINS)
|
||||||
|
|
||||||
foreach(plugin ${PLUGINS})
|
set(PLUGINS "")
|
||||||
message(STATUS "Building plugin: ${plugin}")
|
get_cmake_property(all_variables VARIABLES)
|
||||||
set(PLUGIN_ENABLED_${plugin} "yes")
|
foreach (variable_name ${all_variables})
|
||||||
endforeach(plugin)
|
if (variable_name MATCHES "^DINO_PLUGIN_ENABLED_(.+)$" AND ${variable_name})
|
||||||
|
list(APPEND PLUGINS ${CMAKE_MATCH_1})
|
||||||
|
endif()
|
||||||
|
endforeach ()
|
||||||
|
list(SORT PLUGINS)
|
||||||
|
list(JOIN PLUGINS ", " PLUGINS_TEXT)
|
||||||
|
|
||||||
|
message(STATUS "Configuring Dino ${PROJECT_VERSION} with plugins: ${PLUGINS_TEXT}")
|
||||||
|
|
||||||
# Prepare instal paths
|
# Prepare instal paths
|
||||||
macro(set_path what val desc)
|
macro(set_path what val desc)
|
||||||
if(NOT ${what})
|
if (NOT ${what})
|
||||||
unset(${what} CACHE)
|
unset(${what} CACHE)
|
||||||
set(${what} ${val})
|
set(${what} ${val})
|
||||||
|
endif ()
|
||||||
|
if (NOT "${${what}}" STREQUAL "${_${what}_SET}")
|
||||||
|
message(STATUS "${desc}: ${${what}}")
|
||||||
|
set(_${what}_SET ${${what}} CACHE INTERNAL ${desc})
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "${desc}: ${${what}}")
|
|
||||||
endmacro(set_path)
|
endmacro(set_path)
|
||||||
|
|
||||||
string(REGEX REPLACE "^liblib" "lib" LIBDIR_NAME "lib${LIB_SUFFIX}")
|
string(REGEX REPLACE "^liblib" "lib" LIBDIR_NAME "lib${LIB_SUFFIX}")
|
||||||
message(STATUS "Installation directory for architecture-independent files: ${CMAKE_INSTALL_PREFIX}")
|
set_path(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Installation directory for architecture-independent files")
|
||||||
set_path(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Installation directory for architecture-dependent files")
|
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(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Installation directory for read-only architecture-independent data")
|
||||||
|
|
||||||
|
@ -52,22 +92,22 @@ include(CheckCSourceCompiles)
|
||||||
macro(AddCFlagIfSupported flag)
|
macro(AddCFlagIfSupported flag)
|
||||||
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
||||||
check_c_compiler_flag(${flag} COMPILER_SUPPORTS${flag_name})
|
check_c_compiler_flag(${flag} COMPILER_SUPPORTS${flag_name})
|
||||||
if(${COMPILER_SUPPORTS${flag_name}})
|
if (${COMPILER_SUPPORTS${flag_name}})
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
|
||||||
endif()
|
endif ()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(AddValaCFlagIfSupported flag)
|
macro(AddValaCFlagIfSupported flag)
|
||||||
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
string(REGEX REPLACE "[^a-z^A-Z^_^0-9]+" "_" flag_name ${flag})
|
||||||
check_c_compiler_flag(${flag} COMPILER_SUPPORTS${flag_name})
|
check_c_compiler_flag(${flag} COMPILER_SUPPORTS${flag_name})
|
||||||
if(${COMPILER_SUPPORTS${flag_name}})
|
if (${COMPILER_SUPPORTS${flag_name}})
|
||||||
set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
|
set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
|
||||||
endif()
|
endif ()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
if("Ninja" STREQUAL ${CMAKE_GENERATOR})
|
if ("Ninja" STREQUAL ${CMAKE_GENERATOR})
|
||||||
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
|
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
AddCFlagIfSupported(-Wall)
|
AddCFlagIfSupported(-Wall)
|
||||||
AddCFlagIfSupported(-Werror=format-security)
|
AddCFlagIfSupported(-Werror=format-security)
|
||||||
|
@ -82,36 +122,37 @@ AddValaCFlagIfSupported(-Wno-unused-function)
|
||||||
AddValaCFlagIfSupported(-Wno-unused-label)
|
AddValaCFlagIfSupported(-Wno-unused-label)
|
||||||
|
|
||||||
try_compile(__WITHOUT_FILE_OFFSET_BITS_64 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/LargeFileOffsets.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
|
try_compile(__WITHOUT_FILE_OFFSET_BITS_64 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/LargeFileOffsets.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
|
||||||
if(NOT __WITHOUT_FILE_OFFSET_BITS_64)
|
if (NOT __WITHOUT_FILE_OFFSET_BITS_64)
|
||||||
try_compile(__WITH_FILE_OFFSET_BITS_64 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/LargeFileOffsets.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
|
try_compile(__WITH_FILE_OFFSET_BITS_64 ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/LargeFileOffsets.c COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
|
||||||
|
|
||||||
if(__WITH_FILE_OFFSET_BITS_64)
|
if (__WITH_FILE_OFFSET_BITS_64)
|
||||||
AddCFlagIfSupported(-D_FILE_OFFSET_BITS=64)
|
AddCFlagIfSupported(-D_FILE_OFFSET_BITS=64)
|
||||||
AddValaCFlagIfSupported(-D_FILE_OFFSET_BITS=64)
|
AddValaCFlagIfSupported(-D_FILE_OFFSET_BITS=64)
|
||||||
message(STATUS "Enabled large file support using _FILE_OFFSET_BITS=64")
|
message(STATUS "Enabled large file support using _FILE_OFFSET_BITS=64")
|
||||||
else(__WITH_FILE_OFFSET_BITS_64)
|
else (__WITH_FILE_OFFSET_BITS_64)
|
||||||
message(STATUS "Large file support not available")
|
message(STATUS "Large file support not available")
|
||||||
endif(__WITH_FILE_OFFSET_BITS_64)
|
endif (__WITH_FILE_OFFSET_BITS_64)
|
||||||
unset(__WITH_FILE_OFFSET_BITS_64)
|
unset(__WITH_FILE_OFFSET_BITS_64)
|
||||||
endif(NOT __WITHOUT_FILE_OFFSET_BITS_64)
|
endif (NOT __WITHOUT_FILE_OFFSET_BITS_64)
|
||||||
unset(__WITHOUT_FILE_OFFSET_BITS_64)
|
unset(__WITHOUT_FILE_OFFSET_BITS_64)
|
||||||
|
|
||||||
if($ENV{USE_CCACHE})
|
if ($ENV{USE_CCACHE})
|
||||||
# Configure CCache if available
|
# Configure CCache if available
|
||||||
find_program(CCACHE_FOUND ccache)
|
find_program(CCACHE_BIN ccache)
|
||||||
if(CCACHE_FOUND)
|
mark_as_advanced(CCACHE_BIN)
|
||||||
|
if (CCACHE_BIN)
|
||||||
message(STATUS "Using ccache")
|
message(STATUS "Using ccache")
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE_BIN})
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE_BIN})
|
||||||
else(CCACHE_FOUND)
|
else (CCACHE_BIN)
|
||||||
message(STATUS "USE_CCACHE was set but ccache was not found")
|
message(STATUS "USE_CCACHE was set but ccache was not found")
|
||||||
endif(CCACHE_FOUND)
|
endif (CCACHE_BIN)
|
||||||
endif($ENV{USE_CCACHE})
|
endif ($ENV{USE_CCACHE})
|
||||||
|
|
||||||
if(NOT NO_DEBUG)
|
if (NOT NO_DEBUG)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
|
||||||
set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} -g")
|
set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} -g")
|
||||||
endif(NOT NO_DEBUG)
|
endif (NOT NO_DEBUG)
|
||||||
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
@ -119,15 +160,15 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
set(GTK3_GLOBAL_VERSION 3.22)
|
set(GTK3_GLOBAL_VERSION 3.22)
|
||||||
set(GLib_GLOBAL_VERSION 2.38)
|
set(GLib_GLOBAL_VERSION 2.38)
|
||||||
|
|
||||||
if(NOT VALA_EXECUTABLE)
|
if (NOT VALA_EXECUTABLE)
|
||||||
unset(VALA_EXECUTABLE CACHE)
|
unset(VALA_EXECUTABLE CACHE)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
find_package(Vala 0.34 REQUIRED)
|
find_package(Vala 0.34 REQUIRED)
|
||||||
if(VALA_VERSION VERSION_GREATER "0.34.90" AND VALA_VERSION VERSION_LESS "0.36.1" OR # Due to a bug on 0.36.0 (and pre-releases), we need to disable FAST_VAPI
|
if (VALA_VERSION VERSION_GREATER "0.34.90" AND VALA_VERSION VERSION_LESS "0.36.1" OR # Due to a bug on 0.36.0 (and pre-releases), we need to disable FAST_VAPI
|
||||||
VALA_VERSION VERSION_EQUAL "0.44.10" OR VALA_VERSION VERSION_EQUAL "0.46.4" OR VALA_VERSION VERSION_EQUAL "0.47.1") # See Dino issue #646
|
VALA_VERSION VERSION_EQUAL "0.44.10" OR VALA_VERSION VERSION_EQUAL "0.46.4" OR VALA_VERSION VERSION_EQUAL "0.47.1") # See Dino issue #646
|
||||||
set(DISABLE_FAST_VAPI yes)
|
set(DISABLE_FAST_VAPI yes)
|
||||||
endif()
|
endif ()
|
||||||
|
|
||||||
include(${VALA_USE_FILE})
|
include(${VALA_USE_FILE})
|
||||||
include(MultiFind)
|
include(MultiFind)
|
||||||
|
|
104
cmake/ComputeVersion.cmake
Normal file
104
cmake/ComputeVersion.cmake
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
function(_compute_version_from_file)
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/VERSION)
|
||||||
|
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/VERSION)
|
||||||
|
set(VERSION_FOUND 0 PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION VERSION_FILE)
|
||||||
|
string(REPLACE " " ";" VERSION_FILE "${VERSION_FILE}")
|
||||||
|
cmake_parse_arguments(VERSION_FILE "" "RELEASE;PRERELEASE" "" ${VERSION_FILE})
|
||||||
|
if (DEFINED VERSION_FILE_RELEASE)
|
||||||
|
string(STRIP "${VERSION_FILE_RELEASE}" VERSION_FILE_RELEASE)
|
||||||
|
set(VERSION_IS_RELEASE 1 PARENT_SCOPE)
|
||||||
|
set(VERSION_FULL "${VERSION_FILE_RELEASE}" PARENT_SCOPE)
|
||||||
|
set(VERSION_FOUND 1 PARENT_SCOPE)
|
||||||
|
elseif (DEFINED VERSION_FILE_PRERELEASE)
|
||||||
|
string(STRIP "${VERSION_FILE_PRERELEASE}" VERSION_FILE_PRERELEASE)
|
||||||
|
set(VERSION_IS_RELEASE 0 PARENT_SCOPE)
|
||||||
|
set(VERSION_FULL "${VERSION_FILE_PRERELEASE}" PARENT_SCOPE)
|
||||||
|
set(VERSION_FOUND 1 PARENT_SCOPE)
|
||||||
|
else ()
|
||||||
|
set(VERSION_FOUND 0 PARENT_SCOPE)
|
||||||
|
endif ()
|
||||||
|
endfunction(_compute_version_from_file)
|
||||||
|
|
||||||
|
function(_compute_version_from_git)
|
||||||
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/.git)
|
||||||
|
if (NOT GIT_EXECUTABLE)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
if (NOT GIT_FOUND)
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
endif (NOT GIT_EXECUTABLE)
|
||||||
|
|
||||||
|
# Git tag
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --tags --abbrev=0
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE git_result
|
||||||
|
OUTPUT_VARIABLE git_tag
|
||||||
|
ERROR_VARIABLE git_error
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if (NOT git_result EQUAL 0)
|
||||||
|
return()
|
||||||
|
endif (NOT git_result EQUAL 0)
|
||||||
|
|
||||||
|
if (git_tag MATCHES "^v?([0-9]+[.]?[0-9]*[.]?[0-9]*)(-[.0-9A-Za-z-]+)?([+][.0-9A-Za-z-]+)?$")
|
||||||
|
set(VERSION_LAST_RELEASE "${CMAKE_MATCH_1}")
|
||||||
|
else ()
|
||||||
|
return()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Git describe
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --tags
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE git_result
|
||||||
|
OUTPUT_VARIABLE git_describe
|
||||||
|
ERROR_VARIABLE git_error
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if (NOT git_result EQUAL 0)
|
||||||
|
return()
|
||||||
|
endif (NOT git_result EQUAL 0)
|
||||||
|
|
||||||
|
if ("${git_tag}" STREQUAL "${git_describe}")
|
||||||
|
set(VERSION_IS_RELEASE 1)
|
||||||
|
else ()
|
||||||
|
set(VERSION_IS_RELEASE 0)
|
||||||
|
if (git_describe MATCHES "g([0-9a-f]+)$")
|
||||||
|
set(VERSION_COMMIT_HASH "${CMAKE_MATCH_1}")
|
||||||
|
endif ()
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" show --format=%cd --date=format:%Y%m%d -s
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE git_result
|
||||||
|
OUTPUT_VARIABLE git_time
|
||||||
|
ERROR_VARIABLE git_error
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if (NOT git_result EQUAL 0)
|
||||||
|
return()
|
||||||
|
endif (NOT git_result EQUAL 0)
|
||||||
|
set(VERSION_COMMIT_DATE "${git_time}")
|
||||||
|
endif ()
|
||||||
|
if (NOT VERSION_IS_RELEASE)
|
||||||
|
set(VERSION_SUFFIX ".git${VERSION_COMMIT_DATE}.${VERSION_COMMIT_HASH}")
|
||||||
|
else (NOT VERSION_IS_RELEASE)
|
||||||
|
set(VERSION_SUFFIX "")
|
||||||
|
endif (NOT VERSION_IS_RELEASE)
|
||||||
|
set(VERSION_IS_RELEASE ${VERSION_IS_RELEASE} PARENT_SCOPE)
|
||||||
|
set(VERSION_FULL "${VERSION_LAST_RELEASE}${VERSION_SUFFIX}" PARENT_SCOPE)
|
||||||
|
set(VERSION_FOUND 1 PARENT_SCOPE)
|
||||||
|
endfunction(_compute_version_from_git)
|
||||||
|
|
||||||
|
_compute_version_from_file()
|
||||||
|
if (NOT VERSION_FOUND)
|
||||||
|
_compute_version_from_git()
|
||||||
|
endif (NOT VERSION_FOUND)
|
|
@ -25,9 +25,12 @@ if(GDK3_FOUND AND NOT GDK3_VERSION)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(GDK3_FOUND)
|
if (GDK3_FOUND)
|
||||||
find_file(GDK3_WITH_X11 "gdk/gdkx.h" HINTS ${GDK3_INCLUDE_DIRS})
|
find_file(GDK3_WITH_X11 "gdk/gdkx.h" HINTS ${GDK3_INCLUDE_DIRS})
|
||||||
endif()
|
if (GDK3_WITH_X11)
|
||||||
|
set(GDK3_WITH_X11 yes CACHE INTERNAL "Does GDK3 support X11")
|
||||||
|
endif (GDK3_WITH_X11)
|
||||||
|
endif ()
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
find_package_handle_standard_args(GDK3
|
find_package_handle_standard_args(GDK3
|
||||||
|
|
|
@ -193,6 +193,9 @@ function(vala_precompile output)
|
||||||
endif(ARGS_GENERATE_HEADER)
|
endif(ARGS_GENERATE_HEADER)
|
||||||
|
|
||||||
string(REPLACE " " ";" VALAC_FLAGS ${CMAKE_VALA_FLAGS})
|
string(REPLACE " " ";" VALAC_FLAGS ${CMAKE_VALA_FLAGS})
|
||||||
|
if (VALA_VERSION VERSION_GREATER "0.38")
|
||||||
|
set(VALAC_COLORS "--color=always")
|
||||||
|
endif ()
|
||||||
|
|
||||||
if(ARGS_FAST_VAPI)
|
if(ARGS_FAST_VAPI)
|
||||||
foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
|
foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
|
||||||
|
@ -211,6 +214,7 @@ function(vala_precompile output)
|
||||||
COMMAND
|
COMMAND
|
||||||
${VALA_EXECUTABLE}
|
${VALA_EXECUTABLE}
|
||||||
ARGS
|
ARGS
|
||||||
|
${VALAC_COLORS}
|
||||||
--fast-vapi ${fast_vapi_file}
|
--fast-vapi ${fast_vapi_file}
|
||||||
${vala_define_opts}
|
${vala_define_opts}
|
||||||
${ARGS_OPTIONS}
|
${ARGS_OPTIONS}
|
||||||
|
@ -246,6 +250,7 @@ function(vala_precompile output)
|
||||||
COMMAND
|
COMMAND
|
||||||
${VALA_EXECUTABLE}
|
${VALA_EXECUTABLE}
|
||||||
ARGS
|
ARGS
|
||||||
|
${VALAC_COLORS}
|
||||||
"-C"
|
"-C"
|
||||||
"-d" ${dir}
|
"-d" ${dir}
|
||||||
${vala_pkg_opts}
|
${vala_pkg_opts}
|
||||||
|
@ -271,6 +276,7 @@ function(vala_precompile output)
|
||||||
COMMAND
|
COMMAND
|
||||||
${VALA_EXECUTABLE}
|
${VALA_EXECUTABLE}
|
||||||
ARGS
|
ARGS
|
||||||
|
${VALAC_COLORS}
|
||||||
-C -q --disable-warnings
|
-C -q --disable-warnings
|
||||||
${header_arguments}
|
${header_arguments}
|
||||||
${vapi_arguments}
|
${vapi_arguments}
|
||||||
|
@ -306,6 +312,7 @@ function(vala_precompile output)
|
||||||
COMMAND
|
COMMAND
|
||||||
${VALA_EXECUTABLE}
|
${VALA_EXECUTABLE}
|
||||||
ARGS
|
ARGS
|
||||||
|
${VALAC_COLORS}
|
||||||
-C
|
-C
|
||||||
${header_arguments}
|
${header_arguments}
|
||||||
${vapi_arguments}
|
${vapi_arguments}
|
||||||
|
|
22
configure
vendored
22
configure
vendored
|
@ -191,9 +191,16 @@ if ! [ -x "$ninja_bin" ]; then
|
||||||
ninja_bin="$(which ninja 2>/dev/null)"
|
ninja_bin="$(which ninja 2>/dev/null)"
|
||||||
fi
|
fi
|
||||||
if [ -x "$ninja_bin" ]; then
|
if [ -x "$ninja_bin" ]; then
|
||||||
ninja_version=$($ninja_bin --version 2>/dev/null)
|
ninja_version=`$ninja_bin --version 2>/dev/null`
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "-- Found Ninja: $ninja_bin (found version \"$ninja_version\")"
|
if [ -d build ]; then
|
||||||
|
last_ninja_version=`cat build/.ninja_version 2>/dev/null`
|
||||||
|
else
|
||||||
|
last_ninja_version=0
|
||||||
|
fi
|
||||||
|
if [ "$ninja_version" != "$last_ninja_version" ]; then
|
||||||
|
echo "-- Found Ninja: $ninja_bin (found version \"$ninja_version\")"
|
||||||
|
fi
|
||||||
cmake_type="Ninja"
|
cmake_type="Ninja"
|
||||||
exec_bin="$ninja_bin"
|
exec_bin="$ninja_bin"
|
||||||
exec_command="$exec_bin"
|
exec_command="$exec_bin"
|
||||||
|
@ -219,14 +226,12 @@ if ! [ -x "$exec_bin" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -f ./build ]
|
if [ -f ./build ]; then
|
||||||
then
|
|
||||||
echo "-!- ./build file exists. ./configure can't continue"
|
echo "-!- ./build file exists. ./configure can't continue"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d build ]
|
if [ -d build ]; then
|
||||||
then
|
|
||||||
last_type=`cat build/.cmake_type`
|
last_type=`cat build/.cmake_type`
|
||||||
if [ "$cmake_type" != "$last_type" ]
|
if [ "$cmake_type" != "$last_type" ]
|
||||||
then
|
then
|
||||||
|
@ -241,6 +246,7 @@ mkdir -p build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
echo "$cmake_type" > .cmake_type
|
echo "$cmake_type" > .cmake_type
|
||||||
|
echo "$ninja_version" > .ninja_version
|
||||||
cmake -G "$cmake_type" \
|
cmake -G "$cmake_type" \
|
||||||
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
-DCMAKE_INSTALL_PREFIX="$PREFIX" \
|
||||||
-DENABLED_PLUGINS="$ENABLED_PLUGINS" \
|
-DENABLED_PLUGINS="$ENABLED_PLUGINS" \
|
||||||
|
@ -256,10 +262,10 @@ cmake -G "$cmake_type" \
|
||||||
-DBIN_INSTALL_DIR="$BINDIR" \
|
-DBIN_INSTALL_DIR="$BINDIR" \
|
||||||
-DINCLUDE_INSTALL_DIR="$INCLUDEDIR" \
|
-DINCLUDE_INSTALL_DIR="$INCLUDEDIR" \
|
||||||
-DLIB_INSTALL_DIR="$LIBDIR" \
|
-DLIB_INSTALL_DIR="$LIBDIR" \
|
||||||
|
-Wno-dev \
|
||||||
.. || exit 9
|
.. || exit 9
|
||||||
|
|
||||||
if [ "$cmake_type" = "Ninja" ]
|
if [ "$cmake_type" = "Ninja" ]; then
|
||||||
then
|
|
||||||
cat << EOF > Makefile
|
cat << EOF > Makefile
|
||||||
default:
|
default:
|
||||||
@sh -c "$exec_command"
|
@sh -c "$exec_command"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
using Dino.Entities;
|
using Dino.Entities;
|
||||||
|
|
||||||
public interface Dino.Application : GLib.Application {
|
namespace Dino {
|
||||||
|
extern const string VERSION;
|
||||||
|
|
||||||
|
public interface Application : GLib.Application {
|
||||||
|
|
||||||
public abstract Database db { get; set; }
|
public abstract Database db { get; set; }
|
||||||
public abstract Dino.Entities.Settings settings { get; set; }
|
public abstract Dino.Entities.Settings settings { get; set; }
|
||||||
|
@ -76,7 +79,7 @@ public interface Dino.Application : GLib.Application {
|
||||||
jid = jid.substring(1);
|
jid = jid.substring(1);
|
||||||
}
|
}
|
||||||
string query = "message";
|
string query = "message";
|
||||||
Gee.Map<string, string> options = new Gee.HashMap<string,string>();
|
Gee.Map<string, string> options = new Gee.HashMap<string, string>();
|
||||||
if (m.length == 2) {
|
if (m.length == 2) {
|
||||||
string[] cmds = m[1].split(";");
|
string[] cmds = m[1].split(";");
|
||||||
query = cmds[0];
|
query = cmds[0];
|
||||||
|
@ -127,3 +130,4 @@ public interface Dino.Application : GLib.Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -169,7 +169,7 @@ OPTIONS
|
||||||
${MAIN_EXTRA_OPTIONS}
|
${MAIN_EXTRA_OPTIONS}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\")
|
add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\" -DDINO_VERSION=\"${PROJECT_VERSION}\")
|
||||||
add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET} src/emojichooser.c)
|
add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET} src/emojichooser.c)
|
||||||
add_dependencies(dino ${GETTEXT_PACKAGE}-translations)
|
add_dependencies(dino ${GETTEXT_PACKAGE}-translations)
|
||||||
target_include_directories(dino PRIVATE src)
|
target_include_directories(dino PRIVATE src)
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
<attribute name="action">app.open_shortcuts</attribute>
|
<attribute name="action">app.open_shortcuts</attribute>
|
||||||
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
|
<attribute name="label" translatable="yes">Keyboard Shortcuts</attribute>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<attribute name="action">app.about</attribute>
|
||||||
|
<attribute name="label" translatable="yes">About Dino</attribute>
|
||||||
|
</item>
|
||||||
</section>
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
|
@ -80,6 +80,10 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
settings_action.activate.connect(show_settings_window);
|
settings_action.activate.connect(show_settings_window);
|
||||||
add_action(settings_action);
|
add_action(settings_action);
|
||||||
|
|
||||||
|
SimpleAction about_action = new SimpleAction("about", null);
|
||||||
|
about_action.activate.connect(show_about_window);
|
||||||
|
add_action(about_action);
|
||||||
|
|
||||||
SimpleAction quit_action = new SimpleAction("quit", null);
|
SimpleAction quit_action = new SimpleAction("quit", null);
|
||||||
quit_action.activate.connect(quit);
|
quit_action.activate.connect(quit);
|
||||||
add_action(quit_action);
|
add_action(quit_action);
|
||||||
|
@ -169,6 +173,18 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
dialog.present();
|
dialog.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void show_about_window() {
|
||||||
|
show_about_dialog(get_active_window(),
|
||||||
|
logo_icon_name: "im.dino.Dino",
|
||||||
|
program_name: "Dino",
|
||||||
|
version: Dino.VERSION.strip().length == 0 ? null : Dino.VERSION,
|
||||||
|
comments: "Dino. Communicating happiness.",
|
||||||
|
website: "https://dino.im/",
|
||||||
|
website_label: "dino.im",
|
||||||
|
copyright: "Copyright © 2016-2019 - Dino Team",
|
||||||
|
license_type: License.GPL_3_0);
|
||||||
|
}
|
||||||
|
|
||||||
private void show_join_muc_dialog(Account? account, Jid jid) {
|
private void show_join_muc_dialog(Account? account, Jid jid) {
|
||||||
Dialog dialog = new Dialog.with_buttons(_("Join Channel"), window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR, _("Join"), ResponseType.OK, _("Cancel"), ResponseType.CANCEL);
|
Dialog dialog = new Dialog.with_buttons(_("Join Channel"), window, Gtk.DialogFlags.MODAL | Gtk.DialogFlags.USE_HEADER_BAR, _("Join"), ResponseType.OK, _("Cancel"), ResponseType.CANCEL);
|
||||||
dialog.modal = true;
|
dialog.modal = true;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
if(PLUGIN_ENABLED_http-files)
|
if(DINO_PLUGIN_ENABLED_http-files)
|
||||||
add_subdirectory(http-files)
|
add_subdirectory(http-files)
|
||||||
endif(PLUGIN_ENABLED_http-files)
|
endif(DINO_PLUGIN_ENABLED_http-files)
|
||||||
|
|
||||||
if(PLUGIN_ENABLED_openpgp)
|
if(DINO_PLUGIN_ENABLED_openpgp)
|
||||||
add_subdirectory(gpgme-vala)
|
add_subdirectory(gpgme-vala)
|
||||||
add_subdirectory(openpgp)
|
add_subdirectory(openpgp)
|
||||||
endif(PLUGIN_ENABLED_openpgp)
|
endif(DINO_PLUGIN_ENABLED_openpgp)
|
||||||
|
|
||||||
if(PLUGIN_ENABLED_omemo)
|
if(DINO_PLUGIN_ENABLED_omemo)
|
||||||
add_subdirectory(crypto-vala)
|
add_subdirectory(crypto-vala)
|
||||||
add_subdirectory(omemo)
|
add_subdirectory(omemo)
|
||||||
add_subdirectory(signal-protocol)
|
add_subdirectory(signal-protocol)
|
||||||
endif(PLUGIN_ENABLED_omemo)
|
endif(DINO_PLUGIN_ENABLED_omemo)
|
||||||
|
|
||||||
if(PLUGIN_ENABLED_notification-sound)
|
if(DINO_PLUGIN_ENABLED_notification-sound)
|
||||||
add_subdirectory(notification-sound)
|
add_subdirectory(notification-sound)
|
||||||
endif(PLUGIN_ENABLED_notification-sound)
|
endif(DINO_PLUGIN_ENABLED_notification-sound)
|
||||||
|
|
|
@ -18,8 +18,6 @@ endif()
|
||||||
|
|
||||||
vala_precompile(ENGINE_VALA_C
|
vala_precompile(ENGINE_VALA_C
|
||||||
SOURCES
|
SOURCES
|
||||||
"src/glib_fixes.vapi"
|
|
||||||
|
|
||||||
"src/core/namespace_state.vala"
|
"src/core/namespace_state.vala"
|
||||||
"src/core/stanza_attribute.vala"
|
"src/core/stanza_attribute.vala"
|
||||||
"src/core/stanza_node.vala"
|
"src/core/stanza_node.vala"
|
||||||
|
@ -101,6 +99,8 @@ GENERATE_VAPI
|
||||||
xmpp-vala
|
xmpp-vala
|
||||||
GENERATE_HEADER
|
GENERATE_HEADER
|
||||||
xmpp-vala
|
xmpp-vala
|
||||||
|
CUSTOM_VAPIS
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/src/glib_fixes.vapi"
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
${ENGINE_DEFINITIONS}
|
${ENGINE_DEFINITIONS}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue