diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f40aaf..5dfb6f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) @@ -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()