cmake/signal-protocol: shared lib, mark_as_advanced and others

This commit is contained in:
Marvin W 2017-04-23 10:01:40 +02:00
parent 3eb9aa0fa7
commit eddf17c682
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
32 changed files with 252 additions and 239 deletions

View file

@ -96,6 +96,9 @@ 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})
set(GTK3_GLOBAL_VERSION 3.22)
set(GLib_GLOBAL_VERSION 2.38)
if(NOT VALA_EXECUTABLE) if(NOT VALA_EXECUTABLE)
unset(VALA_EXECUTABLE CACHE) unset(VALA_EXECUTABLE CACHE)
endif() endif()
@ -110,9 +113,6 @@ include(${VALA_USE_FILE})
include(MultiFind) include(MultiFind)
include(GlibCompileResourcesSupport) 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}") set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --thread --target-glib=${GLib_GLOBAL_VERSION}")
add_subdirectory(qlite) add_subdirectory(qlite)

View file

@ -8,14 +8,15 @@ find_pkg_config_with_fallback(ATK
) )
if(ATK_FOUND AND NOT ATK_VERSION) if(ATK_FOUND AND NOT ATK_VERSION)
find_path(ATK_INCLUDE_DIR "atk/atk.h" HINTS ${ATK_INCLUDE_DIRS}) find_file(ATK_VERSION_HEADER "atk/atkversion.h" HINTS ${ATK_INCLUDE_DIRS})
mark_as_advanced(ATK_VERSION_HEADER)
if(ATK_INCLUDE_DIR) if(ATK_VERSION_HEADER)
file(STRINGS "${ATK_INCLUDE_DIR}/atk/atkversion.h" ATK_MAJOR_VERSION REGEX "^#define ATK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") file(STRINGS "${ATK_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${ATK_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${ATK_VERSION_HEADER}" 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}") 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}") set(ATK_VERSION "${ATK_MAJOR_VERSION}.${ATK_MINOR_VERSION}.${ATK_MICRO_VERSION}")
unset(ATK_MAJOR_VERSION) unset(ATK_MAJOR_VERSION)
@ -26,7 +27,5 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ATK find_package_handle_standard_args(ATK
FOUND_VAR ATK_FOUND
REQUIRED_VARS ATK_LIBRARY REQUIRED_VARS ATK_LIBRARY
VERSION_VAR ATK_VERSION VERSION_VAR ATK_VERSION)
)

View file

@ -7,14 +7,15 @@ find_pkg_config_with_fallback(Cairo
) )
if(Cairo_FOUND AND NOT Cairo_VERSION) if(Cairo_FOUND AND NOT Cairo_VERSION)
find_path(Cairo_INCLUDE_DIR "cairo.h" HINTS ${Cairo_INCLUDE_DIRS}) find_file(Cairo_VERSION_HEADER "cairo-version.h" HINTS ${Cairo_INCLUDE_DIRS})
mark_as_advanced(Cairo_VERSION_HEADER)
if(Cairo_INCLUDE_DIR) if(Cairo_VERSION_HEADER)
file(STRINGS "${Cairo_INCLUDE_DIR}/cairo-version.h" Cairo_MAJOR_VERSION REGEX "^#define CAIRO_VERSION_MAJOR +\\(?([0-9]+)\\)?$") file(STRINGS "${Cairo_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${Cairo_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${Cairo_VERSION_HEADER}" 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}") 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}") set(Cairo_VERSION "${Cairo_MAJOR_VERSION}.${Cairo_MINOR_VERSION}.${Cairo_MICRO_VERSION}")
unset(Cairo_MAJOR_VERSION) unset(Cairo_MAJOR_VERSION)
@ -25,7 +26,5 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Cairo find_package_handle_standard_args(Cairo
FOUND_VAR Cairo_FOUND
REQUIRED_VARS Cairo_LIBRARY REQUIRED_VARS Cairo_LIBRARY
VERSION_VAR Cairo_VERSION VERSION_VAR Cairo_VERSION)
)

View file

@ -39,10 +39,12 @@ if(GCrypt_CONFIG_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
gcrypt_config_fail(${ERRCODE}) gcrypt_config_fail(${ERRCODE})
string(REGEX REPLACE "^(.* |)-l([^ ]*gcrypt[^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY "${GCrypt_LDFLAGS}") string(REGEX REPLACE "^(.* |)-l([^ ]*gcrypt[^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_NAME "${GCrypt_LDFLAGS}")
string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_DIRS "${GCrypt_LDFLAGS}") string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GCrypt_LIBRARY_DIRS "${GCrypt_LDFLAGS}")
find_library(LIB_NAME_GCrypt ${GCrypt_LIBRARY} HINTS ${GCrypt_LIBRARY_DIRS}) find_library(GCrypt_LIBRARY ${GCrypt_LIBRARY_NAME} HINTS ${GCrypt_LIBRARY_DIRS})
set(GCrypt_LIBRARY ${LIB_NAME_GCrypt}) mark_as_advanced(GCrypt_LIBRARY)
unset(GCrypt_LIBRARY_NAME)
unset(GCrypt_LIBRARY_DIRS)
if(NOT TARGET gcrypt) if(NOT TARGET gcrypt)
add_library(gcrypt INTERFACE IMPORTED) add_library(gcrypt INTERFACE IMPORTED)

View file

@ -8,14 +8,15 @@ find_pkg_config_with_fallback(GDK3
) )
if(GDK3_FOUND AND NOT GDK3_VERSION) if(GDK3_FOUND AND NOT GDK3_VERSION)
find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS}) find_file(GDK3_VERSION_HEADER "gdk/gdkversionmacros.h" HINTS ${GDK3_INCLUDE_DIRS})
mark_as_advanced(GDK3_VERSION_HEADER)
if(GDK3_INCLUDE_DIR) if(GDK3_VERSION_HEADER)
file(STRINGS "${GDK3_INCLUDE_DIR}/gdk/gdkversionmacros.h" GDK3_MAJOR_VERSION REGEX "^#define GDK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") file(STRINGS "${GDK3_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${GDK3_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${GDK3_VERSION_HEADER}" 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}") 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}") set(GDK3_VERSION "${GDK3_MAJOR_VERSION}.${GDK3_MINOR_VERSION}.${GDK3_MICRO_VERSION}")
unset(GDK3_MAJOR_VERSION) unset(GDK3_MAJOR_VERSION)
@ -25,19 +26,10 @@ if(GDK3_FOUND AND NOT GDK3_VERSION)
endif() endif()
if(GDK3_FOUND) if(GDK3_FOUND)
find_path(GDK3_INCLUDE_DIR "gdk/gdk.h" HINTS ${GDK3_INCLUDE_DIRS}) find_file(GDK3_WITH_X11 "gdk/gdkx.h" HINTS ${GDK3_INCLUDE_DIRS})
unset(GDK3_WITH_X11)
if(GDK3_INCLUDE_DIR)
if(EXISTS "${GDK3_INCLUDE_DIR}/gdk/gdkx.h")
set(GDK3_WITH_X11 yes)
endif()
endif()
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDK3 find_package_handle_standard_args(GDK3
FOUND_VAR GDK3_FOUND
REQUIRED_VARS GDK3_LIBRARY REQUIRED_VARS GDK3_LIBRARY
VERSION_VAR GDK3_VERSION VERSION_VAR GDK3_VERSION)
)

View file

@ -8,17 +8,16 @@ find_pkg_config_with_fallback(GDKPixbuf2
) )
if(GDKPixbuf2_FOUND AND NOT GDKPixbuf2_VERSION) if(GDKPixbuf2_FOUND AND NOT GDKPixbuf2_VERSION)
find_path(GDKPixbuf2_INCLUDE_DIR "gdk-pixbuf/gdk-pixbuf.h" HINTS ${GDKPixbuf2_INCLUDE_DIRS}) find_file(GDKPixbuf2_FEATURES_HEADER "gdk-pixbuf/gdk-pixbuf-features.h" HINTS ${GDKPixbuf2_INCLUDE_DIRS})
mark_as_advanced(GDKPixbuf2_FEATURES_HEADER)
if(GDKPixbuf2_INCLUDE_DIR) if(GDKPixbuf2_FEATURES_HEADER)
file(STRINGS "${GDKPixbuf2_INCLUDE_DIR}/gdk-pixbuf/gdk-pixbuf-features.h" GDKPixbuf2_VERSION REGEX "^#define GDK_PIXBUF_VERSION \\\"[^\\\"]+\\\"") file(STRINGS "${GDKPixbuf2_FEATURES_HEADER}" 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}") string(REGEX REPLACE "^#define GDK_PIXBUF_VERSION \\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" GDKPixbuf2_VERSION "${GDKPixbuf2_VERSION}")
endif() endif()
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDKPixbuf2 find_package_handle_standard_args(GDKPixbuf2
FOUND_VAR GDKPixbuf2_FOUND
REQUIRED_VARS GDKPixbuf2_LIBRARY REQUIRED_VARS GDKPixbuf2_LIBRARY
VERSION_VAR GDKPixbuf2_VERSION VERSION_VAR GDKPixbuf2_VERSION)
)

