From 0128417447bf7742f014b3e0b48b04555086bb1d Mon Sep 17 00:00:00 2001 From: Nathan Litke Date: Thu, 7 Aug 2014 13:10:23 -0700 Subject: [PATCH] Allow NEON to be disabled on Android. Works similar to GCD on Mac OS X. --- CMakeLists.txt | 21 +++++++++++---------- opensubdiv/osd/CMakeLists.txt | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e67cb730..f7dbc296 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,7 +121,7 @@ SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) set(OSD_COMPILER_FLAGS) -# Disable spurrious warnings in gcc builds and clang +# Disable spurious warnings in gcc builds and clang if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_ICC ) # Turn on all warnings @@ -178,10 +178,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_ICC endforeach() endif() - if(ANDROID) - list(APPEND OSD_COMPILER_FLAGS -mfpu=neon) - endif() - elseif(MSVC) # Turn on all warnings @@ -289,7 +285,8 @@ option(NO_TBB "Disable TBB backend" OFF) option(NO_CUDA "Disable CUDA backend" OFF) option(NO_OPENCL "Disable OpenCL backend" OFF) option(NO_CLEW "Disable CLEW wrapper library" OFF) -option(NO_NO_GCD "Disable GrandCentralDispatch backend" OFF) +option(NO_GCD "Disable GrandCentralDispatch backend" OFF) +option(NO_NEON "Disable NEON backend" OFF) # Check for dependencies if(NOT NO_OMP) @@ -339,6 +336,10 @@ if (NOT NO_GCD AND APPLE) set(GCD_FOUND 1) endif() +if (NOT NO_NEON AND ANDROID) + set(NEON_FOUND 1) +endif() + if (NOT NO_MAYA) find_package(Maya 201200) endif() @@ -347,14 +348,14 @@ endif() # disabled. Also, add preprocessor defines that can be used in the source # code to determine if a specific dependency is present or not. -if(ANDROID) - add_definitions(-DLOCAL_ARM_MODE=arm -DLOCAL_ARM_NEON=true) -endif() - if(GCD_FOUND) add_definitions( -DOPENSUBDIV_HAS_GCD ) endif() +if(NEON_FOUND) + add_definitions(-DLOCAL_ARM_MODE=arm -DLOCAL_ARM_NEON=true -mfpu=neon) +endif() + if(OPENMP_FOUND) add_definitions( -DOPENSUBDIV_HAS_OPENMP diff --git a/opensubdiv/osd/CMakeLists.txt b/opensubdiv/osd/CMakeLists.txt index d4310371..734f768e 100644 --- a/opensubdiv/osd/CMakeLists.txt +++ b/opensubdiv/osd/CMakeLists.txt @@ -168,7 +168,7 @@ set(NEON_PRIVATE_HEADERS neonKernel.h ) -if(ANDROID) +if(NEON_FOUND) enable_language(ASM) list(APPEND CPU_SOURCE_FILES neonComputeContext.cpp