1# Downloads the declared version of python-snappy source code and builds it.
2
3# First, download the dependency: snappy itself. Set CMAKE_INSTALL_PREFIX
4# to a local directory to dump in there, and add that directory to CMAKE_PREFIX_PATH.
5SET (_snappy_install "${CMAKE_CURRENT_BINARY_DIR}/dep-install")
6SET (_orig_install_prefix "${CMAKE_INSTALL_PREFIX}")
7SET (CMAKE_INSTALL_PREFIX "${_snappy_install}")
8IF (WIN32)
9  MESSAGE (FATAL_ERROR "python-snappy > 1.1.1 cannot be built on Windows")
10ELSE ()
11  DECLARE_DEP (snappy VERSION 1.1.1-cb2 PLATFORMS centos6 centos7 debian8 debian9 macosx rhel8 sunos suse11.2 suse12.2 ubuntu14.04 ubuntu16.04 freebsd)
12ENDIF ()
13SET (CMAKE_INSTALL_PREFIX "${_orig_install_prefix}")
14
15include(ExternalProject)
16
17### Download, configure and build python-snappy ####################################
18ExternalProject_Add(python-snappy
19  GIT_REPOSITORY ${_git_repo}
20  GIT_TAG ${_git_rev}
21
22  CONFIGURE_COMMAND "${CMAKE_COMMAND}" -E echo Configuring python-snappy...
23
24  BUILD_COMMAND python setup.py build build_ext
25                -I "${CMAKE_CURRENT_BINARY_DIR}/snappy.exploded/include" -L "${_snappy_install}/lib"
26  BUILD_IN_SOURCE 1
27
28  INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/install
29  INSTALL_COMMAND python setup.py install --install-lib <INSTALL_DIR>/lib/python/pysnappy2
30
31  COMMAND ${CMAKE_COMMAND} -E echo FILE "(COPY lib DESTINATION \"\${CMAKE_INSTALL_PREFIX}\")" > <INSTALL_DIR>/CMakeLists.txt
32)
33
34# cbdeps boilerplate
35_ADD_PACKAGE_STEP()
36