1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:17:35 +00:00

Everywhere: Mark dependencies of most targets as PRIVATE

Otherwise, we end up propagating those dependencies into targets that
link against that library, which creates unnecessary link-time
dependencies.

Also included are changes to readd now missing dependencies to tools
that actually need them.
This commit is contained in:
Tim Schumacher 2022-10-21 21:43:56 +02:00 committed by Linus Groh
parent 678db534ff
commit ce2f1b845f
174 changed files with 386 additions and 384 deletions

View file

@ -8,7 +8,7 @@ function(serenity_set_implicit_links target_name)
# The latter is a problem with Clang especially, since we might have the
# slightly outdated stub in the sysroot, but have not yet installed the freshly
# built LibC.
target_link_libraries(${target_name} LibC)
target_link_libraries(${target_name} PRIVATE LibC)
# Same goes for -lssp_nonshared, which is required during build time but is not
# yet installed in the sysroot. However, we just want to add the link directory
@ -118,9 +118,9 @@ function(serenity_test test_src sub_dir)
add_dependencies(ComponentTests ${test_name})
set_target_properties(${test_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
serenity_set_implicit_links(${test_name})
target_link_libraries(${test_name} LibTest LibCore)
target_link_libraries(${test_name} PRIVATE LibTest LibCore)
foreach(lib ${SERENITY_TEST_LIBS})
target_link_libraries(${test_name} ${lib})
target_link_libraries(${test_name} PRIVATE ${lib})
endforeach()
install(TARGETS ${test_name} RUNTIME DESTINATION usr/Tests/${sub_dir} OPTIONAL)
endfunction()
@ -178,7 +178,7 @@ endfunction()
function(link_with_locale_data target)
if (ENABLE_UNICODE_DATABASE_DOWNLOAD AND SERENITYOS)
target_link_libraries("${target}" LibLocaleData)
target_link_libraries("${target}" PRIVATE LibLocaleData)
endif()
endfunction()

View file

@ -202,9 +202,9 @@ function(lagom_lib target_name fs_name)
EXPORT_NAME ${library}
OUTPUT_NAME lagom-${fs_name}
)
target_link_libraries(${target_name} ${LAGOM_LIBRARY_LIBS})
target_link_libraries(${target_name} PRIVATE ${LAGOM_LIBRARY_LIBS})
if (NOT ${target_name} STREQUAL "LibCore")
target_link_libraries(${target_name} LibCore)
target_link_libraries(${target_name} PRIVATE LibCore)
endif()
install(
TARGETS ${target_name}
@ -306,7 +306,7 @@ install(TARGETS LibC LibCrypt LibSystem NoCoverage EXPORT LagomTargets)
# Note: AK is included in LibCore for the host build instead of LibC per the target build
add_serenity_subdirectory(AK)
add_serenity_subdirectory(Userland/Libraries/LibCore)
target_link_libraries(LibCore Threads::Threads)
target_link_libraries(LibCore PRIVATE Threads::Threads)
target_sources(LibCore PRIVATE ${AK_SOURCES})
# LibMain
@ -385,7 +385,7 @@ if (BUILD_LAGOM)
set(GENERATED_SOURCES ${LIBWEBVIEW_GENERATED_SOURCES})
lagom_lib(LibWebView webview
SOURCES ${LIBWEBVIEW_SOURCES} ${LIBWEBVIEW_GENERATED_SOURCES}
LIBS LibGUI LibWeb)
LIBS LibGfx LibGUI LibIPC LibWeb)
unset(GENERATED_SOURCES)
endif()
@ -425,7 +425,7 @@ if (BUILD_LAGOM)
# FIXME: LibLocaleData is an object lib in Lagom, because the weak symbol trick we use on serenity
# straight up isn't supposed to work per ELF rules
target_link_libraries(LibLocale LibTimeZone)
target_link_libraries(LibLocale PRIVATE LibTimeZone)
install(TARGETS LibLocaleData EXPORT LagomTargets)
add_serenity_subdirectory(Userland/Shell)
@ -457,11 +457,11 @@ if (BUILD_LAGOM)
if (ENABLE_LAGOM_LIBWEB)
add_executable(headless-browser ../../Userland/Utilities/headless-browser.cpp)
target_link_libraries(headless-browser LibWeb LibWebSocket LibHTTP LibJS LibGfx LibMain)
target_link_libraries(headless-browser LibWeb LibWebSocket LibCrypto LibGemini LibHTTP LibJS LibGfx LibMain LibTLS)
endif()
add_executable(js ../../Userland/Utilities/js.cpp)
target_link_libraries(js LibJS LibLine LibMain LibTextCodec Threads::Threads)
target_link_libraries(js LibCrypto LibJS LibLine LibLocale LibMain LibTextCodec Threads::Threads)
add_executable(markdown-check ../../Userland/Utilities/markdown-check.cpp)
target_link_libraries(markdown-check LibMarkdown LibMain)
@ -486,7 +486,7 @@ if (BUILD_LAGOM)
LibTest
${LIBTEST_SOURCES}
)
target_link_libraries(LibTest LibCore)
target_link_libraries(LibTest PRIVATE LibCore)
set_target_properties(LibTest PROPERTIES OUTPUT_NAME lagom-test)
add_library(
LibTestMain
@ -527,7 +527,7 @@ if (BUILD_LAGOM)
file(COPY "${SERENITY_PROJECT_ROOT}/Tests/LibGL/reference-images" DESTINATION "./")
file(GLOB LIBGL_TESTS CONFIGURE_DEPENDS "../../Tests/LibGL/*.cpp")
foreach(source ${LIBGL_TESTS})
lagom_test(${source} LIBS LibGL LibGPU LibSoftGPU)
lagom_test(${source} LIBS LibGfx LibGL LibGPU LibSoftGPU)
endforeach()
# Locale
@ -567,7 +567,7 @@ if (BUILD_LAGOM)
# TLS
file(GLOB LIBTLS_TESTS CONFIGURE_DEPENDS "../../Tests/LibTLS/*.cpp")
foreach(source ${LIBTLS_TESTS})
lagom_test(${source} LIBS LibTLS
lagom_test(${source} LIBS LibCrypto LibTLS
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../Tests/LibTLS)
endforeach()