-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
50 lines (40 loc) · 1.29 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.26)
project(mantis)
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
option(MANTIS_BUILD_EXAMPLES "Build the examples" OFF)
option(MANTIS_BUILD_BENCH "Build the benchmarks" OFF)
option(MANTIS_BUILD_TESTS "Build the tests" ON)
# This is split out into a separate target to avoid setting compile flags that would
# affect the correctness of geogram's exact predicates.
add_library(delaunay
Delaunay_psm.cpp
Delaunay_psm.h
)
add_library(mantis
mantis.h
mantis.cpp
)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(mantis PRIVATE "-march=native")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(AVX)
if(CXX_AVX512_FOUND)
target_compile_options(mantis PRIVATE "/arch:AVX512")
else()
target_compile_options(mantis PRIVATE "/arch:AVX")
endif ()
endif()
target_link_libraries(mantis PRIVATE delaunay)
target_include_directories(mantis PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
if (MANTIS_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
if (MANTIS_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
if (MANTIS_BUILD_BENCH)
add_subdirectory(bench)
endif()