summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2022-01-07 16:31:48 +0200
committerAndreas Kling <kling@serenityos.org>2022-01-12 14:55:19 +0100
commitf464ae84ce5b1acd355a43b37156fcab476ac3e7 (patch)
treee76d654cc5c46634ebb73eb206e76747d6a1398c
parentafb4c447b4e94a70b80209124d71eb0c512be464 (diff)
downloadserenity-f464ae84ce5b1acd355a43b37156fcab476ac3e7.zip
CMake: Add HACKSTUDIO_BUILD option for building from Hack Studio
If this option is set, we will not build all components. Instead, we include an external CMake file passed in via a variable named HACKSTUDIO_BUILD_CMAKE_FILE. This will be used to build serenity components from Hack Studio.
-rw-r--r--CMakeLists.txt35
-rw-r--r--Meta/CMake/common_options.cmake2
2 files changed, 26 insertions, 11 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 728b1d69ed..db12529730 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,13 +47,17 @@ if(CCACHE_PROGRAM)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}" CACHE FILEPATH "Path to a compiler launcher program, e.g. ccache")
endif()
-# 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)
+if (NOT HACKSTUDIO_BUILD)
-# Host tools, required to generate files for the build
-find_package(Lagom CONFIG REQUIRED)
+ # 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()
# Meta target to run all code-gen steps in the build.
add_custom_target(all_generated)
@@ -109,11 +113,15 @@ add_custom_target(install-ports
USES_TERMINAL
)
-add_custom_target(configure-components
- COMMAND "$<TARGET_FILE:Lagom::ConfigureComponents>"
- USES_TERMINAL
-)
-add_dependencies(configure-components Lagom::ConfigureComponents)
+if (NOT HACKSTUDIO_BUILD)
+
+ add_custom_target(configure-components
+ COMMAND "$<TARGET_FILE:Lagom::ConfigureComponents>"
+ USES_TERMINAL
+ )
+ add_dependencies(configure-components Lagom::ConfigureComponents)
+
+endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -251,6 +259,11 @@ serenity_component(
RECOMMENDED
)
+if (HACKSTUDIO_BUILD)
+ include(${HACKSTUDIO_BUILD_CMAKE_FILE})
+ return()
+endif()
+
add_subdirectory(AK)
add_subdirectory(Kernel)
if(NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
diff --git a/Meta/CMake/common_options.cmake b/Meta/CMake/common_options.cmake
index 3a1f9ef409..eb516be7fc 100644
--- a/Meta/CMake/common_options.cmake
+++ b/Meta/CMake/common_options.cmake
@@ -12,3 +12,5 @@ serenity_option(ENABLE_COMPILETIME_HEADER_CHECK OFF CACHE BOOL "Enable compileti
serenity_option(ENABLE_TIME_ZONE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of the IANA Time Zone Database at build time")
serenity_option(ENABLE_UNICODE_DATABASE_DOWNLOAD ON CACHE BOOL "Enable download of Unicode UCD and CLDR files at build time")
serenity_option(INCLUDE_WASM_SPEC_TESTS OFF CACHE BOOL "Download and include the WebAssembly spec testsuite")
+
+serenity_option(HACKSTUDIO_BUILD OFF CACHE BOOL "Automatically enabled when building from HackStudio")