2020-05-15 10:52:37 +03:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2021-09-07 10:50:09 +03:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/Meta/CMake")
|
|
|
|
|
2020-05-15 10:52:37 +03:00
|
|
|
project(SerenityOS C CXX ASM)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2020-06-06 04:23:31 +03:00
|
|
|
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "")
|
2021-05-13 14:15:35 +03:00
|
|
|
message(FATAL_ERROR
|
2020-06-06 04:23:31 +03:00
|
|
|
": Don't use CMAKE_BUILD_TYPE when building serenity.\n"
|
|
|
|
"The default build type is optimized with debug info and asserts enabled,\n"
|
|
|
|
"and that's all there is.")
|
|
|
|
endif()
|
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "SerenityOS")
|
|
|
|
message(FATAL_ERROR "System name is not SerenityOS, this is unsupported.\n"
|
|
|
|
"Please re-read the BuildInstructions documentation, and use the superbuild configuration\n")
|
2021-05-31 11:18:22 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-03 11:26:13 +03:00
|
|
|
# Check for toolchain mismatch, user might need to rebuild toolchain
|
|
|
|
set(GCC_VERSION "11.2.0")
|
|
|
|
set(LLVM_VERSION "13.0.0")
|
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
set(EXPECTED_COMPILER_VERSION "${GCC_VERSION}")
|
|
|
|
else()
|
|
|
|
set(EXPECTED_COMPILER_VERSION "${LLVM_VERSION}")
|
|
|
|
endif()
|
|
|
|
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "${EXPECTED_COMPILER_VERSION}")
|
|
|
|
message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} version (${CMAKE_CXX_COMPILER_VERSION}) does not match "
|
|
|
|
"expected compiler version (${EXPECTED_COMPILER_VERSION}).\n"
|
|
|
|
"Please rebuild the ${CMAKE_CXX_COMPILER_ID} Toolchain\n")
|
|
|
|
endif()
|
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
set(CMAKE_INSTALL_MESSAGE NEVER)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2020-11-12 01:59:06 +03:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2021-09-07 11:08:54 +03:00
|
|
|
if(NOT COMMAND serenity_option)
|
|
|
|
macro(serenity_option)
|
|
|
|
set(${ARGV})
|
|
|
|
endmacro()
|
|
|
|
endif()
|
|
|
|
include(serenity_options)
|
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
find_program(CCACHE_PROGRAM ccache)
|
|
|
|
if(CCACHE_PROGRAM)
|
|
|
|
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache")
|
|
|
|
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache")
|
2021-07-13 17:43:45 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-07 17:31:48 +03:00
|
|
|
if (NOT HACKSTUDIO_BUILD)
|
2021-09-07 11:21:36 +03:00
|
|
|
|
2022-01-07 17:31:48 +03:00
|
|
|
# FIXME: With cmake 3.18, we can change unzip/untar steps to use
|
|
|
|
# file( ARCHIVE_EXTRACT) instead
|
|
|
|
find_program(UNZIP unzip REQUIRED)
|
|
|
|
find_program(TAR tar REQUIRED)
|
|
|
|
|
|
|
|
# Host tools, required to generate files for the build
|
|
|
|
find_package(Lagom CONFIG REQUIRED)
|
|
|
|
|
|
|
|
endif()
|
2021-05-26 21:34:52 +03:00
|
|
|
|
2021-08-30 05:27:50 +03:00
|
|
|
# Meta target to run all code-gen steps in the build.
|
|
|
|
add_custom_target(all_generated)
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
add_custom_target(run
|
2021-08-08 03:32:49 +03:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_ARCH=${SERENITY_ARCH}" "${SerenityOS_SOURCE_DIR}/Meta/run.sh"
|
2020-05-06 18:40:06 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
|
2021-02-15 02:59:20 +03:00
|
|
|
# This can currently only be implemented by ordered commands
|
|
|
|
# as cmake doesn't support inter dependency ordering, and we
|
|
|
|
# would like to avoid inject dependencies on the existing
|
|
|
|
# custom commands to allow people to run commands adhoc with
|
|
|
|
# out forcing re-builds when they might not want them.
|
|
|
|
add_custom_target(setup-and-run
|
|
|
|
COMMAND ${CMAKE_MAKE_PROGRAM} install
|
|
|
|
COMMAND ${CMAKE_MAKE_PROGRAM} image
|
|
|
|
COMMAND ${CMAKE_MAKE_PROGRAM} run
|
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
|
2020-06-20 04:04:42 +03:00
|
|
|
add_custom_target(image
|
|
|
|
DEPENDS qemu-image
|
|
|
|
)
|
2021-07-13 17:43:45 +03:00
|
|
|
|
2020-06-20 04:04:42 +03:00
|
|
|
add_custom_target(qemu-image
|
2021-09-07 11:21:36 +03:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SerenityOS_SOURCE_DIR}" "SERENITY_ARCH=${SERENITY_ARCH}" "SERENITY_TOOLCHAIN=${CMAKE_CXX_COMPILER_ID}" "LLVM_VERSION=${CMAKE_CXX_COMPILER_VERSION}" "${SerenityOS_SOURCE_DIR}/Meta/build-image-qemu.sh"
|
2021-08-08 03:32:49 +03:00
|
|
|
BYPRODUCTS "${CMAKE_BINARY_DIR}/_disk_image"
|
2020-06-20 04:04:42 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
2020-05-27 00:51:18 +03:00
|
|
|
add_custom_target(grub-image
|
2021-09-07 11:21:36 +03:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E env "SERENITY_SOURCE_DIR=${SerenityOS_SOURCE_DIR}" "SERENITY_ARCH=${SERENITY_ARCH}" "SERENITY_TOOLCHAIN=${CMAKE_CXX_COMPILER_ID}" "LLVM_VERSION=${CMAKE_CXX_COMPILER_VERSION}" "${SerenityOS_SOURCE_DIR}/Meta/build-image-grub.sh"
|
2020-05-28 11:08:38 +03:00
|
|
|
BYPRODUCTS ${CMAKE_BINARY_DIR}/grub_disk_image
|
2020-05-27 00:51:18 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
2021-05-08 14:02:36 +03:00
|
|
|
add_custom_target(extlinux-image
|
2021-09-07 11:21:36 +03:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SerenityOS_SOURCE_DIR}" "SERENITY_ARCH=${SERENITY_ARCH}" "SERENITY_TOOLCHAIN=${CMAKE_CXX_COMPILER_ID}" "LLVM_VERSION=${CMAKE_CXX_COMPILER_VERSION}" "${SerenityOS_SOURCE_DIR}/Meta/build-image-extlinux.sh"
|
2021-08-08 03:32:49 +03:00
|
|
|
BYPRODUCTS "${CMAKE_BINARY_DIR}/extlinux_disk_image"
|
2021-05-08 14:02:36 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
2020-05-27 00:51:18 +03:00
|
|
|
|
2020-05-28 22:06:44 +03:00
|
|
|
add_custom_target(lint-shell-scripts
|
2021-08-08 03:32:49 +03:00
|
|
|
COMMAND "${SerenityOS_SOURCE_DIR}/Meta/lint-shell-scripts.sh"
|
2020-05-28 22:06:44 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
add_custom_target(check-style
|
2021-08-08 03:32:49 +03:00
|
|
|
COMMAND "${SerenityOS_SOURCE_DIR}/Meta/check-style.sh"
|
2020-05-28 22:06:44 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
|
2021-04-03 06:53:41 +03:00
|
|
|
add_custom_target(install-ports
|
2021-09-07 11:21:36 +03:00
|
|
|
COMMAND "${CMAKE_COMMAND}" -E env "SERENITY_SOURCE_DIR=${SerenityOS_SOURCE_DIR}" "SERENITY_ARCH=${SERENITY_ARCH}" "SERENITY_TOOLCHAIN=${CMAKE_CXX_COMPILER_ID}" "${SerenityOS_SOURCE_DIR}/Meta/install-ports-tree.sh"
|
2021-04-03 06:53:41 +03:00
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
|
2022-01-07 17:31:48 +03:00
|
|
|
if (NOT HACKSTUDIO_BUILD)
|
|
|
|
|
|
|
|
add_custom_target(configure-components
|
|
|
|
COMMAND "$<TARGET_FILE:Lagom::ConfigureComponents>"
|
|
|
|
USES_TERMINAL
|
|
|
|
)
|
|
|
|
add_dependencies(configure-components Lagom::ConfigureComponents)
|
|
|
|
|
|
|
|
endif()
|
2021-06-20 15:54:45 +03:00
|
|
|
|
2020-12-22 03:47:47 +03:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
|
2021-05-24 00:33:52 +03:00
|
|
|
if (ENABLE_ALL_DEBUG_FACILITIES)
|
|
|
|
set(ENABLE_ALL_THE_DEBUG_MACROS ON)
|
|
|
|
set(ENABLE_EXTRA_KERNEL_DEBUG_SYMBOLS ON)
|
2021-05-31 12:38:50 +03:00
|
|
|
|
|
|
|
# Immediately finds violations during boot, shouldn't be discoverable
|
|
|
|
# by people who aren't working on fixing issues. Use this check to make
|
|
|
|
# sure this code continues to build instead of all_debug_macros to avoid
|
|
|
|
# people filing bugs.
|
|
|
|
set(KMALLOC_VERIFY_NO_SPINLOCK_HELD ON)
|
2021-06-07 02:15:07 +03:00
|
|
|
|
|
|
|
# Enables KCOV API and injects kernel coverage instrumentation via
|
|
|
|
# -fsanitize-coverage=trace-pc. Mostly here to ensure that the CI catches
|
|
|
|
# commits breaking this flag.
|
|
|
|
set(ENABLE_KERNEL_COVERAGE_COLLECTION ON)
|
2021-05-24 00:33:52 +03:00
|
|
|
endif()
|
|
|
|
|
2021-01-01 13:26:52 +03:00
|
|
|
if (ENABLE_ALL_THE_DEBUG_MACROS)
|
2021-09-07 10:50:09 +03:00
|
|
|
include(all_the_debug_macros)
|
2021-01-01 13:26:52 +03:00
|
|
|
endif(ENABLE_ALL_THE_DEBUG_MACROS)
|
2020-08-27 01:59:36 +03:00
|
|
|
|
2021-01-24 01:29:11 +03:00
|
|
|
configure_file(AK/Debug.h.in AK/Debug.h @ONLY)
|
2021-01-25 18:07:10 +03:00
|
|
|
configure_file(Kernel/Debug.h.in Kernel/Debug.h @ONLY)
|
2021-01-24 01:29:11 +03:00
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(CMAKE_STAGING_PREFIX ${CMAKE_BINARY_DIR}/Root)
|
|
|
|
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Root)
|
|
|
|
set(CMAKE_INSTALL_DATAROOTDIR ${CMAKE_BINARY_DIR}/Root/res)
|
|
|
|
|
2021-01-07 02:55:01 +03:00
|
|
|
# We disable it completely because it makes cmake very spammy.
|
2020-12-28 02:04:29 +03:00
|
|
|
# This will need to be revisited when the Loader supports RPATH/RUN_PATH.
|
2021-01-07 02:55:01 +03:00
|
|
|
set(CMAKE_SKIP_RPATH TRUE)
|
2020-12-28 02:04:29 +03:00
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-Wall)
|
|
|
|
add_compile_options(-Wextra)
|
2021-03-28 17:48:37 +03:00
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
if (NOT CMAKE_HOST_SYSTEM_NAME MATCHES SerenityOS)
|
2021-03-28 17:43:05 +03:00
|
|
|
# FIXME: Something makes this go crazy and flag unused variables that aren't flagged as such when building with the toolchain.
|
|
|
|
# Disable -Werror for now.
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-Werror)
|
2021-03-28 17:43:05 +03:00
|
|
|
endif()
|
|
|
|
|
2021-04-15 10:07:44 +03:00
|
|
|
# The following warnings are sorted by the "base" name (the part excluding the initial Wno or W).
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-Wno-address-of-packed-member)
|
|
|
|
add_compile_options(-Wcast-qual)
|
2021-10-10 16:59:49 +03:00
|
|
|
add_compile_options(-Wdeprecated-copy)
|
2021-04-15 10:07:44 +03:00
|
|
|
add_compile_options(-Wduplicated-cond)
|
|
|
|
add_compile_options(-Wformat=2)
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-Wimplicit-fallthrough)
|
2021-04-15 10:07:44 +03:00
|
|
|
add_compile_options(-Wlogical-op)
|
|
|
|
add_compile_options(-Wmisleading-indentation)
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-Wmissing-declarations)
|
2021-04-15 20:43:29 +03:00
|
|
|
add_compile_options(-Wnon-virtual-dtor)
|
2021-12-04 12:09:09 +03:00
|
|
|
add_compile_options(-Wsuggest-override)
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-Wno-unknown-warning-option)
|
|
|
|
add_compile_options(-Wundef)
|
2021-04-15 10:07:44 +03:00
|
|
|
add_compile_options(-Wunused)
|
2021-07-13 17:43:45 +03:00
|
|
|
add_compile_options(-Wno-unused-command-line-argument)
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-Wwrite-strings)
|
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-fdiagnostics-color=always)
|
|
|
|
add_compile_options(-fno-delete-null-pointer-checks)
|
2021-08-08 03:32:49 +03:00
|
|
|
add_compile_options(-ffile-prefix-map=${SerenityOS_SOURCE_DIR}=.)
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-fno-exceptions)
|
2021-07-13 17:43:45 +03:00
|
|
|
add_compile_options(-fno-semantic-interposition)
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-fsized-deallocation)
|
2021-07-13 17:43:45 +03:00
|
|
|
add_compile_options(-fstack-clash-protection)
|
2021-03-28 17:48:37 +03:00
|
|
|
add_compile_options(-fstack-protector-strong)
|
|
|
|
add_compile_options(-g1)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2021-09-07 11:21:36 +03:00
|
|
|
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
|
|
add_compile_options(-Wno-literal-suffix)
|
2021-12-11 09:40:22 +03:00
|
|
|
add_compile_options(-Wno-maybe-uninitialized)
|
2022-01-03 11:28:12 +03:00
|
|
|
# Only ignore expansion-to-defined for g++, clang's implementation doesn't complain about function-like macros
|
|
|
|
add_compile_options(-Wno-expansion-to-defined)
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-Wcast-align)
|
|
|
|
add_compile_options(-Wdouble-promotion)
|
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
|
|
|
add_compile_options(-Wno-user-defined-literals)
|
2021-07-13 17:43:45 +03:00
|
|
|
add_compile_options(-Wno-atomic-alignment)
|
|
|
|
add_compile_options(-Wno-implicit-const-int-float-conversion)
|
2021-12-11 09:40:22 +03:00
|
|
|
add_compile_options(-Wno-unused-const-variable)
|
|
|
|
add_compile_options(-Wno-unused-private-field)
|
2021-07-13 17:43:45 +03:00
|
|
|
add_compile_options(-fconstexpr-steps=16777216)
|
|
|
|
|
Toolchain+Meta: Update LLVM version to 13.0.0
This commit updates the Clang toolchain's version to 13.0.0, which comes
with better C++20 support and improved handling of new features by
clang-format. Due to the newly enabled `-Bsymbolic-functions` flag, our
Clang binaries will only be 2-4% slower than if we dynamically linked
them, but we save hundreds of megabytes of disk space.
The `BuildClang.sh` script has been reworked to build the entire
toolchain in just three steps: one for the compiler, one for GNU
binutils, and one for the runtime libraries. This reduces the complexity
of the build script, and will allow us to modify the CI configuration to
only rebuild the libraries when our libc headers change.
Most of the compile flags have been moved out to a separate CMake cache
file, similarly to how the Android and Fuchsia toolchains are
implemented within the LLVM repo. This provides a nicer interface than
the heaps of command-line arguments.
We no longer build separate toolchains for each architecture, as the
same Clang binary can compile code for multiple targets.
The horrible mess that `SERENITY_CLANG_ARCH` was, has been removed in
this commit. Clang happily accepts an `i686-pc-serenity` target triple,
which matches what our GCC toolchain accepts.
2021-08-13 13:11:12 +03:00
|
|
|
# Clang doesn't add compiler_rt to the search path when compiling with -nostdlib.
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/lib/clang/${CMAKE_CXX_COMPILER_VERSION}/lib/${SERENITY_ARCH}-pc-serenity/)
|
2021-07-13 17:43:45 +03:00
|
|
|
endif()
|
|
|
|
|
2021-08-18 18:39:04 +03:00
|
|
|
add_link_options(LINKER:-z,text)
|
2022-01-08 22:33:36 +03:00
|
|
|
add_link_options(LINKER:--no-allow-shlib-undefined)
|
2021-08-18 18:39:04 +03:00
|
|
|
|
2021-07-12 10:31:47 +03:00
|
|
|
add_compile_definitions(SANITIZE_PTRS)
|
2020-12-11 16:44:08 +03:00
|
|
|
set(CMAKE_CXX_FLAGS_STATIC "${CMAKE_CXX_FLAGS} -static")
|
2020-12-20 23:32:10 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fpic")
|
2021-01-01 13:20:55 +03:00
|
|
|
|
2021-02-23 20:14:04 +03:00
|
|
|
if (ENABLE_COMPILETIME_FORMAT_CHECK)
|
|
|
|
add_compile_definitions(ENABLE_COMPILETIME_FORMAT_CHECK)
|
2021-02-08 20:26:28 +03:00
|
|
|
endif()
|
|
|
|
|
2021-07-13 17:43:45 +03:00
|
|
|
add_link_options(-Wno-unused-command-line-argument)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2021-08-08 10:31:23 +03:00
|
|
|
include_directories(.)
|
|
|
|
include_directories(Userland/Libraries)
|
2021-01-12 14:17:30 +03:00
|
|
|
include_directories(Userland/Libraries/LibC)
|
2021-05-01 12:38:19 +03:00
|
|
|
include_directories(Userland/Libraries/LibCrypt)
|
2021-01-12 14:17:30 +03:00
|
|
|
include_directories(Userland/Libraries/LibM)
|
2021-05-01 12:38:19 +03:00
|
|
|
include_directories(Userland/Libraries/LibPthread)
|
2021-02-05 14:16:30 +03:00
|
|
|
include_directories(Userland/Libraries/LibSystem)
|
2021-01-12 14:23:01 +03:00
|
|
|
include_directories(Userland/Services)
|
2021-01-12 13:53:14 +03:00
|
|
|
include_directories(Userland)
|
2020-09-14 13:51:12 +03:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
2021-01-12 14:23:01 +03:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Userland/Services)
|
2021-01-12 14:17:30 +03:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Userland/Libraries)
|
2021-01-12 13:53:14 +03:00
|
|
|
include_directories(${CMAKE_CURRENT_BINARY_DIR}/Userland)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2021-05-24 04:40:22 +03:00
|
|
|
# FIXME: vptr sanitizing requires.. intense ABI wrangling of std::type_info
|
|
|
|
# And would be better served by porting ubsan_type_hash_itanium.cpp from compiler-rt
|
|
|
|
if (ENABLE_UNDEFINED_SANITIZER)
|
2021-09-07 11:21:36 +03:00
|
|
|
add_compile_options(-fsanitize=undefined -fno-sanitize=vptr)
|
|
|
|
add_link_options(-fsanitize=undefined -fno-sanitize=vptr)
|
2021-05-24 04:40:22 +03:00
|
|
|
endif()
|
|
|
|
|
2021-06-15 16:07:25 +03:00
|
|
|
add_custom_target(components ALL)
|
|
|
|
option(BUILD_EVERYTHING "Build all optional components" ON)
|
|
|
|
|
2021-09-07 10:50:09 +03:00
|
|
|
include(utils)
|
|
|
|
include(wasm_spec_tests)
|
2021-06-15 16:07:25 +03:00
|
|
|
|
|
|
|
serenity_component(
|
|
|
|
Tests
|
|
|
|
RECOMMENDED
|
|
|
|
)
|
|
|
|
|
2022-01-07 17:31:48 +03:00
|
|
|
if (HACKSTUDIO_BUILD)
|
|
|
|
include(${HACKSTUDIO_BUILD_CMAKE_FILE})
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
2020-05-26 21:20:24 +03:00
|
|
|
add_subdirectory(AK)
|
2020-05-06 18:40:06 +03:00
|
|
|
add_subdirectory(Kernel)
|
2021-08-28 19:56:51 +03:00
|
|
|
if(NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
|
2022-01-19 22:54:34 +03:00
|
|
|
if (ENABLE_MOLD_LINKER)
|
|
|
|
add_link_options(-fuse-ld=mold)
|
|
|
|
endif()
|
2021-08-28 19:56:51 +03:00
|
|
|
add_subdirectory(Userland)
|
|
|
|
add_subdirectory(Tests)
|
|
|
|
endif()
|
2021-01-21 23:41:48 +03:00
|
|
|
if (ENABLE_COMPILETIME_HEADER_CHECK)
|
|
|
|
add_subdirectory(Meta/HeaderCheck)
|
|
|
|
endif()
|
2021-02-07 02:52:40 +03:00
|
|
|
|
2021-06-15 16:07:25 +03:00
|
|
|
export_components("${CMAKE_BINARY_DIR}/components.ini")
|
|
|
|
|
2021-12-23 03:32:00 +03:00
|
|
|
set(PCI_IDS_FILE pci.ids)
|
|
|
|
set(PCI_IDS_GZ_URL https://pci-ids.ucw.cz/v2.2/${PCI_IDS_FILE}.gz)
|
|
|
|
set(PCI_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/${PCI_IDS_FILE}.gz)
|
|
|
|
set(PCI_IDS_PATH ${CMAKE_BINARY_DIR}/${PCI_IDS_FILE})
|
|
|
|
set(PCI_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${PCI_IDS_FILE})
|
2021-03-04 01:50:25 +03:00
|
|
|
|
|
|
|
if(ENABLE_PCI_IDS_DOWNLOAD AND NOT EXISTS ${PCI_IDS_GZ_PATH})
|
|
|
|
message(STATUS "Downloading PCI ID database from ${PCI_IDS_GZ_URL}...")
|
|
|
|
file(DOWNLOAD ${PCI_IDS_GZ_URL} ${PCI_IDS_GZ_PATH} INACTIVITY_TIMEOUT 10)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(EXISTS ${PCI_IDS_GZ_PATH} AND NOT EXISTS ${PCI_IDS_INSTALL_PATH})
|
|
|
|
message(STATUS "Extracting PCI ID database from ${PCI_IDS_GZ_PATH}...")
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
|
2021-12-29 20:52:59 +03:00
|
|
|
execute_process(COMMAND gzip -d -c "${PCI_IDS_GZ_PATH}" OUTPUT_FILE "${PCI_IDS_INSTALL_PATH}")
|
2021-02-07 02:52:40 +03:00
|
|
|
endif()
|
2021-06-09 17:24:04 +03:00
|
|
|
|
2021-12-23 03:32:00 +03:00
|
|
|
set(USB_IDS_FILE usb.ids)
|
|
|
|
set(USB_IDS_GZ_URL http://www.linux-usb.org/${USB_IDS_FILE}.gz)
|
|
|
|
set(USB_IDS_GZ_PATH ${CMAKE_BINARY_DIR}/${USB_IDS_FILE}.gz)
|
|
|
|
set(USB_IDS_PATH ${CMAKE_BINARY_DIR}/${USB_IDS_FILE})
|
|
|
|
set(USB_IDS_INSTALL_PATH ${CMAKE_INSTALL_DATAROOTDIR}/${USB_IDS_FILE})
|
2021-06-09 17:24:04 +03:00
|
|
|
|
|
|
|
if(ENABLE_USB_IDS_DOWNLOAD AND NOT EXISTS ${USB_IDS_GZ_PATH})
|
|
|
|
message(STATUS "Downloading USB ID database from ${USB_IDS_GZ_URL}...")
|
|
|
|
file(DOWNLOAD ${USB_IDS_GZ_URL} ${USB_IDS_GZ_PATH} INACTIVITY_TIMEOUT 10)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(EXISTS ${USB_IDS_GZ_PATH} AND NOT EXISTS ${USB_IDS_INSTALL_PATH})
|
|
|
|
message(STATUS "Extracting USB ID database from ${USB_IDS_GZ_PATH}...")
|
|
|
|
file(MAKE_DIRECTORY ${CMAKE_INSTALL_DATAROOTDIR})
|
2021-12-29 20:52:59 +03:00
|
|
|
execute_process(COMMAND gzip -d -c "${USB_IDS_GZ_PATH}" OUTPUT_FILE "${USB_IDS_INSTALL_PATH}")
|
2021-06-09 17:24:04 +03:00
|
|
|
endif()
|