-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathCMakeLists.txt
91 lines (71 loc) · 2.94 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
cmake_minimum_required(VERSION 3.12)
project(gproshan VERSION 2.0 LANGUAGES CXX)
list(APPEND CMAKE_MODULE_PATH "${gproshan_SOURCE_DIR}/cmake")
find_package(CUDA 10.1)
if(CUDA_FOUND)
enable_language(CUDA)
endif(CUDA_FOUND)
find_package(Threads REQUIRED)
find_package(OpenMP REQUIRED)
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(GLUT REQUIRED)
find_package(X11 REQUIRED)
find_package(Armadillo REQUIRED)
find_package(CGAL REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(SuiteSparse REQUIRED)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS "-fopenmp -Wall -Wno-unused-result")
set(CMAKE_CUDA_FLAGS "-Xcompiler -fopenmp")
set(THREADS_PREFER_PTHREAD_FLAG ON)
add_definitions(${EIGEN3_DEFINITIONS})
# ARMA warning ARMA_ALLOW_FAKE_GCC with g++-9
add_definitions(-DARMA_ALLOW_FAKE_GCC)
if(CUDA_FOUND)
add_definitions(-DGPROSHAN_CUDA)
include_directories(${CUDA_INCLUDE_DIRS})
endif(CUDA_FOUND)
include_directories(${OPENGL_INCLUDE_DIR})
include_directories(${GLEW_INCLUDE_DIRS})
include_directories(${GLUT_INCLUDE_DIR})
include_directories(${X11_INCLUDE_DIR})
include_directories(${AMADILLO_INCLUDE_DIR})
include_directories(${EIGEN3_INCLUDE_DIR})
include_directories(${SuiteSparse_INCLUDE_DIRS})
include_directories(${CGAL_INCLUDE_DIRS})
include_directories(${gproshan_SOURCE_DIR}/include)
include_directories(${gproshan_SOURCE_DIR}/include/viewer)
include_directories(${gproshan_SOURCE_DIR}/include/mdict)
include_directories(${gproshan_SOURCE_DIR}/include/cuda)
FILE(GLOB_RECURSE cpp_sources ${gproshan_SOURCE_DIR}/src/*.cpp)
add_library(gproshan_cpp STATIC ${cpp_sources})
target_link_libraries(gproshan_cpp ${OpenMP_CXX_LIBRARIES})
target_link_libraries(gproshan_cpp ${OPENGL_LIBRARIES})
target_link_libraries(gproshan_cpp ${GLEW_LIBRARIES})
target_link_libraries(gproshan_cpp ${GLUT_LIBRARIES})
target_link_libraries(gproshan_cpp ${X11_X11_LIB})
target_link_libraries(gproshan_cpp ${ARMADILLO_LIBRARIES})
target_link_libraries(gproshan_cpp CGAL::CGAL)
target_link_libraries(gproshan_cpp ${SuiteSparse_LIBRARIES})
if(CUDA_FOUND)
FILE(GLOB_RECURSE cu_sources ${gproshan_SOURCE_DIR}/src/*.cu)
add_library(gproshan_cu STATIC ${cu_sources})
set_target_properties(gproshan_cu PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_link_libraries(gproshan_cu gproshan_cpp)
target_link_libraries(gproshan_cu ${CUDA_LIBRARIES} ${CUDA_cublas_LIBRARY} ${CUDA_cusolver_LIBRARY} ${CUDA_cusparse_LIBRARY})
endif(CUDA_FOUND)
add_executable(gproshan gproshan.cpp)
add_executable(test_geodesics test_geodesics.cpp)
add_executable(test_image_denoising test_image_denoising.cpp)
target_link_libraries(gproshan gproshan_cpp)
target_link_libraries(test_geodesics gproshan_cpp)
target_link_libraries(test_image_denoising gproshan_cpp)
if(CUDA_FOUND)
target_link_libraries(gproshan gproshan_cu)
target_link_libraries(test_geodesics gproshan_cu)
target_link_libraries(test_image_denoising gproshan_cu)
endif(CUDA_FOUND)
file(MAKE_DIRECTORY tmp)