mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-02 15:46:33 +00:00
CMake: Remove unused CMake functions
This commit is contained in:
parent
5bfbb7abe6
commit
f22f6e1f5b
Notes:
github-actions[bot]
2025-03-20 17:37:13 +00:00
Author: https://github.com/ADKaster
Commit: f22f6e1f5b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4009
Reviewed-by: https://github.com/Hendiadyoin1
5 changed files with 1 additions and 167 deletions
|
@ -46,9 +46,6 @@ endif()
|
|||
|
||||
serenity_lib(AK ak)
|
||||
|
||||
serenity_install_headers(AK)
|
||||
serenity_install_sources(AK)
|
||||
|
||||
include(stacktrace)
|
||||
configure_file(Backtrace.h.in Backtrace.h @ONLY)
|
||||
link_stacktrace_library(AK STD_DEFINITION AK_HAS_STD_STACKTRACE)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#
|
||||
# Options common for the Serenity (target) and Lagom (host) builds
|
||||
#
|
||||
|
||||
# Make relative paths in depfiles be relative to CMAKE_CURRENT_BINARY_DIR rather than to CMAKE_BINARY_DIR
|
||||
if (POLICY CMP0116)
|
||||
cmake_policy(SET CMP0116 NEW)
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
include(utils)
|
||||
|
||||
if(INCLUDE_FLAC_SPEC_TESTS)
|
||||
if (CMAKE_PROJECT_NAME STREQUAL "SerenityOS")
|
||||
set(SOURCE_DIR "${SerenityOS_SOURCE_DIR}")
|
||||
else()
|
||||
set(SOURCE_DIR "${SERENITY_PROJECT_ROOT}")
|
||||
endif()
|
||||
set(FLAC_SPEC_TEST_GZ_URL https://github.com/ietf-wg-cellar/flac-test-files/archive/refs/heads/main.tar.gz)
|
||||
|
||||
set(FLAC_TEST_PATH ${CMAKE_BINARY_DIR}/Tests/LibMedia/FLAC CACHE PATH "Location of FLAC tests")
|
||||
set(FLAC_SPEC_TEST_GZ_PATH ${FLAC_TEST_PATH}/flac-spec-testsuite.tar.gz)
|
||||
set(FLAC_SPEC_TEST_PATH ${FLAC_TEST_PATH}/SpecTests)
|
||||
|
||||
if(NOT EXISTS ${FLAC_SPEC_TEST_GZ_PATH})
|
||||
message(STATUS "Downloading the IETF CELLAR FLAC testsuite...")
|
||||
download_file(${FLAC_SPEC_TEST_GZ_URL} ${FLAC_SPEC_TEST_GZ_PATH})
|
||||
endif()
|
||||
|
||||
if(EXISTS ${FLAC_SPEC_TEST_GZ_PATH} AND NOT EXISTS ${FLAC_SPEC_TEST_PATH})
|
||||
extract_path(${FLAC_TEST_PATH} ${FLAC_SPEC_TEST_GZ_PATH} "flac-test-files-main/subset/*.flac" ${FLAC_SPEC_TEST_PATH})
|
||||
file(RENAME "${FLAC_TEST_PATH}/flac-test-files-main/subset" ${FLAC_SPEC_TEST_PATH})
|
||||
file(REMOVE "${FLAC_TEST_PATH}/flac-test-files-main")
|
||||
endif()
|
||||
endif()
|
|
@ -1,32 +1,6 @@
|
|||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/code_generators.cmake)
|
||||
|
||||
function(serenity_set_implicit_links target_name)
|
||||
# Make sure that CMake is aware of the implicit LibC dependency, and ensure
|
||||
# that we are choosing the correct and updated LibC.
|
||||
# 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} PRIVATE LibC)
|
||||
endfunction()
|
||||
|
||||
function(serenity_install_headers target_name)
|
||||
file(GLOB_RECURSE headers RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
|
||||
foreach(header ${headers})
|
||||
get_filename_component(subdirectory ${header} DIRECTORY)
|
||||
install(FILES ${header} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${target_name}/${subdirectory}" OPTIONAL)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(serenity_install_sources)
|
||||
cmake_path(RELATIVE_PATH CMAKE_CURRENT_SOURCE_DIR BASE_DIRECTORY ${SerenityOS_SOURCE_DIR} OUTPUT_VARIABLE current_source_dir_relative)
|
||||
file(GLOB_RECURSE sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h" "*.cpp" "*.gml")
|
||||
foreach(source ${sources})
|
||||
get_filename_component(subdirectory ${source} DIRECTORY)
|
||||
install(FILES ${source} DESTINATION usr/src/serenity/${current_source_dir_relative}/${subdirectory} OPTIONAL)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(serenity_generated_sources target_name)
|
||||
if(DEFINED GENERATED_SOURCES)
|
||||
set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED 1)
|
||||
|
@ -38,79 +12,6 @@ function(serenity_generated_sources target_name)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
if (NOT COMMAND serenity_lib)
|
||||
function(serenity_lib target_name fs_name)
|
||||
cmake_parse_arguments(PARSE_ARGV 2 SERENITY_LIB "" "TYPE" "")
|
||||
|
||||
if ("${SERENITY_LIB_TYPE}" STREQUAL "")
|
||||
set(SERENITY_LIB_TYPE SHARED)
|
||||
endif()
|
||||
|
||||
serenity_install_headers(${target_name})
|
||||
serenity_install_sources()
|
||||
add_library(${target_name} ${SERENITY_LIB_TYPE} ${SOURCES} ${GENERATED_SOURCES})
|
||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
set_target_properties(${target_name} PROPERTIES VERSION "serenity")
|
||||
target_link_libraries(${target_name} PUBLIC GenericClangPlugin)
|
||||
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR} OPTIONAL)
|
||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
||||
serenity_generated_sources(${target_name})
|
||||
serenity_set_implicit_links(${target_name})
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
function(serenity_libc target_name fs_name)
|
||||
serenity_install_headers("")
|
||||
serenity_install_sources()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -fpic -ftls-model=initial-exec")
|
||||
add_library(${target_name} SHARED ${SOURCES})
|
||||
install(TARGETS ${target_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${fs_name})
|
||||
# Avoid creating a dependency cycle between system libraries and the C++ standard library. This is necessary
|
||||
# to ensure that initialization functions will be called in the right order (libc++ must come after LibPthread).
|
||||
target_link_options(${target_name} PRIVATE -static-libstdc++)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" AND ENABLE_USERSPACE_COVERAGE_COLLECTION)
|
||||
target_link_libraries(${target_name} PRIVATE clang_rt.profile)
|
||||
endif()
|
||||
target_link_directories(LibC PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
|
||||
serenity_generated_sources(${target_name})
|
||||
endfunction()
|
||||
|
||||
if (NOT COMMAND serenity_bin)
|
||||
function(serenity_bin target_name)
|
||||
serenity_install_sources()
|
||||
add_executable(${target_name} ${SOURCES})
|
||||
target_link_libraries(${target_name} PUBLIC GenericClangPlugin)
|
||||
set_target_properties(${target_name} PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
install(TARGETS ${target_name} RUNTIME DESTINATION bin OPTIONAL)
|
||||
serenity_generated_sources(${target_name})
|
||||
serenity_set_implicit_links(${target_name})
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
if (NOT COMMAND serenity_test)
|
||||
function(serenity_test test_src sub_dir)
|
||||
cmake_parse_arguments(PARSE_ARGV 2 SERENITY_TEST "MAIN_ALREADY_DEFINED" "CUSTOM_MAIN" "LIBS")
|
||||
set(TEST_SOURCES ${test_src})
|
||||
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
|
||||
set(SERENITY_TEST_CUSTOM_MAIN "$<TARGET_OBJECTS:LibTestMain>")
|
||||
endif()
|
||||
if (NOT ${SERENITY_TEST_MAIN_ALREADY_DEFINED})
|
||||
list(PREPEND TEST_SOURCES "${SERENITY_TEST_CUSTOM_MAIN}")
|
||||
endif()
|
||||
get_filename_component(test_name ${test_src} NAME_WE)
|
||||
add_executable(${test_name} ${TEST_SOURCES})
|
||||
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} PRIVATE LibTest LibCore LibFileSystem)
|
||||
foreach(lib ${SERENITY_TEST_LIBS})
|
||||
target_link_libraries(${test_name} PRIVATE ${lib})
|
||||
endforeach()
|
||||
install(TARGETS ${test_name} RUNTIME DESTINATION usr/Tests/${sub_dir} OPTIONAL)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
function(serenity_testjs_test test_src sub_dir)
|
||||
cmake_parse_arguments(PARSE_ARGV 2 SERENITY_TEST "" "CUSTOM_MAIN" "LIBS")
|
||||
if ("${SERENITY_TEST_CUSTOM_MAIN}" STREQUAL "")
|
||||
|
@ -122,32 +23,6 @@ function(serenity_testjs_test test_src sub_dir)
|
|||
LIBS ${SERENITY_TEST_LIBS})
|
||||
endfunction()
|
||||
|
||||
function(serenity_app target_name)
|
||||
cmake_parse_arguments(PARSE_ARGV 1 SERENITY_APP "" "ICON" "")
|
||||
|
||||
serenity_bin("${target_name}")
|
||||
set(small_icon "${SerenityOS_SOURCE_DIR}/Base/res/icons/16x16/${SERENITY_APP_ICON}.png")
|
||||
set(medium_icon "${SerenityOS_SOURCE_DIR}/Base/res/icons/32x32/${SERENITY_APP_ICON}.png")
|
||||
|
||||
if (EXISTS "${small_icon}")
|
||||
embed_resource("${target_name}" serenity_icon_s "${small_icon}")
|
||||
else()
|
||||
message(FATAL_ERROR "Missing small app icon: ${small_icon}")
|
||||
endif()
|
||||
|
||||
if (EXISTS "${medium_icon}")
|
||||
embed_resource("${target_name}" serenity_icon_m "${medium_icon}")
|
||||
else()
|
||||
# These icons are designed small only for use in applets, and thus are exempt.
|
||||
list(APPEND allowed_missing_medium_icons "audio-volume-high")
|
||||
list(APPEND allowed_missing_medium_icons "edit-copy")
|
||||
|
||||
if (NOT ${SERENITY_APP_ICON} IN_LIST allowed_missing_medium_icons)
|
||||
message(FATAL_ERROR "Missing medium app icon: ${medium_icon}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(remove_path_if_version_changed version version_file cache_path)
|
||||
set(version_differs YES)
|
||||
|
||||
|
|
|
@ -80,7 +80,6 @@ if (ENABLE_FUZZERS OR CMAKE_CROSSCOMPILING)
|
|||
set(BUILD_LAGOM_TOOLS OFF)
|
||||
endif()
|
||||
|
||||
include(flac_spec_tests)
|
||||
include(ca_certificates_data)
|
||||
include(lagom_compile_options)
|
||||
|
||||
|
@ -248,7 +247,6 @@ function(lagom_lib target_name fs_name)
|
|||
endif()
|
||||
add_lagom_library_install_rules(${target_name} ALIAS_NAME ${library})
|
||||
if (ENABLE_INSTALL_HEADERS)
|
||||
# FIXME: Move this to serenity_install_headers
|
||||
install(
|
||||
DIRECTORY "${SERENITY_PROJECT_ROOT}/Libraries/Lib${library}"
|
||||
COMPONENT Lagom_Development
|
||||
|
@ -311,12 +309,6 @@ function(serenity_lib name fs_name)
|
|||
lagom_lib(${name} ${fs_name} LIBRARY_TYPE ${SERENITY_LIB_TYPE} SOURCES ${SOURCES} ${GENERATED_SOURCES})
|
||||
endfunction()
|
||||
|
||||
function(serenity_install_headers dir)
|
||||
endfunction()
|
||||
|
||||
function(serenity_install_sources dir)
|
||||
endfunction()
|
||||
|
||||
macro(add_serenity_subdirectory path)
|
||||
add_subdirectory("${SERENITY_PROJECT_ROOT}/${path}" "${CMAKE_CURRENT_BINARY_DIR}/${path}")
|
||||
endmacro()
|
||||
|
@ -331,14 +323,13 @@ add_lagom_library_install_rules(GenericClangPlugin)
|
|||
add_lagom_library_install_rules(JSClangPlugin)
|
||||
|
||||
# Create mostly empty targets for system libraries we don't need to build for Lagom
|
||||
add_library(LibC INTERFACE)
|
||||
add_library(LibCrypt INTERFACE)
|
||||
if (NOT APPLE AND NOT ANDROID AND NOT EMSCRIPTEN AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" AND NOT HAIKU AND NOT WIN32)
|
||||
target_link_libraries(LibCrypt INTERFACE crypt) # LibCore::Account uses crypt() but it's not in libcrypt on macOS
|
||||
endif()
|
||||
add_library(NoCoverage INTERFACE)
|
||||
# "install" these special targets to placate CMake
|
||||
install(TARGETS LibC LibCrypt NoCoverage EXPORT LagomTargets)
|
||||
install(TARGETS LibCrypt NoCoverage EXPORT LagomTargets)
|
||||
|
||||
# AK
|
||||
add_serenity_subdirectory(AK)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue