-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
131 lines (117 loc) · 5.69 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
cmake_minimum_required(VERSION 2.8)
project(EASI)
##cmakedefine USE_MYMATH
set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -DDEBUG")
set(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER})
include(CMakeBackwardCompatibilityC)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules ${CMAKE_MODULE_PATH})
message( STATUS "Start suffixes" )
message( STATUS "Executable: ${CMAKE_EXECUTABLE_SUFFIX}" )
message( STATUS "Shared library: ${CMAKE_SHARED_LIBRARY_SUFFIX}" )
message( STATUS "Static library: ${CMAKE_STATIC_LIBRARY_SUFFIX}" )
message( STATUS "Debug postfix: ${CMAKE_DEBUG_POSTFIX}" )
message( STATUS "Release postfix: ${CMAKE_RELEASE_POSTFIX}" )
set(CMAKE_EXECUTABLE_SUFFIX ${CMAKE_EXECUTABLE_SUFFIX} CACHE STRING "suffix/postfix for multi-build installations on executables")
set(CMAKE_SHARED_LIBRARY_SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE STRING "suffix for multi-build installations on shared libraries")
set(CMAKE_STATIC_LIBRARY_SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX} CACHE STRING "suffix for multi-build installations on static libraries")
set(CMAKE_DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX} CACHE STRING "Debug postfix for multi-build installations on libraries")
set(CMAKE_RELEASE_POSTFIX ${CMAKE_RELEASE_POSTFIX} CACHE STRING "Release postfix for multi-build installations on libraries")
#if(WIN32)
# set(CMAKE_EXECUTABLE_SUFFIX "${CMAKE_EXECUTABLE_SUFFIX}.exe")
# set(CMAKE_SHARED_LIBRARY_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}.dll")
# set(CMAKE_STATIC_LIBRARY_SUFFIX "${CMAKE_STATIC_LIBRARY_SUFFIX}.lib")
#else()
#
#endif()
set(ADDITIONAL_HEADERS "")
set(ADDITIONAL_SOURCES "")
set(CUDA_SOURCES "")
set(KERNEL_O "")
#set(SOURCE_FOLDER src)
set(ADDITIONAL_LIBRARY_PATHS "")
set(ADDITIONAL_LINKER_FLAGS "")
if(UNIX)
set(ADDITIONAL_CXX_FLAGS "-fpermissive -std=c++0x" CACHE STRING "Additional C++ flags to append")
else()
set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional C++ flags to append")
endif()
set(LIBRARIES "")
#osg osgDB ${CGAL_LIBRARIES} gmp core++ mpfr ${VTK_LIBRARIES} ${Boost_LIBRARIES}
set(INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FOLDER}" )
#message( STATUS ${INCLUDE_DIRS} )
if(WIN32)
#set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost COMPONENTS regex filesystem system thread program_options REQUIRED)
else()
find_package(Boost REQUIRED)
endif()
if(Boost_FOUND)
#set(LIBRARIES "${LIBRARIES} ${Boost_LIBRARIES}")
list(APPEND ADDITIONAL_LIBRARY_PATHS ${BOOST_LIBRARYDIR})
list(APPEND LIBRARIES ${Boost_LIBRARIES})
set(Boost_SUBSYSTEM "")
if(WIN32)
list(APPEND Boost_SUBSYSTEM ${Boost_SYSTEM_LIBRARY})
list(APPEND Boost_SUBSYSTEM ${Boost_FSYSTEM_LIBRARY})
list(APPEND Boost_SUBSYSTEM ${Boost_REGEX_LIBRARY})
list(APPEND Boost_SUBSYSTEM ${Boost_THREAD_LIBRARY})
list(APPEND Boost_SUBSYSTEM ${Boost_POPTIONS_LIBRARY})
else()
list(APPEND Boost_SUBSYSTEM boost_system)
list(APPEND Boost_SUBSYSTEM boost_filesystem)
list(APPEND Boost_SUBSYSTEM boost_regex)
list(APPEND Boost_SUBSYSTEM boost_thread)
list(APPEND Boost_SUBSYSTEM boost_program_options)
endif()
message(STATUS ${Boost_SUBSYSTEM})
message(STATUS ${Boost_LIBRARIES})
#set(INCLUDE_DIRS "${INCLUDE_DIRS} ${Boost_INCLUDE_DIR}")
list(APPEND INCLUDE_DIRS ${Boost_INCLUDE_DIR})
message(${CMAKE_CXX_FLAGS})
link_directories(${BOOST_LIBRARYDIR})
link_libraries(${Boost_LIBRARIES} ${Boost_SUBSYSTEM})
endif(Boost_FOUND)
FIND_PACKAGE( OpenMP REQUIRED)
if(OPENMP_FOUND)
message("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}")
set (ADDITIONAL_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} ${OpenMP_EXE_LINKER_FLAGS} -fopenmp")
set (ADDITIONAL_LINKER_FLAGS "${ADDITIONAL_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS} -fopenmp")
message(${CMAKE_CXX_FLAGS})
endif(OPENMP_FOUND)
list(REMOVE_DUPLICATES ADDITIONAL_LIBRARY_PATHS)
list(REMOVE_DUPLICATES INCLUDE_DIRS)
#set(ADDITIONAL_CXX_FLAGS "${ADDITIONAL_CXX_FLAGS} -D_CXX_COMPILE_")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${ADDITIONAL_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ADDITIONAL_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${ADDITIONAL_CXX_FLAGS}")
#message(${CMAKE_CXX_FLAGS})
#message(${INCLUDE_DIRS})
set(M_LIBRARY)
if(UNIX)
set(M_LIBRARY m)
endif(UNIX)
# gmp core++ mpfr
set(LIBS_WO_M "${LIBRARIES}")
OPTION(BUILD_SHARED_LIBS "Build shared libraries." ON)
SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} CACHE STRING "You may add additional search paths here. Use ; to separate multiple paths.")
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "(EXPERIMENTAL) You may add additional search paths here. Use ; to separate multiple paths.")
SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE STRING "Final Installation Path.")
ADD_SUBDIRECTORY(ImageSegmentation)
ADD_SUBDIRECTORY(VolumeSegmentation)
ADD_SUBDIRECTORY(Utilities)