Skip to content

Commit

Permalink
adding optional support for armv8 by removing bitness compiler flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Cutler committed Feb 22, 2018
1 parent 69836df commit 7ba1050
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ endif()

# Set bitness
if(${ARCH} STREQUAL "x86-64")
set(BITNESS "64")
set(BITNESS "64")
set(BITNESS_FLAG "-m${BITNESS}")
elseif(${ARCH} STREQUAL "x86")
set(BITNESS "32")
set(BITNESS "32")
set(BITNESS_FLAG "-m${BITNESS}")
elseif(${ARCH} STREQUAL "armv8")
set(BITNESS "64")
set(BITNESS_FLAG "")
else()
set(BITNESS "32")
set(ARCH "x86")
set(BITNESS_FLAG "-m${BITNESS}")
message("Unknown architecture selected, defaulting to x86")
endif()

Expand All @@ -91,7 +97,7 @@ if(WINDOWS AND GCC)
# -fipa-cp-clone causes a SegFault in Eigen when enabled with MinGW i686 4.9.2 with dwarf exception model
#set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fipa-cp-clone")
endif()

# To avoid an external dependency (libgcc_s_seh11.dll or libgcc_s_dw2-1.dll)
# we statically link the libraries required by MinGW runtimes
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -static")
Expand All @@ -110,11 +116,11 @@ if(MSVC)
elseif(GCC OR CLANG)
# Treat warning return-type as error to avoid undefined behaviour
# when a non-void function does not return a value.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${BITNESS} -std=c++11 -Werror=return-type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BITNESS_FLAG} -std=c++11 -Werror=return-type")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wno-long-long")

elseif(INTEL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m${BITNESS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${BITNESS_FLAG} -std=c++11")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
endif()

Expand Down Expand Up @@ -299,7 +305,7 @@ if(DOXYGEN_FOUND)
${PROJECT_BINARY_DIR}/Doxyfile
COMMENT "Generating API documentation with Doxygen"
VERBATIM)

endif()

if(CMAKE_BUILD_TYPE STREQUAL DEBUG)
Expand Down

2 comments on commit 7ba1050

@gablank
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for the PR!

@markcutler
Copy link
Contributor

@markcutler markcutler commented on 7ba1050 Feb 23, 2018 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.