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

macOS compatibility #167

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
35 changes: 28 additions & 7 deletions CMake/Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,28 @@ endif (USE_DOUBLE_PRECISION)

cmake_dependent_option(USE_AVX "Use AVX" ON "NOT USE_DOUBLE_PRECISION" OFF)
if (USE_AVX)
include(avx)
set_avx_flags()
if (FOUND_AVX2)
message(STATUS "Using AVX2")
set(FOUND_ACCELERATE OFF)
if (APPLE)
find_library(ACCELERATE Accelerate)
endif()
if (ACCELERATE)
set(FOUND_ACCELERATE ON)
message(STATUS "Using Accelerate")
link_libraries(${ACCELERATE})
else()
include(avx)
set_avx_flags()
if (FOUND_AVX2)
message(STATUS "Using AVX2")
endif()
endif()
if (FOUND_ACCELERATE OR FOUND_AVX2)
set(FOUND_SIMD ON)
add_definitions(-DUSE_AVX)
endif()
endif()

cmake_dependent_option(USE_PERFORMANCE_OPTIMIZATION "Optimize performance (higher memory consumption)" ON "FOUND_AVX2" OFF)
cmake_dependent_option(USE_PERFORMANCE_OPTIMIZATION "Optimize performance (higher memory consumption)" ON "FOUND_SIMD" OFF)
if (USE_PERFORMANCE_OPTIMIZATION)
add_definitions( -DUSE_PERFORMANCE_OPTIMIZATION)
endif (USE_PERFORMANCE_OPTIMIZATION)
Expand Down Expand Up @@ -64,8 +77,12 @@ option(USE_OpenMP "Use OpenMP" ON)
if(USE_OpenMP)
FIND_PACKAGE(OpenMP)
if(OPENMP_FOUND)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
if (CMAKE_VERSION VERSION_GREATER "3.8")
link_libraries(OpenMP::OpenMP_CXX)
else()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
endif()
endif()

Expand All @@ -86,6 +103,9 @@ if (UNIX OR MINGW)
if (CI_BUILD)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -march=x86-64")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -march=x86-64")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -mcpu=native")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -mcpu=native")
else()
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -march=native")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -march=native")
Expand All @@ -101,6 +121,7 @@ endif(MINGW)

if(APPLE)
set(CMAKE_MACOSX_RPATH 1)
add_definitions(-DGL_SILENCE_DEPRECATION)
endif()

if (MSVC)
Expand Down
4 changes: 2 additions & 2 deletions CMake/NeighborhoodSearch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ else(USE_GPU_NEIGHBORHOOD_SEARCH)
ExternalProject_Add(
Ext_NeighborhoodSearch
PREFIX "${CMAKE_BINARY_DIR}/extern/CompactNSearch"
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/CompactNSearch.git
GIT_TAG "3f11ece16a419fc1cc5795d6aa87cb7fe6b86960"
GIT_REPOSITORY https://github.com/ruberith/CompactNSearch.git
GIT_TAG "847c2c22fad4fdae9b99d62d21646db79ff88ef2"
INSTALL_DIR ${ExternalInstallDir}/NeighborhoodSearch
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/NeighborhoodSearch -DUSE_DOUBLE_PRECISION:BOOL=${USE_DOUBLE_PRECISION} -DBUILD_DEMO:BOOL=OFF
)
Expand Down
2 changes: 1 addition & 1 deletion CMake/SetUpExternalProjects.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ExternalProject_Add(
Ext_Discregrid
PREFIX "${CMAKE_BINARY_DIR}/extern/Discregrid"
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/Discregrid.git
GIT_TAG "0b69062ff9c56fbb6dcecd296652028bedbacf0e"
GIT_TAG "4c27e1cc88be828c6ac5b8a05759ac7e01cf79e9"
INSTALL_DIR ${ExternalInstallDir}/Discregrid
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/Discregrid -DBUILD_CMD_EXECUTABLE:BOOL=0 -DEIGEN3_INCLUDE_DIR:PATH=${EIGEN3_INCLUDE_DIR} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
)
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ endif()
## Eigen3 is used by most of the libraries that follow
find_package(Eigen3 REQUIRED)
add_definitions(-DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -idirafter${EIGEN3_INCLUDE_DIR}")
digitalillusions marked this conversation as resolved.
Show resolved Hide resolved
endif()

################################################################################
# own external libraries
Expand Down
Loading