View file

@ -8,13 +8,12 @@ find_pkg_config_with_fallback(GIO
) )
if(GIO_FOUND AND NOT GIO_VERSION) if(GIO_FOUND AND NOT GIO_VERSION)
find_package(GLib) # TODO
find_package(GLib ${GLib_GLOBAL_VERSION})
set(GIO_VERSION ${GLib_VERSION}) set(GIO_VERSION ${GLib_VERSION})
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GIO find_package_handle_standard_args(GIO
FOUND_VAR GIO_FOUND
REQUIRED_VARS GIO_LIBRARY REQUIRED_VARS GIO_LIBRARY
VERSION_VAR GIO_VERSION VERSION_VAR GIO_VERSION)
)

View file

@ -9,14 +9,15 @@ find_pkg_config_with_fallback(GLib
) )
if(GLib_FOUND AND NOT GLib_VERSION) if(GLib_FOUND AND NOT GLib_VERSION)
find_path(GLib_CONFIG_INCLUDE_DIR "glibconfig.h" HINTS ${GLib_INCLUDE_DIRS}) find_file(GLib_CONFIG_HEADER "glibconfig.h" HINTS ${GLib_INCLUDE_DIRS})
mark_as_advanced(GLib_CONFIG_HEADER)
if(GLib_CONFIG_INCLUDE_DIR) if(GLib_CONFIG_HEADER)
file(STRINGS "${GLib_CONFIG_INCLUDE_DIR}/glibconfig.h" GLib_MAJOR_VERSION REGEX "^#define GLIB_MAJOR_VERSION +([0-9]+)") file(STRINGS "${GLib_CONFIG_HEADER}" 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}") 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]+)") file(STRINGS "${GLib_CONFIG_HEADER}" 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}") 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]+)") file(STRINGS "${GLib_CONFIG_HEADER}" 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}") 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}") set(GLib_VERSION "${GLib_MAJOR_VERSION}.${GLib_MINOR_VERSION}.${GLib_MICRO_VERSION}")
unset(GLib_MAJOR_VERSION) unset(GLib_MAJOR_VERSION)
@ -27,7 +28,5 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLib find_package_handle_standard_args(GLib
FOUND_VAR GLib_FOUND
REQUIRED_VARS GLib_LIBRARY REQUIRED_VARS GLib_LIBRARY
VERSION_VAR GLib_VERSION VERSION_VAR GLib_VERSION)
)

View file

@ -8,13 +8,12 @@ find_pkg_config_with_fallback(GModule
) )
if(GModule_FOUND AND NOT GModule_VERSION) if(GModule_FOUND AND NOT GModule_VERSION)
find_package(GLib) # TODO
find_package(GLib ${GLib_GLOBAL_VERSION})
set(GModule_VERSION ${GLib_VERSION}) set(GModule_VERSION ${GLib_VERSION})
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GModule find_package_handle_standard_args(GModule
FOUND_VAR GModule_FOUND
REQUIRED_VARS GModule_LIBRARY REQUIRED_VARS GModule_LIBRARY
VERSION_VAR GModule_VERSION VERSION_VAR GModule_VERSION)
)

View file

@ -8,13 +8,12 @@ find_pkg_config_with_fallback(GObject
) )
if(GObject_FOUND AND NOT GObject_VERSION) if(GObject_FOUND AND NOT GObject_VERSION)
find_package(GLib) # TODO
find_package(GLib ${GLib_GLOBAL_VERSION})
set(GObject_VERSION ${GLib_VERSION}) set(GObject_VERSION ${GLib_VERSION})
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GObject find_package_handle_standard_args(GObject
FOUND_VAR GObject_FOUND
REQUIRED_VARS GObject_LIBRARY REQUIRED_VARS GObject_LIBRARY
VERSION_VAR GObject_VERSION VERSION_VAR GObject_VERSION)
)

View file

@ -39,10 +39,12 @@ if(GPGME_CONFIG_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
gpgme_config_fail(${ERRCODE}) gpgme_config_fail(${ERRCODE})
string(REGEX REPLACE "^(.* |)-l([^ ]*gpgme[^ ]*)( .*|)$" "\\2" GPGME_LIBRARY "${GPGME_LDFLAGS}") string(REGEX REPLACE "^(.* |)-l([^ ]*gpgme[^ ]*)( .*|)$" "\\2" GPGME_LIBRARY_NAME "${GPGME_LDFLAGS}")
string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GPGME_LIBRARY_DIRS "${GPGME_LDFLAGS}") string(REGEX REPLACE "^(.* |)-L([^ ]*)( .*|)$" "\\2" GPGME_LIBRARY_DIRS "${GPGME_LDFLAGS}")
find_library(LIB_NAME_GPGME ${GPGME_LIBRARY} HINTS ${GPGME_LIBRARY_DIRS}) find_library(GPGME_LIBRARY ${GPGME_LIBRARY_NAME} HINTS ${GPGME_LIBRARY_DIRS})
set(GPGME_LIBRARY ${LIB_NAME_GPGME}) mark_as_advanced(GPGME_LIBRARY)
unset(GPGME_LIBRARY_NAME)
unset(GPGME_LIBRARY_DIRS)
if(NOT TARGET gpgme) if(NOT TARGET gpgme)
add_library(gpgme INTERFACE IMPORTED) add_library(gpgme INTERFACE IMPORTED)

View file

@ -8,14 +8,15 @@ find_pkg_config_with_fallback(GTK3
) )
if(GTK3_FOUND AND NOT GTK3_VERSION) if(GTK3_FOUND AND NOT GTK3_VERSION)
find_path(GTK3_INCLUDE_DIR "gtk/gtk.h" HINTS ${GTK3_INCLUDE_DIRS}) find_file(GTK3_VERSION_HEADER "gtk/gtkversion.h" HINTS ${GTK3_INCLUDE_DIRS})
mark_as_advanced(GTK3_VERSION_HEADER)
if(GTK3_INCLUDE_DIR) if(GTK3_VERSION_HEADER)
file(STRINGS "${GTK3_INCLUDE_DIR}/gtk/gtkversion.h" GTK3_MAJOR_VERSION REGEX "^#define GTK_MAJOR_VERSION +\\(?([0-9]+)\\)?$") file(STRINGS "${GTK3_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${GTK3_VERSION_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${GTK3_VERSION_HEADER}" 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}") 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}") set(GTK3_VERSION "${GTK3_MAJOR_VERSION}.${GTK3_MINOR_VERSION}.${GTK3_MICRO_VERSION}")
unset(GTK3_MAJOR_VERSION) unset(GTK3_MAJOR_VERSION)
@ -26,7 +27,5 @@ endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTK3 find_package_handle_standard_args(GTK3
FOUND_VAR GTK3_FOUND
REQUIRED_VARS GTK3_LIBRARY REQUIRED_VARS GTK3_LIBRARY
VERSION_VAR GTK3_VERSION VERSION_VAR GTK3_VERSION)
)

View file

@ -9,7 +9,5 @@ find_pkg_config_with_fallback(Gee
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gee find_package_handle_standard_args(Gee
FOUND_VAR Gee_FOUND
REQUIRED_VARS Gee_LIBRARY REQUIRED_VARS Gee_LIBRARY
VERSION_VAR Gee_VERSION VERSION_VAR Gee_VERSION)
)

View file

