[evolution-data-server/wip/cmake] Build Camel-1.2.gir without its .typelib for now



commit 80a56743d58a3be6c767117ff7bfef03c23cf9ae
Author: Milan Crha <mcrha redhat com>
Date:   Thu Sep 29 22:13:35 2016 +0200

    Build Camel-1.2.gir without its .typelib for now

 camel/CMakeLists.txt                     |   32 +++++++++++----------
 cmake/modules/GObjectIntrospection.cmake |   34 ++++++++++++----------
 vala/CMakeLists.txt                      |   45 ++++++++++++++---------------
 3 files changed, 57 insertions(+), 54 deletions(-)
---
diff --git a/camel/CMakeLists.txt b/camel/CMakeLists.txt
index 80e8428..40e236b 100644
--- a/camel/CMakeLists.txt
+++ b/camel/CMakeLists.txt
@@ -315,22 +315,24 @@ set(gir_libdirs)
 set(gir_libs camel)
 set(gir_deps)
 
-# Enable once the typelib will be buildable; the gi-r-compiler crashes with
+# Remove the below set() once the typelib will be buildable; the gi-r-compiler crashes with
 #    ERROR:girepository/girparser.c:343:state_switch: assertion failed: (ctx->state != newstate)
-#
-#gir_add_introspection_simple(
-#      Camel
-#      camel
-#      ${API_VERSION}
-#      "camel/camel.h"
-#      gir_identifies_prefixes
-#      gir_includes
-#      gir_cflags
-#      gir_libdirs
-#      gir_libs
-#      gir_deps
-#      gir_sources
-#)
+gir_construct_names(Camel ${API_VERSION} camel_gir_name camel_gir_vars_prefix)
+set(${camel_gir_vars_prefix}_SKIP_TYPELIB ON)
+
+gir_add_introspection_simple(
+       Camel
+       camel
+       ${API_VERSION}
+       "camel/camel.h"
+       gir_identifies_prefixes
+       gir_includes
+       gir_cflags
+       gir_libdirs
+       gir_libs
+       gir_deps
+       gir_sources
+)
 
 if(NOT WIN32)
        add_executable(camel-lock-helper
diff --git a/cmake/modules/GObjectIntrospection.cmake b/cmake/modules/GObjectIntrospection.cmake
index b4e77ba..1ca8811 100644
--- a/cmake/modules/GObjectIntrospection.cmake
+++ b/cmake/modules/GObjectIntrospection.cmake
@@ -68,6 +68,7 @@ macro(gir_girfilename_to_target _outvar _girfilename)
 endmacro(gir_girfilename_to_target)
 
 # the macro does something only if ENABLE_INTROSPECTION is ON
+# optionally ${_gir_name}_SKIP_TYPELIB can be set to ON to not build .typelib file, only the .gir file
 macro(gir_add_introspection gir)
        if(ENABLE_INTROSPECTION)
                set(_gir_girs)
@@ -129,23 +130,24 @@ macro(gir_add_introspection gir)
                )
                list(APPEND _gir_girs ${CMAKE_CURRENT_BINARY_DIR}/${gir})
                install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION ${SHARE_INSTALL_DIR}/gir-1.0)
-
-               string(REPLACE ".gir" ".typelib" _typelib "${gir}")
-               add_custom_command(
-                       COMMAND ${G_IR_COMPILER}
-                               ${INTROSPECTION_COMPILER_ARGS}
-                               --includedir=.
-                               ${CMAKE_CURRENT_BINARY_DIR}/${gir}
-                               -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}
-                       DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir}
-                       OUTPUT ${_typelib}
-                       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-               )
-               list(APPEND _gir_typelibs ${CMAKE_CURRENT_BINARY_DIR}/${_typelib})
-               install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION 
${LIB_INSTALL_DIR}/girepository-1.0)
-
                add_custom_target(gir-girs-${_gir_name} ALL DEPENDS ${_gir_girs})
-               add_custom_target(gir-typelibs-${_gir_name} ALL DEPENDS ${_gir_typelibs})
+
+               if(NOT DEFINED ${_gir_name}_SKIP_TYPELIB OR NOT ${${_gir_name}_SKIP_TYPELIB})
+                       string(REPLACE ".gir" ".typelib" _typelib "${gir}")
+                       add_custom_command(
+                               COMMAND ${G_IR_COMPILER}
+                                       ${INTROSPECTION_COMPILER_ARGS}
+                                       --includedir=.
+                                       ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+                                       -o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}
+                               DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir}
+                               OUTPUT ${_typelib}
+                               WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+                       )
+                       list(APPEND _gir_typelibs ${CMAKE_CURRENT_BINARY_DIR}/${_typelib})
+                       install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION 
${LIB_INSTALL_DIR}/girepository-1.0)
+                       add_custom_target(gir-typelibs-${_gir_name} ALL DEPENDS ${_gir_typelibs})
+               endif(NOT DEFINED ${_gir_name}_SKIP_TYPELIB OR NOT ${${_gir_name}_SKIP_TYPELIB})
        endif(ENABLE_INTROSPECTION)
 endmacro(gir_add_introspection)
 
diff --git a/vala/CMakeLists.txt b/vala/CMakeLists.txt
index 6798e1d..90f32c5 100644
--- a/vala/CMakeLists.txt
+++ b/vala/CMakeLists.txt
@@ -10,35 +10,34 @@ set(valafiles
 add_custom_target(vala ALL)
 
 # ***********************************
-# camel (currently conditionally compiled)
+# camel
 # ***********************************
 
 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_deps}
-                       ${gir_fullname}
-       )
-endif(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_deps}
+               ${gir_fullname}
+)
 
 # ***********************************
 # libedataserver


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