Skip to content

Commit

Permalink
Port to Ubuntu-23 on Aarch64 (typically on Apple M cpus).
Browse files Browse the repository at this point in the history
  • Loading branch information
FonsRademakers committed Feb 22, 2024
1 parent 73cfdb8 commit b7b0832
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
12 changes: 10 additions & 2 deletions cmake/SetCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 6 additions & 4 deletions cmake/external/ROOT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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}})

Expand Down
3 changes: 3 additions & 0 deletions cmake/external/SHA256Digests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 8 additions & 1 deletion cmake/utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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()

Expand Down

0 comments on commit b7b0832

Please sign in to comment.