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