From 9b05fb98f3c742e66b70a661952f0c601e8437c6 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Fri, 31 May 2024 17:08:24 -0600 Subject: [PATCH] CMake: Remove unused files --- Meta/CMake/Superbuild/CMakeLists.txt | 117 ---------------------- Meta/CMake/pnp_ids.cmake | 25 ----- Meta/CMake/serenity_compile_options.cmake | 54 ---------- Meta/CMake/serenity_options.cmake | 11 -- 4 files changed, 207 deletions(-) delete mode 100644 Meta/CMake/Superbuild/CMakeLists.txt delete mode 100644 Meta/CMake/pnp_ids.cmake delete mode 100644 Meta/CMake/serenity_compile_options.cmake delete mode 100644 Meta/CMake/serenity_options.cmake diff --git a/Meta/CMake/Superbuild/CMakeLists.txt b/Meta/CMake/Superbuild/CMakeLists.txt deleted file mode 100644 index a692dc7d18e..00000000000 --- a/Meta/CMake/Superbuild/CMakeLists.txt +++ /dev/null @@ -1,117 +0,0 @@ -cmake_minimum_required(VERSION 3.20) - -project( - SerenitySuperbuild - DESCRIPTION "Orchestrate host and target builds in a single build" - LANGUAGES NONE -) - -# NOTE: Before CMake 3.19, if a custom command is attached to multiple step targets for Makefile and Visual Studio generators, -# it might be run multiple times during the build. Enable new behavior of policy CMP0114 to avoid this. -cmake_policy(SET CMP0114 NEW) - -get_filename_component( - SERENITY_SOURCE_DIR "${PROJECT_SOURCE_DIR}/../../.." - ABSOLUTE CACHE -) -set(SERENITY_ARCH "x86_64" CACHE STRING "Target architecture for SerenityOS.") -set(SERENITY_TOOLCHAIN "GNU" CACHE STRING "Compiler toolchain to use for Serenity (GNU or Clang)") - -# FIXME: It is preferred to keep all the sub-build artifacts below the binary directory for the superbuild -# However, this has an impact on developer's IDE settings and more significantly, the Ports tree. -# See https://github.com/SerenityOS/serenity/pull/9297#discussion_r697877603 -set(SERENITY_BUILD_DIR_SUFFIX "") -if(NOT SERENITY_TOOLCHAIN STREQUAL "GNU") - string(TOLOWER "${SERENITY_TOOLCHAIN}" SERENITY_BUILD_DIR_SUFFIX) -endif() -set(SERENITY_BUILD_DIR "${PROJECT_BINARY_DIR}/../${SERENITY_ARCH}${SERENITY_BUILD_DIR_SUFFIX}") - -# Pkgconf incorrectly discards a sysroot if it doesn't match the start of the path to the -# library file. To avoid that, resolve our sysroot into an absolute and canonical path -# that matches pkgconf's result for resolving the library file. -get_filename_component(SERENITY_BUILD_DIR "${SERENITY_BUILD_DIR}" ABSOLUTE) - -# TODO: Figure out if and how we can skip this when building on Serenity. -configure_file("${SERENITY_SOURCE_DIR}/Toolchain/CMake/${SERENITY_TOOLCHAIN}Toolchain.txt.in" "${SERENITY_BUILD_DIR}/CMakeToolchain.txt" @ONLY) -set(SERENITY_TOOLCHAIN_FILE "${SERENITY_BUILD_DIR}/CMakeToolchain.txt" CACHE PATH "Toolchain file to use for cross-compilation") -# Support non-cross builds by stuffing this in a variable -set(SERENITY_TOOLCHAIN_FILE_ARG "-DCMAKE_TOOLCHAIN_FILE:STRING=${SERENITY_TOOLCHAIN_FILE}") - -configure_file("${SERENITY_SOURCE_DIR}/Toolchain/CMake/meson-cross-file-${SERENITY_TOOLCHAIN}.txt.in" "${SERENITY_BUILD_DIR}/meson-cross-file.txt" @ONLY) - -# Allow the Ninja generators to output messages as they happen by assigning -# these jobs to the 'console' job pool -set(console_access "") -if(CMAKE_GENERATOR MATCHES "^Ninja") - set( - console_access - USES_TERMINAL_CONFIGURE YES - USES_TERMINAL_BUILD YES - USES_TERMINAL_INSTALL YES - ) -endif() - -include(ExternalProject) - -# Collect options for Lagom build -set(lagom_options "") -macro(serenity_option name) - set(${ARGV}) - list(APPEND lagom_options "-D${name}:STRING=${${name}}") -endmacro() -include("${SERENITY_SOURCE_DIR}/Meta/CMake/lagom_options.cmake") - -# Forward user defined host toolchain to lagom build -if (DEFINED CMAKE_C_COMPILER) - set(CMAKE_C_COMPILER "${CMAKE_C_COMPILER}" CACHE STRING "C Compiler to use for host builds") - list(APPEND lagom_options "-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}") -endif() -if (DEFINED CMAKE_CXX_COMPILER) - set(CMAKE_CXX_COMPILER "${CMAKE_CXX_COMPILER}" CACHE STRING "C++ Compiler to use for host builds") - list(APPEND lagom_options "-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}") -endif() - -ExternalProject_Add( - lagom - SOURCE_DIR "${SERENITY_SOURCE_DIR}/Meta/Lagom" - BINARY_DIR "${PROJECT_BINARY_DIR}/../lagom" - INSTALL_DIR "${PROJECT_BINARY_DIR}/../lagom-install" - EXCLUDE_FROM_ALL YES - CMAKE_CACHE_ARGS - "-DCMAKE_INSTALL_PREFIX:STRING=" - "-DSERENITY_CACHE_DIR:STRING=${SERENITY_CACHE_DIR}" - ${lagom_options} - # Always call the build step of tools, so keeping things up-to-date is easy - BUILD_ALWAYS YES - # Expose install step as a target, so it can be depended on - STEP_TARGETS install - ${console_access} -) - -# Collect options for serenity build -set(serenity_options "") -macro(serenity_option name) - set(${ARGV}) - list(APPEND serenity_options "-D${name}:STRING=${${name}}") -endmacro() -include("${SERENITY_SOURCE_DIR}/Meta/CMake/serenity_options.cmake") - -ExternalProject_Add( - serenity - SOURCE_DIR "${SERENITY_SOURCE_DIR}" - BINARY_DIR "${SERENITY_BUILD_DIR}" - CMAKE_CACHE_ARGS - # Tell the find_package(Lagom REQUIRED) command call where to find - # the CMake package - "-DCMAKE_PREFIX_PATH:STRING=${PROJECT_BINARY_DIR}/../lagom-install" - "-DSERENITY_CACHE_DIR:STRING=${SERENITY_CACHE_DIR}" - "-DSERENITY_ARCH:STRING=${SERENITY_ARCH}" - "${SERENITY_TOOLCHAIN_FILE_ARG}" - ${serenity_options} - # Always call the build step - BUILD_ALWAYS YES - # Host tools must be built and installed before the OS can be built - DEPENDS lagom-install - STEP_TARGETS configure install - ${console_access} -) diff --git a/Meta/CMake/pnp_ids.cmake b/Meta/CMake/pnp_ids.cmake deleted file mode 100644 index 757906c69f4..00000000000 --- a/Meta/CMake/pnp_ids.cmake +++ /dev/null @@ -1,25 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/utils.cmake) - -set(PNP_IDS_URL https://uefi.org/uefi-pnp-export) -set(PNP_IDS_EXPORT_PATH ${SERENITY_CACHE_DIR}/pnp_ids.csv) - -if (ENABLE_PNP_IDS_DOWNLOAD) - download_file("${PNP_IDS_URL}" "${PNP_IDS_EXPORT_PATH}") - - set(PNP_IDS_HEADER PnpIDs.h) - set(PNP_IDS_IMPLEMENTATION PnpIDs.cpp) - - invoke_generator( - "PnpIDsData" - Lagom::GeneratePnpIDsData - "${PNP_IDS_EXPORT_PATH}" - "${PNP_IDS_HEADER}" - "${PNP_IDS_IMPLEMENTATION}" - arguments -p "${PNP_IDS_EXPORT_PATH}" - ) - - set(PNP_IDS_SOURCES - ${PNP_IDS_HEADER} - ${PNP_IDS_IMPLEMENTATION} - ) -endif() diff --git a/Meta/CMake/serenity_compile_options.cmake b/Meta/CMake/serenity_compile_options.cmake deleted file mode 100644 index ba9816e6595..00000000000 --- a/Meta/CMake/serenity_compile_options.cmake +++ /dev/null @@ -1,54 +0,0 @@ -include(${CMAKE_CURRENT_LIST_DIR}/common_compile_options.cmake) - -# The following options are sorted by the "base" name (the part excluding the initial Wno/fno or W/f). - -add_compile_options(-Wno-address-of-packed-member) -add_compile_options(-Wcast-qual) -add_compile_options(-Wdeprecated-copy) -add_compile_options(-Wduplicated-cond) -add_compile_options(-Wformat=2) -add_compile_options(-Wimplicit-fallthrough) -add_compile_options(-Wlogical-op) -add_compile_options(-Wmisleading-indentation) -add_compile_options(-Wmissing-declarations) -add_compile_options(-Wnon-virtual-dtor) -add_compile_options(-Wsuggest-override) -add_compile_options(-Wundef) -add_compile_options(-Wunused) -add_compile_options(-Wwrite-strings) - -add_compile_options(-fno-delete-null-pointer-checks) -add_compile_options(-ffile-prefix-map=${SerenityOS_SOURCE_DIR}=.) -add_compile_options(-fno-omit-frame-pointer) -add_compile_options(-fsigned-char) -add_compile_options(-fsized-deallocation) -add_compile_options(-fstack-clash-protection) -add_compile_options(-fstack-protector-strong) -add_link_options(-fstack-protector-strong) - -add_compile_options(-g1) - -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - -add_link_options(LINKER:-Bsymbolic-non-weak-functions) - -if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - add_compile_options(-Wno-maybe-uninitialized) - add_compile_options(-Wcast-align) - add_compile_options(-Wdouble-promotion) -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$") - add_compile_options(-Wno-atomic-alignment) - add_compile_options(-Wno-unused-const-variable) - add_compile_options(-Wno-unused-private-field) - - # Clang doesn't add compiler_rt to the search path when compiling with -nostdlib. - string(REGEX REPLACE "\\.(.*)" "" LLVM_MAJOR_VERSION "${CMAKE_CXX_COMPILER_VERSION}") - link_directories(${TOOLCHAIN_ROOT}/lib/clang/${LLVM_MAJOR_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/) -endif() - -if ("${SERENITY_ARCH}" STREQUAL "riscv64") - # Unaligned memory access will cause a trap, so to make sure the compiler doesn't generate - # those unaligned accesses, the strict-align flag is added. - # FIXME: Remove -Wno-cast-align when we are able to build everything without this warning turned on. - add_compile_options(-mstrict-align -Wno-cast-align) -endif() diff --git a/Meta/CMake/serenity_options.cmake b/Meta/CMake/serenity_options.cmake deleted file mode 100644 index 2e1a29d0c77..00000000000 --- a/Meta/CMake/serenity_options.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# -# Options specific to the Serenity (target) build -# - -include(${CMAKE_CURRENT_LIST_DIR}/common_options.cmake NO_POLICY_SCOPE) - -serenity_option(ENABLE_PCI_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pci.ids database at build time") -serenity_option(ENABLE_USB_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the usb.ids database at build time") -serenity_option(ENABLE_PNP_IDS_DOWNLOAD ON CACHE BOOL "Enable download of the pnp.ids database at build time") -serenity_option(ENABLE_MOLD_LINKER OFF CACHE BOOL "Link the SerenityOS userland with the mold linker") -serenity_option(ENABLE_USERSPACE_COVERAGE_COLLECTION OFF CACHE BOOL "Enable code coverage instrumentation for userspace binaries in clang")