diff options
author | Nico Weber <thakis@chromium.org> | 2020-08-02 09:54:06 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-04 15:58:08 +0200 |
commit | d8b6314018b4a3f9217752dca2f421c4e598b3c8 (patch) | |
tree | 97d8f097a47aa2bfa9f49818f82dd2b787db7716 /Libraries | |
parent | 1d08cab9ab11c03869f3e02b1b1c73f60272599f (diff) | |
download | serenity-d8b6314018b4a3f9217752dca2f421c4e598b3c8.zip |
Build: Support make's and ninja's restat optimization
After running a build command, make by default stat()s the command's
output, and if it wasn't touched, then it cancels all build steps
that were scheduled only because this command was expected to change
the output.
Ninja has the same feature, but it's opt-in behind the per-command
"restat = 1" setting. However, CMake enables it by default for all
custom commands.
Use Meta/write-only-on-difference.sh to write the output to a temporary
file, and then copy the temporary file only to the final location if the
contents of the output have changed since last time.
write-only-on-difference.sh automatically creates the output's parent
directory, so stop doing that in CMake.
Reduces the number of build steps that run after touching a file
in LibCore from 522 to 312.
Since we now no longer trigger the CMake special case "If COMMAND
specifies an executable target name (created by the add_executable()
command), it will automatically be replaced by the location of the
executable created at build time", we now need to use qualified paths to
the generators.
Somewhat related to #2877.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibWeb/CMakeLists.txt | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt index 8e3f621152..1bec9e2e92 100644 --- a/Libraries/LibWeb/CMakeLists.txt +++ b/Libraries/LibWeb/CMakeLists.txt @@ -146,16 +146,14 @@ function(libweb_js_wrapper class) add_wrapper_sources(Bindings/${basename}Wrapper.cpp Bindings/${basename}Wrapper.h) add_custom_command( OUTPUT Bindings/${basename}Wrapper.h - COMMAND /bin/mkdir -p Bindings - COMMAND WrapperGenerator --header ${CMAKE_CURRENT_SOURCE_DIR}/${class}.idl > Bindings/${basename}Wrapper.h + COMMAND ${write_if_different} Bindings/${basename}Wrapper.h CodeGenerators/WrapperGenerator --header ${CMAKE_CURRENT_SOURCE_DIR}/${class}.idl VERBATIM DEPENDS WrapperGenerator MAIN_DEPENDENCY ${class}.idl ) add_custom_command( OUTPUT Bindings/${basename}Wrapper.cpp - COMMAND /bin/mkdir -p Bindings - COMMAND WrapperGenerator --implementation ${CMAKE_CURRENT_SOURCE_DIR}/${class}.idl > Bindings/${basename}Wrapper.cpp + COMMAND ${write_if_different} Bindings/${basename}Wrapper.cpp CodeGenerators/WrapperGenerator --implementation ${CMAKE_CURRENT_SOURCE_DIR}/${class}.idl VERBATIM DEPENDS WrapperGenerator MAIN_DEPENDENCY ${class}.idl @@ -203,8 +201,7 @@ set(SOURCES ${SOURCES} ${WRAPPER_SOURCES}) add_custom_command( OUTPUT CSS/PropertyID.h - COMMAND /bin/mkdir -p CSS - COMMAND Generate_CSS_PropertyID_h ${CMAKE_CURRENT_SOURCE_DIR}/CSS/Properties.json > CSS/PropertyID.h + COMMAND ${write_if_different} CSS/PropertyID.h CodeGenerators/Generate_CSS_PropertyID_h ${CMAKE_CURRENT_SOURCE_DIR}/CSS/Properties.json VERBATIM DEPENDS Generate_CSS_PropertyID_h MAIN_DEPENDENCY CSS/Properties.json @@ -214,7 +211,7 @@ add_custom_target(generate_PropertyID.h DEPENDS CSS/PropertyID.h) add_custom_command( OUTPUT CSS/PropertyID.cpp COMMAND /bin/mkdir -p CSS - COMMAND Generate_CSS_PropertyID_cpp ${CMAKE_CURRENT_SOURCE_DIR}/CSS/Properties.json > CSS/PropertyID.cpp + COMMAND ${write_if_different} CSS/PropertyID.cpp CodeGenerators/Generate_CSS_PropertyID_cpp ${CMAKE_CURRENT_SOURCE_DIR}/CSS/Properties.json VERBATIM DEPENDS Generate_CSS_PropertyID_cpp MAIN_DEPENDENCY CSS/Properties.json @@ -222,9 +219,7 @@ add_custom_command( add_custom_command( OUTPUT CSS/DefaultStyleSheetSource.cpp - COMMAND /bin/mkdir -p CSS - COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/GenerateStyleSheetSource.sh default_stylesheet_source - ${CMAKE_CURRENT_SOURCE_DIR}/CSS/Default.css > CSS/DefaultStyleSheetSource.cpp + COMMAND ${write_if_different} CSS/DefaultStyleSheetSource.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Scripts/GenerateStyleSheetSource.sh default_stylesheet_source ${CMAKE_CURRENT_SOURCE_DIR}/CSS/Default.css VERBATIM DEPENDS Scripts/GenerateStyleSheetSource.sh MAIN_DEPENDENCY CSS/Default.css |