Interim fix for incremental compilation: Improves (but does not fix) #5117.
This commit is contained in:
parent
bf7c83dd43
commit
41e2c65f47
3 changed files with 61 additions and 52 deletions
|
|
@ -41,8 +41,12 @@ find_package(Vala REQUIRED)
|
|||
# of c files outputted by the vala compiler. This list can than be used in
|
||||
# conjuction with functions like "add_executable" or others to create the
|
||||
# neccessary compile rules with CMake.
|
||||
#
|
||||
# The second parameter provided is a unique name for the source bundle, which
|
||||
# is used to create a .stamp file that marks the last time the bundle was
|
||||
# compiled to C.
|
||||
#
|
||||
# The initial variable is followed by a list of .vala files to be compiled.
|
||||
# The initial variables are followed by a list of .vala files to be compiled.
|
||||
# Please take care to add every vala file belonging to the currently compiled
|
||||
# project or library as Vala will otherwise not be able to resolve all
|
||||
# dependencies.
|
||||
|
|
@ -77,7 +81,7 @@ find_package(Vala REQUIRED)
|
|||
# The following call is a simple example to the vala_precompile macro showing
|
||||
# an example to every of the optional sections:
|
||||
#
|
||||
# vala_precompile(VALA_C
|
||||
# vala_precompile(VALA_C mysourcebundle
|
||||
# source1.vala
|
||||
# source2.vala
|
||||
# source3.vala
|
||||
|
|
@ -101,39 +105,47 @@ find_package(Vala REQUIRED)
|
|||
# file names after the call.
|
||||
##
|
||||
|
||||
macro(vala_precompile output)
|
||||
macro(vala_precompile output source_bundle_name)
|
||||
parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN})
|
||||
|
||||
if(ARGS_DIRECTORY)
|
||||
set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY})
|
||||
else(ARGS_DIRECTORY)
|
||||
set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
endif(ARGS_DIRECTORY)
|
||||
|
||||
include_directories(${DIRECTORY})
|
||||
|
||||
set(vala_pkg_opts "")
|
||||
foreach(pkg ${ARGS_PACKAGES})
|
||||
list(APPEND vala_pkg_opts "--pkg=${pkg}")
|
||||
endforeach(pkg ${ARGS_PACKAGES})
|
||||
|
||||
set(in_files "")
|
||||
set(out_files "")
|
||||
set(${output} "")
|
||||
foreach(src ${ARGS_DEFAULT_ARGS})
|
||||
string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" src ${src})
|
||||
string(REGEX MATCH "^/" IS_MATCHED ${src})
|
||||
|
||||
if(${IS_MATCHED} MATCHES "/")
|
||||
list(APPEND in_files "${src}")
|
||||
set(in_file ${src})
|
||||
else()
|
||||
list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
|
||||
set(in_file "${CMAKE_CURRENT_SOURCE_DIR}/${src}")
|
||||
endif()
|
||||
|
||||
string(REPLACE ".vala" ".c" src ${src})
|
||||
string(REPLACE ".gs" ".c" src ${src})
|
||||
|
||||
if(${IS_MATCHED} MATCHES "/")
|
||||
get_filename_component(VALA_FILE_NAME ${src} NAME)
|
||||
set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}")
|
||||
list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}")
|
||||
else()
|
||||
set(out_file "${DIRECTORY}/${src}")
|
||||
list(APPEND out_files "${DIRECTORY}/${src}")
|
||||
endif()
|
||||
|
||||
list(APPEND in_files ${in_file})
|
||||
list(APPEND out_files ${out_file})
|
||||
list(APPEND ${output} ${out_file})
|
||||
endforeach(src ${ARGS_DEFAULT_ARGS})
|
||||
|
||||
|
|
@ -142,19 +154,21 @@ macro(vala_precompile output)
|
|||
foreach(vapi ${ARGS_CUSTOM_VAPIS})
|
||||
if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
|
||||
list(APPEND custom_vapi_arguments ${vapi})
|
||||
else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
|
||||
else(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
|
||||
list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi})
|
||||
endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR})
|
||||
endforeach(vapi ${ARGS_CUSTOM_VAPIS})
|
||||
endif(ARGS_CUSTOM_VAPIS)
|
||||
|
||||
set(STAMP_FILE ".${source_bundle_name}.stamp")
|
||||
|
||||
set(vapi_arguments "")
|
||||
if(ARGS_GENERATE_VAPI)
|
||||
list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi")
|
||||
set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi")
|
||||
|
||||
|
||||
# Header and internal header is needed to generate internal vapi
|
||||
if (NOT ARGS_GENERATE_HEADER)
|
||||
if(NOT ARGS_GENERATE_HEADER)
|
||||
set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI})
|
||||
endif(NOT ARGS_GENERATE_HEADER)
|
||||
endif(ARGS_GENERATE_VAPI)
|
||||
|
|
@ -167,9 +181,9 @@ macro(vala_precompile output)
|
|||
list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h")
|
||||
endif(ARGS_GENERATE_HEADER)
|
||||
|
||||
add_custom_command(OUTPUT ${out_files}
|
||||
COMMAND
|
||||
${VALA_EXECUTABLE}
|
||||
add_custom_command(OUTPUT ${STAMP_FILE}
|
||||
COMMAND
|
||||
${VALA_EXECUTABLE}
|
||||
ARGS
|
||||
"-C"
|
||||
${header_arguments}
|
||||
|
|
@ -180,8 +194,15 @@ macro(vala_precompile output)
|
|||
${ARGS_OPTIONS}
|
||||
${in_files}
|
||||
${custom_vapi_arguments}
|
||||
COMMAND
|
||||
touch
|
||||
ARGS
|
||||
${STAMP_FILE}
|
||||
DEPENDS
|
||||
${in_files}
|
||||
${in_files}
|
||||
${ARGS_CUSTOM_VAPIS}
|
||||
)
|
||||
|
||||
add_custom_command(OUTPUT ${out_files} DEPENDS ${STAMP_FILE})
|
||||
endmacro(vala_precompile)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
# This file is merely to give Valencia (http://trac.yorba.org/wiki/Valencia) an indicator of the
|
||||
# Geary project root. This file can be removed when this bug is fixed:
|
||||
#
|
||||
# http://trac.yorba.org/ticket/3410
|
||||
|
|
@ -299,9 +299,17 @@ set(LIB_PATHS ${DEPS_LIBRARY_DIRS})
|
|||
link_directories(${LIB_PATHS})
|
||||
add_definitions(${CFLAGS})
|
||||
|
||||
set(VALAC_OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/vapi
|
||||
--thread
|
||||
--enable-checking
|
||||
--debug
|
||||
--fatal-warnings
|
||||
)
|
||||
|
||||
# Engine (static library used for building)
|
||||
#################################################
|
||||
vala_precompile(ENGINE_VALA_C
|
||||
vala_precompile(ENGINE_VALA_C geary-static
|
||||
${ENGINE_SRC}
|
||||
${COMMON_SRC}
|
||||
PACKAGES
|
||||
|
|
@ -310,11 +318,7 @@ PACKAGES
|
|||
GENERATE_VAPI
|
||||
geary-static
|
||||
OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/vapi
|
||||
--thread
|
||||
--enable-checking
|
||||
--debug
|
||||
--fatal-warnings
|
||||
${VALAC_OPTIONS}
|
||||
)
|
||||
|
||||
add_library(geary-static STATIC ${ENGINE_VALA_C})
|
||||
|
|
@ -322,19 +326,16 @@ target_link_libraries(geary-static ${DEPS_LIBRARIES} gthread-2.0)
|
|||
|
||||
# Geary client app
|
||||
#################################################
|
||||
vala_precompile(GEARY_VALA_C
|
||||
vala_precompile(GEARY_VALA_C geary
|
||||
${CLIENT_SRC}
|
||||
PACKAGES
|
||||
${CLIENT_PACKAGES}
|
||||
${ENGINE_PACKAGES}
|
||||
geary-static
|
||||
CUSTOM_VAPIS
|
||||
"${CMAKE_BINARY_DIR}/src/geary-static.vapi"
|
||||
OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/vapi
|
||||
${VALAC_OPTIONS}
|
||||
--vapidir=${CMAKE_BINARY_DIR}/src
|
||||
--thread
|
||||
--enable-checking
|
||||
--debug
|
||||
--fatal-warnings
|
||||
)
|
||||
|
||||
add_executable(geary ${GEARY_VALA_C})
|
||||
|
|
@ -354,19 +355,16 @@ add_schemas(geary ${GSETTINGS_DIR})
|
|||
|
||||
# Console app
|
||||
#################################################
|
||||
vala_precompile(CONSOLE_VALA_C
|
||||
vala_precompile(CONSOLE_VALA_C geary-console
|
||||
${CONSOLE_SRC}
|
||||
PACKAGES
|
||||
${CONSOLE_PACKAGES}
|
||||
${ENGINE_PACKAGES}
|
||||
geary-static
|
||||
CUSTOM_VAPIS
|
||||
"${CMAKE_BINARY_DIR}/src/geary-static.vapi"
|
||||
OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/vapi
|
||||
${VALAC_OPTIONS}
|
||||
--vapidir=${CMAKE_BINARY_DIR}/src
|
||||
--thread
|
||||
--enable-checking
|
||||
--debug
|
||||
--fatal-warnings
|
||||
)
|
||||
|
||||
add_executable(geary-console ${CONSOLE_VALA_C})
|
||||
|
|
@ -381,18 +379,15 @@ add_custom_command(
|
|||
|
||||
# Mailer app
|
||||
#################################################
|
||||
vala_precompile(MAILER_VALA_C
|
||||
vala_precompile(MAILER_VALA_C geary-mailer
|
||||
${MAILER_SRC}
|
||||
PACKAGES
|
||||
${ENGINE_PACKAGES}
|
||||
geary-static
|
||||
CUSTOM_VAPIS
|
||||
"${CMAKE_BINARY_DIR}/src/geary-static.vapi"
|
||||
OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/vapi
|
||||
${VALAC_OPTIONS}
|
||||
--vapidir=${CMAKE_BINARY_DIR}/src
|
||||
--thread
|
||||
--enable-checking
|
||||
--debug
|
||||
--fatal-warnings
|
||||
)
|
||||
|
||||
add_executable(geary-mailer ${MAILER_VALA_C})
|
||||
|
|
@ -407,19 +402,16 @@ add_custom_command(
|
|||
|
||||
# DBus Service
|
||||
#################################################
|
||||
vala_precompile(DBUS_VALA_C
|
||||
vala_precompile(DBUS_VALA_C gearyd
|
||||
${DBUSSERVICE_SRC}
|
||||
PACKAGES
|
||||
${DBUSSERVICE_PACKAGES}
|
||||
${ENGINE_PACKAGES}
|
||||
geary-static
|
||||
CUSTOM_VAPIS
|
||||
"${CMAKE_BINARY_DIR}/src/geary-static.vapi"
|
||||
OPTIONS
|
||||
--vapidir=${CMAKE_SOURCE_DIR}/vapi
|
||||
${VALAC_OPTIONS}
|
||||
--vapidir=${CMAKE_BINARY_DIR}/src
|
||||
--thread
|
||||
--enable-checking
|
||||
--debug
|
||||
--fatal-warnings
|
||||
)
|
||||
|
||||
add_executable(gearyd ${DBUS_VALA_C})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue