From 390ba2f4fdc8520192182f97d934c9f20367c6a1 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 8 May 2025 17:42:54 +0800 Subject: Build Dullahan in Linux aarch64 config stage GCC needs cstdint header inclusion for it to compile. include/cef needs to exist first otherwise configuration would fail. INSTALL_RPATH is needed in try_compile-ing. PROJECT_ARCH needs to be set on aarch64 to avoid -m64 and -march(=x86-64) settings which aren't recognised (and wouldn't be correct) on aarch64. ENABLE_CXX11_ABI needs to be set ON, otherwise it would use C++ 03's ABI and cause a linking failure. Dullahan headers don't seem to be included in the installation upstream, and dullahan_version.h gets generated only at least after Dullahan configuration, hence the 2 files copying. dullahan_host rpath removal is taken out of scope because the Fedora we support isn't only x86-64 now. The reindentations are just to make the uniform with the rest in the file. --- indra/cmake/CEFPlugin.cmake | 68 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 9 deletions(-) (limited to 'indra/cmake/CEFPlugin.cmake') diff --git a/indra/cmake/CEFPlugin.cmake b/indra/cmake/CEFPlugin.cmake index 119a41f570..70e6c366a4 100644 --- a/indra/cmake/CEFPlugin.cmake +++ b/indra/cmake/CEFPlugin.cmake @@ -35,16 +35,66 @@ elseif (CMAKE_OSX_ARCHITECTURES MATCHES x86_64) ) file(WRITE ${PREBUILD_TRACKING_DIR}/dullahan_installed "0") endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/dullahan_installed OR NOT ${dullahan_installed} EQUAL 0) +elseif (CMAKE_SYSTEM_PROCESSOR MATCHES aarch64) + if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/dullahan_installed OR NOT ${dullahan_installed} EQUAL 0) + if (NOT EXISTS ${CMAKE_BINARY_DIR}/v1.14.0-r3.tar.gz) + file(DOWNLOAD + https://github.com/secondlife/dullahan/archive/refs/tags/v1.14.0-r3.tar.gz + ${CMAKE_BINARY_DIR}/v1.14.0-r3.tar.gz + ) + endif () + file(ARCHIVE_EXTRACT + INPUT ${CMAKE_BINARY_DIR}/v1.14.0-r3.tar.gz + DESTINATION ${CMAKE_BINARY_DIR} + ) + execute_process( + COMMAND sed -i "/#include /a #include " dullahan.h + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dullahan-1.14.0-r3/src + ) + file(MAKE_DIRECTORY ${LIBS_PREBUILT_DIR}/include/cef) + try_compile(DULLAHAN_RESULT + PROJECT dullahan + SOURCE_DIR ${CMAKE_BINARY_DIR}/dullahan-1.14.0-r3 + BINARY_DIR ${CMAKE_BINARY_DIR}/dullahan-1.14.0-r3 + CMAKE_FLAGS + -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} + -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES} + -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${CMAKE_OSX_DEPLOYMENT_TARGET} + -DCMAKE_INSTALL_PREFIX:PATH=${LIBS_PREBUILT_DIR} + -DCMAKE_INSTALL_LIBDIR:PATH=${ARCH_PREBUILT_DIRS_RELEASE} + -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DUSE_SPOTIFY_CEF:BOOL=ON + -DSPOTIFY_CEF_URL:STRING=https://cef-builds.spotifycdn.com/cef_binary_118.4.1%2Bg3dd6078%2Bchromium-118.0.5993.54_linuxarm64_beta_minimal.tar.bz2 + -DPROJECT_ARCH:STRING=${CMAKE_SYSTEM_PROCESSOR} + -DENABLE_CXX11_ABI:BOOL=ON + ) + if (${DULLAHAN_RESULT}) + execute_process( + COMMAND ${CMAKE_MAKE_PROGRAM} install + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dullahan-1.14.0-r3 + OUTPUT_VARIABLE dullahan_installed + ) + file( + COPY + ${CMAKE_BINARY_DIR}/dullahan-1.14.0-r3/src/dullahan.h + ${CMAKE_BINARY_DIR}/dullahan-1.14.0-r3/src/dullahan_version.h + DESTINATION ${LIBS_PREBUILT_DIR}/include/cef + ) + file(WRITE ${PREBUILD_TRACKING_DIR}/dullahan_installed "${dullahan_installed}") + endif (${DULLAHAN_RESULT}) + endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/dullahan_installed OR NOT ${dullahan_installed} EQUAL 0) else (CMAKE_OSX_ARCHITECTURES MATCHES arm64) use_prebuilt_binary(dullahan) - if (${LINUX_DISTRO} MATCHES fedora) - execute_process( - COMMAND patchelf --remove-rpath bin/release/dullahan_host - WORKING_DIRECTORY ${LIBS_PREBUILT_DIR} - ) - endif (${LINUX_DISTRO} MATCHES fedora) endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64) +if (${LINUX_DISTRO} MATCHES fedora) + execute_process( + COMMAND patchelf --remove-rpath bin/release/dullahan_host + WORKING_DIRECTORY ${LIBS_PREBUILT_DIR} + ) +endif (${LINUX_DISTRO} MATCHES fedora) + target_include_directories( ll::cef SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/cef) if (WINDOWS) @@ -73,8 +123,8 @@ elseif (DARWIN) elseif (LINUX) target_link_libraries( ll::cef INTERFACE - libdullahan.a - cef - cef_dll_wrapper.a + libdullahan.a + cef + cef_dll_wrapper.a ) endif (WINDOWS) -- cgit v1.2.3