aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt82
-rw-r--r--cmake/FindATK.cmake32
-rw-r--r--cmake/FindCairo.cmake31
-rw-r--r--cmake/FindGDK3.cmake32
-rw-r--r--cmake/FindGDKPixbuf2.cmake24
-rw-r--r--cmake/FindGIO.cmake20
-rw-r--r--cmake/FindGLib.cmake33
-rw-r--r--cmake/FindGModule.cmake20
-rw-r--r--cmake/FindGObject.cmake20
-rw-r--r--cmake/FindGPGME.cmake17
-rw-r--r--cmake/FindGTK3.cmake32
-rw-r--r--cmake/FindGee.cmake15
-rw-r--r--cmake/FindLibnotify.cmake31
-rw-r--r--cmake/FindPango.cmake32
-rw-r--r--cmake/FindSQLite3.cmake22
-rw-r--r--cmake/FindVala.cmake1
-rw-r--r--cmake/MultiFind.cmake45
-rw-r--r--cmake/PkgConfigWithFallback.cmake99
-rw-r--r--cmake/UseVala.cmake18
-rw-r--r--cmake/cmake_uninstall.cmake.in21
-rwxr-xr-xconfigure68
-rw-r--r--libdino/CMakeLists.txt38
-rw-r--r--libdino/src/plugin/loader.vala18
-rw-r--r--libdino/src/settings.vala2
-rw-r--r--main/CMakeLists.txt50
-rw-r--r--main/data/dino.desktop12
-rw-r--r--main/src/main.vala11
-rw-r--r--plugins/CMakeLists.txt8
-rw-r--r--plugins/gpgme-vala/CMakeLists.txt20
-rw-r--r--plugins/omemo/CMakeLists.txt29
-rw-r--r--plugins/openpgp/CMakeLists.txt30
-rw-r--r--plugins/signal-protocol/CMakeLists.txt30
-rw-r--r--qlite/CMakeLists.txt27
-rw-r--r--xmpp-vala/CMakeLists.txt31
34 files changed, 810 insertions, 191 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aab54d8a..229abfce 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,29 +1,87 @@
-list(APPEND CMAKE_MODULE_PATH
- ${CMAKE_SOURCE_DIR}/cmake
-)
+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
+message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")
+
+string(REGEX REPLACE "^liblib" "lib" LIBDIR_NAME "lib${LIB_SUFFIX}")
+set(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share")
+
+set(APPLICATION_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications")
+set(BIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/bin")
+set(DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dino")
+set(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons")
+set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include")
+set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBDIR_NAME}")
+set(PLUGIN_INSTALL_DIR "${DATA_INSTALL_DIR}/plugins")
+set(VAPI_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/vala/vapi")
+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})
include(CheckCCompilerFlag)
-macro(AddCFlagIfSupported flag test)
- CHECK_C_COMPILER_FLAG(${flag} ${test})
- if(${${test}})
+
+macro(AddCFlagIfSupported flag)
+ CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag})
+ if(${COMPILER_SUPPORTS${flag}})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}")
endif()
endmacro()
-cmake_minimum_required(VERSION 3.0)
+macro(AddValaCFlagIfSupported flag)
+ CHECK_C_COMPILER_FLAG(${flag} COMPILER_SUPPORTS${flag})
+ if(${COMPILER_SUPPORTS${flag}})
+ set(VALA_CFLAGS "${VALA_CFLAGS} ${flag}")
+ endif()
+endmacro()
if("Ninja" STREQUAL ${CMAKE_GENERATOR})
AddCFlagIfSupported(-fdiagnostics-color COMPILER_SUPPORTS_fdiagnistics-color)
endif()
-set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
-set (GLOBAL_DEBUG_FLAGS -g)
-set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GLOBAL_DEBUG_FLAGS}")
-set (VALA_CFLAGS -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-int-conversion -Wno-discarded-qualifiers)
+AddValaCFlagIfSupported(-Wno-deprecated-declarations)
+AddValaCFlagIfSupported(-Wno-incompatible-pointer-types)
+AddValaCFlagIfSupported(-Wno-int-conversion)
+AddValaCFlagIfSupported(-Wno-discarded-qualifiers)
+
+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})
+
+find_package(Vala 0.30 REQUIRED)
+include(${VALA_USE_FILE})
+include(MultiFind)
+include(GlibCompileResourcesSupport)
+
+set(GTK3_GLOBAL_VERSION 3.22)
+set(GLib_GLOBAL_VERSION 2.38)
+
+set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --thread --target-glib=${GLib_GLOBAL_VERSION}")
add_subdirectory(qlite)
add_subdirectory(xmpp-vala)
add_subdirectory(libdino)
add_subdirectory(main)
add_subdirectory(plugins)
+
+# 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...")
diff --git a/cmake/FindATK.cmake b/cmake/FindATK.cmake
new file mode 100644
index 00000000..bdd25897
--- /dev/null
+++ b/cmake/FindATK.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(ATK
+ PKG_CONFIG_NAME atk
+ LIB_NAMES atk-1.0
+ INCLUDE_NAMES atk/atk.h
+ INCLUDE_DIR_SUFFIXES atk-1.0 atk-1.0/include
+ DEPENDS GObject
+)
+
+if(ATK_FOUND AND NOT ATK_VERSION)
+ find_path(ATK_INCLUDE_DIR "atk/atk.h" HINTS ${ATK_INCLUDE_DIRS})
+
+ if(ATK_INCLUDE_DIR)
+ file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MAJOR_VERSION REGEX "^#define ATK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define ATK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MAJOR_VERSION "${ATK_MAJOR_VERSION}")
+ file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MINOR_VERSION REGEX "^#define ATK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define ATK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MINOR_VERSION "${ATK_MINOR_VERSION}")
+ file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MICRO_VERSION REGEX "^#define ATK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define ATK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" ATK_MICRO_VERSION "${ATK_MICRO_VERSION}")
+ set(ATK_VERSION "${ATK_MAJOR_VERSION}.${ATK_MINOR_VERSION}.${ATK_MICRO_VERSION}")
+ unset(ATK_MAJOR_VERSION)
+ unset(ATK_MINOR_VERSION)
+ unset(ATK_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(ATK
+ FOUND_VAR ATK_FOUND
+ REQUIRED_VARS ATK_LIBRARY
+ VERSION_VAR ATK_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake
new file mode 100644
index 00000000..5d2a2fbf
--- /dev/null
+++ b/cmake/FindCairo.cmake
@@ -0,0 +1,31 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Cairo
+ PKG_CONFIG_NAME cairo
+ LIB_NAMES cairo
+ INCLUDE_NAMES cairo.h
+ INCLUDE_DIR_SUFFIXES cairo cairo/include
+)
+
+if(Cairo_FOUND AND NOT Cairo_VERSION)
+ find_path(Cairo_INCLUDE_DIR "cairo.h" HINTS ${Cairo_INCLUDE_DIRS})
+
+ if(Cairo_INCLUDE_DIR)
+ file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MAJOR_VERSION REGEX "^#define CAIRO_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define CAIRO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Cairo_MAJOR_VERSION "${Cairo_MAJOR_VERSION}")
+ file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MINOR_VERSION REGEX "^#define CAIRO_VERSION_MINOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define CAIRO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Cairo_MINOR_VERSION "${Cairo_MINOR_VERSION}")
+ file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MICRO_VERSION REGEX "^#define CAIRO_VERSION_MICRO +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define CAIRO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Cairo_MICRO_VERSION "${Cairo_MICRO_VERSION}")
+ set(Cairo_VERSION "${Cairo_MAJOR_VERSION}.${Cairo_MINOR_VERSION}.${Cairo_MICRO_VERSION}")
+ unset(Cairo_MAJOR_VERSION)
+ unset(Cairo_MINOR_VERSION)
+ unset(Cairo_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Cairo
+ FOUND_VAR Cairo_FOUND
+ REQUIRED_VARS Cairo_LIBRARY
+ VERSION_VAR Cairo_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGDK3.cmake b/cmake/FindGDK3.cmake
new file mode 100644
index 00000000..fd5061c0
--- /dev/null
+++ b/cmake/FindGDK3.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GDK3
+ PKG_CONFIG_NAME gdk-3.0
+ LIB_NAMES gdk-3
+ INCLUDE_NAMES gdk/gdk.h
+ INCLUDE_DIR_SUFFIXES gtk-3.0 gtk-3.0/include gtk+-3.0 gtk+-3.0/include
+ DEPENDS Pango Cairo GDKPixbuf2
+)
+
+if(GDK3_FOUND AND NOT GDK3_VERSION)
+ find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS})
+
+ if(GDK3_INCLUDE_DIR)
+ file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GDK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MAJOR_VERSION "${GDK3_MAJOR_VERSION}")
+ file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MINOR_VERSION REGEX "^#define GDK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GDK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MINOR_VERSION "${GDK3_MINOR_VERSION}")
+ file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MICRO_VERSION REGEX "^#define GDK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GDK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GDK3_MICRO_VERSION "${GDK3_MICRO_VERSION}")
+ set(GDK3_VERSION "${GDK3_MAJOR_VERSION}.${GDK3_MINOR_VERSION}.${GDK3_MICRO_VERSION}")
+ unset(GDK3_MAJOR_VERSION)
+ unset(GDK3_MINOR_VERSION)
+ unset(GDK3_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GDK3
+ FOUND_VAR GDK3_FOUND
+ REQUIRED_VARS GDK3_LIBRARY
+ VERSION_VAR GDK3_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGDKPixbuf2.cmake b/cmake/FindGDKPixbuf2.cmake
new file mode 100644
index 00000000..d100deea
--- /dev/null
+++ b/cmake/FindGDKPixbuf2.cmake
@@ -0,0 +1,24 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GDKPixbuf2
+ PKG_CONFIG_NAME gdk-pixbuf-2.0
+ LIB_NAMES gdk_pixbuf-2.0
+ INCLUDE_NAMES gdk-pixbuf/gdk-pixbuf.h
+ INCLUDE_DIR_SUFFIXES gdk-pixbuf-2.0 gdk-pixbuf-2.0/include
+ DEPENDS GLib
+)
+
+if(GDKPixbuf2_FOUND AND NOT GDKPixbuf2_VERSION)
+ find_path(GDKPixbuf2_INCLUDE_DIR "gdk-pixbuf/gdk-pixbuf.h" HINTS ${GDKPixbuf2_INCLUDE_DIRS})
+
+ if(GDKPixbuf2_INCLUDE_DIR)
+ file(STRINGS "${GDKPixbuf2_INCLUDE_DIR}/gdk-pixbuf/gdk-pixbuf-features.h" GDKPixbuf2_VERSION REGEX "^#define GDK_PIXBUF_VERSION \\\"[^\\\"]+\\\"")
+ string(REGEX REPLACE "^#define GDK_PIXBUF_VERSION \\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" GDKPixbuf2_VERSION "${GDKPixbuf2_VERSION}")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GDKPixbuf2
+ FOUND_VAR GDKPixbuf2_FOUND
+ REQUIRED_VARS GDKPixbuf2_LIBRARY
+ VERSION_VAR GDKPixbuf2_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGIO.cmake b/cmake/FindGIO.cmake
new file mode 100644
index 00000000..d65749dd
--- /dev/null
+++ b/cmake/FindGIO.cmake
@@ -0,0 +1,20 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GIO
+ PKG_CONFIG_NAME gio-2.0
+ LIB_NAMES gio-2.0
+ INCLUDE_NAMES gio/gio.h
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+ DEPENDS GObject
+)
+
+if(GIO_FOUND AND NOT GIO_VERSION)
+ find_package(GLib)
+ set(GIO_VERSION ${GLib_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GIO
+ FOUND_VAR GIO_FOUND
+ REQUIRED_VARS GIO_LIBRARY
+ VERSION_VAR GIO_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGLib.cmake b/cmake/FindGLib.cmake
new file mode 100644
index 00000000..eb054e65
--- /dev/null
+++ b/cmake/FindGLib.cmake
@@ -0,0 +1,33 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GLib
+ PKG_CONFIG_NAME glib-2.0
+ LIB_NAMES glib-2.0
+ INCLUDE_NAMES glib.h glibconfig.h
+ INCLUDE_DIR_HINTS ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH}
+ INCLUDE_DIR_PATHS ${CMAKE_PREFIX_PATH}/lib64 ${CMAKE_PREFIX_PATH}/lib
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+)
+
+if(GLib_FOUND AND NOT GLib_VERSION)
+ find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" HINTS ${GLib_INCLUDE_DIRS})
+
+ if(GLib_CONFIG_INCLUDE_DIR)
+ file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)")
+ string(REGEX REPLACE "^#define GLIB_MAJOR_VERSION ([0-9]+)$" "\\1" GLib_MAJOR_VERSION "${GLib_MAJOR_VERSION}")
+ file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MINOR_VERSION REGEX "^#define GLIB_MINOR_VERSION +([0-9]+)")
+ string(REGEX REPLACE "^#define GLIB_MINOR_VERSION ([0-9]+)$" "\\1" GLib_MINOR_VERSION "${GLib_MINOR_VERSION}")
+ file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MICRO_VERSION REGEX "^#define GLIB_MICRO_VERSION +([0-9]+)")
+ string(REGEX REPLACE "^#define GLIB_MICRO_VERSION ([0-9]+)$" "\\1" GLib_MICRO_VERSION "${GLib_MICRO_VERSION}")
+ set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}")
+ unset(GLib_MAJOR_VERSION)
+ unset(GLib_MINOR_VERSION)
+ unset(GLib_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GLib
+ FOUND_VAR GLib_FOUND
+ REQUIRED_VARS GLib_LIBRARY
+ VERSION_VAR GLib_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGModule.cmake b/cmake/FindGModule.cmake
new file mode 100644
index 00000000..61233145
--- /dev/null
+++ b/cmake/FindGModule.cmake
@@ -0,0 +1,20 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GModule
+ PKG_CONFIG_NAME gmodule-2.0
+ LIB_NAMES gmodule-2.0
+ INCLUDE_NAMES gmodule.h
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+ DEPENDS GLib
+)
+
+if(GModule_FOUND AND NOT GModule_VERSION)
+ find_package(GLib)
+ set(GModule_VERSION ${GLib_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GModule
+ FOUND_VAR GModule_FOUND
+ REQUIRED_VARS GModule_LIBRARY
+ VERSION_VAR GModule_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGObject.cmake b/cmake/FindGObject.cmake
new file mode 100644
index 00000000..22327469
--- /dev/null
+++ b/cmake/FindGObject.cmake
@@ -0,0 +1,20 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GObject
+ PKG_CONFIG_NAME gobject-2.0
+ LIB_NAMES gobject-2.0
+ INCLUDE_NAMES gobject/gobject.h
+ INCLUDE_DIR_SUFFIXES glib-2.0 glib-2.0/include
+ DEPENDS GLib
+)
+
+if(GObject_FOUND AND NOT GObject_VERSION)
+ find_package(GLib)
+ set(GObject_VERSION ${GLib_VERSION})
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GObject
+ FOUND_VAR GObject_FOUND
+ REQUIRED_VARS GObject_LIBRARY
+ VERSION_VAR GObject_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGPGME.cmake b/cmake/FindGPGME.cmake
index fd096363..90f734fe 100644
--- a/cmake/FindGPGME.cmake
+++ b/cmake/FindGPGME.cmake
@@ -1,4 +1,4 @@
-# TODO: Windows related stuff
+set(GPGME_PKG_CONFIG_NAME gpgme)
find_program(GPGME_CONFIG_EXECUTABLE NAMES gpgme-config)
mark_as_advanced(GPGME_CONFIG_EXECUTABLE)
@@ -17,11 +17,22 @@ if(GPGME_CONFIG_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GPGME_CONFIG_EXECUTABLE} --libs
- OUTPUT_VARIABLE GPGME_LIBRARIES
+ OUTPUT_VARIABLE GPGME_LDFLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ string(REGEX REPLACE "^(.* |)-l([^ ]*)$( .*|)" "\\2" GPGME_LIBRARY "${GPGME_LDFLAGS}")
+ string(REGEX REPLACE "^(.* |)-L([^ ]*)$( .*|)" "\\2" GPGME_LIBRARY_DIRS "${GPGME_LDFLAGS}")
+ find_library(LIB_NAME_GPGME ${GPGME_LIBRARY} HINTS ${GPGME_LIBRARY_DIRS})
+ set(GPGME_LIBRARY ${LIB_NAME_GPGME})
+
+ if(NOT TARGET gpgme)
+ add_library(gpgme SHARED IMPORTED)
+ set_property(TARGET gpgme PROPERTY IMPORTED_LOCATION "${GPGME_LIBRARY}")
+ set_property(TARGET gpgme PROPERTY INTERFACE_COMPILE_OPTIONS "${GPGME_CFLAGS}")
+ endif(NOT TARGET gpgme)
endif(GPGME_CONFIG_EXECUTABLE)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GPGME
- REQUIRED_VARS GPGME_CONFIG_EXECUTABLE
+ REQUIRED_VARS GPGME_LIBRARY
VERSION_VAR GPGME_VERSION) \ No newline at end of file
diff --git a/cmake/FindGTK3.cmake b/cmake/FindGTK3.cmake
new file mode 100644
index 00000000..f70c23c2
--- /dev/null
+++ b/cmake/FindGTK3.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(GTK3
+ PKG_CONFIG_NAME gtk+-3.0
+ LIB_NAMES gtk-3
+ INCLUDE_NAMES gtk/gtk.h
+ INCLUDE_DIR_SUFFIXES gtk-3.0 gtk-3.0/include gtk+-3.0 gtk+-3.0/include
+ DEPENDS GDK3 ATK
+)
+
+if(GTK3_FOUND AND NOT GTK3_VERSION)
+ find_path(GTK3_INCLUDE_DIR "gtk/gtk.h" HINTS ${GTK3_INCLUDE_DIRS})
+
+ if(GTK3_INCLUDE_DIR)
+ file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GTK_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MAJOR_VERSION "${GTK3_MAJOR_VERSION}")
+ file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MINOR_VERSION REGEX "^#define GTK_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GTK_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MINOR_VERSION "${GTK3_MINOR_VERSION}")
+ file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MICRO_VERSION REGEX "^#define GTK_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define GTK_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" GTK3_MICRO_VERSION "${GTK3_MICRO_VERSION}")
+ set(GTK3_VERSION "${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_MICRO_VERSION}")
+ unset(GTK3_MAJOR_VERSION)
+ unset(GTK3_MINOR_VERSION)
+ unset(GTK3_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GTK3
+ FOUND_VAR GTK3_FOUND
+ REQUIRED_VARS GTK3_LIBRARY
+ VERSION_VAR GTK3_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindGee.cmake b/cmake/FindGee.cmake
new file mode 100644
index 00000000..32232d52
--- /dev/null
+++ b/cmake/FindGee.cmake
@@ -0,0 +1,15 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Gee
+ PKG_CONFIG_NAME gee-0.8
+ LIB_NAMES gee-0.8
+ INCLUDE_NAMES gee.h
+ INCLUDE_DIR_SUFFIXES gee-0.8 gee-0.8/include
+ DEPENDS GObject
+)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Gee
+ FOUND_VAR Gee_FOUND
+ REQUIRED_VARS Gee_LIBRARY
+ VERSION_VAR Gee_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindLibnotify.cmake b/cmake/FindLibnotify.cmake
new file mode 100644
index 00000000..468ef0c9
--- /dev/null
+++ b/cmake/FindLibnotify.cmake
@@ -0,0 +1,31 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Libnotify
+ PKG_CONFIG_NAME libnotify
+ LIB_NAMES notify
+ INCLUDE_NAMES libnotify/notify.h
+ DEPENDS GIO GDKPixbuf2
+)
+
+if(Libnotify_FOUND AND NOT Libnotify_VERSION)
+ find_path(Libnotify_INCLUDE_DIR "libnotify/notify-features.h" HINTS ${Libnotify_INCLUDE_DIRS})
+
+ if(Libnotify_INCLUDE_DIR)
+ file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MAJOR_VERSION REGEX "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MAJOR_VERSION "${Libnotify_MAJOR_VERSION}")
+ file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MINOR_VERSION REGEX "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define NOTIFY_VERSION_MINOR +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MINOR_VERSION "${Libnotify_MINOR_VERSION}")
+ file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MICRO_VERSION REGEX "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define NOTIFY_VERSION_MICRO +\\(?([0-9]+)\\)?$" "\\1" Libnotify_MICRO_VERSION "${Libnotify_MICRO_VERSION}")
+ set(Libnotify_VERSION "${Libnotify_MAJOR_VERSION}.${Libnotify_MINOR_VERSION}.${Libnotify_MICRO_VERSION}")
+ unset(Libnotify_MAJOR_VERSION)
+ unset(Libnotify_MINOR_VERSION)
+ unset(Libnotify_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Libnotify
+ FOUND_VAR Libnotify_FOUND
+ REQUIRED_VARS Libnotify_LIBRARY
+ VERSION_VAR Libnotify_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindPango.cmake b/cmake/FindPango.cmake
new file mode 100644
index 00000000..b934c6ff
--- /dev/null
+++ b/cmake/FindPango.cmake
@@ -0,0 +1,32 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Pango
+ PKG_CONFIG_NAME pango
+ LIB_NAMES pango-1.0
+ INCLUDE_NAMES pango/pango.h
+ INCLUDE_DIR_SUFFIXES pango-1.0 pango-1.0/include
+ DEPENDS GObject
+)
+
+if(Pango_FOUND AND NOT Pango_VERSION)
+ find_path(Pango_INCLUDE_DIR "pango/pango.h" HINTS ${Pango_INCLUDE_DIRS})
+
+ if(Pango_INCLUDE_DIR)
+ file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MAJOR_VERSION REGEX "^#define PANGO_VERSION_MAJOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define PANGO_VERSION_MAJOR \\(?([0-9]+)\\)?$" "\\1" Pango_MAJOR_VERSION "${Pango_MAJOR_VERSION}")
+ file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MINOR_VERSION REGEX "^#define PANGO_VERSION_MINOR +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define PANGO_VERSION_MINOR \\(?([0-9]+)\\)?$" "\\1" Pango_MINOR_VERSION "${Pango_MINOR_VERSION}")
+ file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MICRO_VERSION REGEX "^#define PANGO_VERSION_MICRO +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define PANGO_VERSION_MICRO \\(?([0-9]+)\\)?$" "\\1" Pango_MICRO_VERSION "${Pango_MICRO_VERSION}")
+ set(Pango_VERSION "${Pango_MAJOR_VERSION}.${Pango_MINOR_VERSION}.${Pango_MICRO_VERSION}")
+ unset(Pango_MAJOR_VERSION)
+ unset(Pango_MINOR_VERSION)
+ unset(Pango_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Pango
+ FOUND_VAR Pango_FOUND
+ REQUIRED_VARS Pango_LIBRARY
+ VERSION_VAR Pango_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindSQLite3.cmake b/cmake/FindSQLite3.cmake
new file mode 100644
index 00000000..bf258997
--- /dev/null
+++ b/cmake/FindSQLite3.cmake
@@ -0,0 +1,22 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(SQLite3
+ PKG_CONFIG_NAME sqlite3
+ LIB_NAMES sqlite3
+ INCLUDE_NAMES sqlite3.h
+)
+
+if(SQLite3_FOUND AND NOT SQLite3_VERSION)
+ find_path(SQLite3_INCLUDE_DIR "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS})
+
+ if(SQLite3_INCLUDE_DIR)
+ file(STRINGS "${SQLite3_INCLUDE_DIR}/sqlite3.h" SQLite3_VERSION REGEX "^#define SQLITE_VERSION +\\\"[^\\\"]+\\\"")
+ string(REGEX REPLACE "^#define SQLITE_VERSION +\\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" SQLite3_VERSION "${SQLite3_VERSION}")
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(SQLite3
+ FOUND_VAR SQLite3_FOUND
+ REQUIRED_VARS SQLite3_LIBRARY
+ VERSION_VAR SQLite3_VERSION
+) \ No newline at end of file
diff --git a/cmake/FindVala.cmake b/cmake/FindVala.cmake
index 5150a7d9..371daaf5 100644
--- a/cmake/FindVala.cmake
+++ b/cmake/FindVala.cmake
@@ -46,6 +46,7 @@
# Search for the valac executable in the usual system paths
# Some distributions rename the valac to contain the major.minor in the binary name
+find_package(GObject REQUIRED)
find_program(VALA_EXECUTABLE NAMES valac valac-0.20 valac-0.18 valac-0.16 valac-0.14 valac-0.12 valac-0.10)
mark_as_advanced(VALA_EXECUTABLE)
diff --git a/cmake/MultiFind.cmake b/cmake/MultiFind.cmake
new file mode 100644
index 00000000..b40a4677
--- /dev/null
+++ b/cmake/MultiFind.cmake
@@ -0,0 +1,45 @@
+include(CMakeParseArguments)
+
+function(find_packages result)
+ cmake_parse_arguments(ARGS "" "" "REQUIRED;OPTIONAL" ${ARGN})
+ set(_res "")
+ set(_res_libs "")
+ foreach(pkg ${ARGS_REQUIRED})
+ string(REPLACE ">=" ";" pkg_ ${pkg})
+ list(GET pkg_ "0" pkg)
+ list(LENGTH pkg_ pkg_has_version)
+ if(pkg_has_version GREATER 1)
+ list(GET pkg_ "1" pkg_version)
+ else()
+ if(${pkg}_GLOBAL_VERSION)
+ set(pkg_version ${${pkg}_GLOBAL_VERSION})
+ else()
+ unset(pkg_version)
+ endif()
+ endif()
+ find_package(${pkg} ${pkg_version} REQUIRED)
+ list(APPEND _res ${${pkg}_PKG_CONFIG_NAME})
+ list(APPEND _res_libs ${${pkg}_LIBRARIES})
+ endforeach(pkg)
+ foreach(pkg ${ARGS_OPTIONAL})
+ string(REPLACE ">=" ";" pkg_ ${pkg})
+ list(GET pkg_ "0" pkg)
+ list(LENGTH pkg_ pkg_has_version)
+ if(pkg_has_version GREATER 1)
+ list(GET pkg_ "1" pkg_version)
+ else()
+ if(${pkg}_GLOBAL_VERSION)
+ set(pkg_version ${${pkg}_GLOBAL_VERSION})
+ else()
+ unset(pkg_version)
+ endif()
+ endif()
+ find_package(${pkg} ${pkg_version})
+ if(${pkg}_FOUND)
+ list(APPEND _res ${${pkg}_PKG_CONFIG_NAME})
+ list(APPEND _res_libs ${${pkg}_LIBRARIES})
+ endif()
+ endforeach(pkg)
+ set(${result} "${_res}" PARENT_SCOPE)
+ set(${result}_LIBS "${_res_libs}" PARENT_SCOPE)
+endfunction()
diff --git a/cmake/PkgConfigWithFallback.cmake b/cmake/PkgConfigWithFallback.cmake
new file mode 100644
index 00000000..988e4564
--- /dev/null
+++ b/cmake/PkgConfigWithFallback.cmake
@@ -0,0 +1,99 @@
+include(CMakeParseArguments)
+
+function(find_pkg_config_with_fallback name)
+ cmake_parse_arguments(ARGS "" "PKG_CONFIG_NAME" "LIB_NAMES;LIB_DIR_HINTS;INCLUDE_NAMES;INCLUDE_DIR_PATHS;INCLUDE_DIR_HINTS;INCLUDE_DIR_SUFFIXES;DEPENDS" ${ARGN})
+ set(${name}_PKG_CONFIG_NAME ${ARGS_PKG_CONFIG_NAME} PARENT_SCOPE)
+ find_package(PkgConfig)
+
+ if(PKG_CONFIG_FOUND)
+ pkg_search_module(${name}_PKG_CONFIG QUIET ${ARGS_PKG_CONFIG_NAME})
+ endif(PKG_CONFIG_FOUND)
+
+ if (${name}_PKG_CONFIG_FOUND)
+ # Found via pkg-config, using it's result values
+ set(${name}_FOUND ${${name}_PKG_CONFIG_FOUND})
+
+ # Try to find real file name of libraries
+ foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
+ find_library(LIB_NAME_${lib} ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
+ if(NOT LIB_NAME_${lib})
+ unset(${name}_FOUND)
+ endif(NOT LIB_NAME_${lib})
+ endforeach(lib)
+ if(${name}_FOUND)
+ set(${name}_LIBRARIES "")
+ foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
+ list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}})
+ endforeach(lib)
+ list(REMOVE_DUPLICATES ${name}_LIBRARIES)
+ set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)
+ list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY)
+
+ set(${name}_FOUND ${${name}_FOUND} PARENT_SCOPE)
+ set(${name}_INCLUDE_DIRS ${${name}_PKG_CONFIG_INCLUDE_DIRS} PARENT_SCOPE)
+ set(${name}_LIBRARIES ${${name}_PKG_CONFIG_LIBRARIES} PARENT_SCOPE)
+ set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE)
+ set(${name}_VERSION ${${name}_PKG_CONFIG_VERSION} PARENT_SCOPE)
+
+ if(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ add_library(${ARGS_PKG_CONFIG_NAME} INTERFACE IMPORTED)
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_COMPILE_OPTIONS "${${name}_PKG_CONFIG_CFLAGS_OTHER}")
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${name}_PKG_CONFIG_INCLUDE_DIRS}")
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_LINK_LIBRARIES "${${name}_LIBRARIES}")
+ endif(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ endif(${name}_FOUND)
+ else(${name}_PKG_CONFIG_FOUND)
+ # No success with pkg-config, try via find_library on all lib_names
+ set(${name}_FOUND "1")
+ foreach(lib ${ARGS_LIB_NAMES})
+ find_library(LIB_NAME_${lib} ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS})
+
+ if(NOT LIB_NAME_${lib})
+ unset(${name}_FOUND)
+ endif(NOT LIB_NAME_${lib})
+ endforeach(lib)
+
+ foreach(inc ${ARGS_INCLUDE_NAMES})
+ find_path(INCLUDE_PATH_${inc} ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES})
+
+ if(NOT INCLUDE_PATH_${inc})
+ unset(${name}_FOUND)
+ endif(NOT INCLUDE_PATH_${inc})
+ endforeach(inc)
+
+ if(${name}_FOUND)
+ set(${name}_LIBRARIES "")
+ set(${name}_INCLUDE_DIRS "")
+ foreach(lib ${ARGS_LIB_NAMES})
+ list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}})
+ endforeach(lib)
+ foreach(inc ${ARGS_INCLUDE_NAMES})
+ list(APPEND ${name}_INCLUDE_DIRS ${INCLUDE_PATH_${inc}})
+ endforeach(inc)
+ list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY)
+
+ foreach(dep ${ARGS_DEPENDS})
+ find_package(${dep} QUIET)
+
+ if(${dep}_FOUND)
+ list(APPEND ${name}_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})
+ list(APPEND ${name}_LIBRARIES ${${dep}_LIBRARIES})
+ else(${dep}_FOUND)
+ unset(${name}_FOUND)
+ endif(${dep}_FOUND)
+ endforeach(dep)
+
+ set(${name}_FOUND ${${name}_FOUND} PARENT_SCOPE)
+ set(${name}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS} PARENT_SCOPE)
+ set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)
+ set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE)
+ unset(${name}_VERSION PARENT_SCOPE)
+
+ if(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ add_library(${ARGS_PKG_CONFIG_NAME} INTERFACE IMPORTED)
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${${name}_INCLUDE_DIRS}")
+ set_property(TARGET ${ARGS_PKG_CONFIG_NAME} PROPERTY INTERFACE_LINK_LIBRARIES "${${name}_LIBRARIES}")
+ endif(NOT TARGET ${ARGS_PKG_CONFIG_NAME})
+ endif(${name}_FOUND)
+ endif(${name}_PKG_CONFIG_FOUND)
+endfunction() \ No newline at end of file
diff --git a/cmake/UseVala.cmake b/cmake/UseVala.cmake
index 94ea4534..820b6d82 100644
--- a/cmake/UseVala.cmake
+++ b/cmake/UseVala.cmake
@@ -116,9 +116,9 @@ endfunction()
function(vala_precompile output)
cmake_parse_arguments(ARGS "FAST_VAPI" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;EXPORTS_DIR"
- "SOURCES;PACKAGES;OPTIONS;DEFINITIONS;CUSTOM_VAPIS;GRESOURCES" ${ARGN})
+ "SOURCES;PACKAGES;OPTIONS;DEFINITIONS;CUSTOM_VAPIS;CUSTOM_DEPS;GRESOURCES" ${ARGN})
- if("Ninja" STREQUAL ${CMAKE_GENERATOR})
+ if("Ninja" STREQUAL ${CMAKE_GENERATOR} AND NOT DISABLE_FAST_VAPI)
set(ARGS_FAST_VAPI true)
endif()
@@ -165,6 +165,7 @@ function(vala_precompile output)
set(fast_vapi_files "")
set(out_files "")
set(out_extra_files "")
+ set(out_deps_files "")
set(vapi_arguments "")
if(ARGS_GENERATE_VAPI)
@@ -176,6 +177,11 @@ function(vala_precompile output)
if (NOT ARGS_GENERATE_HEADER)
set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
endif(NOT ARGS_GENERATE_HEADER)
+
+ if(ARGS_PACKAGES)
+ string(REPLACE ";" "\\n" pkgs "${ARGS_PACKAGES};${ARGS_CUSTOM_DEPS}")
+ add_custom_command(OUTPUT "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}.deps" COMMAND echo -e "\"${pkgs}\"" > "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}.deps" COMMENT "Generating ${ARGS_GENERATE_VAPI}.deps")
+ endif(ARGS_PACKAGES)
endif(ARGS_GENERATE_VAPI)
set(header_arguments "")
@@ -186,6 +192,8 @@ function(vala_precompile output)
list(APPEND header_arguments "--internal-header=${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_HEADER}_internal.h")
endif(ARGS_GENERATE_HEADER)
+ string(REPLACE " " ";" VALAC_FLAGS ${CMAKE_VALA_FLAGS})
+
if(ARGS_FAST_VAPI)
foreach(src ${ARGS_SOURCES} ${ARGS_UNPARSED_ARGUMENTS})
set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
@@ -205,6 +213,7 @@ function(vala_precompile output)
ARGS
--fast-vapi ${fast_vapi_file}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${in_file}
DEPENDS
${in_file}
@@ -242,6 +251,7 @@ function(vala_precompile output)
${vala_define_opts}
${gresources_args}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${fast_vapi_flags}
${in_file}
${custom_vapi_arguments}
@@ -269,6 +279,7 @@ function(vala_precompile output)
${vala_define_opts}
${gresources_args}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${in_files}
${custom_vapi_arguments}
DEPENDS
@@ -303,6 +314,7 @@ function(vala_precompile output)
${vala_define_opts}
${gresources_args}
${ARGS_OPTIONS}
+ ${VALAC_FLAGS}
${in_files}
${custom_vapi_arguments}
DEPENDS
@@ -314,4 +326,4 @@ function(vala_precompile output)
)
endif(ARGS_FAST_VAPI)
set(${output} ${out_files} PARENT_SCOPE)
-endfunction(vala_precompile)
+endfunction(vala_precompile) \ No newline at end of file
diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in
new file mode 100644
index 00000000..d0db323f
--- /dev/null
+++ b/cmake/cmake_uninstall.cmake.in
@@ -0,0 +1,21 @@
+if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+ message(FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+foreach(file ${files})
+ message(STATUS "Uninstalling: $ENV{DESTDIR}${file}")
+ if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ exec_program(
+ "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
+ OUTPUT_VARIABLE rm_out
+ RETURN_VALUE rm_retval
+ )
+ if(NOT "${rm_retval}" STREQUAL 0)
+ message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
+ endif(NOT "${rm_retval}" STREQUAL 0)
+ else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+ message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
+ endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
diff --git a/configure b/configure
index a0dd959e..425d9528 100755
--- a/configure
+++ b/configure
@@ -1,13 +1,56 @@
#!/bin/bash
-cont() {
- read c
- if [ "$c" != "yes" ] && [ "$c" != "Yes" ] && [ "$c" != "y" ] && [ "$c" != "Y" ]
- then
- exit 3
- fi
+OPTS=`getopt -o "h" --long prefix:,enable-plugin:,disable-plugin:,valac:,valac-flags:,lib-suffix:,help,disable-fast-vapi,no-debug -n './configure' -- "$@"`
+if [ $? != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi
+
+eval set -- "$OPTS"
+
+PREFIX=${PREFIX:-/usr/local}
+VALA_EXECUTABLE=${VALA_EXECUTABLE:-$(which valac)}
+ENABLED_PLUGINS=
+DISABLED_PLUGINS=
+VALAC_FLAGS=
+DISABLE_FAST_VAPI=
+LIB_SUFFIX=
+NO_DEBUG=
+
+help() {
+ cat << EOF
+Usage:
+ ./configure [OPTIONS]...
+
+Options:
+ -h, --help Print this help and exit
+ --prefix=PREFIX Prepend PREFIX to program installation paths. [$PREFIX]
+ --lib-suffix=SUFFIX Append SUFFIX to the directory name for libraries
+ --no-debug Build without debug symbols
+
+ --enable-plugin=PLUGIN Enable compilation of plugin PLUGIN.
+ --disable-plugin=PLUGIN Disable compilation of plugin PLUGIN.
+
+ --valac=VALAC Use VALAC as Vala pre-compiler. [$VALA_EXECUTABLE]
+ --valac-flags=FLAGS Use FLAGS when invoking the vala compiler
+ --disable-fast-vapi Disable the usage of Vala compilers fast-vapi feature.
+
+EOF
}
+while true; do
+ case "$1" in
+ --prefix ) PREFIX="$2"; shift; shift ;;
+ --enable-plugin ) if [ "$ENABLED_PLUGINS" == "" ]; then ENABLED_PLUGINS="$2"; else ENABLED_PLUGINS="ENABLED_PLUGINS;$2"; fi; shift; shift ;;
+ --disable-plugin ) if [ "$DISABLED_PLUGINS" == "" ]; then DISABLED_PLUGINS="$2"; else DISABLED_PLUGINS="DISABLED_PLUGINS;$2"; fi; shift; shift ;;
+ --valac ) VALA_EXECUTABLE="$2"; shift; shift ;;
+ --valac-flags ) VALAC_FLAGS="$2"; shift; shift ;;
+ --lib-suffix ) LIB_SUFFIX="$2"; shift; shift ;;
+ --disable-fast-vapi ) DISABLE_FAST_VAPI=yes; shift ;;
+ --no-debug ) NO_DEBUG=yes; shift ;;
+ -h | --help ) help; exit 0 ;;
+ -- ) shift; break ;;
+ * ) break ;;
+ esac
+done
+
if [ ! -x "$(which cmake 2>/dev/null)" ]
then
echo "-!- CMake required."
@@ -37,6 +80,7 @@ if ! [ -x "$exec_bin" ]; then
cmake_type="Unix Makefiles"
exec_bin="$make_bin"
exec_command="$exec_bin"
+ echo "-- Running with make. Using Ninja (ninja-build) might improve build experience."
fi
fi
@@ -45,6 +89,7 @@ if ! [ -x "$exec_bin" ]; then
exit 4
fi
+# TODO don't use git submodule
git submodule update --init --recursive
if [ -f ./build ]
@@ -55,11 +100,6 @@ fi
if [ -d build ]
then
- if [ ! -f "build/.cmake_type" ]
- then
- printf "-!- ./build exists but was not created by ./configure script, continue? [y/N] "
- cont
- fi
last_type=`cat build/.cmake_type`
if [ "$cmake_type" != "$last_type" ]
then
@@ -74,7 +114,7 @@ mkdir -p build
cd build
echo "$cmake_type" > .cmake_type
-cmake -G "$cmake_type" ..
+cmake -G "$cmake_type" -DCMAKE_INSTALL_PREFIX="$PREFIX" -DENABLED_PLUGINS="$ENABLED_PLUGINS" -DDISABLED_PLUGINS="$DISABLED_PLUGINS" -DVALA_EXECUTABLE="$VALA_EXECUTABLE" -DCMAKE_VALA_FLAGS="$VALAC_FLAGS" -DDISABLE_FAST_VAPI="$DISABLE_FAST_VAPI" -DLIB_SUFFIX="$LIB_SUFFIX" -DNO_DEBUG="$NO_DEBUG" ..
if [ "$cmake_type" == "Ninja" ]
then
@@ -95,6 +135,4 @@ default:
@sh -c "cd build; $exec_command \"\$@\""
EOF
-if [[ "$exec_bin" == "$make_bin" ]]; then
- echo "-- Running with make. Using Ninja (ninja-build) might improve build experience."
-fi \ No newline at end of file
+echo "-- Configured. Type 'make' to build, 'make install' to install." \ No newline at end of file
diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt
index a2b47381..16454115 100644
--- a/libdino/CMakeLists.txt
+++ b/libdino/CMakeLists.txt
@@ -1,17 +1,11 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(${VALA_USE_FILE})
-
-set(LIBDINO_PACKAGES
- gee-0.8
- glib-2.0
- gtk+-3.0
- gmodule-2.0
- sqlite3
+find_packages(LIBDINO_PACKAGES REQUIRED
+ Gee
+ GLib
+ GModule
+ GObject
+ GTK3
)
-pkg_check_modules(LIBDINO REQUIRED ${LIBDINO_PACKAGES})
-
vala_precompile(LIBDINO_VALA_C
SOURCES
src/application.vala
@@ -49,28 +43,27 @@ SOURCES
CUSTOM_VAPIS
"${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi"
"${CMAKE_BINARY_DIR}/exports/qlite.vapi"
+CUSTOM_DEPS
+ xmpp-vala
+ qlite
PACKAGES
${LIBDINO_PACKAGES}
GENERATE_VAPI
dino
GENERATE_HEADER
dino
-OPTIONS
- --target-glib=2.38
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${LIBDINO_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_library(libdino SHARED ${LIBDINO_VALA_C})
add_dependencies(libdino xmpp-vala-vapi qlite-vapi)
-target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_LIBRARIES} -lm)
+target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} -lm)
set_target_properties(libdino PROPERTIES PREFIX "")
add_custom_target(dino-vapi
DEPENDS
${CMAKE_BINARY_DIR}/exports/dino.vapi
+ ${CMAKE_BINARY_DIR}/exports/dino.deps
)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gschemas.compiled
@@ -83,4 +76,9 @@ DEPENDS
add_custom_target(dino-gsettings-schema-compiled
DEPENDS
${CMAKE_BINARY_DIR}/gschemas.compiled
-) \ No newline at end of file
+)
+
+install(TARGETS libdino ${TARGET_INSTALL})
+install(FILES ${CMAKE_BINARY_DIR}/exports/dino.vapi ${CMAKE_BINARY_DIR}/exports/dino.deps DESTINATION ${VAPI_INSTALL_DIR})
+install(FILES ${CMAKE_BINARY_DIR}/exports/dino.h DESTINATION ${INCLUDE_INSTALL_DIR})
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/dino.gschema.xml DESTINATION ${SHARE_INSTALL_PREFIX}/glib-2.0/schemas/) \ No newline at end of file
diff --git a/libdino/src/plugin/loader.vala b/libdino/src/plugin/loader.vala
index 42d7fa9b..8c633ef1 100644
--- a/libdino/src/plugin/loader.vala
+++ b/libdino/src/plugin/loader.vala
@@ -20,18 +20,30 @@ public class Loader : Object {
public Loader(string? exec_str = null) {
search_paths += Application.get_storage_dir();
- if (exec_str != null) {
- string exec_path = exec_str;
+ string? exec_path = exec_str;
+ if (exec_path != null) {
if (!exec_path.contains(Path.DIR_SEPARATOR_S)) {
exec_path = Environment.find_program_in_path(exec_str);
}
- if (exec_path[0:5] != "/usr") {
+ // TODO: more robust is detection if installed
+ if (!exec_path.has_prefix("/usr/")) {
search_paths += Path.get_dirname(exec_path);
}
}
foreach (string dir in Environment.get_system_data_dirs()) {
search_paths += Path.build_filename(dir, "dino");
}
+ if (exec_path != null) {
+ if (Path.get_basename(Path.get_dirname(exec_path)) == "bin") {
+ search_paths += Path.build_filename(Path.get_dirname(Path.get_dirname(exec_path)), "share", "dino");
+ }
+ }
+ }
+
+ public void print_search_paths() {
+ foreach (string prefix in search_paths) {
+ print(@"$prefix/plugins\n");
+ }
}
public RootInterface load(string name, Dino.Application app) throws Error {
diff --git a/libdino/src/settings.vala b/libdino/src/settings.vala
index 17177232..3700583b 100644
--- a/libdino/src/settings.vala
+++ b/libdino/src/settings.vala
@@ -20,7 +20,7 @@ public class Settings {
public static Settings instance() {
SettingsSchemaSource sss = SettingsSchemaSource.get_default();
- SettingsSchema schema = sss.lookup("org.dino-im", false);
+ SettingsSchema? schema = sss.lookup("org.dino-im", true);
return new Settings(new GLib.Settings.full(schema, null, null));
}
}
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 76f5e507..60d91c7b 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -1,19 +1,12 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(${VALA_USE_FILE})
-include(GlibCompileResourcesSupport)
-
-set(MAIN_PACKAGES
- gee-0.8
- glib-2.0
- gtk+-3.0
- gmodule-2.0
- libnotify
- sqlite3
+find_packages(MAIN_PACKAGES REQUIRED
+ Gee
+ GLib>=2.38
+ GModule
+ GObject
+ GTK3>=3.22
+ Libnotify
)
-pkg_check_modules(MAIN REQUIRED ${MAIN_PACKAGES})
-
set(RESOURCE_LIST
icons/dino-double-tick-symbolic.svg
icons/dino-status-away.svg
@@ -107,14 +100,29 @@ PACKAGES
${MAIN_PACKAGES}
GRESOURCES
${MAIN_GRESOURCES_XML}
-OPTIONS
- --target-glib=2.38
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET})
add_dependencies(dino dino-vapi dino-gsettings-schema-compiled)
-target_link_libraries(dino libdino ${MAIN_LIBRARIES}) \ No newline at end of file
+target_link_libraries(dino libdino ${MAIN_PACKAGES})
+
+if(WIN32)
+ target_link_libraries(dino -mwindows)
+endif(WIN32)
+
+install(TARGETS dino ${TARGET_INSTALL})
+install(FILES data/dino.desktop DESTINATION ${APPLICATION_INSTALL_DIR})
+install(FILES data/icons/dino.svg DESTINATION ${ICON_INSTALL_DIR}/hicolor/scalable/apps)
+install(FILES data/icons/dino-symbolic.svg DESTINATION ${ICON_INSTALL_DIR}/hicolor/symbolic/apps)
+install(FILES
+ data/icons/dino-status-away.svg
+ data/icons/dino-status-chat.svg
+ data/icons/dino-status-dnd.svg
+ data/icons/dino-status-online.svg
+
+ data/icons/dino-double-tick-symbolic.svg
+ data/icons/dino-tick-symbolic.svg
+DESTINATION
+ ${ICON_INSTALL_DIR}/hicolor/scalable/status
+)
diff --git a/main/data/dino.desktop b/main/data/dino.desktop
new file mode 100644
index 00000000..924cc587
--- /dev/null
+++ b/main/data/dino.desktop
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Version=1.0
+Name=Dino
+GenericName=Jabber/XMPP Client
+Keywords=chat;talk;im;message;xmpp;jabber;
+Exec=dino
+Icon=dino
+StartupNotify=false
+Terminal=false
+Type=Application
+Categories=GTK;Network;Chat;InstantMessaging;
+X-GNOME-UsesNotifications=true \ No newline at end of file
diff --git a/main/src/main.vala b/main/src/main.vala
index ba326ad8..96744e12 100644
--- a/main/src/main.vala
+++ b/main/src/main.vala
@@ -15,6 +15,17 @@ void main(string[] args) {
Plugins.Loader loader = new Plugins.Loader(exec_path);
Gtk.init(ref args);
Dino.Ui.Application app = new Dino.Ui.Application();
+
+ app.add_main_option("show-plugin-paths", 0, 0, OptionArg.NONE, "Display plugin search paths and exit", null);
+ app.handle_local_options.connect((options) => {
+ Variant v = options.lookup_value("show-plugin-paths", VariantType.BOOLEAN);
+ if (v != null && v.get_type() == VariantType.BOOLEAN && v.get_boolean()) {
+ loader.print_search_paths();
+ return 0;
+ }
+ return -1;
+ });
+
foreach (string plugin in new string[]{"omemo", "openpgp"}) {
try {
loader.load(plugin, app);
diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
index 9a3b9763..1eb3dbb1 100644
--- a/plugins/CMakeLists.txt
+++ b/plugins/CMakeLists.txt
@@ -1,9 +1,9 @@
-if(NOT WITHOUT_OPENPGP)
+if(PLUGIN_ENABLED_openpgp)
add_subdirectory(gpgme-vala)
add_subdirectory(openpgp)
-endif(NOT WITHOUT_OPENPGP)
+endif(PLUGIN_ENABLED_openpgp)
-if(NOT WITHOUT_OMEMO)
+if(PLUGIN_ENABLED_omemo)
add_subdirectory(omemo)
add_subdirectory(signal-protocol)
-endif(NOT WITHOUT_OMEMO)
+endif(PLUGIN_ENABLED_omemo)
diff --git a/plugins/gpgme-vala/CMakeLists.txt b/plugins/gpgme-vala/CMakeLists.txt
index b5b13c69..14cef3d2 100644
--- a/plugins/gpgme-vala/CMakeLists.txt
+++ b/plugins/gpgme-vala/CMakeLists.txt
@@ -1,15 +1,10 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
find_package(GPGME REQUIRED)
-include(${VALA_USE_FILE})
-
-set(GPGME_VALA_PACKAGES
- gee-0.8
- glib-2.0
+find_packages(GPGME_VALA_PACKAGES REQUIRED
+ Gee
+ GLib
+ GObject
)
-pkg_check_modules(GPGME_VALA REQUIRED ${GPGME_VALA_PACKAGES})
-
vala_precompile(GPGME_VALA_C
SOURCES
"src/gpgme_helper.vala"
@@ -23,15 +18,12 @@ GENERATE_VAPI
gpgme-vala
GENERATE_HEADER
gpgme-vala
-OPTIONS
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${GPGME_VALA_CFLAGS} ${GPGME_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src)
+set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src)
add_definitions(${CFLAGS})
add_library(gpgme-vala ${GPGME_VALA_C} src/gpgme_fix.c)
-target_link_libraries(gpgme-vala ${GPGME_VALA_LIBRARIES} ${GPGME_LIBRARIES})
+target_link_libraries(gpgme-vala ${GPGME_VALA_PACKAGES} gpgme)
set_property(TARGET gpgme-vala PROPERTY POSITION_INDEPENDENT_CODE ON)
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h"
diff --git a/plugins/omemo/CMakeLists.txt b/plugins/omemo/CMakeLists.txt
index 4a040f19..7f031714 100644
--- a/plugins/omemo/CMakeLists.txt
+++ b/plugins/omemo/CMakeLists.txt
@@ -1,17 +1,11 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(${VALA_USE_FILE})
-
-set(OMEMO_PACKAGES
- gee-0.8
- glib-2.0
- gtk+-3.0
- gmodule-2.0
- sqlite3
+find_packages(OMEMO_PACKAGES REQUIRED
+ Gee
+ GLib
+ GModule
+ GObject
+ GTK3
)
-pkg_check_modules(OMEMO REQUIRED ${OMEMO_PACKAGES})
-
vala_precompile(OMEMO_VALA_C
SOURCES
src/account_settings_entry.vala
@@ -35,16 +29,13 @@ CUSTOM_VAPIS
${CMAKE_BINARY_DIR}/exports/dino.vapi
PACKAGES
${OMEMO_PACKAGES}
-OPTIONS
- --target-glib=2.38
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${OMEMO_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_library(omemo SHARED ${OMEMO_VALA_C})
add_dependencies(omemo dino-vapi signal-protocol-vapi)
-target_link_libraries(omemo libdino signal-protocol-vala)
+target_link_libraries(omemo libdino signal-protocol-vala ${OMEMO_PACKAGES})
set_target_properties(omemo PROPERTIES PREFIX "")
set_target_properties(omemo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)
+
+install(TARGETS omemo ${PLUGIN_INSTALL}) \ No newline at end of file
diff --git a/plugins/openpgp/CMakeLists.txt b/plugins/openpgp/CMakeLists.txt
index 09a4ca7f..9a1a9d46 100644
--- a/plugins/openpgp/CMakeLists.txt
+++ b/plugins/openpgp/CMakeLists.txt
@@ -1,18 +1,11 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(${VALA_USE_FILE})
-include(GlibCompileResourcesSupport)
-
-set(OPENPGP_PACKAGES
- gee-0.8
- glib-2.0
- gtk+-3.0
- gmodule-2.0
- sqlite3
+find_packages(OPENPGP_PACKAGES REQUIRED
+ Gee
+ GLib>=2.38
+ GModule
+ GObject
+ GTK3
)
-pkg_check_modules(OPENPGP REQUIRED ${OPENPGP_PACKAGES})
-
set(RESOURCE_LIST
account_settings_item.ui
)
@@ -47,16 +40,13 @@ PACKAGES
${OPENPGP_PACKAGES}
GRESOURCES
${OPENPGP_GRESOURCES_XML}
-OPTIONS
- --target-glib=2.38
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${OPENPGP_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_library(openpgp SHARED ${OPENPGP_VALA_C} ${OPENPGP_GRESOURCES_TARGET})
add_dependencies(openpgp dino-vapi gpgme-vapi)
-target_link_libraries(openpgp libdino gpgme-vala)
+target_link_libraries(openpgp libdino gpgme-vala ${OPENPGP_PACKAGES})
set_target_properties(openpgp PROPERTIES PREFIX "")
set_target_properties(openpgp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)
+
+install(TARGETS openpgp ${PLUGIN_INSTALL}) \ No newline at end of file
diff --git a/plugins/signal-protocol/CMakeLists.txt b/plugins/signal-protocol/CMakeLists.txt
index de95adc6..6a283b9b 100644
--- a/plugins/signal-protocol/CMakeLists.txt
+++ b/plugins/signal-protocol/CMakeLists.txt
@@ -1,21 +1,15 @@
-add_subdirectory(libsignal-protocol-c)
+add_subdirectory(libsignal-protocol-c EXCLUDE_FROM_ALL)
set_property(TARGET curve25519 PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET protobuf-c PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET signal-protocol-c PROPERTY POSITION_INDEPENDENT_CODE ON)
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
find_package(OpenSSL REQUIRED)
-include(${VALA_USE_FILE})
-
-set(SIGNAL_PROTOCOL_PACKAGES
- glib-2.0
- gee-0.8
- gobject-2.0
+find_packages(SIGNAL_PROTOCOL_PACKAGES REQUIRED
+ Gee
+ GLib
+ GObject
)
-pkg_check_modules(SIGNAL_PROTOCOL REQUIRED ${SIGNAL_PROTOCOL_PACKAGES})
-
vala_precompile(SIGNAL_PROTOCOL_VALA_C
SOURCES
"src/context.vala"
@@ -34,16 +28,13 @@ GENERATE_VAPI
signal-protocol-vala
GENERATE_HEADER
signal-protocol-vala
-OPTIONS
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${SIGNAL_PROTOCOL_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src -I${CMAKE_CURRENT_SOURCE_DIR}/src)
+set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src -I${CMAKE_CURRENT_SOURCE_DIR}/src)
add_definitions(${CFLAGS})
add_library(signal-protocol-vala ${SIGNAL_PROTOCOL_VALA_C} ${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.c)
add_dependencies(signal-protocol-vala signal-protocol-c)
-target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARY} signal-protocol-c -lm)
+target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} ${OPENSSL_CRYPTO_LIBRARY} signal-protocol-c -lm)
set_property(TARGET signal-protocol-vala PROPERTY POSITION_INDEPENDENT_CODE ON)
set(SIGNAL_PROTOCOL_C_HEADERS
@@ -126,13 +117,10 @@ if(BUILD_TESTING)
${CMAKE_CURRENT_SOURCE_DIR}/vapi/signal-protocol-native.vapi
PACKAGES
${SIGNAL_PROTOCOL_PACKAGES}
- OPTIONS
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
- set(CFLAGS ${VALA_CFLAGS} ${SIGNAL_PROTOCOL_CFLAGS} -I${CMAKE_CURRENT_BINARY_DIR}/signal-protocol)
+ set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_BINARY_DIR}/signal-protocol)
add_executable(signal-protocol-vala-test ${SIGNAL_TEST_VALA_C})
add_dependencies(signal-protocol-vala-test signal-protocol-vala signal-protocol-vapi)
- target_link_libraries(signal-protocol-vala-test signal-protocol-vala)
+ target_link_libraries(signal-protocol-vala-test signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES})
endif(BUILD_TESTING) \ No newline at end of file
diff --git a/qlite/CMakeLists.txt b/qlite/CMakeLists.txt
index 2aeabb79..ccc86898 100644
--- a/qlite/CMakeLists.txt
+++ b/qlite/CMakeLists.txt
@@ -1,15 +1,10 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(${VALA_USE_FILE})
-
-set(QLITE_PACKAGES
- gee-0.8
- glib-2.0
- sqlite3
+find_packages(QLITE_PACKAGES REQUIRED
+ Gee
+ GLib
+ GObject
+ SQLite3
)
-pkg_check_modules(QLITE REQUIRED ${QLITE_PACKAGES})
-
vala_precompile(QLITE_VALA_C
SOURCES
"src/database.vala"
@@ -28,18 +23,18 @@ GENERATE_VAPI
qlite
GENERATE_HEADER
qlite
-OPTIONS
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${QLITE_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_library(qlite SHARED ${QLITE_VALA_C})
-target_link_libraries(qlite ${QLITE_LIBRARIES})
+target_link_libraries(qlite ${QLITE_PACKAGES})
add_custom_target(qlite-vapi
DEPENDS
${CMAKE_BINARY_DIR}/exports/qlite.vapi
+ ${CMAKE_BINARY_DIR}/exports/qlite.deps
)
+install(TARGETS qlite ${TARGET_INSTALL})
+install(FILES ${CMAKE_BINARY_DIR}/exports/qlite.vapi ${CMAKE_BINARY_DIR}/exports/qlite.deps DESTINATION ${VAPI_INSTALL_DIR})
+install(FILES ${CMAKE_BINARY_DIR}/exports/qlite.h DESTINATION ${INCLUDE_INSTALL_DIR})
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt
index 426f7922..32162f0c 100644
--- a/xmpp-vala/CMakeLists.txt
+++ b/xmpp-vala/CMakeLists.txt
@@ -1,17 +1,11 @@
-find_package(Vala REQUIRED)
-find_package(PkgConfig REQUIRED)
-include(GlibCompileResourcesSupport)
-include(${VALA_USE_FILE})
-
-set(ENGINE_PACKAGES
- gee-0.8
- gio-2.0
- glib-2.0
- gdk-3.0
+find_packages(ENGINE_PACKAGES REQUIRED
+ GDKPixbuf2
+ Gee
+ GIO
+ GLib
+ GObject
)
-pkg_check_modules(ENGINE REQUIRED ${ENGINE_PACKAGES})
-
vala_precompile(ENGINE_VALA_C
SOURCES
"src/core/namespace_state.vala"
@@ -66,19 +60,18 @@ GENERATE_VAPI
xmpp-vala
GENERATE_HEADER
xmpp-vala
-OPTIONS
- --target-glib=2.38
- ${GLOBAL_DEBUG_FLAGS}
- --thread
)
-set(CFLAGS ${VALA_CFLAGS} ${ENGINE_CFLAGS})
-add_definitions(${CFLAGS})
+add_definitions(${VALA_CFLAGS})
add_library(xmpp-vala SHARED ${ENGINE_VALA_C})
-target_link_libraries(xmpp-vala ${ENGINE_LIBRARIES})
+target_link_libraries(xmpp-vala ${ENGINE_PACKAGES})
add_custom_target(xmpp-vala-vapi
DEPENDS
${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
+ ${CMAKE_BINARY_DIR}/exports/xmpp-vala.deps
)
+install(TARGETS xmpp-vala ${TARGET_INSTALL})
+install(FILES ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi ${CMAKE_BINARY_DIR}/exports/xmpp-vala.deps DESTINATION ${VAPI_INSTALL_DIR})
+install(FILES ${CMAKE_BINARY_DIR}/exports/xmpp-vala.h DESTINATION ${INCLUDE_INSTALL_DIR}) \ No newline at end of file