forked from fblumenthal/buildem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lemon.cmake
64 lines (53 loc) · 2.25 KB
/
lemon.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
#
# Install lemon from source
#
if (NOT lemon_NAME)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
include (ExternalProject)
include (ExternalSource)
include (BuildSupport)
include (PatchSupport)
external_source (lemon
1.3
lemon-1.3.tar.gz
814d97757c157c5b46a413cc39aad625
http://lemon.cs.elte.hu/pub/sources
"FORCE")
if((${CMAKE_SYSTEM_NAME} MATCHES "Darwin") AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang"))
set(LEMON_OSX_CONFIG -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
else()
set(LEMON_OSX_CONFIG "")
endif()
message ("Installing ${lemon_NAME} into FlyEM build area: ${BUILDEM_DIR} ...")
ExternalProject_Add(${lemon_NAME}
PREFIX ${BUILDEM_DIR}
URL ${lemon_URL}
URL_MD5 ${lemon_MD5}
UPDATE_COMMAND ""
PATCH_COMMAND ${BUILDEM_ENV_STRING} ${PATCH_EXE}
# This patch fixes a build error that clang detects.
# (Already fixed in lemon trunk, but not in the tarball release.)
${lemon_SRC_DIR}/lemon/graph_to_eps.h ${PATCH_DIR}/lemon.patch
# Apparently one test file is missing from the release.
# This patch removes it from CMakeLists.txt
${lemon_SRC_DIR}/test/CMakeLists.txt ${PATCH_DIR}/lemon-test.patch
CONFIGURE_COMMAND ${BUILDEM_ENV_STRING} ${CMAKE_COMMAND} ${lemon_SRC_DIR}
-DBUILD_SHARED_LIBS=ON
-DCMAKE_INSTALL_PREFIX=${BUILDEM_DIR}
-DCMAKE_PREFIX_PATH=${BUILDEM_DIR}
# Lemon can be optionally built with glpk to enable the LP solver.
# We don't want to build with glpk because it isn't needed for cylemon.
# Kill these cache variables to make sure we don't use it
# (avoid potential linker errors if cmake finds a version of glpk on our system)
-DGLPK_LIBRARY=
-DGLPK_INCLUDE_DIR=
-DGLPK_ROOT_DIR=
-DCMAKE_CXX_FLAGS=${BUILDEM_ADDITIONAL_CXX_FLAGS}
${LEMON_OSX_CONFIG}
BUILD_COMMAND ${BUILDEM_ENV_STRING} $(MAKE)
INSTALL_COMMAND ${BUILDEM_ENV_STRING} $(MAKE) install
#TEST_COMMAND ${BUILDEM_ENV_STRING} $(MAKE) check
)
set_target_properties(${lemon_NAME} PROPERTIES EXCLUDE_FROM_ALL ON)
endif (NOT lemon_NAME)