xref: /6.0.3/tlm/deps/packages/rocksdb/CMakeLists.txt (revision 918b0d8d)
1# Downloads the declared version of rocksdb and builds it.
2
3# Download RocksDB dependencies.
4SET (_dep_install "${CMAKE_CURRENT_BINARY_DIR}/dep-install")
5SET (_temp_cmake_install_prefix "${CMAKE_INSTALL_PREFIX}")
6SET (CMAKE_INSTALL_PREFIX "${_dep_install}")
7DECLARE_DEP (snappy VERSION 1.1.1 PLATFORMS windows_msvc)
8DECLARE_DEP (snappy VERSION 1.1.1-cb2 PLATFORMS centos6 centos7 debian7 debian8 debian9 macosx sunos suse11.2 suse12.2 ubuntu12.04 ubuntu14.04 ubuntu16.04 ubuntu17.04 freebsd)
9DECLARE_DEP (lz4 VERSION 1.8.0-cb2 PLATFORMS centos6 centos7 debian7 debian8 debian9 macosx sunos suse11.2 suse12.2 ubuntu14.04 ubuntu16.04)
10SET (CMAKE_INSTALL_PREFIX "${_temp_cmake_install_prefix}")
11
12include(ExternalProject)
13
14### Download, configure and build rocksdb  ####################################
15_DETERMINE_CPU_COUNT(_parallelism)
16configure_file("build_rocksdb.sh.in" "build_rocksdb.sh")
17ExternalProject_Add(rocksdb
18  GIT_REPOSITORY https://github.com/couchbasedeps/rocksdb.git
19  GIT_TAG ${_git_rev}
20
21  BUILD_IN_SOURCE 1
22  CONFIGURE_COMMAND ""
23
24  BUILD_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/build_rocksdb.sh" -j${_parallelism} shared_lib
25
26  CMAKE_ARGS -D CMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/install
27
28  INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/install
29  INSTALL_COMMAND "${CMAKE_CURRENT_BINARY_DIR}/build_rocksdb.sh" INSTALL_PATH=<INSTALL_DIR> install-shared
30
31  COMMAND ${CMAKE_COMMAND} -E echo FILE "(COPY lib DESTINATION \"\${CMAKE_INSTALL_PREFIX}\")" > <INSTALL_DIR>/CMakeLists.txt
32)
33
34# OS X-only: Custom post-build step to set the shared library install name.
35if (APPLE)
36  ExternalProject_Add_Step(rocksdb install_name
37    COMMAND install_name_tool -id @rpath/librocksdb.5.8.dylib <BINARY_DIR>/librocksdb.5.8.dylib
38
39    DEPENDEES build
40    DEPENDERS install
41    WORKING_DIRECTORY <BINARY_DIR>
42  )
43endif(APPLE)
44
45# cbdeps boilerplate
46_ADD_PACKAGE_STEP()
47