@ -2,17 +2,19 @@ find_program(XGETTEXT_EXECUTABLE xgettext)
find_program(MSGMERGE_EXECUTABLE msgmerge) find_program(MSGMERGE_EXECUTABLE msgmerge)
find_program(MSGFMT_EXECUTABLE msgfmt) find_program(MSGFMT_EXECUTABLE msgfmt)
find_program(MSGCAT_EXECUTABLE msgcat) find_program(MSGCAT_EXECUTABLE msgcat)
mark_as_advanced(XGETTEXT_EXECUTABLE MSGMERGE_EXECUTABLE MSGFMT_EXECUTABLE MSGCAT_EXECUTABLE)
if(XGETTEXT_EXECUTABLE) if(XGETTEXT_EXECUTABLE)
execute_process(COMMAND ${XGETTEXT_EXECUTABLE} "--version" execute_process(COMMAND ${XGETTEXT_EXECUTABLE} "--version"
OUTPUT_VARIABLE GETTEXT_VERSION OUTPUT_VARIABLE Gettext_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "xgettext \\(GNU gettext-tools\\) ([0-9\\.]*).*" "\\1" GETTEXT_VERSION "${GETTEXT_VERSION}") string(REGEX REPLACE "xgettext \\(GNU gettext-tools\\) ([0-9\\.]*).*" "\\1" Gettext_VERSION "${Gettext_VERSION}")
endif(XGETTEXT_EXECUTABLE) endif(XGETTEXT_EXECUTABLE)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Gettext find_package_handle_standard_args(Gettext
FOUND_VAR Gettext_FOUND
REQUIRED_VARS XGETTEXT_EXECUTABLE MSGMERGE_EXECUTABLE MSGFMT_EXECUTABLE MSGCAT_EXECUTABLE REQUIRED_VARS XGETTEXT_EXECUTABLE MSGMERGE_EXECUTABLE MSGFMT_EXECUTABLE MSGCAT_EXECUTABLE
VERSION_VAR GETTEXT_VERSION) VERSION_VAR Gettext_VERSION)
set(GETTEXT_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseGettext.cmake") set(GETTEXT_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseGettext.cmake")

View file

@ -7,14 +7,15 @@ find_pkg_config_with_fallback(Libnotify
) )
if(Libnotify_FOUND AND NOT Libnotify_VERSION) if(Libnotify_FOUND AND NOT Libnotify_VERSION)
find_path(Libnotify_INCLUDE_DIR "libnotify/notify-features.h" HINTS ${Libnotify_INCLUDE_DIRS}) find_file(Libnotify_FEATURES_HEADER "libnotify/notify-features.h" HINTS ${Libnotify_INCLUDE_DIRS})
mark_as_advanced(Libnotify_FEATURES_HEADER)
if(Libnotify_INCLUDE_DIR) if(Libnotify_FEATURES_HEADER)
file(STRINGS "${Libnotify_INCLUDE_DIR}/libnotify/notify-features.h" Libnotify_MAJOR_VERSION REGEX "^#define NOTIFY_VERSION_MAJOR +\\(?([0-9]+)\\)?$") file(STRINGS "${Libnotify_FEATURES_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${Libnotify_FEATURES_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${Libnotify_FEATURES_HEADER}" 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}") 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}") set(Libnotify_VERSION "${Libnotify_MAJOR_VERSION}.${Libnotify_MINOR_VERSION}.${Libnotify_MICRO_VERSION}")
unset(Libnotify_MAJOR_VERSION) unset(Libnotify_MAJOR_VERSION)

View file

@ -8,14 +8,15 @@ find_pkg_config_with_fallback(Pango
) )
if(Pango_FOUND AND NOT Pango_VERSION) if(Pango_FOUND AND NOT Pango_VERSION)
find_path(Pango_INCLUDE_DIR "pango/pango.h" HINTS ${Pango_INCLUDE_DIRS}) find_file(Pango_FEATURES_HEADER "pango/pango-features.h" HINTS ${Pango_INCLUDE_DIRS})
mark_as_advanced(Pango_FEATURES_HEADER)
if(Pango_INCLUDE_DIR) if(Pango_FEATURES_HEADER)
file(STRINGS "${Pango_INCLUDE_DIR}/pango/pango-features.h" Pango_MAJOR_VERSION REGEX "^#define PANGO_VERSION_MAJOR +\\(?([0-9]+)\\)?$") file(STRINGS "${Pango_FEATURES_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${Pango_FEATURES_HEADER}" 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}") 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]+)\\)?$") file(STRINGS "${Pango_FEATURES_HEADER}" 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}") 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}") set(Pango_VERSION "${Pango_MAJOR_VERSION}.${Pango_MINOR_VERSION}.${Pango_MICRO_VERSION}")
unset(Pango_MAJOR_VERSION) unset(Pango_MAJOR_VERSION)

View file

@ -6,17 +6,16 @@ find_pkg_config_with_fallback(SQLite3
) )
if(SQLite3_FOUND AND NOT SQLite3_VERSION) if(SQLite3_FOUND AND NOT SQLite3_VERSION)
find_path(SQLite3_INCLUDE_DIR "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS}) find_file(SQLite3_HEADER "sqlite3.h" HINTS ${SQLite3_INCLUDE_DIRS})
mark_as_advanced(SQLite3_HEADER)
if(SQLite3_INCLUDE_DIR) if(SQLite3_HEADER)
file(STRINGS "${SQLite3_INCLUDE_DIR}/sqlite3.h" SQLite3_VERSION REGEX "^#define SQLITE_VERSION +\\\"[^\\\"]+\\\"") file(STRINGS "${SQLite3_HEADER}" 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}") string(REGEX REPLACE "^#define SQLITE_VERSION +\\\"([0-9]+)\\.([0-9]+)\\.([0-9]+)\\\"$" "\\1.\\2.\\3" SQLite3_VERSION "${SQLite3_VERSION}")
endif() endif()
endif() endif()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SQLite3 find_package_handle_standard_args(SQLite3
FOUND_VAR SQLite3_FOUND
REQUIRED_VARS SQLite3_LIBRARY REQUIRED_VARS SQLite3_LIBRARY
VERSION_VAR SQLite3_VERSION VERSION_VAR SQLite3_VERSION)
)

View file

@ -0,0 +1,10 @@
include(PkgConfigWithFallback)
find_pkg_config_with_fallback(SignalProtocol
PKG_CONFIG_NAME signal-protocol-c
LIB_NAMES signal-protocol-c
INCLUDE_NAMES signal/signal_protocol.h
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(SignalProtocol
REQUIRED_VARS SignalProtocol_LIBRARY)

View file

@ -65,6 +65,7 @@ endif(VALA_EXECUTABLE)
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vala find_package_handle_standard_args(Vala
FOUND_VAR VALA_FOUND
REQUIRED_VARS VALA_EXECUTABLE REQUIRED_VARS VALA_EXECUTABLE
VERSION_VAR VALA_VERSION) VERSION_VAR VALA_VERSION)

View file

@ -15,15 +15,16 @@ function(find_pkg_config_with_fallback name)
# Try to find real file name of libraries # Try to find real file name of libraries
foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
find_library(LIB_NAME_${lib} ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS}) find_library(${name}_${lib}_LIBRARY ${lib} HINTS ${${name}_PKG_CONFIG_LIBRARY_DIRS})
if(NOT LIB_NAME_${lib}) mark_as_advanced(${name}_${lib}_LIBRARY)
if(NOT ${name}_${lib}_LIBRARY)
unset(${name}_FOUND) unset(${name}_FOUND)
endif(NOT LIB_NAME_${lib}) endif(NOT ${name}_${lib}_LIBRARY)
endforeach(lib) endforeach(lib)
if(${name}_FOUND) if(${name}_FOUND)
set(${name}_LIBRARIES "") set(${name}_LIBRARIES "")
foreach(lib ${${name}_PKG_CONFIG_LIBRARIES}) foreach(lib ${${name}_PKG_CONFIG_LIBRARIES})
list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}}) list(APPEND ${name}_LIBRARIES ${${name}_${lib}_LIBRARY})
endforeach(lib) endforeach(lib)
list(REMOVE_DUPLICATES ${name}_LIBRARIES) list(REMOVE_DUPLICATES ${name}_LIBRARIES)
set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE) set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)
@ -46,34 +47,36 @@ function(find_pkg_config_with_fallback name)
# No success with pkg-config, try via find_library on all lib_names # No success with pkg-config, try via find_library on all lib_names
set(${name}_FOUND "1") set(${name}_FOUND "1")
foreach(lib ${ARGS_LIB_NAMES}) foreach(lib ${ARGS_LIB_NAMES})
find_library(LIB_NAME_${lib} ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS}) find_library(${name}_${lib}_LIBRARY ${ARGS_LIB_NAMES} HINTS ${ARGS_LIB_DIR_HINTS})
mark_as_advanced(${name}_${lib}_LIBRARY)
if(NOT LIB_NAME_${lib}) if(NOT ${name}_${lib}_LIBRARY)
unset(${name}_FOUND) unset(${name}_FOUND)
endif(NOT LIB_NAME_${lib}) endif(NOT ${name}_${lib}_LIBRARY)
endforeach(lib) endforeach(lib)
foreach(inc ${ARGS_INCLUDE_NAMES}) 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}) find_path(${name}_${inc}_INCLUDE_PATH ${inc} HINTS ${ARGS_INCLUDE_DIR_HINTS} PATHS ${ARGS_INCLUDE_DIR_PATHS} PATH_SUFFIXES ${ARGS_INCLUDE_DIR_SUFFIXES})
mark_as_advanced(${name}_${inc}_INCLUDE_PATH)
if(NOT INCLUDE_PATH_${inc}) if(NOT ${name}_${inc}_INCLUDE_PATH)
unset(${name}_FOUND) unset(${name}_FOUND)
endif(NOT INCLUDE_PATH_${inc}) endif(NOT ${name}_${inc}_INCLUDE_PATH)
endforeach(inc) endforeach(inc)
if(${name}_FOUND) if(${name}_FOUND)
set(${name}_LIBRARIES "") set(${name}_LIBRARIES "")
set(${name}_INCLUDE_DIRS "") set(${name}_INCLUDE_DIRS "")
foreach(lib ${ARGS_LIB_NAMES}) foreach(lib ${ARGS_LIB_NAMES})
list(APPEND ${name}_LIBRARIES ${LIB_NAME_${lib}}) list(APPEND ${name}_LIBRARIES ${${name}_${lib}_LIBRARY})
endforeach(lib) endforeach(lib)
foreach(inc ${ARGS_INCLUDE_NAMES}) foreach(inc ${ARGS_INCLUDE_NAMES})
list(APPEND ${name}_INCLUDE_DIRS ${INCLUDE_PATH_${inc}}) list(APPEND ${name}_INCLUDE_DIRS ${${name}_${inc}_INCLUDE_PATH})
endforeach(inc) endforeach(inc)
list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY) list(GET ${name}_LIBRARIES "0" ${name}_LIBRARY)
foreach(dep ${ARGS_DEPENDS}) foreach(dep ${ARGS_DEPENDS})
find_package(${dep} QUIET) find_package(${dep} ${${dep}_GLOBAL_VERSION} QUIET)
if(${dep}_FOUND) if(${dep}_FOUND)
list(APPEND ${name}_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS}) list(APPEND ${name}_INCLUDE_DIRS ${${dep}_INCLUDE_DIRS})

View file

@ -66,16 +66,11 @@ COMMENT
Copy header file dino_i18n.h Copy header file dino_i18n.h
) )
add_definitions(${VALA_CFLAGS} -DDINO_PLUGINS_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_PLUGINS_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}")
add_library(libdino SHARED ${LIBDINO_VALA_C} ${CMAKE_BINARY_DIR}/exports/dino_i18n.h)
add_dependencies(libdino xmpp-vala-vapi qlite-vapi)
target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
set_target_properties(libdino PROPERTIES PREFIX "" VERSION 0.0 SOVERSION 0)
add_custom_target(dino-vapi add_custom_target(dino-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/exports/dino.vapi ${CMAKE_BINARY_DIR}/exports/dino.vapi
${CMAKE_BINARY_DIR}/exports/dino.deps ${CMAKE_BINARY_DIR}/exports/dino.deps
${CMAKE_BINARY_DIR}/exports/dino_i18n.h
) )
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gschemas.compiled add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gschemas.compiled
@ -90,7 +85,13 @@ DEPENDS
${CMAKE_BINARY_DIR}/gschemas.compiled ${CMAKE_BINARY_DIR}/gschemas.compiled
) )
add_definitions(${VALA_CFLAGS} -DDINO_PLUGINS_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_PLUGINS_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}")
add_library(libdino SHARED ${LIBDINO_VALA_C} ${CMAKE_BINARY_DIR}/exports/dino_i18n.h)
add_dependencies(libdino dino-vapi dino-gsettings-schema-compiled)
target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
set_target_properties(libdino PROPERTIES PREFIX "" VERSION 0.0 SOVERSION 0)
install(TARGETS libdino ${TARGET_INSTALL}) 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.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_BINARY_DIR}/exports/dino.h ${CMAKE_BINARY_DIR}/exports/dino_i18n.h DESTINATION ${INCLUDE_INSTALL_DIR})
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/dino.gschema.xml DESTINATION ${SHARE_INSTALL_PREFIX}/glib-2.0/schemas/) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/dino.gschema.xml DESTINATION ${SHARE_INSTALL_PREFIX}/glib-2.0/schemas/)

View file

@ -124,7 +124,7 @@ 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}\")
add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET}) add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET})
add_dependencies(dino dino-vapi dino-gsettings-schema-compiled ${GETTEXT_PACKAGE}-translations) add_dependencies(dino ${GETTEXT_PACKAGE}-translations)
target_link_libraries(dino libdino ${MAIN_PACKAGES}) target_link_libraries(dino libdino ${MAIN_PACKAGES})
if(WIN32) if(WIN32)

View file

@ -20,12 +20,6 @@ GENERATE_HEADER
gpgme-vala gpgme-vala
) )
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_PACKAGES} gpgme)
set_property(TARGET gpgme-vala PROPERTY POSITION_INDEPENDENT_CODE ON)
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h" add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h"
COMMAND COMMAND
cp "${CMAKE_CURRENT_SOURCE_DIR}/src/gpgme_fix.h" "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h" cp "${CMAKE_CURRENT_SOURCE_DIR}/src/gpgme_fix.h" "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h"
@ -49,3 +43,10 @@ DEPENDS
${CMAKE_BINARY_DIR}/exports/gpgme.vapi ${CMAKE_BINARY_DIR}/exports/gpgme.vapi
) )
set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/src)
add_definitions(${CFLAGS})
add_library(gpgme-vala ${GPGME_VALA_C} src/gpgme_fix.c)
add_dependencies(gpgme-vala gpgme-vapi)
target_link_libraries(gpgme-vala ${GPGME_VALA_PACKAGES} gpgme)
set_property(TARGET gpgme-vala PROPERTY POSITION_INDEPENDENT_CODE ON)

View file

@ -38,7 +38,7 @@ PACKAGES
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}\")
add_library(omemo SHARED ${OMEMO_VALA_C}) add_library(omemo SHARED ${OMEMO_VALA_C})
add_dependencies(omemo dino-vapi signal-protocol-vapi ${GETTEXT_PACKAGE}-translations) add_dependencies(omemo ${GETTEXT_PACKAGE}-translations)
target_link_libraries(omemo libdino signal-protocol-vala ${OMEMO_PACKAGES}) target_link_libraries(omemo libdino signal-protocol-vala ${OMEMO_PACKAGES})
set_target_properties(omemo PROPERTIES PREFIX "") set_target_properties(omemo PROPERTIES PREFIX "")
set_target_properties(omemo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) set_target_properties(omemo PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)

View file

@ -50,7 +50,7 @@ GRESOURCES
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}\")
add_library(openpgp SHARED ${OPENPGP_VALA_C} ${OPENPGP_GRESOURCES_TARGET}) add_library(openpgp SHARED ${OPENPGP_VALA_C} ${OPENPGP_GRESOURCES_TARGET})
add_dependencies(openpgp dino-vapi gpgme-vapi ${GETTEXT_PACKAGE}-translations) add_dependencies(openpgp ${GETTEXT_PACKAGE}-translations)
target_link_libraries(openpgp libdino gpgme-vala ${OPENPGP_PACKAGES}) target_link_libraries(openpgp libdino gpgme-vala ${OPENPGP_PACKAGES})
set_target_properties(openpgp PROPERTIES PREFIX "") set_target_properties(openpgp PROPERTIES PREFIX "")
set_target_properties(openpgp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/) set_target_properties(openpgp PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins/)

View file

