forked from liangfu/bet2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·83 lines (61 loc) · 2.2 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
cmake_minimum_required(VERSION 3.11.1)
project(bet2)
# set(CMAKE_CXX_STANDARD 11)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if (UNIX)
add_compile_options(-fPIC) # for WSL compilation, not tested on native Linux
endif()
# set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_MODULE_PATH ${bnviewer_SOURCE_DIR}/CMake)
# this is EXTREMELY important to put these setting before add_library/executable
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
# when building, don't use the install RPATH already
# (but later on when installing)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib:$ORIGIN/")
# add the automatically determined parts of the RPATH
# which point to directories outside the build tree to the install RPATH
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
# find_package(VTK REQUIRED)
# include(${VTK_USE_FILE})
# include_directories(${VTK_INCLUDE_DIRS})
add_subdirectory(znzlib)
add_subdirectory(niftiio)
add_subdirectory(newmat)
add_subdirectory(fslio)
add_subdirectory(newimage)
add_subdirectory(meshclass)
add_subdirectory(miscmaths)
add_subdirectory(utils)
add_subdirectory(vtkzlib)
set( Srcs bet2.cpp)
##set( Hdrs bet2.cpp)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
newmat fslio newimage
)
add_executable(bet2 ${Srcs} )
target_link_libraries(bet2
newmat fslio newimage niftiio znzlib meshclass utils miscmaths vtkzlib
)
ADD_LIBRARY(libbet2 STATIC ${Srcs})
target_link_libraries(libbet2
newmat fslio newimage niftiio znzlib meshclass utils miscmaths vtkzlib
)
set_target_properties(libbet2 PROPERTIES OUTPUT_NAME bet2)
ADD_LIBRARY(libbet2so SHARED bet2_dll.cpp)
target_link_libraries(libbet2so
newmat fslio newimage niftiio znzlib meshclass utils miscmaths vtkzlib
)
set_target_properties(libbet2so PROPERTIES OUTPUT_NAME bet2)
find_package(Matlab)
if(Matlab_FOUND)
matlab_add_mex(NAME bet2_mex LINK_TO libbet2 newmat fslio newimage niftiio znzlib meshclass utils miscmaths vtkzlib SRC bet2_mex.cpp)
endif()