forked from fblumenthal/buildem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgmlink.cmake
84 lines (69 loc) · 2.71 KB
/
pgmlink.cmake
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
#
# Install pgmlink libraries from source
#
if (NOT pgmlink_NAME)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
include (ExternalProject)
include (ExternalSource)
include (BuildSupport)
include (PatchSupport)
if(CPLEX_ROOT_DIR)
set(CMAKE_CPLEX_ROOT_DIR "-DCPLEX_ROOT_DIR=${CPLEX_ROOT_DIR}")
endif()
#if ("${CMAKE_CPLEX_ROOT_DIR}" STREQUAL "")
if (NOT CMAKE_CPLEX_ROOT_DIR)
message ("CPLEX not found. Pgmlink will not be built.")
set(pgmlink_NAME "pgmlink-skipped-without-CPLEX")
set(build_pgmlink 0)
else()
set(build_pgmlink 1)
include (python)
include (ann)
include (lemon)
include (vigra)
include (boost)
include (opengm)
include (dlib)
include (mlpack)
include (numpy)
include (cplex-shared)
external_git_repo (pgmlink
HEAD
https://github.com/martinsch/pgmlink)
message ("Installing ${pgmlink_NAME} into FlyEM build aread: ${BUILDEM_DIR} ...")
ExternalProject_Add(${pgmlink_NAME}
DEPENDS ${ann_NAME} ${lemon_NAME} ${vigra_NAME} ${boost_NAME} ${opengm_NAME} ${numpy_NAME}
${cplex-shared} ${concert-shared} ${ilocplex-shared}
${dlib_NAME} ${mlpack_NAME}
PREFIX ${BUILDEM_DIR}
GIT_REPOSITORY ${pgmlink_URL}
UPDATE_COMMAND ""
PATCH_COMMAND ${BUILDEM_ENV_STRING} ${PATCH_EXE}
# Patch CMakeLists as it just overwrote the CXX_FLAGS
${pgmlink_SRC_DIR}/CMakeLists.txt ${PATCH_DIR}/pgmlink-cmake.patch
CONFIGURE_COMMAND ${BUILDEM_ENV_STRING} ${CMAKE_COMMAND} ${pgmlink_SRC_DIR}
-DCMAKE_INSTALL_PREFIX=${BUILDEM_DIR}
-DCMAKE_PREFIX_PATH=${BUILDEM_DIR}
-DBUILD_SHARED_LIBS=ON
"-DCMAKE_CXX_FLAGS=${BUILDEM_ADDITIONAL_CXX_FLAGS} -ftemplate-depth=512"
-DCMAKE_EXE_LINKER_FLAGS=${BUILDEM_ADDITIONAL_CXX_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS=${BUILDEM_ADDITIONAL_CXX_FLAGS}
-DWITH_PYTHON=ON
-DWITH_TESTS=ON
-DWITH_CHECKED_STL=OFF
-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_PATH}
-DPYTHON_LIBRARY=${PYTHON_LIBRARY_FILE}
-DVigranumpy_DIR="${BUILDEM_DIR}/lib/vigranumpy"
${CMAKE_CPLEX_ROOT_DIR}
BUILD_COMMAND ${BUILDEM_ENV_STRING} $(MAKE)
INSTALL_COMMAND ${BUILDEM_ENV_STRING} $(MAKE) install
TEST_COMMAND ${TEST_STRING}
)
set_target_properties(${pgmlink_NAME} PROPERTIES EXCLUDE_FROM_ALL ON)
if(NOT WIN32)
ExternalProject_Add_Step(${pgmlink_NAME} ${pgmlink_NAME}-create-symlink
COMMAND bash ${PATCH_DIR}/pgmlink-create-symlink.sh ${BUILDEM_DIR}
DEPENDEES configure)
endif()
endif()
endif (NOT pgmlink_NAME)