mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:27:35 +00:00
CMake: Add custom target to build only the generated sources
This is needed so all headers and files exist on disk, so that the sonar cloud analyzer can find them when executing the compilation commands contained in compile_commands.json, without actually building. Co-authored-by: Andrew Kaster <akaster@serenityos.org>
This commit is contained in:
parent
779cf49f38
commit
619200774b
6 changed files with 32 additions and 0 deletions
|
@ -15,6 +15,7 @@ function(compile_gml source output string_name)
|
|||
)
|
||||
get_filename_component(output_name ${output} NAME)
|
||||
add_custom_target(generate_${output_name} DEPENDS ${output})
|
||||
add_dependencies(all_generated generate_${output_name})
|
||||
endfunction()
|
||||
|
||||
function(compile_ipc source output)
|
||||
|
@ -30,6 +31,7 @@ function(compile_ipc source output)
|
|||
)
|
||||
get_filename_component(output_name ${output} NAME)
|
||||
add_custom_target(generate_${output_name} DEPENDS ${output})
|
||||
add_dependencies(all_generated generate_${output_name})
|
||||
endfunction()
|
||||
|
||||
function(generate_state_machine source header)
|
||||
|
@ -51,5 +53,6 @@ function(generate_state_machine source header)
|
|||
MAIN_DEPENDENCY ${source}
|
||||
)
|
||||
add_custom_target(${target_name} DEPENDS ${output})
|
||||
add_dependencies(all_generated ${target_name})
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
|
@ -121,12 +121,15 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
|||
set(UNICODE_LOCALE_HEADER LibUnicode/UnicodeLocale.h)
|
||||
set(UNICODE_LOCALE_IMPLEMENTATION LibUnicode/UnicodeLocale.cpp)
|
||||
|
||||
set(UNICODE_META_TARGET_PREFIX LibUnicode_)
|
||||
|
||||
if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibUnicode") # Serenity build.
|
||||
set(UNICODE_DATA_HEADER UnicodeData.h)
|
||||
set(UNICODE_DATA_IMPLEMENTATION UnicodeData.cpp)
|
||||
|
||||
set(UNICODE_LOCALE_HEADER UnicodeLocale.h)
|
||||
set(UNICODE_LOCALE_IMPLEMENTATION UnicodeLocale.cpp)
|
||||
set(UNICODE_META_TARGET_PREFIX "")
|
||||
endif()
|
||||
|
||||
add_custom_command(
|
||||
|
@ -135,6 +138,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
|||
VERBATIM
|
||||
DEPENDS GenerateUnicodeData ${UNICODE_DATA_PATH} ${SPECIAL_CASING_PATH} ${DERIVED_GENERAL_CATEGORY_PATH} ${PROP_LIST_PATH} ${DERIVED_CORE_PROP_PATH} ${DERIVED_BINARY_PROP_PATH} ${PROP_ALIAS_PATH} ${PROP_VALUE_ALIAS_PATH} ${SCRIPTS_PATH} ${SCRIPT_EXTENSIONS_PATH} ${EMOJI_DATA_PATH} ${NORM_PROPS_PATH}
|
||||
)
|
||||
add_custom_target(generate_${UNICODE_META_TARGET_PREFIX}UnicodeData DEPENDS ${UNICODE_DATA_HEADER} ${UNICODE_DATA_IMPLEMENTATION})
|
||||
add_dependencies(all_generated generate_${UNICODE_META_TARGET_PREFIX}UnicodeData)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION}
|
||||
|
@ -142,6 +147,8 @@ if (ENABLE_UNICODE_DATABASE_DOWNLOAD)
|
|||
VERBATIM
|
||||
DEPENDS GenerateUnicodeLocale ${CLDR_LOCALES_PATH} ${CLDR_NUMBERS_PATH}
|
||||
)
|
||||
add_custom_target(generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale DEPENDS ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
|
||||
add_dependencies(all_generated generate_${UNICODE_META_TARGET_PREFIX}UnicodeLocale)
|
||||
|
||||
set(UNICODE_DATA_SOURCES ${UNICODE_DATA_HEADER} ${UNICODE_DATA_IMPLEMENTATION} ${UNICODE_LOCALE_HEADER} ${UNICODE_LOCALE_IMPLEMENTATION})
|
||||
endif()
|
||||
|
|
|
@ -24,6 +24,7 @@ function(serenity_generated_sources target_name)
|
|||
foreach(generated ${GENERATED_SOURCES})
|
||||
get_filename_component(generated_name ${generated} NAME)
|
||||
add_dependencies(${target_name} generate_${generated_name})
|
||||
add_dependencies(all_generated generate_${generated_name})
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
|
|
@ -227,6 +227,12 @@ if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER)
|
|||
endif()
|
||||
|
||||
if (BUILD_LAGOM)
|
||||
|
||||
if (NOT TARGET all_generated)
|
||||
# Meta target to run all code-gen steps in the build.
|
||||
add_custom_target(all_generated)
|
||||
endif()
|
||||
|
||||
# Lagom Libraries
|
||||
|
||||
# Archive
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue