Skip to content

Commit

Permalink
Get arch in this file (as utils.cmake is not included in UseBioDynaMo…
Browse files Browse the repository at this point in the history
….cmake).
  • Loading branch information
FonsRademakers committed Feb 22, 2024
1 parent b7b0832 commit 0cb3d08
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmake/SetCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,17 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
# turn off compiler specific extensions e.g. gnu++17
set(CMAKE_CXX_EXTENSIONS OFF)

# get machine architecture
execute_process(COMMAND arch OUTPUT_VARIABLE DISTRO_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)

# general 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")
if(${DISTRO_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")
if(${DISTRO_ARCH} STREQUAL "aarch64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcpu=native")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mcpu=native")
endif()
Expand Down

0 comments on commit 0cb3d08

Please sign in to comment.