-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#338 arg_router_translation_generator isn't detecting changes in the …
…TOML files Fix #338
- Loading branch information
1 parent
e63c318
commit 4e925b8
Showing
10 changed files
with
126 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
### Copyright (C) 2023 by Camden Mannett. | ||
### Distributed under the Boost Software License, Version 1.0. | ||
### (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt) | ||
|
||
function(arg_router_translation_generator) | ||
set(single_value_args OUTPUT_DIR TARGET) | ||
set(multi_value_args SOURCES) | ||
cmake_parse_arguments(ARGS "" "${single_value_args}" "${multi_value_args}" ${ARGN}) | ||
|
||
if (NOT DEFINED ARGS_SOURCES) | ||
message(FATAL_ERROR "Translation generator requires at least one source file") | ||
endif() | ||
if (NOT DEFINED ARGS_OUTPUT_DIR) | ||
message(FATAL_ERROR "Translation generator output directory must be set, typically CMAKE_CURRENT_BINARY_DIR") | ||
endif() | ||
if (NOT DEFINED ARGS_TARGET) | ||
message(FATAL_ERROR "Translation generator requires a target output variable") | ||
endif() | ||
|
||
add_custom_target(${ARGS_TARGET} | ||
COMMAND ${CMAKE_COMMAND} | ||
"-DSOURCES=${ARGS_SOURCES}" | ||
-DOUTPUT_DIR=${ARGS_OUTPUT_DIR} | ||
-P ${CMAKE_SOURCE_DIR}/cmake/translation_generator/translation_generator_script.cmake | ||
SOURCES ${ARGS_SOURCES} | ||
"${CMAKE_SOURCE_DIR}/cmake/translation_generator/translation_generator_script.cmake" | ||
VERBATIM) | ||
|
||
# set_source_files_properties cannot be used in a script so that's set here | ||
foreach(source ${ARGS_SOURCES}) | ||
get_filename_component(language_id "${source}" NAME_WLE) | ||
set(output_file "${ARGS_OUTPUT_DIR}/${language_id}.hpp") | ||
|
||
target_sources(${ARGS_TARGET} PRIVATE "${output_file}") | ||
set_source_files_properties("${output_file}" PROPERTIES GENERATED TRUE) | ||
endforeach() | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters