-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (55 loc) · 2.35 KB
/
CMakeLists.txt
File metadata and controls
71 lines (55 loc) · 2.35 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
################################################################################
cmake_minimum_required(VERSION 3.1)
project(TMesh_Kernel)
################################################################################
# Uncomment and adapt the following definition after having downloaded
# mpir and compiled it for 64bit.
#set(MPIR_LOCATION "D:/SOFTWARE/mpir-master/msvc/vs19/lib_mpir_gc/x64/Release")
################################################################################
# Options for enabling/disabling optional libraries
option(USE_LAZY_KERNEL "Use lazy kernel" ON)
################################################################################
# library
################################################################################
if(${USE_LAZY_KERNEL})
if(NOT DEFINED MPIR_LOCATION)
message(FATAL_ERROR "MPIR_LOCATION is undefined. Please set it on line 8 in CMakeLists.txt")
endif(NOT DEFINED MPIR_LOCATION)
set(TMESH_LIB_PATH "kernel_Lazy64")
else()
set(TMESH_LIB_PATH "kernel_Fast64")
endif()
add_library(${TMESH_LIB_PATH} STATIC
src/coordinates.cpp
src/expansion.cpp
src/mixedPredicates.cpp
src/orientation.cpp
src/point.cpp
src/tmesh.cpp
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(${TMESH_LIB_PATH} PUBLIC -frounding-math)
set(MPIR_LIB ${MPIR_LOCATION}/mpir.a)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_compile_options(${TMESH_LIB_PATH} PUBLIC "/fp:strict")
target_compile_definitions(${TMESH_LIB_PATH} PUBLIC -D_CRT_SECURE_NO_WARNINGS)
set(MPIR_LIB ${MPIR_LOCATION}/mpir.lib)
endif()
if(${USE_LAZY_KERNEL})
target_compile_definitions(${TMESH_LIB_PATH} PUBLIC -DUSE_LAZY_KERNEL)
target_compile_definitions(${TMESH_LIB_PATH} PUBLIC -DUSE_HYBRID_KERNEL)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_definitions(${TMESH_LIB_PATH} PUBLIC -DIS64BITPLATFORM)
endif()
# Public include directory
target_include_directories(${TMESH_LIB_PATH} PUBLIC include)
# Use C++14
target_compile_features(${TMESH_LIB_PATH} PUBLIC ${CXX14_FEATURES})
################################################################################
# Required libraries
################################################################################
if(${USE_LAZY_KERNEL})
target_include_directories(${TMESH_LIB_PATH} PUBLIC ${MPIR_LOCATION}/)
target_link_libraries(${TMESH_LIB_PATH} PUBLIC ${MPIR_LIB})
endif()