mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +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
Notes:
sideshowbarker
2024-07-18 05:05:35 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/619200774bc Pull-request: https://github.com/SerenityOS/serenity/pull/9681 Reviewed-by: https://github.com/ADKaster
6 changed files with 32 additions and 0 deletions
|
@ -45,6 +45,9 @@ option(BUILD_LAGOM "Build parts of the system targeting the host OS for fuzzing/
|
|||
option(ENABLE_KERNEL_LTO "Build the kernel with link-time optimization" OFF)
|
||||
option(USE_CLANG_TOOLCHAIN "Build the kernel with the experimental Clang toolchain" OFF)
|
||||
|
||||
# Meta target to run all code-gen steps in the build.
|
||||
add_custom_target(all_generated)
|
||||
|
||||
add_custom_target(run
|
||||
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_ARCH=${SERENITY_ARCH}" "${SerenityOS_SOURCE_DIR}/Meta/run.sh"
|
||||
USES_TERMINAL
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -281,11 +281,17 @@ function(libweb_js_wrapper class)
|
|||
)
|
||||
endforeach()
|
||||
add_custom_target(generate_${basename}Wrapper.h DEPENDS Bindings/${basename}Wrapper.h)
|
||||
add_dependencies(all_generated generate_${basename}Wrapper.h)
|
||||
add_custom_target(generate_${basename}Wrapper.cpp DEPENDS Bindings/${basename}Wrapper.cpp)
|
||||
add_dependencies(all_generated generate_${basename}Wrapper.cpp)
|
||||
add_custom_target(generate_${basename}Constructor.h DEPENDS Bindings/${basename}Constructor.h)
|
||||
add_dependencies(all_generated generate_${basename}Constructor.h)
|
||||
add_custom_target(generate_${basename}Constructor.cpp DEPENDS Bindings/${basename}Constructor.cpp)
|
||||
add_dependencies(all_generated generate_${basename}Constructor.cpp)
|
||||
add_custom_target(generate_${basename}Prototype.h DEPENDS Bindings/${basename}Prototype.h)
|
||||
add_dependencies(all_generated generate_${basename}Prototype.h)
|
||||
add_custom_target(generate_${basename}Prototype.cpp DEPENDS Bindings/${basename}Prototype.cpp)
|
||||
add_dependencies(all_generated generate_${basename}Prototype.cpp)
|
||||
endfunction()
|
||||
|
||||
libweb_js_wrapper(CSS/CSSStyleDeclaration)
|
||||
|
@ -411,6 +417,7 @@ add_custom_command(
|
|||
MAIN_DEPENDENCY CSS/Properties.json
|
||||
)
|
||||
add_custom_target(generate_PropertyID.h DEPENDS CSS/PropertyID.h)
|
||||
add_dependencies(all_generated generate_PropertyID.h)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT CSS/PropertyID.cpp
|
||||
|
@ -423,6 +430,7 @@ add_custom_command(
|
|||
MAIN_DEPENDENCY CSS/Properties.json
|
||||
)
|
||||
add_custom_target(generate_PropertyID.cpp DEPENDS CSS/PropertyID.cpp)
|
||||
add_dependencies(all_generated generate_PropertyID.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT CSS/ValueID.h
|
||||
|
@ -435,6 +443,7 @@ add_custom_command(
|
|||
MAIN_DEPENDENCY CSS/Identifiers.json
|
||||
)
|
||||
add_custom_target(generate_ValueID.h DEPENDS CSS/ValueID.h)
|
||||
add_dependencies(all_generated generate_ValueID.h)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT CSS/ValueID.cpp
|
||||
|
@ -447,6 +456,7 @@ add_custom_command(
|
|||
MAIN_DEPENDENCY CSS/Identifiers.json
|
||||
)
|
||||
add_custom_target(generate_ValueID.cpp DEPENDS CSS/ValueID.cpp)
|
||||
add_dependencies(all_generated generate_ValueID.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT CSS/DefaultStyleSheetSource.cpp
|
||||
|
@ -459,6 +469,7 @@ add_custom_command(
|
|||
MAIN_DEPENDENCY CSS/Default.css
|
||||
)
|
||||
add_custom_target(generate_DefaultStyleSheetSource.cpp DEPENDS CSS/DefaultStyleSheetSource.cpp)
|
||||
add_dependencies(all_generated generate_DefaultStyleSheetSource.cpp)
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT CSS/QuirksModeStyleSheetSource.cpp
|
||||
|
@ -471,5 +482,6 @@ add_custom_command(
|
|||
MAIN_DEPENDENCY CSS/Default.css
|
||||
)
|
||||
add_custom_target(generate_QuirksModeStyleSheetSource.cpp DEPENDS CSS/QuirksModeStyleSheetSource.cpp)
|
||||
add_dependencies(all_generated generate_QuirksModeStyleSheetSource.cpp)
|
||||
|
||||
add_subdirectory(DumpLayoutTree)
|
||||
|
|
Loading…
Reference in a new issue