[evolution-data-server/wip/cmake] vala directory



commit 4ebcb48ae2ca44d33a4807d2bfedd46f3a943fba
Author: Milan Crha <mcrha redhat com>
Date:   Tue Sep 27 14:33:40 2016 +0200

    vala directory

 CMakeLists.txt                           |    6 +-
 cmake/modules/GObjectIntrospection.cmake |   11 ++-
 vala/CMakeLists.txt                      |  138 ++++++++++++++++++++++++++++++
 3 files changed, 151 insertions(+), 4 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 672b939..c4624ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -890,6 +890,6 @@ if(ENABLE_EXAMPLES)
        add_subdirectory(examples)
 endif(ENABLE_EXAMPLES)
 
-#if(ENABLE_VALA_BINDINGS)
-#      add_subdirectory(vala)
-#endif(ENABLE_VALA_BINDINGS)
+if(ENABLE_VALA_BINDINGS)
+       add_subdirectory(vala)
+endif(ENABLE_VALA_BINDINGS)
diff --git a/cmake/modules/GObjectIntrospection.cmake b/cmake/modules/GObjectIntrospection.cmake
index 004934e..b4e77ba 100644
--- a/cmake/modules/GObjectIntrospection.cmake
+++ b/cmake/modules/GObjectIntrospection.cmake
@@ -58,6 +58,15 @@ macro(gir_construct_names _prefix _version _out_girname _out_varsprefix)
        set(${_out_varsprefix} ${_varsprefix})
 endmacro(gir_construct_names)
 
+macro(gir_girfilename_to_target _outvar _girfilename)
+       set(${_outvar})
+       foreach(_gir_name "${_girfilename}" ${ARGN})
+               string(REPLACE "-" "_" _gir_name "${_gir_name}")
+               string(REPLACE "." "_" _gir_name "${_gir_name}")
+               list(APPEND ${_outvar} gir-girs-${_gir_name})
+       endforeach(_gir_name)
+endmacro(gir_girfilename_to_target)
+
 # the macro does something only if ENABLE_INTROSPECTION is ON
 macro(gir_add_introspection gir)
        if(ENABLE_INTROSPECTION)
@@ -199,7 +208,7 @@ macro(gir_add_introspection_simple gir_library pkg_export_prefix gir_library_ver
                ${_gir_identifies_prefixes}
                ${_gir_deps}
                --pkg-export ${pkg_export_prefix}-${gir_library_version}
-               --c-include="${c_include}"
+               --c-include=${c_include}
                --cflags-begin
                ${${gir_vars_prefix}_CFLAGS}
                --cflags-end
diff --git a/vala/CMakeLists.txt b/vala/CMakeLists.txt
new file mode 100644
index 0000000..dbe3ef3
--- /dev/null
+++ b/vala/CMakeLists.txt
@@ -0,0 +1,138 @@
+set(valafiles
+       ${CMAKE_CURRENT_SOURCE_DIR}/libedataserver-${API_VERSION}.deps
+       ${CMAKE_CURRENT_BINARY_DIR}/libedataserver-${API_VERSION}.vapi
+       ${CMAKE_CURRENT_SOURCE_DIR}/libebook-${API_VERSION}.deps
+       ${CMAKE_CURRENT_BINARY_DIR}/libebook-${API_VERSION}.vapi
+       ${CMAKE_CURRENT_SOURCE_DIR}/libebook-contacts-${API_VERSION}.deps
+       ${CMAKE_CURRENT_BINARY_DIR}/libebook-contacts-${API_VERSION}.vapi
+)
+
+add_custom_target(vala ALL)
+
+# ***********************************
+# camel (currently conditionally compiled)
+# ***********************************
+
+set(gir_fullname ${CMAKE_BINARY_DIR}/camel/Camel-${API_VERSION}.gir)
+gir_girfilename_to_target(gir_deps Camel-${API_VERSION}.gir)
+if(TARGET ${gir_deps})
+       list(APPEND valafiles
+               ${CMAKE_CURRENT_SOURCE_DIR}/camel-${API_VERSION}.deps
+               ${CMAKE_CURRENT_BINARY_DIR}/camel-${API_VERSION}.vapi
+       )
+
+       add_dependencies(vala ${gir_deps})
+
+       add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/camel-${API_VERSION}.vapi
+               COMMAND ${VAPIGEN}
+                       --vapidir=${CMAKE_CURRENT_SOURCE_DIR}
+                       --vapidir=${CMAKE_CURRENT_BINARY_DIR}
+                       --girdir=${CMAKE_BINARY_DIR}/camel
+                       --pkg gio-2.0
+                       --pkg libxml-2.0
+                       --pkg posix
+                       --library camel-${API_VERSION}
+                       --metadatadir=${CMAKE_CURRENT_SOURCE_DIR}
+                       ${gir_fullname}
+               DEPENDS camel-${API_VERSION}.deps
+                       ${gir_fullname}
+       )
+endif(TARGET ${gir_deps})
+
+# ***********************************
+# libedataserver
+# ***********************************
+
+set(gir_fullname ${CMAKE_BINARY_DIR}/libedataserver/EDataServer-${API_VERSION}.gir)
+gir_girfilename_to_target(gir_deps EDataServer-${API_VERSION}.gir)
+
+add_dependencies(vala ${gir_deps})
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libedataserver-${API_VERSION}.vapi
+       COMMAND ${VAPIGEN}
+               --vapidir=${CMAKE_CURRENT_SOURCE_DIR}
+               --vapidir=${CMAKE_CURRENT_BINARY_DIR}
+               --girdir=${CMAKE_BINARY_DIR}/libedataserver
+               --pkg gio-2.0
+               --pkg libxml-2.0
+               --pkg libsoup-2.4
+               --pkg posix
+               --library libedataserver-${API_VERSION}
+               --metadatadir=${CMAKE_CURRENT_SOURCE_DIR}
+               ${gir_fullname}
+       DEPENDS libedataserver-${API_VERSION}.deps
+               ${gir_fullname}
+)
+
+# ***********************************
+# libebook-contacts
+# ***********************************
+
+set(gir_fullname ${CMAKE_BINARY_DIR}/addressbook/libebook-contacts/EBookContacts-${API_VERSION}.gir)
+gir_girfilename_to_target(gir_deps EBookContacts-${API_VERSION}.gir)
+
+add_dependencies(vala ${gir_deps})
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libebook-contacts-${API_VERSION}.vapi
+       COMMAND ${VAPIGEN}
+               --vapidir=${CMAKE_CURRENT_SOURCE_DIR}
+               --vapidir=${CMAKE_CURRENT_BINARY_DIR}
+               --girdir=${CMAKE_BINARY_DIR}/libedataserver
+               --pkg libedataserver-${API_VERSION}
+               --pkg gio-2.0
+               --pkg libxml-2.0
+               --pkg libsoup-2.4
+               --pkg posix
+               --library libebook-contacts-${API_VERSION}
+               --metadatadir=${CMAKE_CURRENT_SOURCE_DIR}
+               ${gir_fullname}
+               ${CMAKE_CURRENT_SOURCE_DIR}/libebook-contacts-${API_VERSION}-custom.vala
+       DEPENDS libebook-contacts-${API_VERSION}.deps
+               libebook-contacts-${API_VERSION}-custom.vala
+               ${gir_fullname}
+               ${CMAKE_CURRENT_BINARY_DIR}/libedataserver-${API_VERSION}.vapi
+)
+
+# ***********************************
+# libebook
+# ***********************************
+
+set(gir_fullname ${CMAKE_BINARY_DIR}/addressbook/libebook/EBook-${API_VERSION}.gir)
+gir_girfilename_to_target(gir_deps EBook-${API_VERSION}.gir)
+
+add_dependencies(vala ${gir_deps})
+
+add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libebook-${API_VERSION}.vapi
+       COMMAND ${VAPIGEN}
+               --vapidir=${CMAKE_CURRENT_SOURCE_DIR}
+               --vapidir=${CMAKE_CURRENT_BINARY_DIR}
+               --girdir=${CMAKE_BINARY_DIR}/libedataserver
+               --girdir=${CMAKE_BINARY_DIR}/addressbook/libebook-contacts
+               --pkg libedataserver-${API_VERSION}
+               --pkg libebook-contacts-${API_VERSION}
+               --pkg gio-2.0
+               --pkg libxml-2.0
+               --pkg libsoup-2.4
+               --pkg posix
+               --library libebook-${API_VERSION}
+               --metadatadir=${CMAKE_CURRENT_SOURCE_DIR}
+               ${gir_fullname}
+       DEPENDS libebook-${API_VERSION}.deps
+               ${gir_fullname}
+               ${CMAKE_CURRENT_BINARY_DIR}/libedataserver-${API_VERSION}.vapi
+               ${CMAKE_CURRENT_BINARY_DIR}/libebook-contacts-${API_VERSION}.vapi
+)
+
+# ***********************************
+# Install all VAPI files
+# ***********************************
+
+add_custom_target(vala-files
+       DEPENDS ${valafiles}
+)
+
+add_dependencies(vala vala-files)
+
+install(FILES ${valafiles}
+       DESTINATION ${SHARE_INSTALL_DIR}/vala/vapi
+)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]