This repository has been archived by the owner on Mar 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
112 lines (95 loc) · 3.49 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
109
110
111
112
cmake_minimum_required(VERSION 3.0)
include(FindPkgConfig)
set(TARGET_NAME "slicerecon")
project(slicerecon)
# --------------------------------------------------------------------------------------------
# GLM
find_package(glm REQUIRED)
# --------------------------------------------------------------------------------------------
# ASTRA
pkg_check_modules(ASTRA REQUIRED "libastra")
add_library(astra-toolbox INTERFACE)
target_include_directories(astra-toolbox SYSTEM INTERFACE ${ASTRA_INCLUDE_DIRS})
target_compile_definitions(astra-toolbox INTERFACE "ASTRA_CUDA")
target_link_libraries(astra-toolbox INTERFACE ${ASTRA_LDFLAGS})
# --------------------------------------------------------------------------------------------
# Eigen
find_package (Eigen3 3.3 QUIET NO_MODULE)
if (Eigen3_FOUND)
message("Eigen found" ${EIGEN3_INCLUDE_DIR})
else()
message("Eigen not found, building from source")
execute_process(COMMAND git submodule update --init -- ext/eigen
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_subdirectory(${CMAKE_SOURCE_DIR}/ext/eigen)
endif()
# --------------------------------------------------------------------------------------------
# ZeroMQ
find_package(ZeroMQ QUIET)
if (ZeroMQ_FOUND)
add_library(zmq INTERFACE)
target_include_directories(zmq INTERFACE ${ZeroMQ_INCLUDE_DIR})
target_link_libraries(zmq INTERFACE ${ZeroMQ_LIBRARY})
else()
message("'zmq' not installed on the system, building from source...")
execute_process(COMMAND git submodule update --init --remote -- ext/libzmq
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
set(ZMQ_BUILD_TESTS OFF CACHE BOOL "disable tests" FORCE)
set(WITH_PERF_TOOL OFF CACHE BOOL "disable perf-tools" FORCE)
add_subdirectory(${CMAKE_SOURCE_DIR}/ext/libzmq)
set(ZMQ_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/ext/libzmq/include)
# ZeroMQ names their target libzmq, which is inconsistent => create a ghost dependency
add_library(zmq INTERFACE)
target_link_libraries(zmq INTERFACE libzmq)
endif()
# --------------------------------------------------------------------------------------------
# cppzmq
find_package(cppzmq QUIET)
if (NOT cppzmq_FOUND)
execute_process(COMMAND git submodule update --init -- ext/cppzmq
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_library(cppzmq INTERFACE)
target_include_directories(cppzmq INTERFACE ext/cppzmq)
target_link_libraries(cppzmq INTERFACE zmq)
endif()
# --------------------------------------------------------------------------------------------
# tomopackets
set(TOMOP_LIB_ONLY ON CACHE BOOL "build tomopackets as a library" FORCE)
add_subdirectory(ext/tomopackets)
# --------------------------------------------------------------------------------------------
# Bulk
add_subdirectory(${CMAKE_SOURCE_DIR}/ext/bulk)
# --------------------------------------------------------------------------------------------
set(
SOURCES
"src/util/util.cpp"
"src/util/log.cpp"
"src/util/processing.cpp"
"src/reconstruction/reconstructor.cpp"
"src/reconstruction/helpers.cpp"
)
set(
LIB_NAMES
"astra-toolbox"
"Eigen3::Eigen"
"flags"
"zmq"
"cppzmq"
"tomop"
"bulk_thread"
"glm"
)
add_library(${TARGET_NAME} ${SOURCES})
target_include_directories(${TARGET_NAME} PUBLIC "include")
target_link_libraries(${TARGET_NAME} ${LIB_NAMES})
target_compile_options(${TARGET_NAME} PUBLIC
"-Wfatal-errors"
"-Werror"
"-Wall"
"-O3"
"-std=c++17"
"-fPIC"
"-static")
add_subdirectory("example")
add_subdirectory("ext/pybind11")
add_subdirectory("python")