This repository has been archived by the owner on Nov 20, 2021. It is now read-only.
forked from NathanFrench/buildem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basholeveldb.cmake
76 lines (66 loc) · 2.65 KB
/
basholeveldb.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
#
# Install basholeveldb from source
#
if (NOT basholeveldb_NAME)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
include (ExternalProject)
include (ExternalSource)
include (BuildSupport)
external_source (basholeveldb
2.0.29
basholeveldb-2.0.29.tar.gz
8839a580b2ed58331a7c8053aee3ab1a)
message ("Installing ${basholeveldb_NAME} into FlyEM build area: ${BUILDEM_DIR} ...")
if (${APPLE})
message ("Basho-tuned leveldb cmake system: Detected Apple platform.")
set (LIBFILE "dylib")
elseif (${UNIX})
message ("Basho-tuned leveldb cmake system: Detected UNIX-like platform.")
set (LIBFILE "so")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
if (EXISTS "/etc/issue")
file(READ "/etc/issue" LINUX_ISSUE)
# Ubuntu
if (LINUX_ISSUE MATCHES "Ubuntu")
message ("Detected Ubuntu system. Using -lrt linker flag.")
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-as-needed;-lrt")
endif ()
endif ()
endif ()
elseif (${WINDOWS})
message (FATAL_ERROR "Leveldb cmake system: Detected Windows platform. Not setup for it yet!")
endif ()
ExternalProject_Add(${basholeveldb_NAME}
PREFIX ${BUILDEM_DIR}
URL ${basholeveldb_URL}
URL_MD5 ${basholeveldb_MD5}
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ${BUILDEM_ENV_STRING} $(MAKE)
BUILD_IN_SOURCE 1
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
${basholeveldb_SRC_DIR}/libleveldb.${LIBFILE}.1.9 ${BUILDEM_LIB_DIR}/libleveldb.${LIBFILE}
)
ExternalProject_add_step(${basholeveldb_NAME} install_lib_link
DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E create_symlink
${BUILDEM_LIB_DIR}/libleveldb.${LIBFILE} ${BUILDEM_LIB_DIR}/libleveldb.${LIBFILE}.1
COMMENT "Created symbolic link for libleveldb.${LIBFILE}.1 in ${BUILDEM_LIB_DIR}"
)
ExternalProject_add_step(${basholeveldb_NAME} install_includes
DEPENDEES build
COMMAND ${CMAKE_COMMAND} -E copy_directory
${basholeveldb_SRC_DIR}/include/leveldb ${BUILDEM_INCLUDE_DIR}/leveldb
COMMENT "Placed basholeveldb include files in ${BUILDEM_INCLUDE_DIR}/leveldb"
)
include_directories (${BUILDEM_INCLUDE_DIR}/leveldb)
ExternalProject_add_step(${basholeveldb_NAME} install_static_library
DEPENDEES install_includes
COMMAND ${CMAKE_COMMAND} -E copy
${basholeveldb_SRC_DIR}/libleveldb.a ${BUILDEM_LIB_DIR}
COMMENT "Placed libleveldb.a in ${BUILDEM_LIB_DIR}"
)
set_target_properties(${basholeveldb_NAME} PROPERTIES EXCLUDE_FROM_ALL ON)
set (basholeveldb_STATIC_LIBRARIES ${BUILDEM_LIB_DIR}/libleveldb.a)
endif (NOT basholeveldb_NAME)