From b7b0832e2817986e5d0ee37cf06293257f07e415 Mon Sep 17 00:00:00 2001 From: Fons Rademakers Date: Thu, 22 Feb 2024 17:54:18 +0100 Subject: [PATCH] Port to Ubuntu-23 on Aarch64 (typically on Apple M cpus). --- CMakeLists.txt | 2 +- cmake/SetCompilerFlags.cmake | 12 ++++++++++-- cmake/external/ROOT.cmake | 10 ++++++---- cmake/external/SHA256Digests.cmake | 3 +++ cmake/utils.cmake | 9 ++++++++- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1927e5a14..737cc26da 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -650,7 +650,7 @@ if (CUDA_FOUND) message("CUDA Debug mode") set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -g -G -O0" ) endif() - set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++11") + set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -std=c++17") target_link_libraries(biodynamo ${CUDA_LIBRARIES}) cuda_include_directories(${CUDA_INCLUDE_DIRS} ${CUDA_TOOLKIT_ROOT_DIR}) diff --git a/cmake/SetCompilerFlags.cmake b/cmake/SetCompilerFlags.cmake index 17cdec15f..04cccb230 100644 --- a/cmake/SetCompilerFlags.cmake +++ b/cmake/SetCompilerFlags.cmake @@ -26,8 +26,16 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) # general flags -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-missing-braces -m64 -fPIC ${OpenMP_CXX_FLAGS}") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-missing-braces -m64 -fPIC ${OpenMP_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-missing-braces -fPIC ${OpenMP_CXX_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-missing-braces -fPIC ${OpenMP_C_FLAGS}") +if(${DETECTED_ARCH} STREQUAL "x86_64") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64") +endif() +if(${DETECTED_ARCH} STREQUAL "aarch64") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=native") +endif() # suppress OpenCL-generated warnings if (OPENCL_FOUND) diff --git a/cmake/external/ROOT.cmake b/cmake/external/ROOT.cmake index 88c978652..4be6d2b11 100644 --- a/cmake/external/ROOT.cmake +++ b/cmake/external/ROOT.cmake @@ -37,10 +37,12 @@ if(APPLE) elseif("${DETECTED_OS_VERS}" MATCHES "^osx-11") message(FATAL_ERROR "We officially only support the latest macOS 11 versions 11.6, 11.7.") endif() -else() - if("${DETECTED_OS_VERS}" MATCHES "^ubuntu-22") - set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_${DETECTED_OS_VERS}.tar.gz) - endif() +#else() + #if("${DETECTED_OS_VERS}" MATCHES "^ubuntu-23" AND + #"${DETECTED_ARCH}" STREQUAL "aarch64") + #set(ROOT_SHA_KEY ubuntu-23.04-${DETECTED_ARCH}-ROOT) + #set(ROOT_TAR_FILE root_v6.30.02_cxx17_python3.9_ubuntu-23.04-${DETECTED_ARCH}.tar.gz) +# endif() endif() set(ROOT_SHA ${${ROOT_SHA_KEY}}) diff --git a/cmake/external/SHA256Digests.cmake b/cmake/external/SHA256Digests.cmake index b1342559a..a9274759c 100644 --- a/cmake/external/SHA256Digests.cmake +++ b/cmake/external/SHA256Digests.cmake @@ -84,6 +84,9 @@ SET(ubuntu-22.04-ParaView afc803835973fdb8b963fe10eaf1103f2e1650e4573141964c1322 SET(ubuntu-22.04-Qt b2388d1bcca4e3741ab5b2b0fb95395aeb6c448951a0d3cdeb6db33b64a7d41c) SET(ubuntu-22.04-ROOT 24921a85b53c5cfbe9f192e523263781d595c59c9c553818349992e61efc64ac) +SET(ubuntu-23.04-aarch64-ROOT 7d2fcaaeb1e452c38c1d8436288e3171d1b6935f5b6f25d5df16b21e00ca45d8) +SET(ubuntu-23.10-aarch64-ROOT 8f6fa9db579e011ef4ae7e96830d8ab1284b6df95a1b2f46e6a1cea56fd4626f) + SET(centos-7-Libroadrunner a0b49487a28aedc4b909a71c66263d4a388964008e2b23073dd744231251470c) SET(centos-7-ParaView 45d545e75baf32c9fe30944781b4f6b172d4efd7d6cd794dcd19ec671cc5ead0) SET(centos-7-Qt 4308621ff9ec84585c3aead92a9d2de787b3c700323333b6e78ed45d04a0d2a4) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 76a5f2cc1..9ab61f8b0 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -15,6 +15,9 @@ # Detect the system flavour and version. Generate variables # called DETECTED_OS (ubuntu-18.04, ubuntu-20.04, centos-7, osx) # and DETECTED_OS_VERS (ubuntu-18.04, ubuntu-20.04, centos-7 or osx-11.2-i386). +# In case the Linux arch is aarch64, the DETECTED_OS_VERS ends in -aarch64, +# like ubuntu-23.10-aarch64. For backward compatibility reasons we don't +# add -x86_64. function(detect_os) if(APPLE) execute_process(COMMAND sw_vers "-productVersion" @@ -40,7 +43,11 @@ function(detect_os) set(BDM_OS "${DISTRO_NAME}-${DISTRO_VERSION}") set(DETECTED_OS "${BDM_OS}" PARENT_SCOPE) set(DETECTED_ARCH "${DISTRO_ARCH}" PARENT_SCOPE) - set(DETECTED_OS_VERS "${BDM_OS}" PARENT_SCOPE) + if("${DISTRO_ARCH}" STREQUAL "aarch64") + set(DETECTED_OS_VERS "${BDM_OS}-${DISTRO_ARCH}" PARENT_SCOPE) + else() + set(DETECTED_OS_VERS "${BDM_OS}" PARENT_SCOPE) + endif() endif() endfunction()