-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
executable file
·206 lines (159 loc) · 5.88 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
cmake_minimum_required(VERSION 3.10.2)
project (auto_segm)
set(CMAKE_CPP_COMPILER gcc) #nvcc)#gcc)
#set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE RelWithDebInfo)
# The version number.
set (TestPipeline_VERSION_MAJOR 1)
set (TestPipeline_VERSION_MINOR 0)
set (ITK_DIR /home/michail/software/ITK-5.0a01/build2)
set (VTK_DIR /home/michail/software/VTK-8.1.1/build)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
#find ITK path of build
find_package(ITK REQUIRED)
include( ${ITK_USE_FILE} )
#find VTK path of build
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
# This module defines
# LIBCONFIG_INCLUDE_DIR, where to find cppunit include files, etc.
# LIBCONFIG_LIBRARIES, the libraries to link against to use CppUnit.
# LIBCONFIG_STATIC_LIBRARIY_PATH
# LIBCONFIG_FOUND, If false, do not try to use CppUnit.
# also defined, but not for general use are
# LIBCONFIG_LIBRARY, where to find the CUnit library.
#MESSAGE("Searching for libconfig library")
FIND_PATH(LIBCONFIG_INCLUDE_DIR libconfig.h
/usr/local/include
/usr/include
)
FIND_PATH(LIBCONFIGPP_INCLUDE_DIR libconfig.h++
/usr/local/include
/usr/include
)
FIND_LIBRARY(LIBCONFIG_LIBRARY config
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(LIBCONFIGPP_LIBRARY config++
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(LIBCONFIG_STATIC_LIBRARY "libconfig${CMAKE_STATIC_LIBRARY_SUFFIX}"
/usr/local/lib
/usr/lib
)
FIND_LIBRARY(LIBCONFIGPP_STATIC_LIBRARY "libconfig++${CMAKE_STATIC_LIBRARY_SUFFIX}"
/usr/local/lib
/usr/lib
)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
endif()
IF(OPENMP_INCLUDE_DIR)
IF(OPENMP_LIBRARY)
SET(OPENMP_FOUND TRUE)
SET(OPENMP_LIBRARIES ${OPENMP_LIBRARY})
SET(OPENMP_STATIC_LIBRARY_PATH ${OPENMP_STATIC_LIBRARY})
ENDIF(OPENMP_LIBRARY)
ENDIF(OPENMP_INCLUDE_DIR)
IF(LIBCONFIG_INCLUDE_DIR)
IF(LIBCONFIG_LIBRARY)
SET(LIBCONFIG_FOUND TRUE)
SET(LIBCONFIG_LIBRARIES ${LIBCONFIG_LIBRARY})
SET(LIBCONFIG_STATIC_LIBRARY_PATH ${LIBCONFIG_STATIC_LIBRARY})
ENDIF(LIBCONFIG_LIBRARY)
ENDIF(LIBCONFIG_INCLUDE_DIR)
IF(LIBCONFIGPP_INCLUDE_DIR)
IF(LIBCONFIGPP_LIBRARY)
SET(LIBCONFIGPP_FOUND TRUE)
SET(LIBCONFIGPP_LIBRARIES ${LIBCONFIGPP_LIBRARY})
SET(LIBCONFIGPP_STATIC_LIBRARY_PATH ${LIBCONFIGPP_STATIC_LIBRARY})
ENDIF(LIBCONFIGPP_LIBRARY)
ENDIF(LIBCONFIGPP_INCLUDE_DIR)
IF (LIBCONFIG_FOUND)
IF (NOT LibConfig_FIND_QUIETLY)
MESSAGE(STATUS "Found LibConfig++: ${LIBCONFIGPP_LIBRARIES}" )
MESSAGE(STATUS "Found LibConfig: ${LIBCONFIG_LIBRARIES}")
MESSAGE(STATUS "static LibConfig path: ${LIBCONFIG_STATIC_LIBRARY_PATH}")
ENDIF (NOT LibConfig_FIND_QUIETLY)
ELSE (LIBCONFIG_FOUND)
IF (LibConfig_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could NOT find LibConfig")
ENDIF (LibConfig_FIND_REQUIRED)
ENDIF (LIBCONFIG_FOUND)
MARK_AS_ADVANCED(LIBCONFIG_INCLUDE_DIR LIBCONFIG_LIBRARIES)
if (ITKVtkGlue_LOADED)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
else()
find_package(ITKVtkGlue REQUIRED)
include(${ITKVtkGlue_USE_FILE})
set(Glue ITKVtkGlue)
endif()
# configure a header file to pass some of the CMake settings
# to the source code
configure_file (
"${PROJECT_SOURCE_DIR}/TestPipelineConfig.h.in"
"${PROJECT_BINARY_DIR}/TestPipelineConfig.h"
)
# add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
include_directories("${PROJECT_BINARY_DIR}")
# add subdirectories
include_directories ("${PROJECT_SOURCE_DIR}/Filters")
include_directories ("${PROJECT_SOURCE_DIR}/Clustering")
include_directories ("${PROJECT_SOURCE_DIR}/Segmentation")
include_directories ("${PROJECT_SOURCE_DIR}/IO")
include_directories ("${PROJECT_SOURCE_DIR}/test")
include_directories ("${PROJECT_SOURCE_DIR}/core")
include_directories ("${PROJECT_SOURCE_DIR}/Deformation")
add_subdirectory (Filters)
add_subdirectory (Clustering)
add_subdirectory (Segmentation)
add_subdirectory (IO)
add_subdirectory (test)
add_subdirectory (core)
add_subdirectory (Deformation)
# add the executable
add_executable(auto_segm auto_segm.cxx) #Evaluation.cxx Preprossesing.cxx)
#link the libraries
target_link_libraries( auto_segm ${ITK_LIBRARIES} ${Glue} ${VTK_LIBRARIES} ${ITKCommon_LIBRARIES} ${PYTHON_LIBRARIES})
target_link_libraries (auto_segm Filters)
target_link_libraries (auto_segm Clustering)
target_link_libraries (auto_segm Segmentation)
target_link_libraries (auto_segm IO)
target_link_libraries (auto_segm core)
target_link_libraries (auto_segm Deformation)
target_link_libraries (auto_segm ${LIBCONFIGPP_LIBRARY})
target_link_libraries (auto_segm ${OPENMP_LIBRARY})
#install
install (TARGETS auto_segm DESTINATION /)
install (FILES TestPipelineConfig.h DESTINATION Filters/header)
install (FILES TestPipelineConfig.h DESTINATION Clustering/header)
install (FILES TestPipelineConfig.h DESTINATION Segmentation/header)
install (FILES TestPipelineConfig.h DESTINATION IO/header)
install (FILES TestPipelineConfig.h DESTINATION test/header)
install (FILES TestPipelineConfig.h DESTINATION core/header)
install (FILES TestPipelineConfig.h DESTINATION Deformation/header)
# add test so the correct use of code is verified
#install the auto_segm software python
add_executable(Install_Python_project ${CMAKE_SOURCE_DIR}/install_python_software.cpp)
set (cmd3 "ls")
set (arg "./Install_Python_project")
set (CMAKE_SOURCE ${CMAKE_SOURCE_DIR}/build/)
message(STATUS "git cmd: ${arg}")
execute_process(COMMAND ${cmd3}
WORKING_DIRECTORY ${CMAKE_SOURCE}
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_ver)
message(STATUS "git ver[${git_result}]: ${git_ver}")
execute_process(COMMAND ${arg}
WORKING_DIRECTORY ${CMAKE_SOURCE}
RESULT_VARIABLE exe_result
OUTPUT_VARIABLE exe_ver)
message(STATUS "exe ver[${exe_result}]: ${exe_ver}")