mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Meta/LibTest: Build object libraries for test main files
By using the power of object libraries and $<TARGET_OBJECTS> we can make sure to only build TestMain.cpp and JavaScriptTestRunnerMain.cpp once. Previously we built these cpp files into object files once for every single test executable. This change reduces the number of total compile jobs in a Serenity target build by around 100.
This commit is contained in:
parent
af9be6e093
commit
de2bf3f333
Notes:
sideshowbarker
2024-07-18 07:47:09 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/de2bf3f333e Pull-request: https://github.com/SerenityOS/serenity/pull/9017 Issue: https://github.com/SerenityOS/serenity/issues/8846 Reviewed-by: https://github.com/gunnarbeutner Reviewed-by: https://github.com/linusg
2 changed files with 5 additions and 4 deletions
|
@ -77,8 +77,7 @@ function(serenity_test test_src sub_dir)
|
|||
cmake_parse_arguments(SERENITY_TEST "MAIN_ALREADY_DEFINED" "CUSTOM_MAIN" "LIBS" ${ARGN})
|
||||
set(TEST_SOURCES ${test_src})
|
||||
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
|
||||
set(SERENITY_TEST_CUSTOM_MAIN
|
||||
"${CMAKE_SOURCE_DIR}/Userland/Libraries/LibTest/TestMain.cpp")
|
||||
set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:LibTestMain>")
|
||||
endif()
|
||||
if (NOT ${SERENITY_TEST_MAIN_ALREADY_DEFINED})
|
||||
list(PREPEND TEST_SOURCES "${SERENITY_TEST_CUSTOM_MAIN}")
|
||||
|
@ -98,8 +97,7 @@ endfunction()
|
|||
function(serenity_testjs_test test_src sub_dir)
|
||||
cmake_parse_arguments(SERENITY_TEST "" "CUSTOM_MAIN" "LIBS" ${ARGN})
|
||||
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
|
||||
set(SERENITY_TEST_CUSTOM_MAIN
|
||||
"${CMAKE_SOURCE_DIR}/Userland/Libraries/LibTest/JavaScriptTestRunnerMain.cpp")
|
||||
set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:JavaScriptTestRunnerMain>")
|
||||
endif()
|
||||
list(APPEND SERENITY_TEST_LIBS LibJS LibCore)
|
||||
serenity_test(${test_src} ${sub_dir}
|
||||
|
|
|
@ -7,3 +7,6 @@ set(SOURCES
|
|||
|
||||
serenity_lib(LibTest test)
|
||||
target_link_libraries(LibTest LibC)
|
||||
|
||||
add_library(LibTestMain OBJECT TestMain.cpp)
|
||||
add_library(JavaScriptTestRunnerMain OBJECT JavaScriptTestRunnerMain.cpp)
|
||||
|
|
Loading…
Reference in a new issue