-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
108 lines (84 loc) · 2.82 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
if( CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR )
message( FATAL_ERROR "Please select another Build Directory ! (and give it a clever name, like bin_Visual2012_64bits/)" )
endif()
if( CMAKE_SOURCE_DIR MATCHES " " )
message( "Your Source Directory contains spaces. If you experience problems when compiling, this can be the cause." )
endif()
if( CMAKE_BINARY_DIR MATCHES " " )
message( "Your Build Directory contains spaces. If you experience problems when compiling, this can be the cause." )
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
#project name
project(HPMeshGen2 LANGUAGES CUDA CXX)
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED True)
set (CMAKE_POSITION_INDEPENDENT_CODE ON)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (CMAKE_CUDA_COMPILER)
MESSAGE(STATUS "Generate with CUDA")
enable_language(CUDA)
#set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -gencode arch=compute_35,code=sm_35")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-extended-lambda")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr")
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --use_fast_math")
set(CMAKE_CUDA_SEPARABLE_COMPILATION ON)
set(CMAKE_CUDA_ARCHITECTURES 61)
else()
MESSAGE(FATAL_ERROR "Cuda not found")
endif()
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH} )
########## required libraries ##########
#openmp
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
set(LIBS ${LIBS} OpenMP::OpenMP_CXX)
endif()
#glog
find_package(glog REQUIRED)
set(LIBS ${LIBS} glog::glog)
#OpenMesh
find_package(OpenMesh REQUIRED)
set(LIBS ${LIBS} ${OPENMESH_LIBRARIES})
add_definitions(-D_USE_MATH_DEFINES)
#Eigen
#find_package(Eigen3 REQUIRED)
#set(LIBS ${LIBS} Eigen3::Eigen)
#nanoflann
#find_package(nanoflann CONFIG REQUIRED)
#set(LIBS ${LIBS} nanoflann::nanoflann)
#CImg
#find_package(CImg CONFIG)
#if(CImg_FOUND)
# set(LIBS ${LIBS} CImg::CImg)
#endif()
if(NOT MSVC)
#X11
#MESSAGE(STATUS "Add X11 for non windows systems")
#find_package(X11 REQUIRED)
#set(LIBS ${LIBS} X11)
MESSAGE(STATUS "Add stdc++fs for non windows systems")
set(LIBS ${LIBS} stdc++fs)
endif()
if(MSVC)
# enable parallel build in Visual Studio
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
#if (MSVC)
# add_compile_options(/W4 /WX)
#else()
# add_compile_options(-Wall -Wextra -pedantic -Werror)
#endif()
########## executables ##########
set(SRC ${PROJECT_SOURCE_DIR}/src)
add_subdirectory(src)
########## unit tests ##########
option(BUILD_TESTS "Build unit tests" OFF)
if(${BUILD_TESTS})
message(STATUS "Build unit tests")
enable_testing()
include(GoogleTest)
add_subdirectory(tests)
endif()