CMake: merge created header+vapi files into a single directory

This commit is contained in:
Marvin W 2017-03-11 23:20:25 +01:00
parent 083df7e737
commit cd6b904e97
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
7 changed files with 49 additions and 34 deletions

View file

@ -18,7 +18,8 @@ endif()
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 (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") 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) set (VALA_CFLAGS -Wno-deprecated-declarations -Wno-incompatible-pointer-types -Wno-int-conversion -Wno-discarded-qualifiers)
add_subdirectory(gpgme-vala) add_subdirectory(gpgme-vala)

View file

@ -115,7 +115,7 @@ function(_vala_mkdir_for_file file)
endfunction() endfunction()
function(vala_precompile output) function(vala_precompile output)
cmake_parse_arguments(ARGS "FAST_VAPI" "DIRECTORY;GENERATE_HEADER;GENERATE_VAPI" 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;GRESOURCES" ${ARGN})
set(ARGS_FAST_VAPI true) set(ARGS_FAST_VAPI true)
@ -125,7 +125,13 @@ function(vala_precompile output)
else(ARGS_DIRECTORY) else(ARGS_DIRECTORY)
set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
endif(ARGS_DIRECTORY) endif(ARGS_DIRECTORY)
include_directories(${DIRECTORY}) if(ARGS_EXPORTS_DIR)
set(ARGS_EXPORTS_DIR ${CMAKE_BINARY_DIR}/${ARGS_EXPORTS_DIR})
else(ARGS_EXPORTS_DIR)
set(ARGS_EXPORTS_DIR ${CMAKE_BINARY_DIR}/exports)
endif(ARGS_EXPORTS_DIR)
file(MAKE_DIRECTORY "${ARGS_EXPORTS_DIR}")
include_directories(${DIRECTORY} ${ARGS_EXPORTS_DIR})
set(vala_pkg_opts "") set(vala_pkg_opts "")
foreach(pkg ${ARGS_PACKAGES}) foreach(pkg ${ARGS_PACKAGES})
@ -160,9 +166,9 @@ function(vala_precompile output)
set(vapi_arguments "") set(vapi_arguments "")
if(ARGS_GENERATE_VAPI) if(ARGS_GENERATE_VAPI)
list(APPEND out_extra_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi") list(APPEND out_extra_files "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}.vapi")
list(APPEND out_extra_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}-internal.vapi") list(APPEND out_extra_files "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}_internal.vapi")
set(vapi_arguments "--vapi=${ARGS_GENERATE_VAPI}.vapi" "--internal-vapi=${ARGS_GENERATE_VAPI}-internal.vapi") set(vapi_arguments "--vapi=${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}.vapi" "--internal-vapi=${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_VAPI}_internal.vapi")
# Header and internal header is needed to generate internal vapi # Header and internal header is needed to generate internal vapi
if (NOT ARGS_GENERATE_HEADER) if (NOT ARGS_GENERATE_HEADER)
@ -172,10 +178,10 @@ function(vala_precompile output)
set(header_arguments "") set(header_arguments "")
if(ARGS_GENERATE_HEADER) if(ARGS_GENERATE_HEADER)
list(APPEND out_extra_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h") list(APPEND out_extra_files "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_HEADER}.h")
list(APPEND out_extra_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") list(APPEND out_extra_files "${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_HEADER}_internal.h")
list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h") list(APPEND header_arguments "--header=${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_HEADER}.h")
list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") list(APPEND header_arguments "--internal-header=${ARGS_EXPORTS_DIR}/${ARGS_GENERATE_HEADER}_internal.h")
endif(ARGS_GENERATE_HEADER) endif(ARGS_GENERATE_HEADER)
if(ARGS_FAST_VAPI) if(ARGS_FAST_VAPI)

View file

@ -24,7 +24,7 @@ GENERATE_VAPI
GENERATE_HEADER GENERATE_HEADER
gpgme-vala gpgme-vala
OPTIONS OPTIONS
-g ${GLOBAL_DEBUG_FLAGS}
--thread --thread
) )
@ -33,16 +33,26 @@ add_definitions(${CFLAGS})
add_library(gpgme-vala SHARED ${GPGME_VALA_C} src/gpgme_fix.c) add_library(gpgme-vala SHARED ${GPGME_VALA_C} src/gpgme_fix.c)
target_link_libraries(gpgme-vala ${GPGME_VALA_LIBRARIES} ${GPGME_LIBRARIES}) target_link_libraries(gpgme-vala ${GPGME_VALA_LIBRARIES} ${GPGME_LIBRARIES})
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h"
COMMAND COMMAND
cat "${CMAKE_BINARY_DIR}/gpgme-vala/gpgme-vala.vapi" "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi" > "${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi" cp "${CMAKE_CURRENT_SOURCE_DIR}/src/gpgme_fix.h" "${CMAKE_BINARY_DIR}/exports/gpgme_fix.h"
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/gpgme-vala/gpgme-vala.vapi "${CMAKE_CURRENT_SOURCE_DIR}/src/gpgme_fix.h"
COMMENT
Copy header file gpgme_fix.h
)
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/exports/gpgme.vapi
COMMAND
cat "${CMAKE_BINARY_DIR}/exports/gpgme-vala.vapi" "${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi" > "${CMAKE_BINARY_DIR}/exports/gpgme.vapi"
DEPENDS
${CMAKE_BINARY_DIR}/exports/gpgme-vala.vapi
${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi ${CMAKE_CURRENT_SOURCE_DIR}/vapi/gpgme_public.vapi
) )
add_custom_target(gpgme-vapi add_custom_target(gpgme-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi ${CMAKE_BINARY_DIR}/exports/gpgme_fix.h
${CMAKE_BINARY_DIR}/exports/gpgme.vapi
) )

