Files
ladybird/Utilities/CMakeLists.txt
ayeteadoe 5279e0ce73 CMake: Remove ENABLE_WINDOWS_CI option and adjust presets to match Unix
ENABLE_WINDOWS_CI and the *_CI presets were initially added back when
the AK library and all the AK Test* executables were the only targets
that supported building and running in CI. Since then, almost all the
targets in the codebase are built on Windows besides the following:
    - LibLine
    - test-262-runner

Since these targets above are not required to actually run or test the
browser on Windows in its current experimental state, fully disabling
them should be fine for now.

ENABLE_WINDOWS_CI was also used to exclude test-web from ctest. This
can be fully disabled on Windows for now until proper runtime support
is added.

The remaining locations were all using ENABLE_WINDOWS_CI as a proxy for
ENABLE_ADDRESS_SANITIZER, so we can just be explicit instead.

The new presets map much more directly to the unix Release, Debug, and
Sanitizer presets which should make setting up ladybird on Windows less
confusing.

We also make the new Windows_Experimental_Release preset the default in
ladybird.py to match Unix.
2026-01-16 11:15:16 -07:00

84 lines
2.8 KiB
CMake

if(WIN32)
# FIXME: Add support for LibLine on Windows
lagom_utility(js SOURCES js.cpp LIBS LibCrypto LibJS LibUnicode LibMain LibTextCodec LibGC Threads::Threads)
lagom_utility(wasm SOURCES wasm.cpp LIBS LibFileSystem LibWasm LibMain LibJS LibCrypto LibGC)
else()
lagom_utility(js SOURCES js.cpp LIBS LibCrypto LibJS LibLine LibUnicode LibMain LibTextCodec LibGC Threads::Threads)
lagom_utility(wasm SOURCES wasm.cpp LIBS LibFileSystem LibWasm LibLine LibMain LibJS LibCrypto LibGC)
endif()
lagom_utility(xml SOURCES xml.cpp LIBS LibFileSystem LibMain LibXML LibURL)
lagom_utility(dns SOURCES dns.cpp LIBS LibDNS LibMain LibTLS LibCrypto)
if (ENABLE_GUI_TARGETS)
lagom_utility(image SOURCES image.cpp LIBS LibGfx LibMain)
endif()
# FIXME: Increase support for building targets on Windows
if (WIN32)
return()
endif()
lagom_utility(test262-runner SOURCES test262-runner.cpp LIBS LibJS LibFileSystem LibGC)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
include(CheckCSourceCompiles)
# Check for musl's declaration of __assert_fail
check_c_source_compiles("
#include <assert.h>
__attribute__((__noreturn__)) void __assert_fail(char const* assertion, char const* file, int line, char const* function) {}
int main() {}
"
ASSERT_FAIL_HAS_INT
)
endif()
if (ASSERT_FAIL_HAS_INT)
target_compile_definitions(test262-runner PRIVATE ASSERT_FAIL_HAS_INT)
endif()
# Determine the Git commit hash (fallback to 'unknown' if not a Git repo)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if (NOT GIT_COMMIT_HASH)
set(GIT_COMMIT_HASH "unknown")
endif()
# Write it to the build directory
set(GIT_COMMIT_FILE "${CMAKE_BINARY_DIR}/COMMIT")
file(WRITE "${GIT_COMMIT_FILE}" "${GIT_COMMIT_HASH}\n")
if (NOT CMAKE_SKIP_INSTALL_RULES)
install(TARGETS js COMPONENT js)
install(FILES "${GIT_COMMIT_FILE}" COMPONENT js DESTINATION .)
install(TARGETS wasm COMPONENT wasm)
install(FILES "${GIT_COMMIT_FILE}" COMPONENT wasm DESTINATION .)
set(CPACK_GENERATOR "TGZ")
set(CPACK_STRIP_FILES TRUE)
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
set(CPACK_COMPONENTS_ALL js wasm)
set(CPACK_COMPONENTS_GROUPING ONE_PER_GROUP)
if (APPLE)
if("arm64" IN_LIST CMAKE_OSX_ARCHITECTURES AND "x86_64" IN_LIST CMAKE_OSX_ARCHITECTURES)
set(CPACK_SYSTEM_NAME "macOS-universal2")
else()
set(CPACK_SYSTEM_NAME "macOS-${CMAKE_SYSTEM_PROCESSOR}")
endif()
else()
set(CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(CPACK_ARCHIVE_JS_FILE_NAME "ladybird-js-${CPACK_SYSTEM_NAME}")
set(CPACK_ARCHIVE_WASM_FILE_NAME "ladybird-wasm-${CPACK_SYSTEM_NAME}")
include(CPack)
endif()