@ -1,8 +1,3 @@
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(GCrypt REQUIRED) find_package(GCrypt REQUIRED)
find_packages(SIGNAL_PROTOCOL_PACKAGES REQUIRED find_packages(SIGNAL_PROTOCOL_PACKAGES REQUIRED
Gee Gee
@ -30,12 +25,16 @@ GENERATE_HEADER
signal-protocol-vala signal-protocol-vala
) )
set(CFLAGS ${VALA_CFLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src -I${CMAKE_CURRENT_SOURCE_DIR}/src) set(C_HEADERS_SRC "")
add_definitions(${CFLAGS}) set(C_HEADERS_TARGET "")
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) if((SHARED_SIGNAL_PROTOCOL) OR ($ENV{SHARED_SIGNAL_PROTOCOL}))
target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} gcrypt signal-protocol-c m) find_package(SignalProtocol REQUIRED)
set_property(TARGET signal-protocol-vala PROPERTY POSITION_INDEPENDENT_CODE ON) else()
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)
set(SIGNAL_PROTOCOL_C_HEADERS set(SIGNAL_PROTOCOL_C_HEADERS
signal_protocol.h signal_protocol.h
@ -59,21 +58,21 @@ set(SIGNAL_PROTOCOL_C_HEADERS
device_consistency.h device_consistency.h
) )
set(C_HEADERS_SRC "") file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/exports/signal")
set(C_HEADERS_TARGET "")
foreach(f ${SIGNAL_PROTOCOL_C_HEADERS}) foreach(f ${SIGNAL_PROTOCOL_C_HEADERS})
list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}") list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}")
list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/${f}") list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/signal/${f}")
add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/${f}" add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/signal/${f}"
COMMAND COMMAND
cp "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" "${CMAKE_BINARY_DIR}/exports/${f}" cp "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" "${CMAKE_BINARY_DIR}/exports/signal/${f}"
DEPENDS DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}" "${CMAKE_CURRENT_SOURCE_DIR}/libsignal-protocol-c/src/${f}"
COMMENT COMMENT
Copy header file ${f} Copy header file signal/${f}
) )
endforeach(f) endforeach(f)
endif()
list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.h") list(APPEND C_HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/signal_helper.h")
list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/signal_helper.h") list(APPEND C_HEADERS_TARGET "${CMAKE_BINARY_DIR}/exports/signal_helper.h")
@ -102,6 +101,13 @@ DEPENDS
${C_HEADERS_TARGET} ${C_HEADERS_TARGET}
) )
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-vapi)
target_link_libraries(signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES} gcrypt signal-protocol-c m)
set_property(TARGET signal-protocol-vala PROPERTY POSITION_INDEPENDENT_CODE ON)
if(BUILD_TESTS) if(BUILD_TESTS)
vala_precompile(SIGNAL_TEST_VALA_C vala_precompile(SIGNAL_TEST_VALA_C
SOURCES SOURCES
@ -121,6 +127,6 @@ if(BUILD_TESTS)
set(CFLAGS ${VALA_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_executable(signal-protocol-vala-test ${SIGNAL_TEST_VALA_C})
add_dependencies(signal-protocol-vala-test signal-protocol-vala signal-protocol-vapi) add_dependencies(signal-protocol-vala-test signal-protocol-vala)
target_link_libraries(signal-protocol-vala-test signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES}) target_link_libraries(signal-protocol-vala-test signal-protocol-vala ${SIGNAL_PROTOCOL_PACKAGES})
endif(BUILD_TESTS) endif(BUILD_TESTS)

View file

@ -1,7 +1,7 @@
#ifndef SIGNAL_PROTOCOL_VALA_HELPER #ifndef SIGNAL_PROTOCOL_VALA_HELPER
#define SIGNAL_PROTOCOL_VALA_HELPER 1 #define SIGNAL_PROTOCOL_VALA_HELPER 1
#include <signal_protocol.h> #include <signal/signal_protocol.h>
#include <string.h> #include <string.h>
#include <glib.h> #include <glib.h>

View file

@ -1,6 +1,6 @@
namespace Signal { namespace Signal {
[Compact] [Compact]
[CCode (cname = "signal_context", cprefix="signal_context_", free_function="signal_context_destroy", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_context", cprefix="signal_context_", free_function="signal_context_destroy", cheader_filename = "signal/signal_protocol.h")]
public class NativeContext { public class NativeContext {
public static int create(out NativeContext context, void* user_data); public static int create(out NativeContext context, void* user_data);
public int set_crypto_provider(NativeCryptoProvider crypto_provider); public int set_crypto_provider(NativeCryptoProvider crypto_provider);
@ -13,7 +13,7 @@ namespace Signal {
public delegate void LogFunc(LogLevel level, string message, void* user_data); public delegate void LogFunc(LogLevel level, string message, void* user_data);
[Compact] [Compact]
[CCode (cname = "signal_crypto_provider", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_crypto_provider", cheader_filename = "signal/signal_protocol.h")]
public struct NativeCryptoProvider { public struct NativeCryptoProvider {
public RandomFunc random_func; public RandomFunc random_func;
public HmacSha256Init hmac_sha256_init_func; public HmacSha256Init hmac_sha256_init_func;
@ -50,7 +50,7 @@ namespace Signal {
public delegate int CryptFunc(out Buffer output, Cipher cipher, uint8[] key, uint8[] iv, uint8[] content, void* user_data); public delegate int CryptFunc(out Buffer output, Cipher cipher, uint8[] key, uint8[] iv, uint8[] content, void* user_data);
[Compact] [Compact]
[CCode (cname = "signal_protocol_session_store", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_protocol_session_store", cheader_filename = "signal/signal_protocol.h")]
public struct NativeSessionStore { public struct NativeSessionStore {
public LoadSessionFunc load_session_func; public LoadSessionFunc load_session_func;
public GetSubDeviceSessionsFunc get_sub_device_sessions_func; public GetSubDeviceSessionsFunc get_sub_device_sessions_func;
@ -75,7 +75,7 @@ namespace Signal {
public delegate int DeleteAllSessionsFunc(char[] name, void* user_data); public delegate int DeleteAllSessionsFunc(char[] name, void* user_data);
[Compact] [Compact]
[CCode (cname = "signal_protocol_identity_key_store", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_protocol_identity_key_store", cheader_filename = "signal/signal_protocol.h")]
public struct NativeIdentityKeyStore { public struct NativeIdentityKeyStore {
GetIdentityKeyPairFunc get_identity_key_pair; GetIdentityKeyPairFunc get_identity_key_pair;
GetLocalRegistrationIdFunc get_local_registration_id; GetLocalRegistrationIdFunc get_local_registration_id;
@ -94,7 +94,7 @@ namespace Signal {
public delegate int IsTrustedIdentityFunc(Address address, uint8[] key, void* user_data); public delegate int IsTrustedIdentityFunc(Address address, uint8[] key, void* user_data);
[Compact] [Compact]
[CCode (cname = "signal_protocol_pre_key_store", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_protocol_pre_key_store", cheader_filename = "signal/signal_protocol.h")]
public struct NativePreKeyStore { public struct NativePreKeyStore {
LoadPreKeyFunc load_pre_key; LoadPreKeyFunc load_pre_key;
StorePreKeyFunc store_pre_key; StorePreKeyFunc store_pre_key;
@ -114,7 +114,7 @@ namespace Signal {
[Compact] [Compact]
[CCode (cname = "signal_protocol_signed_pre_key_store", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_protocol_signed_pre_key_store", cheader_filename = "signal/signal_protocol.h")]
public struct NativeSignedPreKeyStore { public struct NativeSignedPreKeyStore {
LoadPreKeyFunc load_signed_pre_key; LoadPreKeyFunc load_signed_pre_key;
StorePreKeyFunc store_signed_pre_key; StorePreKeyFunc store_signed_pre_key;
@ -142,7 +142,7 @@ namespace Signal {
public delegate int DestroyFunc(void* user_data); public delegate int DestroyFunc(void* user_data);
[Compact] [Compact]
[CCode (cname = "signal_protocol_store_context", cprefix = "signal_protocol_store_context_", free_function="signal_protocol_store_context_destroy", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_protocol_store_context", cprefix = "signal_protocol_store_context_", free_function="signal_protocol_store_context_destroy", cheader_filename = "signal/signal_protocol.h")]
public class NativeStoreContext { public class NativeStoreContext {
public static int create(out NativeStoreContext context, NativeContext global_context); public static int create(out NativeStoreContext context, NativeContext global_context);
public int set_session_store(NativeSessionStore store); public int set_session_store(NativeSessionStore store);
@ -153,7 +153,7 @@ namespace Signal {
} }
[CCode (cheader_filename = "signal_protocol.h")] [CCode (cheader_filename = "signal/signal_protocol.h")]
namespace Protocol { namespace Protocol {
/** /**
@ -201,7 +201,7 @@ namespace Signal {
public int is_trusted_identity(NativeStoreContext store_context, Address address, ECPublicKey identity_key); public int is_trusted_identity(NativeStoreContext store_context, Address address, ECPublicKey identity_key);
} }
[CCode (cheader_filename = "key_helper.h", cprefix = "signal_protocol_key_helper_")] [CCode (cheader_filename = "signal/key_helper.h", cprefix = "signal_protocol_key_helper_")]
namespace KeyHelper { namespace KeyHelper {
[Compact] [Compact]
[CCode (cname = "signal_protocol_key_helper_pre_key_list_node", cprefix = "signal_protocol_key_helper_key_list_", free_function="signal_protocol_key_helper_key_list_free")] [CCode (cname = "signal_protocol_key_helper_pre_key_list_node", cprefix = "signal_protocol_key_helper_key_list_", free_function="signal_protocol_key_helper_key_list_free")]
@ -222,7 +222,7 @@ namespace Signal {
} }
} }
[CCode (cheader_filename = "curve.h")] [CCode (cheader_filename = "signal/curve.h")]
namespace Curve { namespace Curve {
[CCode (cname = "curve_calculate_agreement")] [CCode (cname = "curve_calculate_agreement")]
public int calculate_agreement([CCode (array_length = false)] out uint8[] shared_key_data, ECPublicKey public_key, ECPrivateKey private_key); public int calculate_agreement([CCode (array_length = false)] out uint8[] shared_key_data, ECPublicKey public_key, ECPrivateKey private_key);
@ -232,35 +232,35 @@ namespace Signal {
public int verify_signature(ECPublicKey signing_key, uint8[] message, uint8[] signature); public int verify_signature(ECPublicKey signing_key, uint8[] message, uint8[] signature);
} }
[CCode (cname = "session_builder_create", cheader_filename = "session_builder.h")] [CCode (cname = "session_builder_create", cheader_filename = "signal/session_builder.h")]
public static int session_builder_create(out SessionBuilder builder, NativeStoreContext store, Address remote_address, NativeContext global_context); public static int session_builder_create(out SessionBuilder builder, NativeStoreContext store, Address remote_address, NativeContext global_context);
[CCode (cname = "session_cipher_create", cheader_filename = "session_cipher.h")] [CCode (cname = "session_cipher_create", cheader_filename = "signal/session_cipher.h")]
public static int session_cipher_create(out SessionCipher cipher, NativeStoreContext store, Address remote_address, NativeContext global_context); public static int session_cipher_create(out SessionCipher cipher, NativeStoreContext store, Address remote_address, NativeContext global_context);
[CCode (cname = "pre_key_signal_message_deserialize", cheader_filename = "protocol.h")] [CCode (cname = "pre_key_signal_message_deserialize", cheader_filename = "signal/protocol.h")]
public static int pre_key_signal_message_deserialize(out PreKeySignalMessage message, uint8[] data, NativeContext global_context); public static int pre_key_signal_message_deserialize(out PreKeySignalMessage message, uint8[] data, NativeContext global_context);
[CCode (cname = "pre_key_signal_message_copy", cheader_filename = "protocol.h")] [CCode (cname = "pre_key_signal_message_copy", cheader_filename = "signal/protocol.h")]
public static int pre_key_signal_message_copy(out PreKeySignalMessage message, PreKeySignalMessage other_message, NativeContext global_context); public static int pre_key_signal_message_copy(out PreKeySignalMessage message, PreKeySignalMessage other_message, NativeContext global_context);
[CCode (cname = "signal_message_create", cheader_filename = "protocol.h")] [CCode (cname = "signal_message_create", cheader_filename = "signal/protocol.h")]
public static int signal_message_create(out SignalMessage message, uint8 message_version, uint8[] mac_key, ECPublicKey sender_ratchet_key, uint32 counter, uint32 previous_counter, uint8[] ciphertext, ECPublicKey sender_identity_key, ECPublicKey receiver_identity_key, NativeContext global_context); public static int signal_message_create(out SignalMessage message, uint8 message_version, uint8[] mac_key, ECPublicKey sender_ratchet_key, uint32 counter, uint32 previous_counter, uint8[] ciphertext, ECPublicKey sender_identity_key, ECPublicKey receiver_identity_key, NativeContext global_context);
[CCode (cname = "signal_message_deserialize", cheader_filename = "protocol.h")] [CCode (cname = "signal_message_deserialize", cheader_filename = "signal/protocol.h")]
public static int signal_message_deserialize(out SignalMessage message, uint8[] data, NativeContext global_context); public static int signal_message_deserialize(out SignalMessage message, uint8[] data, NativeContext global_context);
[CCode (cname = "signal_message_copy", cheader_filename = "protocol.h")] [CCode (cname = "signal_message_copy", cheader_filename = "signal/protocol.h")]
public static int signal_message_copy(out SignalMessage message, SignalMessage other_message, NativeContext global_context); public static int signal_message_copy(out SignalMessage message, SignalMessage other_message, NativeContext global_context);
[CCode (cname = "curve_generate_key_pair", cheader_filename = "curve.h")] [CCode (cname = "curve_generate_key_pair", cheader_filename = "signal/curve.h")]
public static int curve_generate_key_pair(NativeContext context, out ECKeyPair key_pair); public static int curve_generate_key_pair(NativeContext context, out ECKeyPair key_pair);
[CCode (cname = "curve_decode_private_point", cheader_filename = "curve.h")] [CCode (cname = "curve_decode_private_point", cheader_filename = "signal/curve.h")]
public static int curve_decode_private_point(out ECPrivateKey public_key, uint8[] key, NativeContext global_context); public static int curve_decode_private_point(out ECPrivateKey public_key, uint8[] key, NativeContext global_context);
[CCode (cname = "curve_decode_point", cheader_filename = "curve.h")] [CCode (cname = "curve_decode_point", cheader_filename = "signal/curve.h")]
public static int curve_decode_point(out ECPublicKey public_key, uint8[] key, NativeContext global_context); public static int curve_decode_point(out ECPublicKey public_key, uint8[] key, NativeContext global_context);
[CCode (cname = "curve_generate_private_key", cheader_filename = "curve.h")] [CCode (cname = "curve_generate_private_key", cheader_filename = "signal/curve.h")]
public static int curve_generate_private_key(NativeContext context, out ECPrivateKey private_key); public static int curve_generate_private_key(NativeContext context, out ECPrivateKey private_key);
[CCode (cname = "ratchet_identity_key_pair_deserialize", cheader_filename = "ratchet.h")] [CCode (cname = "ratchet_identity_key_pair_deserialize", cheader_filename = "signal/ratchet.h")]
public static int ratchet_identity_key_pair_deserialize(out IdentityKeyPair key_pair, uint8[] data, NativeContext global_context); public static int ratchet_identity_key_pair_deserialize(out IdentityKeyPair key_pair, uint8[] data, NativeContext global_context);
[CCode (cname = "session_signed_pre_key_deserialize", cheader_filename = "signed_pre_key.h")] [CCode (cname = "session_signed_pre_key_deserialize", cheader_filename = "signal/signed_pre_key.h")]
public static int session_signed_pre_key_deserialize(out SignedPreKeyRecord pre_key, uint8[] data, NativeContext global_context); public static int session_signed_pre_key_deserialize(out SignedPreKeyRecord pre_key, uint8[] data, NativeContext global_context);
[Compact] [Compact]
[CCode (cname = "hkdf_context", cprefix = "hkdf_", free_function = "hkdf_destroy", cheader_filename = "hkdf.h")] [CCode (cname = "hkdf_context", cprefix = "hkdf_", free_function = "hkdf_destroy", cheader_filename = "signal/hkdf.h")]
public class NativeHkdfContext { public class NativeHkdfContext {
public static int create(out NativeHkdfContext context, int message_version, NativeContext global_context); public static int create(out NativeHkdfContext context, int message_version, NativeContext global_context);
public int compare(NativeHkdfContext other); public int compare(NativeHkdfContext other);

View file

@ -1,6 +1,6 @@
namespace Signal { namespace Signal {
[CCode (cname = "int", cprefix = "SG_ERR_", cheader_filename = "signal_protocol.h", has_type_id = false)] [CCode (cname = "int", cprefix = "SG_ERR_", cheader_filename = "signal/signal_protocol.h", has_type_id = false)]
public enum ErrorCode { public enum ErrorCode {
[CCode (cname = "SG_SUCCESS")] [CCode (cname = "SG_SUCCESS")]
SUCCESS, SUCCESS,
@ -23,10 +23,10 @@ namespace Signal {
FP_IDENT_MISMATCH; FP_IDENT_MISMATCH;
} }
[CCode (cname = "SG_ERR_MINIMUM", cheader_filename = "signal_protocol.h")] [CCode (cname = "SG_ERR_MINIMUM", cheader_filename = "signal/signal_protocol.h")]
public const int MIN_ERROR_CODE; public const int MIN_ERROR_CODE;
[CCode (cname = "int", cprefix = "SG_LOG_", cheader_filename = "signal_protocol.h", has_type_id = false)] [CCode (cname = "int", cprefix = "SG_LOG_", cheader_filename = "signal/signal_protocol.h", has_type_id = false)]
public enum LogLevel { public enum LogLevel {
ERROR, ERROR,
WARNING, WARNING,
@ -35,7 +35,7 @@ namespace Signal {
DEBUG DEBUG
} }
[CCode (cname = "signal_throw_gerror_by_code_", cheader_filename = "signal_protocol.h")] [CCode (cname = "signal_throw_gerror_by_code_", cheader_filename = "signal/signal_protocol.h")]
private int throw_by_code(int code, string? message = null) throws GLib.Error { private int throw_by_code(int code, string? message = null) throws GLib.Error {
if (code < 0 && code > MIN_ERROR_CODE) { if (code < 0 && code > MIN_ERROR_CODE) {
throw new GLib.Error(-1, code, "%s: %s", message ?? "Signal error", ((ErrorCode)code).to_string()); throw new GLib.Error(-1, code, "%s: %s", message ?? "Signal error", ((ErrorCode)code).to_string());
@ -43,7 +43,7 @@ namespace Signal {
return code; return code;
} }
[CCode (cname = "int", cprefix = "SG_CIPHER_", cheader_filename = "signal_protocol.h", has_type_id = false)] [CCode (cname = "int", cprefix = "SG_CIPHER_", cheader_filename = "signal/signal_protocol.h", has_type_id = false)]
public enum Cipher { public enum Cipher {
AES_CTR_NOPADDING, AES_CTR_NOPADDING,
AES_CBC_PKCS5, AES_CBC_PKCS5,
@ -51,12 +51,12 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "signal_type_base", ref_function="signal_type_ref_vapi", unref_function="signal_type_unref_vapi", cheader_filename="signal_protocol_types.h,signal_helper.h")] [CCode (cname = "signal_type_base", ref_function="signal_type_ref_vapi", unref_function="signal_type_unref_vapi", cheader_filename="signal/signal_protocol_types.h,signal_helper.h")]
public class TypeBase { public class TypeBase {
} }
[Compact] [Compact]
[CCode (cname = "signal_buffer", cheader_filename = "signal_protocol_types.h", free_function="signal_buffer_free")] [CCode (cname = "signal_buffer", cheader_filename = "signal/signal_protocol_types.h", free_function="signal_buffer_free")]
public class Buffer { public class Buffer {
[CCode (cname = "signal_buffer_alloc")] [CCode (cname = "signal_buffer_alloc")]
public Buffer(size_t len); public Buffer(size_t len);
@ -78,7 +78,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "signal_int_list", cheader_filename = "signal_protocol_types.h", free_function="signal_int_list_free")] [CCode (cname = "signal_int_list", cheader_filename = "signal/signal_protocol_types.h", free_function="signal_int_list_free")]
public class IntList { public class IntList {
[CCode (cname = "signal_int_list_alloc")] [CCode (cname = "signal_int_list_alloc")]
public IntList(); public IntList();
@ -90,7 +90,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "session_builder", cprefix = "session_builder_", free_function="session_builder_free", cheader_filename = "session_builder.h")] [CCode (cname = "session_builder", cprefix = "session_builder_", free_function="session_builder_free", cheader_filename = "signal/session_builder.h")]
public class SessionBuilder { public class SessionBuilder {
[CCode (cname = "session_builder_process_pre_key_bundle")] [CCode (cname = "session_builder_process_pre_key_bundle")]
private int process_pre_key_bundle_(PreKeyBundle pre_key_bundle); private int process_pre_key_bundle_(PreKeyBundle pre_key_bundle);
@ -101,7 +101,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "session_pre_key_bundle", cprefix = "session_pre_key_bundle_", cheader_filename = "session_pre_key.h")] [CCode (cname = "session_pre_key_bundle", cprefix = "session_pre_key_bundle_", cheader_filename = "signal/session_pre_key.h")]
public class PreKeyBundle : TypeBase { public class PreKeyBundle : TypeBase {
public static int create(out PreKeyBundle bundle, uint32 registration_id, int device_id, uint32 pre_key_id, ECPublicKey? pre_key_public, public static int create(out PreKeyBundle bundle, uint32 registration_id, int device_id, uint32 pre_key_id, ECPublicKey? pre_key_public,
uint32 signed_pre_key_id, ECPublicKey? signed_pre_key_public, uint8[]? signed_pre_key_signature, ECPublicKey? identity_key); uint32 signed_pre_key_id, ECPublicKey? signed_pre_key_public, uint8[]? signed_pre_key_signature, ECPublicKey? identity_key);
@ -116,7 +116,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "session_pre_key", cprefix = "session_pre_key_", cheader_filename = "session_pre_key.h,signal_helper.h")] [CCode (cname = "session_pre_key", cprefix = "session_pre_key_", cheader_filename = "signal/session_pre_key.h,signal_helper.h")]
public class PreKeyRecord : TypeBase { public class PreKeyRecord : TypeBase {
public PreKeyRecord(uint32 id, ECKeyPair key_pair) throws GLib.Error { public PreKeyRecord(uint32 id, ECKeyPair key_pair) throws GLib.Error {
int err; int err;
@ -134,13 +134,13 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "session_record", cprefix = "session_record_", cheader_filename = "signal_protocol_types.h")] [CCode (cname = "session_record", cprefix = "session_record_", cheader_filename = "signal/signal_protocol_types.h")]
public class SessionRecord : TypeBase { public class SessionRecord : TypeBase {
public SessionState state { get; } public SessionState state { get; }
} }
[Compact] [Compact]
[CCode (cname = "session_state", cprefix = "session_state_", cheader_filename = "session_state.h")] [CCode (cname = "session_state", cprefix = "session_state_", cheader_filename = "signal/session_state.h")]
public class SessionState : TypeBase { public class SessionState : TypeBase {
//public static int create(out SessionState state, NativeContext context); //public static int create(out SessionState state, NativeContext context);
//public static int deserialize(out SessionState state, uint8[] data, NativeContext context); //public static int deserialize(out SessionState state, uint8[] data, NativeContext context);
@ -163,7 +163,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "session_signed_pre_key", cprefix = "session_signed_pre_key_", cheader_filename = "session_pre_key.h")] [CCode (cname = "session_signed_pre_key", cprefix = "session_signed_pre_key_", cheader_filename = "signal/session_pre_key.h")]
public class SignedPreKeyRecord : TypeBase { public class SignedPreKeyRecord : TypeBase {
public SignedPreKeyRecord(uint32 id, uint64 timestamp, ECKeyPair key_pair, uint8[] signature) throws GLib.Error { public SignedPreKeyRecord(uint32 id, uint64 timestamp, ECKeyPair key_pair, uint8[] signature) throws GLib.Error {
int err; int err;
@ -190,7 +190,7 @@ namespace Signal {
* Address of an Signal Protocol message recipient * Address of an Signal Protocol message recipient
*/ */
[Compact] [Compact]
[CCode (cname = "signal_protocol_address", cprefix = "signal_protocol_address_", cheader_filename = "signal_protocol.h,signal_helper.h")] [CCode (cname = "signal_protocol_address", cprefix = "signal_protocol_address_", cheader_filename = "signal/signal_protocol.h,signal_helper.h")]
public class Address { public class Address {
public Address(string name, int32 device_id); public Address(string name, int32 device_id);
public int32 device_id { get; set; } public int32 device_id { get; set; }
@ -210,7 +210,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "ec_public_key", cprefix = "ec_public_key_", cheader_filename = "curve.h,signal_helper.h")] [CCode (cname = "ec_public_key", cprefix = "ec_public_key_", cheader_filename = "signal/curve.h,signal_helper.h")]
public class ECPublicKey : TypeBase { public class ECPublicKey : TypeBase {
[CCode (cname = "curve_generate_public_key")] [CCode (cname = "curve_generate_public_key")]
public static int generate(out ECPublicKey public_key, ECPrivateKey private_key); public static int generate(out ECPublicKey public_key, ECPrivateKey private_key);
@ -227,7 +227,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "ec_private_key", cprefix = "ec_private_key_", cheader_filename = "curve.h,signal_helper.h")] [CCode (cname = "ec_private_key", cprefix = "ec_private_key_", cheader_filename = "signal/curve.h,signal_helper.h")]
public class ECPrivateKey : TypeBase { public class ECPrivateKey : TypeBase {
[CCode (instance_pos = 1, cname = "ec_private_key_serialize")] [CCode (instance_pos = 1, cname = "ec_private_key_serialize")]
private int serialize_([CCode (pos = 0)] out Buffer buffer); private int serialize_([CCode (pos = 0)] out Buffer buffer);
@ -241,19 +241,19 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "ec_key_pair", cprefix="ec_key_pair_", cheader_filename = "curve.h,signal_helper.h")] [CCode (cname = "ec_key_pair", cprefix="ec_key_pair_", cheader_filename = "signal/curve.h,signal_helper.h")]
public class ECKeyPair : TypeBase { public class ECKeyPair : TypeBase {
public static int create(out ECKeyPair key_pair, ECPublicKey public_key, ECPrivateKey private_key); public static int create(out ECKeyPair key_pair, ECPublicKey public_key, ECPrivateKey private_key);
public ECPublicKey public { get; } public ECPublicKey public { get; }
public ECPrivateKey private { get; } public ECPrivateKey private { get; }
} }
[CCode (cname = "ratchet_message_keys", cheader_filename = "ratchet.h")] [CCode (cname = "ratchet_message_keys", cheader_filename = "signal/ratchet.h")]
public class MessageKeys { public class MessageKeys {
} }
[Compact] [Compact]
[CCode (cname = "ratchet_identity_key_pair", cprefix = "ratchet_identity_key_pair_", cheader_filename = "ratchet.h,signal_helper.h")] [CCode (cname = "ratchet_identity_key_pair", cprefix = "ratchet_identity_key_pair_", cheader_filename = "signal/ratchet.h,signal_helper.h")]
public class IdentityKeyPair : TypeBase { public class IdentityKeyPair : TypeBase {
public static int create(out IdentityKeyPair key_pair, ECPublicKey public_key, ECPrivateKey private_key); public static int create(out IdentityKeyPair key_pair, ECPublicKey public_key, ECPrivateKey private_key);
public int serialze(out Buffer buffer); public int serialze(out Buffer buffer);
@ -273,7 +273,7 @@ namespace Signal {
* that session. * that session.
*/ */
[Compact] [Compact]
[CCode (cname = "session_cipher", cprefix = "session_cipher_", cheader_filename = "session_cipher.h", free_function = "session_cipher_free")] [CCode (cname = "session_cipher", cprefix = "session_cipher_", cheader_filename = "signal/session_cipher.h", free_function = "session_cipher_free")]
public class SessionCipher { public class SessionCipher {
public void* user_data { get; set; } public void* user_data { get; set; }
public DecryptionCallback decryption_callback { set; } public DecryptionCallback decryption_callback { set; }
@ -308,7 +308,7 @@ namespace Signal {
public delegate int DecryptionCallback(SessionCipher cipher, Buffer plaintext, void* decrypt_context); public delegate int DecryptionCallback(SessionCipher cipher, Buffer plaintext, void* decrypt_context);
} }
[CCode (cname = "int", cheader_filename = "protocol.h", has_type_id = false)] [CCode (cname = "int", cheader_filename = "signal/protocol.h", has_type_id = false)]
public enum CiphertextType { public enum CiphertextType {
[CCode (cname = "CIPHERTEXT_SIGNAL_TYPE")] [CCode (cname = "CIPHERTEXT_SIGNAL_TYPE")]
SIGNAL, SIGNAL,
@ -321,7 +321,7 @@ namespace Signal {
} }
[Compact] [Compact]
[CCode (cname = "ciphertext_message", cprefix = "ciphertext_message_", cheader_filename = "protocol.h,signal_helper.h")] [CCode (cname = "ciphertext_message", cprefix = "ciphertext_message_", cheader_filename = "signal/protocol.h,signal_helper.h")]
public abstract class CiphertextMessage : TypeBase { public abstract class CiphertextMessage : TypeBase {
public CiphertextType type { get; } public CiphertextType type { get; }
[CCode (cname = "ciphertext_message_get_serialized")] [CCode (cname = "ciphertext_message_get_serialized")]
@ -331,7 +331,7 @@ namespace Signal {
}} }}
} }
[Compact] [Compact]
[CCode (cname = "signal_message", cprefix = "signal_message_", cheader_filename = "protocol.h,signal_helper.h")] [CCode (cname = "signal_message", cprefix = "signal_message_", cheader_filename = "signal/protocol.h,signal_helper.h")]
public class SignalMessage : CiphertextMessage { public class SignalMessage : CiphertextMessage {
public ECPublicKey sender_ratchet_key { get; } public ECPublicKey sender_ratchet_key { get; }
public uint8 message_version { get; } public uint8 message_version { get; }
@ -341,7 +341,7 @@ namespace Signal {
public static int is_legacy(uint8[] data); public static int is_legacy(uint8[] data);
} }
[Compact] [Compact]
[CCode (cname = "pre_key_signal_message", cprefix = "pre_key_signal_message_", cheader_filename = "protocol.h,signal_helper.h")] [CCode (cname = "pre_key_signal_message", cprefix = "pre_key_signal_message_", cheader_filename = "signal/protocol.h,signal_helper.h")]
public class PreKeySignalMessage : CiphertextMessage { public class PreKeySignalMessage : CiphertextMessage {
public uint8 message_version { get; } public uint8 message_version { get; }
public ECPublicKey identity_key { get; } public ECPublicKey identity_key { get; }
@ -352,14 +352,14 @@ namespace Signal {
public SignalMessage signal_message { get; } public SignalMessage signal_message { get; }
} }
[Compact] [Compact]
[CCode (cname = "sender_key_message", cprefix = "sender_key_message_", cheader_filename = "protocol.h,signal_helper.h")] [CCode (cname = "sender_key_message", cprefix = "sender_key_message_", cheader_filename = "signal/protocol.h,signal_helper.h")]
public class SenderKeyMessage : CiphertextMessage { public class SenderKeyMessage : CiphertextMessage {
public uint32 key_id { get; } public uint32 key_id { get; }
public uint32 iteration { get; } public uint32 iteration { get; }
public Buffer ciphertext { get; } public Buffer ciphertext { get; }
} }
[Compact] [Compact]
[CCode (cname = "sender_key_distribution_message", cprefix = "sender_key_distribution_message_", cheader_filename = "protocol.h,signal_helper.h")] [CCode (cname = "sender_key_distribution_message", cprefix = "sender_key_distribution_message_", cheader_filename = "signal/protocol.h,signal_helper.h")]
public class SenderKeyDistributionMessage : CiphertextMessage { public class SenderKeyDistributionMessage : CiphertextMessage {
public uint32 id { get; } public uint32 id { get; }
public uint32 iteration { get; } public uint32 iteration { get; }

View file

@ -25,17 +25,18 @@ GENERATE_HEADER
qlite qlite
) )
add_definitions(${VALA_CFLAGS})
add_library(qlite SHARED ${QLITE_VALA_C})
target_link_libraries(qlite ${QLITE_PACKAGES})
set_target_properties(qlite PROPERTIES VERSION 0.1 SOVERSION 0)
add_custom_target(qlite-vapi add_custom_target(qlite-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/exports/qlite.vapi ${CMAKE_BINARY_DIR}/exports/qlite.vapi
${CMAKE_BINARY_DIR}/exports/qlite.deps ${CMAKE_BINARY_DIR}/exports/qlite.deps
) )
add_definitions(${VALA_CFLAGS})
add_library(qlite SHARED ${QLITE_VALA_C})
add_dependencies(qlite qlite-vapi)
target_link_libraries(qlite ${QLITE_PACKAGES})
set_target_properties(qlite PROPERTIES VERSION 0.1 SOVERSION 0)
install(TARGETS qlite ${TARGET_INSTALL}) 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.vapi ${CMAKE_BINARY_DIR}/exports/qlite.deps DESTINATION ${VAPI_INSTALL_DIR})
install(FILES ${CMAKE_BINARY_DIR}/exports/qlite.h DESTINATION ${INCLUDE_INSTALL_DIR}) install(FILES ${CMAKE_BINARY_DIR}/exports/qlite.h DESTINATION ${INCLUDE_INSTALL_DIR})

View file

@ -65,17 +65,18 @@ GENERATE_HEADER
xmpp-vala xmpp-vala
) )
add_definitions(${VALA_CFLAGS})
add_library(xmpp-vala SHARED ${ENGINE_VALA_C})
target_link_libraries(xmpp-vala ${ENGINE_PACKAGES})
set_target_properties(xmpp-vala PROPERTIES VERSION 0.1 SOVERSION 0)
add_custom_target(xmpp-vala-vapi add_custom_target(xmpp-vala-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
${CMAKE_BINARY_DIR}/exports/xmpp-vala.deps ${CMAKE_BINARY_DIR}/exports/xmpp-vala.deps
) )
add_definitions(${VALA_CFLAGS})
add_library(xmpp-vala SHARED ${ENGINE_VALA_C})
add_dependencies(xmpp-vala xmpp-vala-vapi)
target_link_libraries(xmpp-vala ${ENGINE_PACKAGES})
set_target_properties(xmpp-vala PROPERTIES VERSION 0.1 SOVERSION 0)
install(TARGETS xmpp-vala ${TARGET_INSTALL}) 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.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}) install(FILES ${CMAKE_BINARY_DIR}/exports/xmpp-vala.h DESTINATION ${INCLUDE_INSTALL_DIR})