CMake: Add ENABLE_GUI_TARGETS option to enable disabling GUI components

This is useful when, e.g. building the test262 runner on its own.
This commit is contained in:
Andrew Kaster 2024-07-07 09:24:34 -06:00
parent 22d7aa53fa
commit 62268cca9e
Notes: sideshowbarker 2024-07-17 11:06:06 +09:00
5 changed files with 39 additions and 21 deletions

View file

@ -50,8 +50,10 @@ jobs:
- name: Create build directory Ubuntu
run: |
cmake --preset CI -B Build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=gcc-13 \
-DCMAKE_CXX_COMPILER=g++-13
-DCMAKE_CXX_COMPILER=g++-13 \
-DENABLE_GUI_TARGETS=OFF
if: ${{ matrix.os == 'ubuntu-22.04' }}
env:
CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }}
@ -64,7 +66,8 @@ jobs:
run: |
cmake --preset CI -B Build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0"
-DCMAKE_OSX_DEPLOYMENT_TARGET="11.0" \
-DENABLE_GUI_TARGETS=OFF
if: ${{ matrix.os == 'macos-14' }}
env:
CCACHE_DIR: ${{ env.SERENITY_CCACHE_DIR }}

View file

@ -99,7 +99,7 @@ jobs:
-DCMAKE_CXX_COMPILER=g++-13 \
-DWASM_SPEC_TEST_SKIP_FORMATTING=ON \
-DINCLUDE_WASM_SPEC_TESTS=ON \
-DENABLE_QT=OFF
-DENABLE_GUI_TARGETS=OFF
ninja -C libjs-test262/Build test262-runner test-js test-wasm
- name: Run test262 and test262-parser-tests

View file

@ -71,7 +71,7 @@ if (ANDROID AND ENABLE_QT)
set(ENABLE_QT OFF CACHE BOOL "" FORCE)
endif()
if (ENABLE_QT)
if (ENABLE_QT AND ENABLE_GUI_TARGETS)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
@ -80,7 +80,9 @@ endif()
include(CTest) # for BUILD_TESTING option, default ON
add_subdirectory(Ladybird)
if (ENABLE_GUI_TARGETS)
add_subdirectory(Ladybird)
endif()
add_custom_target(lint-shell-scripts
COMMAND "${ladybird_SOURCE_DIR}/Meta/lint-shell-scripts.sh"

View file

@ -26,3 +26,5 @@ serenity_option(ENABLE_NETWORK_DOWNLOADS ON CACHE BOOL "Allow downloads of requi
serenity_option(ENABLE_CLANG_PLUGINS OFF CACHE BOOL "Enable building with the Clang plugins")
serenity_option(ENABLE_CLANG_PLUGINS_INVALID_FUNCTION_MEMBERS OFF CACHE BOOL "Enable detecting invalid function types as members of GC-allocated objects")
serenity_option(ENABLE_GUI_TARGETS ON CACHE BOOL "Enable building GUI targets")

View file

@ -389,13 +389,10 @@ set(lagom_standard_libraries
Compress
Crypto
Diff
Gfx
HTTP
ImageDecoderClient
IPC
JS
Line
Media
Protocol
Regex
RIFF
@ -406,12 +403,20 @@ set(lagom_standard_libraries
Unicode
URL
Wasm
Web
WebSocket
WebView
XML
)
if (ENABLE_GUI_TARGETS)
list(APPEND lagom_standard_libraries
Gfx
ImageDecoderClient
Media
WebView
Web
)
endif()
target_link_libraries(LibCore PRIVATE LibURL Threads::Threads)
if (${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
# NetBSD has its shm_open and shm_unlink functions in librt so we need to link that
@ -450,15 +455,16 @@ endif()
lagom_utility(abench SOURCES ../../Userland/Utilities/abench.cpp LIBS LibMain LibFileSystem LibAudio)
lagom_utility(aconv SOURCES ../../Userland/Utilities/aconv.cpp LIBS LibMain LibFileSystem LibAudio)
lagom_utility(animation SOURCES ../../Userland/Utilities/animation.cpp LIBS LibGfx LibMain)
if (ENABLE_GUI_TARGETS)
lagom_utility(animation SOURCES ../../Userland/Utilities/animation.cpp LIBS LibGfx LibMain)
lagom_utility(icc SOURCES ../../Userland/Utilities/icc.cpp LIBS LibGfx LibMain LibURL)
lagom_utility(image SOURCES ../../Userland/Utilities/image.cpp LIBS LibGfx LibMain)
lagom_utility(ttfdisasm SOURCES ../../Userland/Utilities/ttfdisasm.cpp LIBS LibGfx LibMain)
endif()
lagom_utility(gzip SOURCES ../../Userland/Utilities/gzip.cpp LIBS LibCompress LibMain)
lagom_utility(icc SOURCES ../../Userland/Utilities/icc.cpp LIBS LibGfx LibMain LibURL)
lagom_utility(image SOURCES ../../Userland/Utilities/image.cpp LIBS LibGfx LibMain)
lagom_utility(ttfdisasm SOURCES ../../Userland/Utilities/ttfdisasm.cpp LIBS LibGfx LibMain)
lagom_utility(js SOURCES ../../Userland/Utilities/js.cpp LIBS LibCrypto LibJS LibLine LibUnicode LibMain LibTextCodec Threads::Threads)
lagom_utility(gzip SOURCES ../../Userland/Utilities/gzip.cpp LIBS LibCompress LibMain)
lagom_utility(lzcat SOURCES ../../Userland/Utilities/lzcat.cpp LIBS LibCompress LibMain)
lagom_utility(tar SOURCES ../../Userland/Utilities/tar.cpp LIBS LibArchive LibCompress LibFileSystem LibMain)
@ -509,18 +515,23 @@ if (BUILD_TESTING)
AK
LibCrypto
LibCompress
LibGfx
LibMedia
LibTest
LibTextCodec
LibTTF
LibUnicode
LibURL
LibWeb
LibWebView
LibXML
)
if (ENABLE_GUI_TARGETS)
list(APPEND TEST_DIRECTORIES
LibGfx
LibMedia
LibTTF
LibWeb
LibWebView
)
endif()
if (ENABLE_CLANG_PLUGINS AND CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
list(APPEND TEST_DIRECTORIES ClangPlugins)
endif()