Fix the Vala module for CMake
It failed to depend on local vapis. At least I understand it again.
This commit is contained in:
parent
71617d4b14
commit
8052b2b754
|
@ -33,30 +33,25 @@ pkg_check_modules (dependencies REQUIRED gtk+-3.0 sqlite3 x11 xext xextproto)
|
||||||
# Precompile Vala sources
|
# Precompile Vala sources
|
||||||
include (ValaPrecompile)
|
include (ValaPrecompile)
|
||||||
|
|
||||||
set (HEADER_PATH "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.h")
|
set (config_path "${PROJECT_BINARY_DIR}/config.vala")
|
||||||
set (CONFIG_PATH "${PROJECT_BINARY_DIR}/config.vala")
|
configure_file (${PROJECT_SOURCE_DIR}/config.vala.in "${config_path}")
|
||||||
configure_file (${PROJECT_SOURCE_DIR}/config.vala.in ${CONFIG_PATH})
|
|
||||||
|
|
||||||
# I'm not sure what this was about, look at slovnik-gui for more comments
|
# I'm not sure what this was about, look at slovnik-gui for more comments;
|
||||||
set (SYMBOLS_PATH "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.def")
|
# seems to be so that symbols are exported for GModule to see
|
||||||
|
set (symbols_path "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.def")
|
||||||
|
|
||||||
vala_init (${PROJECT_NAME}
|
set (project_VALA_SOURCES ${config_path} ${PROJECT_NAME}.vala xsync.vapi)
|
||||||
PACKAGES gmodule-2.0 gio-2.0 gtk+-3.0 gee-0.8 sqlite3 x11
|
vala_precompile (${project_VALA_SOURCES}
|
||||||
CUSTOM_VAPIS ${PROJECT_SOURCE_DIR}/xsync.vapi)
|
|
||||||
vala_add (${PROJECT_NAME} ${CONFIG_PATH})
|
|
||||||
vala_add (${PROJECT_NAME} ${PROJECT_NAME}.vala DEPENDS config)
|
|
||||||
|
|
||||||
vala_finish (${PROJECT_NAME}
|
|
||||||
SOURCES project_VALA_SOURCES
|
|
||||||
OUTPUTS project_VALA_C
|
OUTPUTS project_VALA_C
|
||||||
GENERATE_HEADER ${HEADER_PATH}
|
HEADER ${PROJECT_NAME}.h
|
||||||
GENERATE_SYMBOLS ${SYMBOLS_PATH})
|
SYMBOLS ${symbols_path}
|
||||||
|
PACKAGES gmodule-2.0 gio-2.0 gtk+-3.0 gee-0.8 sqlite3 x11)
|
||||||
|
|
||||||
# Include Vala sources as header files, so they appear in the IDE
|
# Include Vala sources as header files, so they appear in the IDE
|
||||||
# but CMake doesn't try to compile them directly
|
# but CMake doesn't try to compile them directly
|
||||||
set_source_files_properties (${project_VALA_SOURCES}
|
set_source_files_properties (${project_VALA_SOURCES}
|
||||||
PROPERTIES HEADER_FILE_ONLY TRUE)
|
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||||
set (project_SOURCES ${project_VALA_SOURCES} ${project_VALA_C} ${SYMBOLS_PATH})
|
set (project_SOURCES ${project_VALA_SOURCES} ${project_VALA_C} ${symbols_path})
|
||||||
|
|
||||||
# Build the executable and install it
|
# Build the executable and install it
|
||||||
include_directories (${dependencies_INCLUDE_DIRS})
|
include_directories (${dependencies_INCLUDE_DIRS})
|
||||||
|
|
|
@ -43,6 +43,9 @@ Use this project's GitHub to report any bugs, request features, or submit pull
|
||||||
requests. If you want to discuss this project, or maybe just hang out with
|
requests. If you want to discuss this project, or maybe just hang out with
|
||||||
the developer, feel free to join me at irc://irc.janouch.name, channel #dev.
|
the developer, feel free to join me at irc://irc.janouch.name, channel #dev.
|
||||||
|
|
||||||
|
The in-source dependency comments are there for the VIM Syntastic Vala plugin.
|
||||||
|
Vala just makes all sorts of things complicated but it's a necessary evil here.
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
'wdmtg' is written by Přemysl Janouch <p.janouch@gmail.com>.
|
'wdmtg' is written by Přemysl Janouch <p.janouch@gmail.com>.
|
||||||
|
|
|
@ -6,28 +6,20 @@
|
||||||
# VALA_VERSION
|
# VALA_VERSION
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Copyright Přemysl Janouch 2011
|
# Copyright (c) 2011, 2016, Přemysl Janouch <p.janouch@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Permission to use, copy, modify, and/or distribute this software for any
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
# * Redistributions of source code must retain the above copyright
|
# copyright notice and this permission notice appear in all copies.
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
#
|
#
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
|
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
||||||
# OF SUCH DAMAGE.
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
find_program (VALA_COMPILER "valac")
|
find_program (VALA_COMPILER "valac")
|
||||||
|
|
|
@ -1,205 +1,175 @@
|
||||||
# - Precompilation of Vala/Genie source files into C sources
|
# - Precompilation of Vala/Genie source files into C sources
|
||||||
# Makes use of the parallel build ability introduced in Vala 0.11. Derived
|
# Makes use of the parallel build ability introduced in Vala 0.11.
|
||||||
# from a similar module by Jakob Westhoff and the original GNU Make rules.
|
# Might be a bit oversimplified and inefficient but at least it's short.
|
||||||
# Might be a bit oversimplified.
|
# Filenames must be unique within a single compilation unit and that's fine.
|
||||||
#
|
#
|
||||||
# This module defines three functions. The first one:
|
# vala_precompile (source... - .vala, .gs, .vapi
|
||||||
#
|
|
||||||
# vala_init (id
|
|
||||||
# [DIRECTORY dir] - Output directory (binary dir by default)
|
# [DIRECTORY dir] - Output directory (binary dir by default)
|
||||||
# [PACKAGES package...] - Package dependencies
|
# [PACKAGES package...] - Package dependencies
|
||||||
# [OPTIONS option...] - Extra valac options
|
# [OPTIONS option...] - Extra valac options
|
||||||
# [CUSTOM_VAPIS file...]) - Custom vapi files to include in the build
|
|
||||||
#
|
|
||||||
# initializes a single precompilation unit using the given arguments.
|
|
||||||
# You can put files into it via the following function:
|
|
||||||
#
|
|
||||||
# vala_add (id source.vala
|
|
||||||
# [DEPENDS source...]) - Vala/Genie source or .vapi dependencies
|
|
||||||
#
|
|
||||||
# Finally retrieve paths for generated C files by calling:
|
|
||||||
#
|
|
||||||
# vala_finish (id
|
|
||||||
# [SOURCES sources_var] - Input Vala/Genie sources
|
|
||||||
# [OUTPUTS outputs_var] - Output C sources
|
# [OUTPUTS outputs_var] - Output C sources
|
||||||
# [GENERATE_HEADER id.h - Generate id.h and id_internal.h
|
# [HEADER id.h - Generate id.h and id_internal.h
|
||||||
# [GENERATE_VAPI id.vapi] - Generate a vapi file
|
# [VAPI id.vapi] - Generate a vapi file
|
||||||
# [GENERATE_SYMBOLS id.def]]) - Generate a list of public symbols
|
# [SYMBOLS id.def]]) - Generate a list of public symbols
|
||||||
#
|
#
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# Copyright Přemysl Janouch 2011
|
# Copyright (c) 2011, 2016, Přemysl Janouch <p.janouch@gmail.com>
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Permission to use, copy, modify, and/or distribute this software for any
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
# * Redistributions of source code must retain the above copyright
|
# copyright notice and this permission notice appear in all copies.
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
#
|
#
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
|
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
||||||
# OF SUCH DAMAGE.
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
|
|
||||||
find_package (Vala 0.11 REQUIRED)
|
find_package (Vala 0.11 REQUIRED)
|
||||||
include (CMakeParseArguments)
|
include (CMakeParseArguments)
|
||||||
|
|
||||||
function (vala_init id)
|
macro (_vala_parse_source_path)
|
||||||
set (_multi_value PACKAGES OPTIONS CUSTOM_VAPIS)
|
get_filename_component (basename "${file}" NAME)
|
||||||
cmake_parse_arguments (arg "" "DIRECTORY" "${_multi_value}" ${ARGN})
|
get_filename_component (without_extension "${file}" NAME_WE)
|
||||||
|
set (output_vapi "${directory}/${without_extension}.vapi")
|
||||||
|
set (output_c "${directory}/${without_extension}.c")
|
||||||
|
endmacro ()
|
||||||
|
|
||||||
|
# XXX: it would be best to have it working without touching the vapi (which
|
||||||
|
# forces rebuilds even if the API doesn't change) but it appears this cannot
|
||||||
|
# be done in CMake (at least with make, with ninja it seems to be possible
|
||||||
|
# via stamps and BYPRODUCTS)
|
||||||
|
# TODO: check ${CMAKE_GENERATOR} and try to do better -> OUTPUT and "touch"
|
||||||
|
# a stamp, use BYPRODUCTS instead, ... maybe make a target for all stamps,
|
||||||
|
# then DEPEND on that target when precompiling. This should be enough.
|
||||||
|
function (_vala_make_fast file)
|
||||||
|
_vala_parse_source_path ()
|
||||||
|
add_custom_command (OUTPUT "${output_vapi}"
|
||||||
|
COMMAND ${VALA_COMPILER} "${file}" "--fast-vapi=${output_vapi}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch "${output_vapi}"
|
||||||
|
DEPENDS "${file}"
|
||||||
|
COMMENT "Generating a fast vapi for ${basename}" VERBATIM)
|
||||||
|
set (fast_vapi_deps ${fast_vapi_deps} "${output_vapi}" PARENT_SCOPE)
|
||||||
|
set (fast_vapi_args ${fast_vapi_args}
|
||||||
|
"--use-fast-vapi=${output_vapi}" PARENT_SCOPE)
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
function (_vala_make_c file)
|
||||||
|
_vala_parse_source_path ()
|
||||||
|
|
||||||
|
# We need to filter the current file back out or else it creates conflicts
|
||||||
|
set (fast_vapis ${fast_vapi_args})
|
||||||
|
list (REMOVE_ITEM fast_vapis "--use-fast-vapi=${output_vapi}")
|
||||||
|
|
||||||
|
add_custom_command (OUTPUT "${output_c}"
|
||||||
|
COMMAND ${VALA_COMPILER} "${file}" -C ${compiler_args} ${fast_vapis}
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E touch "${output_c}"
|
||||||
|
DEPENDS "${file}" ${fast_vapi_deps} ${vapis}
|
||||||
|
WORKING_DIRECTORY "${directory}"
|
||||||
|
COMMENT "Precompiling ${basename}" VERBATIM)
|
||||||
|
set (c_outputs ${c_outputs} "${output_c}" PARENT_SCOPE)
|
||||||
|
endfunction ()
|
||||||
|
|
||||||
|
function (vala_precompile)
|
||||||
|
set (_single_value DIRECTORY OUTPUTS HEADER VAPI SYMBOLS)
|
||||||
|
set (_multi_value PACKAGES OPTIONS)
|
||||||
|
cmake_parse_arguments (arg "" "${_single_value}" "${_multi_value}" ${ARGN})
|
||||||
|
|
||||||
|
set (directory ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
if (arg_DIRECTORY)
|
if (arg_DIRECTORY)
|
||||||
set (directory ${arg_DIRECTORY})
|
set (directory ${arg_DIRECTORY})
|
||||||
if (NOT IS_DIRECTORY ${directory})
|
if (NOT IS_DIRECTORY ${directory})
|
||||||
file (MAKE_DIRECTORY ${directory})
|
file (MAKE_DIRECTORY ${directory})
|
||||||
endif (NOT IS_DIRECTORY ${directory})
|
endif (NOT IS_DIRECTORY ${directory})
|
||||||
else (arg_DIRECTORY)
|
endif ()
|
||||||
set (directory ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
endif (arg_DIRECTORY)
|
|
||||||
|
|
||||||
set (pkg_opts)
|
set (sources)
|
||||||
foreach (pkg ${arg_PACKAGES})
|
set (vapis)
|
||||||
list (APPEND pkg_opts "--pkg=${pkg}")
|
foreach (_source ${arg_UNPARSED_ARGUMENTS})
|
||||||
endforeach (pkg)
|
if (NOT IS_ABSOLUTE "${_source}")
|
||||||
|
set (_source "${CMAKE_CURRENT_SOURCE_DIR}/${_source}")
|
||||||
|
endif ()
|
||||||
|
if (${_source} MATCHES "\\.vapi$")
|
||||||
|
list (APPEND vapis "${_source}")
|
||||||
|
else ()
|
||||||
|
list (APPEND sources "${_source}")
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
set (VALA_${id}_DIR "${directory}" PARENT_SCOPE)
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
set (VALA_${id}_ARGS ${pkg_opts} ${arg_OPTIONS}
|
|
||||||
${arg_CUSTOM_VAPIS} PARENT_SCOPE)
|
|
||||||
|
|
||||||
set (VALA_${id}_SOURCES "" PARENT_SCOPE)
|
set (fast_vapi_deps)
|
||||||
set (VALA_${id}_OUTPUTS "" PARENT_SCOPE)
|
set (fast_vapi_args)
|
||||||
set (VALA_${id}_FAST_VAPI_FILES "" PARENT_SCOPE)
|
foreach (_source ${sources})
|
||||||
set (VALA_${id}_FAST_VAPI_ARGS "" PARENT_SCOPE)
|
_vala_make_fast ("${_source}")
|
||||||
endfunction (vala_init)
|
endforeach ()
|
||||||
|
|
||||||
function (vala_add id file)
|
set (compiler_args)
|
||||||
cmake_parse_arguments (arg "" "" "DEPENDS" ${ARGN})
|
foreach (_pkg ${arg_PACKAGES})
|
||||||
|
list (APPEND compiler_args "--pkg=${_pkg}")
|
||||||
if (NOT IS_ABSOLUTE "${file}")
|
endforeach ()
|
||||||
set (file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
|
list (APPEND compiler_args ${arg_OPTIONS} ${vapis})
|
||||||
endif (NOT IS_ABSOLUTE "${file}")
|
|
||||||
|
|
||||||
get_filename_component (output_name "${file}" NAME)
|
|
||||||
get_filename_component (output_base "${file}" NAME_WE)
|
|
||||||
set (output_base "${VALA_${id}_DIR}/${output_base}")
|
|
||||||
|
|
||||||
# XXX: It would be best to have it working without touching the vapi
|
|
||||||
# but it appears this cannot be done in CMake.
|
|
||||||
add_custom_command (OUTPUT "${output_base}.vapi"
|
|
||||||
COMMAND ${VALA_COMPILER} "${file}" "--fast-vapi=${output_base}.vapi"
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch "${output_base}.vapi"
|
|
||||||
DEPENDS "${file}"
|
|
||||||
COMMENT "Generating a fast vapi for ${output_name}" VERBATIM)
|
|
||||||
|
|
||||||
set (vapi_opts)
|
|
||||||
set (vapi_depends)
|
|
||||||
foreach (vapi ${arg_DEPENDS})
|
|
||||||
if (NOT IS_ABSOLUTE "${vapi}")
|
|
||||||
set (vapi "${VALA_${id}_DIR}/${vapi}.vapi")
|
|
||||||
endif (NOT IS_ABSOLUTE "${vapi}")
|
|
||||||
|
|
||||||
list (APPEND vapi_opts "--use-fast-vapi=${vapi}")
|
|
||||||
list (APPEND vapi_depends "${vapi}")
|
|
||||||
endforeach (vapi)
|
|
||||||
|
|
||||||
add_custom_command (OUTPUT "${output_base}.c"
|
|
||||||
COMMAND ${VALA_COMPILER} "${file}" -C ${vapi_opts} ${VALA_${id}_ARGS}
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch "${output_base}.c"
|
|
||||||
DEPENDS "${file}" ${vapi_depends}
|
|
||||||
WORKING_DIRECTORY "${VALA_${id}_DIR}"
|
|
||||||
COMMENT "Precompiling ${output_name}" VERBATIM)
|
|
||||||
|
|
||||||
set (VALA_${id}_SOURCES ${VALA_${id}_SOURCES}
|
|
||||||
"${file}" PARENT_SCOPE)
|
|
||||||
set (VALA_${id}_OUTPUTS ${VALA_${id}_OUTPUTS}
|
|
||||||
"${output_base}.c" PARENT_SCOPE)
|
|
||||||
set (VALA_${id}_FAST_VAPI_FILES ${VALA_${id}_FAST_VAPI_FILES}
|
|
||||||
"${output_base}.vapi" PARENT_SCOPE)
|
|
||||||
set (VALA_${id}_FAST_VAPI_ARGS ${VALA_${id}_FAST_VAPI_ARGS}
|
|
||||||
"--use-fast-vapi=${output_base}.vapi" PARENT_SCOPE)
|
|
||||||
endfunction (vala_add)
|
|
||||||
|
|
||||||
function (vala_finish id)
|
|
||||||
set (_one_value SOURCES OUTPUTS
|
|
||||||
GENERATE_VAPI GENERATE_HEADER GENERATE_SYMBOLS)
|
|
||||||
cmake_parse_arguments (arg "" "${_one_value}" "" ${ARGN})
|
|
||||||
|
|
||||||
if (arg_SOURCES)
|
|
||||||
set (${arg_SOURCES} ${VALA_${id}_SOURCES} PARENT_SCOPE)
|
|
||||||
endif (arg_SOURCES)
|
|
||||||
|
|
||||||
|
set (c_outputs)
|
||||||
|
foreach (_source ${sources})
|
||||||
|
_vala_make_c ("${_source}")
|
||||||
|
endforeach ()
|
||||||
if (arg_OUTPUTS)
|
if (arg_OUTPUTS)
|
||||||
set (${arg_OUTPUTS} ${VALA_${id}_OUTPUTS} PARENT_SCOPE)
|
set (${arg_OUTPUTS} ${c_outputs} PARENT_SCOPE)
|
||||||
endif (arg_OUTPUTS)
|
endif (arg_OUTPUTS)
|
||||||
|
|
||||||
set (outputs)
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
set (extra_outputs)
|
||||||
set (export_args)
|
set (export_args)
|
||||||
|
|
||||||
if (arg_GENERATE_VAPI)
|
if (arg_VAPI)
|
||||||
if (NOT IS_ABSOLUTE "${arg_GENERATE_VAPI}")
|
if (NOT IS_ABSOLUTE "${arg_VAPI}")
|
||||||
set (arg_GENERATE_VAPI
|
set (arg_VAPI "${directory}/${arg_VAPI}")
|
||||||
"${VALA_${id}_DIR}/${arg_GENERATE_VAPI}")
|
endif ()
|
||||||
endif (NOT IS_ABSOLUTE "${arg_GENERATE_VAPI}")
|
list (APPEND extra_outputs "${arg_VAPI}")
|
||||||
|
list (APPEND export_args "--internal-vapi=${arg_VAPI}")
|
||||||
list (APPEND outputs "${arg_GENERATE_VAPI}")
|
if (NOT arg_HEADER)
|
||||||
list (APPEND export_args "--internal-vapi=${arg_GENERATE_VAPI}")
|
message (FATAL_ERROR "HEADER generation required for vapi")
|
||||||
|
endif ()
|
||||||
if (NOT arg_GENERATE_HEADER)
|
endif ()
|
||||||
message (FATAL_ERROR "Header generation required for vapi")
|
if (arg_SYMBOLS)
|
||||||
endif (NOT arg_GENERATE_HEADER)
|
if (NOT IS_ABSOLUTE "${arg_SYMBOLS}")
|
||||||
endif (arg_GENERATE_VAPI)
|
set (arg_SYMBOLS "${directory}/${arg_SYMBOLS}")
|
||||||
|
endif ()
|
||||||
if (arg_GENERATE_SYMBOLS)
|
list (APPEND extra_outputs "${arg_SYMBOLS}")
|
||||||
if (NOT IS_ABSOLUTE "${arg_GENERATE_SYMBOLS}")
|
list (APPEND export_args "--symbols=${arg_SYMBOLS}")
|
||||||
set (arg_GENERATE_SYMBOLS
|
if (NOT arg_HEADER)
|
||||||
"${VALA_${id}_DIR}/${arg_GENERATE_SYMBOLS}")
|
message (FATAL_ERROR "HEADER generation required for symbols")
|
||||||
endif (NOT IS_ABSOLUTE "${arg_GENERATE_SYMBOLS}")
|
endif ()
|
||||||
|
endif ()
|
||||||
list (APPEND outputs "${arg_GENERATE_SYMBOLS}")
|
if (arg_HEADER)
|
||||||
list (APPEND export_args "--symbols=${arg_GENERATE_SYMBOLS}")
|
if (NOT IS_ABSOLUTE "${arg_HEADER}")
|
||||||
|
set (arg_HEADER "${directory}/${arg_HEADER}")
|
||||||
if (NOT arg_GENERATE_HEADER)
|
endif ()
|
||||||
message (FATAL_ERROR "Header generation required for symbols")
|
get_filename_component (header_path "${arg_HEADER}" PATH)
|
||||||
endif (NOT arg_GENERATE_HEADER)
|
get_filename_component (header_name "${arg_HEADER}" NAME_WE)
|
||||||
endif (arg_GENERATE_SYMBOLS)
|
|
||||||
|
|
||||||
if (arg_GENERATE_HEADER)
|
|
||||||
if (NOT IS_ABSOLUTE "${arg_GENERATE_HEADER}")
|
|
||||||
set (arg_GENERATE_HEADER
|
|
||||||
"${VALA_${id}_DIR}/${arg_GENERATE_HEADER}")
|
|
||||||
endif (NOT IS_ABSOLUTE "${arg_GENERATE_HEADER}")
|
|
||||||
|
|
||||||
get_filename_component (header_path "${arg_GENERATE_HEADER}" PATH)
|
|
||||||
get_filename_component (header_name "${arg_GENERATE_HEADER}" NAME_WE)
|
|
||||||
set (header_base "${header_path}/${header_name}")
|
set (header_base "${header_path}/${header_name}")
|
||||||
get_filename_component (header_ext "${arg_GENERATE_HEADER}" EXT)
|
get_filename_component (header_ext "${arg_HEADER}" EXT)
|
||||||
|
|
||||||
list (APPEND outputs
|
list (APPEND extra_outputs
|
||||||
"${header_base}${header_ext}"
|
"${header_base}${header_ext}"
|
||||||
"${header_base}_internal${header_ext}")
|
"${header_base}_internal${header_ext}")
|
||||||
list (APPEND export_args
|
list (APPEND export_args
|
||||||
"--header=${header_base}${header_ext}"
|
"--header=${header_base}${header_ext}"
|
||||||
"--internal-header=${header_base}_internal${header_ext}")
|
"--internal-header=${header_base}_internal${header_ext}")
|
||||||
endif (arg_GENERATE_HEADER)
|
endif ()
|
||||||
|
if (extra_outputs)
|
||||||
if (outputs)
|
add_custom_command (OUTPUT ${extra_outputs}
|
||||||
add_custom_command (OUTPUT ${outputs}
|
COMMAND ${VALA_COMPILER}
|
||||||
COMMAND ${VALA_COMPILER} -C ${VALA_${id}_ARGS}
|
-C ${compiler_args} ${export_args} ${fast_vapi_args}
|
||||||
${export_args} ${VALA_${id}_FAST_VAPI_ARGS}
|
DEPENDS ${fast_vapi_deps} ${vapis}
|
||||||
DEPENDS ${VALA_${id}_FAST_VAPI_FILES}
|
|
||||||
COMMENT "Generating vapi/headers/symbols" VERBATIM)
|
COMMENT "Generating vapi/headers/symbols" VERBATIM)
|
||||||
endif (outputs)
|
endif ()
|
||||||
endfunction (vala_finish id)
|
endfunction ()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue