Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let user override ENOKI_NATIVE_FLAGS and ENOKI_ARCH_FLAGS #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ endif()
string(TOUPPER "${CMAKE_BUILD_TYPE}" ENOKI_U_CMAKE_BUILD_TYPE)

set(ENOKI_CXXFLAGS_BACKUP ${CMAKE_CXX_FLAGS})
set(ENOKI_NATIVE_FLAGS "")

if (NOT DEFINED ENOKI_NATIVE_FLAGS)
set(ENOKI_NATIVE_FLAGS "")
endif()

if (MSVC)
set(ENOKI_ARCH_FLAGS_FILE archflags_win32.cpp)
Expand All @@ -64,11 +67,19 @@ endif()

# Clang refuses -march=native on ARM machines
if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "armv7")
set(ENOKI_ARCH_FLAGS -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mfp16-format=ieee)
set(ENOKI_NATIVE_FLAGS ${ENOKI_ARCH_FLAGS})
if (NOT DEFINED ENOKI_ARCH_FLAGS)
set(ENOKI_ARCH_FLAGS -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -mfp16-format=ieee)
endif()
if (NOT ENOKI_NATIVE_FLAGS)
set(ENOKI_NATIVE_FLAGS ${ENOKI_ARCH_FLAGS})
endif()
elseif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(ENOKI_ARCH_FLAGS -march=armv8-a+simd -mtune=cortex-a53)
set(ENOKI_NATIVE_FLAGS ${ENOKI_ARCH_FLAGS})
if (NOT DEFINED ENOKI_ARCH_FLAGS)
set(ENOKI_ARCH_FLAGS -march=armv8-a+simd -mtune=cortex-a53)
endif()
if (NOT ENOKI_NATIVE_FLAGS)
set(ENOKI_NATIVE_FLAGS ${ENOKI_ARCH_FLAGS})
endif()
elseif (CMAKE_CXX_COMPILER MATCHES "/em\\+\\+(-[a-zA-Z0-9.])?$")
# Emscripten
else()
Expand Down