View file

@ -129,9 +129,9 @@ SOURCES
src/ui/unified_window.vala src/ui/unified_window.vala
src/ui/util.vala src/ui/util.vala
CUSTOM_VAPIS CUSTOM_VAPIS
"${CMAKE_BINARY_DIR}/xmpp-vala/xmpp-vala.vapi" "${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi"
"${CMAKE_BINARY_DIR}/qlite/qlite.vapi" "${CMAKE_BINARY_DIR}/exports/qlite.vapi"
"${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi" "${CMAKE_BINARY_DIR}/exports/gpgme.vapi"
PACKAGES PACKAGES
${LIBDINO_PACKAGES} ${LIBDINO_PACKAGES}
GENERATE_VAPI GENERATE_VAPI
@ -142,11 +142,11 @@ GRESOURCES
${LIBDINO_GRESOURCES_XML} ${LIBDINO_GRESOURCES_XML}
OPTIONS OPTIONS
--target-glib=2.38 --target-glib=2.38
-g ${GLOBAL_DEBUG_FLAGS}
--thread --thread
) )
set(CFLAGS ${VALA_CFLAGS} ${LIBDINO_CFLAGS} -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite -I${CMAKE_BINARY_DIR}/gpgme-vala -I${CMAKE_SOURCE_DIR}/gpgme-vala/src) set(CFLAGS ${VALA_CFLAGS} ${LIBDINO_CFLAGS})
add_definitions(${CFLAGS}) add_definitions(${CFLAGS})
add_library(libdino SHARED ${LIBDINO_VALA_C} ${LIBDINO_GRESOURCES_TARGET}) add_library(libdino SHARED ${LIBDINO_VALA_C} ${LIBDINO_GRESOURCES_TARGET})
add_dependencies(libdino xmpp-vala-vapi qlite-vapi gpgme-vapi) add_dependencies(libdino xmpp-vala-vapi qlite-vapi gpgme-vapi)
@ -155,5 +155,5 @@ set_target_properties(libdino PROPERTIES PREFIX "")
add_custom_target(dino-vapi add_custom_target(dino-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/libdino/dino.vapi ${CMAKE_BINARY_DIR}/exports/dino.vapi
) )

View file

