-
Notifications
You must be signed in to change notification settings - Fork 8
/
CMakeLists.txt
143 lines (115 loc) · 5.59 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
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
project(ilastik)
#############################################
#
# install 'buildem' build scripts
#
#############################################
set (BUILDEM_DIR "None" CACHE TYPE STRING)
if (${BUILDEM_DIR} STREQUAL "None")
message (FATAL_ERROR "ERROR: FlyEM build directory (for all downloads & builds) should be specified via -D BUILDEM_DIR=<path> on cmake command line.")
endif ()
get_filename_component(BUILDEM_REPO_DIR ../buildem ABSOLUTE)
if (NOT EXISTS ${BUILDEM_REPO_DIR}/python.cmake)
message ("Downloading buildem repository ...")
execute_process(COMMAND git clone https://github.com/janelia-flyem/buildem.git ${BUILDEM_REPO_DIR}
WORKING_DIRECTORY ${BUILDEM_DIR}
RESULT_VARIABLE BUILDEM_INSTALL_FAILED)
if(BUILDEM_INSTALL_FAILED)
MESSAGE(FATAL_ERROR "Unable to clone buildem scripts from\n 'https://github.com/janelia-flyem/buildem.git'\n(either git is not installed properly on your system, or the repository is not accessible). Please place buildem at\n '${BUILDEM_REPO_DIR}'.")
endif()
else()
message ("Updating buildem repository in ${BUILDEM_REPO_DIR}")
execute_process(COMMAND git pull
WORKING_DIRECTORY ${BUILDEM_REPO_DIR}
RESULT_VARIABLE BUILDEM_UPDATE_FAILED)
if(BUILDEM_UPDATE_FAILED)
MESSAGE(FATAL_ERROR "Unable to update buildem repository at ${BUILDEM_REPO_DIR}")
endif()
endif()
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${BUILDEM_REPO_DIR})
#############################################
#
# compile ilastik and its dependencies
#
#############################################
set(CPLEX_ROOT_DIR "" CACHE PATH "CPLEX root directory")
set(ILASTIK_HEADLESS_ONLY FALSE CACHE BOOL "Build only headless support for ilastik")
if (ILASTIK_HEADLESS_ONLY)
include (ilastik)
else()
include (ilastik-gui)
endif()
include (scikit-image)
set (PACKAGE_WITH_CPLEX OFF CACHE BOOL "Include CPLEX shared libraries in the final binary pacakge." FORCE)
if (PACKAGE_WITH_CPLEX)
if (CPLEX_ROOT_DIR)
install( TARGETS cplex-shared concert-shared ilocplex-shared
LIBRARY DESTINATION ${BUILDEM_DIR}/lib )
else()
message(FATAL_ERROR "Cannot package with CPLEX; CPLEX_ROOT_DIR is not valid")
endif()
endif()
#############################################
#
# install
#
#############################################
IF(NOT APPLE)
configure_file(${PROJECT_SOURCE_DIR}/relative-rpath.sh.in ${BUILDEM_DIR}/tmp/relative-rpath.sh @ONLY)
configure_file(${PROJECT_SOURCE_DIR}/list-dependencies.sh ${BUILDEM_DIR}/bin/list-dependencies.sh COPYONLY)
# compile the python sources so that we can potentially install into write-protected directories
install(CODE "execute_process(COMMAND ${PYTHON_EXE} ${PROJECT_SOURCE_DIR}/compile_all.py ${ilastik_SRC_DIR})")
# set relative RPATH in libraries and executable, or delete RPATH if necessary
install(CODE "execute_process(COMMAND ${BUILDEM_DIR}/tmp/relative-rpath.sh ${BUILDEM_DIR}/lib ${BUILDEM_DIR}/lib)")
install(CODE "execute_process(COMMAND ${BUILDEM_DIR}/tmp/relative-rpath.sh ${BUILDEM_DIR}/lib ${BUILDEM_DIR}/plugins)")
install(CODE "execute_process(COMMAND ${BUILDEM_DIR}/tmp/relative-rpath.sh delete ${ilastik_SRC_DIR})")
install(CODE "execute_process(COMMAND chrpath -r \\$ORIGIN/../lib ${BUILDEM_DIR}/bin/python2.7)")
file(GLOB ALL_BIN_FILES "${BUILDEM_DIR}/bin/*")
list(REMOVE_ITEM ALL_BIN_FILES "${BUILDEM_DIR}/bin/tests")
INSTALL(PROGRAMS ${ALL_BIN_FILES} DESTINATION bin)
# INSTALL(PROGRAMS
# ${BUILDEM_DIR}/bin/ilastik_clusterized
# ${BUILDEM_DIR}/bin/ilastik_gui
# ${BUILDEM_DIR}/bin/ilastik_gui_test
# ${BUILDEM_DIR}/bin/ilastik_headless
# ${BUILDEM_DIR}/bin/ilastik_headless_test
# ${BUILDEM_DIR}/bin/setenv_ilastik_gui.sh
# ${BUILDEM_DIR}/bin/list-dependencies.sh
# ${BUILDEM_DIR}/bin/python
# ${BUILDEM_DIR}/bin/python2
# ${BUILDEM_DIR}/bin/python2.7
# DESTINATION bin)
INSTALL(PROGRAMS ${PROJECT_SOURCE_DIR}/run_ilastik.sh
DESTINATION bin/..)
INSTALL(PROGRAMS ${PROJECT_SOURCE_DIR}/ilastik_python.sh
DESTINATION bin/..)
INSTALL(FILES ${PROJECT_SOURCE_DIR}/qt.conf
DESTINATION bin)
INSTALL(DIRECTORY ${ilastik_SRC_DIR}/ DESTINATION src/${ilastik_NAME} USE_SOURCE_PERMISSIONS)
INSTALL(DIRECTORY ${BUILDEM_DIR}/lib/ DESTINATION lib USE_SOURCE_PERMISSIONS)
INSTALL(DIRECTORY ${BUILDEM_DIR}/include/python2.7/ DESTINATION include/python2.7 USE_SOURCE_PERMISSIONS)
INSTALL(DIRECTORY ${BUILDEM_DIR}/plugins/ DESTINATION plugins USE_SOURCE_PERMISSIONS)
# copy license file to distribution
# this file will be shown in the help->license dialog if it exists
INSTALL(FILES ${PROJECT_SOURCE_DIR}/COPYING
DESTINATION bin/..)
#############################################
#
# create binary package
#
#############################################
SET(CPACK_PACKAGE_VENDOR "The ilastik Team")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Interactive image labeling and segmentation toolkit."
)
# package version setup
set(ILASTIK_VERSION_FILE "${BUILDEM_SRC_DIR}/ilastik/ilastik/ilastik/__init__.py")
CONFIGURE_FILE( ${PROJECT_SOURCE_DIR}/CPackUpdateVersion.cmake.in
${PROJECT_BINARY_DIR}/CPackUpdateVersion.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE ${PROJECT_BINARY_DIR}/CPackUpdateVersion.cmake)
SET(CPACK_STRIP_FILES TRUE)
SET(CPACK_PACKAGE_CONTACT "ilastik Team <[email protected]>")
SET(CPACK_GENERATOR TGZ)
INCLUDE (CPack)
ENDIF(NOT APPLE)