From 2c3b2978959c85c996c088f9c9db434df1736bdc Mon Sep 17 00:00:00 2001 From: Morten Larsen Date: Tue, 18 Jan 2022 00:54:36 +0100 Subject: Lagom: Exclude libraries with X86 code when building for macOS on Arm The CMakeLists.txt for Lagom contains a few libraries and executables with X86-specific code. By excluding those libraries, Lagom builds for macOS on Arm as well. The places are marked FIXME to be removed when the libraries will build for Arm. --- Meta/Lagom/CMakeLists.txt | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'Meta/Lagom') diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index 3daf145601..80875faee8 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -304,12 +304,16 @@ if (BUILD_LAGOM) ) # ELF - file(GLOB LIBELF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibELF/*.cpp") - # There's no way we can reliably make the dynamic loading classes cross platform - list(FILTER LIBELF_SOURCES EXCLUDE REGEX ".*Dynamic.*.cpp$") - lagom_lib(ELF elf - SOURCES ${LIBELF_SOURCES} - ) + # FIXME: Excluding arm64 is a temporary hack to circumvent a build problem + # for Lagom on Apple M1 + if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") + file(GLOB LIBELF_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibELF/*.cpp") + # There's no way we can reliably make the dynamic loading classes cross platform + list(FILTER LIBELF_SOURCES EXCLUDE REGEX ".*Dynamic.*.cpp$") + lagom_lib(ELF elf + SOURCES ${LIBELF_SOURCES} + ) + endif() # Gemini file(GLOB LIBGEMINI_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGemini/*.cpp") @@ -458,10 +462,14 @@ if (BUILD_LAGOM) ) # x86 - file(GLOB LIBX86_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibX86/*.cpp") - lagom_lib(X86 x86 - SOURCES ${LIBX86_SOURCES} - ) + # FIXME: Excluding arm64 is a temporary hack to circumvent a build problem + # for Lagom on Apple M1 + if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") + file(GLOB LIBX86_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibX86/*.cpp") + lagom_lib(X86 x86 + SOURCES ${LIBX86_SOURCES} + ) + endif() if (NOT ENABLE_OSS_FUZZ AND NOT ENABLE_FUZZER_SANITIZER AND NOT ENABLE_COMPILER_EXPLORER_BUILD) # Lagom Examples @@ -476,9 +484,13 @@ if (BUILD_LAGOM) set_target_properties(adjtime_lagom PROPERTIES OUTPUT_NAME adjtime) target_link_libraries(adjtime_lagom LagomCore LagomMain) - add_executable(disasm_lagom ../../Userland/Utilities/disasm.cpp) - set_target_properties(disasm_lagom PROPERTIES OUTPUT_NAME disasm) - target_link_libraries(disasm_lagom LagomCore LagomELF LagomX86 LagomMain) + # FIXME: Excluding arm64 is a temporary hack to circumvent a build problem + # for Lagom on Apple M1 + if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64") + add_executable(disasm_lagom ../../Userland/Utilities/disasm.cpp) + set_target_properties(disasm_lagom PROPERTIES OUTPUT_NAME disasm) + target_link_libraries(disasm_lagom LagomCore LagomELF LagomX86 LagomMain) + endif() add_executable(gml-format_lagom ../../Userland/Utilities/gml-format.cpp) set_target_properties(gml-format_lagom PROPERTIES OUTPUT_NAME gml-format) -- cgit v1.2.3