@ -17,18 +17,18 @@ vala_precompile(MAIN_VALA_C
SOURCES SOURCES
src/main.vala src/main.vala
CUSTOM_VAPIS CUSTOM_VAPIS
${CMAKE_BINARY_DIR}/xmpp-vala/xmpp-vala.vapi ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
${CMAKE_BINARY_DIR}/qlite/qlite.vapi ${CMAKE_BINARY_DIR}/exports/qlite.vapi
${CMAKE_BINARY_DIR}/libdino/dino.vapi ${CMAKE_BINARY_DIR}/exports/dino_internal.vapi
PACKAGES PACKAGES
${MAIN_PACKAGES} ${MAIN_PACKAGES}
OPTIONS OPTIONS
--target-glib=2.38 --target-glib=2.38
-g ${GLOBAL_DEBUG_FLAGS}
--thread --thread
) )
set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS} -I${CMAKE_BINARY_DIR}/xmpp-vala -I${CMAKE_BINARY_DIR}/qlite -I${CMAKE_BINARY_DIR}/libdino) set(CFLAGS ${VALA_CFLAGS} ${MAIN_CFLAGS})
add_definitions(${CFLAGS}) add_definitions(${CFLAGS})
add_executable(dino ${MAIN_VALA_C}) add_executable(dino ${MAIN_VALA_C})
add_dependencies(dino dino-vapi) add_dependencies(dino dino-vapi)

View file

@ -29,9 +29,8 @@ GENERATE_VAPI
GENERATE_HEADER GENERATE_HEADER
qlite qlite
OPTIONS OPTIONS
-g ${GLOBAL_DEBUG_FLAGS}
--thread --thread
--vapidir=${CMAKE_SOURCE_DIR}/vapi
) )
set(CFLAGS ${VALA_CFLAGS} ${QLITE_CFLAGS}) set(CFLAGS ${VALA_CFLAGS} ${QLITE_CFLAGS})
@ -41,6 +40,6 @@ target_link_libraries(qlite ${QLITE_LIBRARIES})
add_custom_target(qlite-vapi add_custom_target(qlite-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/qlite/qlite.vapi ${CMAKE_BINARY_DIR}/exports/qlite.vapi
) )

View file

@ -66,7 +66,7 @@ SOURCES
"src/module/xep/pixbuf_storage.vala" "src/module/xep/pixbuf_storage.vala"
CUSTOM_VAPIS CUSTOM_VAPIS
"${CMAKE_CURRENT_SOURCE_DIR}/vapi/uuid.vapi" "${CMAKE_CURRENT_SOURCE_DIR}/vapi/uuid.vapi"
"${CMAKE_BINARY_DIR}/gpgme-vala/gpgme.vapi" "${CMAKE_BINARY_DIR}/exports/gpgme.vapi"
PACKAGES PACKAGES
${ENGINE_PACKAGES} ${ENGINE_PACKAGES}
GENERATE_VAPI GENERATE_VAPI
@ -75,12 +75,11 @@ GENERATE_HEADER
xmpp-vala xmpp-vala
OPTIONS OPTIONS
--target-glib=2.38 --target-glib=2.38
-g ${GLOBAL_DEBUG_FLAGS}
--thread --thread
--vapidir=${CMAKE_SOURCE_DIR}/vapi
) )
set(CFLAGS ${VALA_CFLAGS} ${ENGINE_CFLAGS} ${GPGME_CFLAGS} ${LIBUUID_CFLAGS} -I${CMAKE_BINARY_DIR}/gpgme-vala -I${CMAKE_SOURCE_DIR}/gpgme-vala/src) set(CFLAGS ${VALA_CFLAGS} ${ENGINE_CFLAGS} ${GPGME_CFLAGS} ${LIBUUID_CFLAGS})
add_definitions(${CFLAGS}) add_definitions(${CFLAGS})
add_library(xmpp-vala SHARED ${ENGINE_VALA_C}) add_library(xmpp-vala SHARED ${ENGINE_VALA_C})
add_dependencies(xmpp-vala gpgme-vapi) add_dependencies(xmpp-vala gpgme-vapi)
@ -88,6 +87,6 @@ target_link_libraries(xmpp-vala gpgme-vala ${ENGINE_LIBRARIES} ${GPGME_LIBRARIES
add_custom_target(xmpp-vala-vapi add_custom_target(xmpp-vala-vapi
DEPENDS DEPENDS
${CMAKE_BINARY_DIR}/xmpp-vala/xmpp-vala.vapi ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi
) )