Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 36 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ endif()
## include the Protobuf generation code
include(ProtobufGen)
include(DownloadBoost)
include(DownloadFizz)
include(DownloadFolly)
include(DownloadWangle)
include(DownloadZookeeper)

include(DownloadCyrusSasl)
include(DownloadDoubleConversion)
set(PROJECT_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/dependencies")

set(BOOST_MIN_VERSION "1.6.1")
Expand All @@ -82,16 +84,27 @@ if (DOWNLOAD_DEPENDENCIES)

set(PROTOBUF_PROTOC_EXECUTABLE "${Protobuf_BINARY_DIR}/bin/protoc" CACHE STRING "" FORCE)
## Add CMAKE_MODULE_PATHS

if(LINUX)
set(WHOLE_ARCHIVE "-Wl,--whole-archive")
set(NO_WHOLE_ARCHIVE "-Wl,--no-whole-archive")
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/zookeeper/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/protobuf/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wangle/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/fizz/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/sasl2/local")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local")
else()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/zookeeper/system")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/system")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/wangle/system")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/fizz/system")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/sasl2/system")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/system")
endif(DOWNLOAD_DEPENDENCIES)

## Build Apache HBase components that are necessary for this project
Expand Down Expand Up @@ -136,9 +149,8 @@ if(COMPILER_SUPPORTS_CXX14)
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no c++14 support. Please use a different C++ compiler.")
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} does not have C++14 support. Please use a different C++ compiler.")
endif()

set(HBASE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase")
set(HBASE_PROTO_GEN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src/hbase/if")
set(HBASE_PROTO_GEN_INC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include/hbase/if")
Expand All @@ -155,12 +167,13 @@ if (OPENSSL_FOUND)
else ()
message( FATAL_ERROR "OpenSSL was not found. Please install OpenSSL" )
endif (OPENSSL_FOUND)
## Download Facebook Folly and build locally


## Download dependencies and build locally
if (DOWNLOAD_DEPENDENCIES)
download_boost(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} "${BOOST_LIBS}")
download_doubleconversion(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
download_cyrus_sasl(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
download_folly(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
download_fizz(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
download_wangle(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
download_zookeeper(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
endif(DOWNLOAD_DEPENDENCIES)
Expand All @@ -173,6 +186,7 @@ find_package(LibEvent REQUIRED)
find_package(Gflags REQUIRED)
if (DOWNLOAD_DEPENDENCIES)
find_package(Sodium REQUIRED)
find_package(Fizz REQUIRED)
endif(DOWNLOAD_DEPENDENCIES)
find_package(Folly REQUIRED)
find_package(Krb5 REQUIRED)
Expand Down Expand Up @@ -206,7 +220,9 @@ include_directories(${Boost_INCLUDE_DIR})
include_directories(${KRB5_INCLUDE_DIRS})
include_directories(${JAVA_INCLUDE_DIRS})
include_directories(${FOLLY_INCLUDE_DIR})
include_directories(${FIZZ_INCLUDE_DIR})
include_directories(${WANGLE_INCLUDE_DIR})
include_directories(${DOUBLE_CONVERSION_INCLUDE_DIR})
### create a directory for the hbase protobuf headers.
### this is helpful so that when we include it, later, we can generate
### the protocol buffer source/headers without polluting our tree.
Expand Down Expand Up @@ -245,10 +261,12 @@ SET_TARGET_PROPERTIES(hbaseclient-static PROPERTIES OUTPUT_NAME hbaseclient CLEA
set_target_properties(hbaseclient-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/libs")
target_link_libraries(hbaseclient-static ${Boost_LIBRARIES})
target_link_libraries(hbaseclient-static ${SASL_LIBS})
target_link_libraries(hbaseclient-static ${CMAKE_DL_LIBS})
target_link_libraries(hbaseclient-static ${GFLAGS_SHARED_LIB})
target_link_libraries(hbaseclient-static ${KRB5_LIBRARIES})
target_link_libraries(hbaseclient-static ${WANGLE_LIBRARIES})
if (DOWNLOAD_DEPENDENCIES)
target_link_libraries(hbaseclient-static ${FIZZ_LIBRARIES})
target_link_libraries(hbaseclient-static ${sodium_LIBRARY_RELEASE})
endif(DOWNLOAD_DEPENDENCIES)
target_link_libraries(hbaseclient-static ${FOLLY_LIBRARIES})
Expand All @@ -258,7 +276,6 @@ target_link_libraries(hbaseclient-static ${PROTOBUF_LIBRARY})
target_link_libraries(hbaseclient-static ${DOUBLE_CONVERSION_LIBRARY})
target_link_libraries(hbaseclient-static ${ZOOKEEPER_LIBRARIES})
target_link_libraries(hbaseclient-static ${OPENSSL_LIBRARIES})
target_link_libraries(hbaseclient-static ${CMAKE_DL_LIBS})

add_library(hbaseclient-shared SHARED ${PROTO_SOURCES} ${CLIENT_SRC} ${CONNECTION_SRC} ${EXCEPTION_SRC} ${PROTO_SRC} ${SECURITY_SRC} ${SRDE_SRC} ${UTILS_SRC})
set_target_properties(hbaseclient-shared PROPERTIES LINKER_LANGUAGE CXX)
Expand All @@ -269,6 +286,7 @@ target_link_libraries(hbaseclient-shared ${PROTOBUF_LIBRARY})
target_link_libraries(hbaseclient-shared ${Boost_LIBRARIES})
target_link_libraries(hbaseclient-shared ${WANGLE_LIBRARIES})
if (DOWNLOAD_DEPENDENCIES)
target_link_libraries(hbaseclient-shared ${FIZZ_LIBRARIES})
target_link_libraries(hbaseclient-shared ${sodium_LIBRARY_RELEASE})
endif(DOWNLOAD_DEPENDENCIES)
target_link_libraries(hbaseclient-shared ${FOLLY_LIBRARIES})
Expand All @@ -284,23 +302,13 @@ target_link_libraries(hbaseclient-shared ${CMAKE_DL_LIBS})
add_executable(simple-client "${HBASE_SRC_DIR}/examples/simple-client.cc")
set_target_properties(simple-client PROPERTIES COMPILE_FLAGS " ")
set_target_properties(simple-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples")
target_link_libraries(simple-client ${PROTOBUF_LIBRARY})
target_link_libraries(simple-client ${Boost_LIBRARIES})
target_link_libraries(simple-client ${SASL_LIBS})
target_link_libraries(simple-client ${GFLAGS_SHARED_LIB})
target_link_libraries(simple-client ${KRB5_LIBRARIES})
target_link_libraries(simple-client ${ZOOKEEPER_LIBRARIES})
target_link_libraries(simple-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(simple-client ${WHOLE_ARCHIVE} ${Boost_context} ${NO_WHOLE_ARCHIVE})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the rationale behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could not get this to build because of missing symbols in folly. It's inevitably a linking issue somewhere. make_fcontext was being dropped and I believe this is written in assembler and linked differently along their build process. My guess is that we have some linking issues to look into but I'm not sure where those are. My hope was to deal with it by ensuring all symbols were provided from boost and create a follow on to investigate.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, fine to do a follow on patch.

add_executable(load-client "${HBASE_SRC_DIR}/examples/load-client.cc")
set_target_properties(load-client PROPERTIES COMPILE_FLAGS " ")
set_target_properties(load-client PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin/examples")
target_link_libraries(load-client ${PROTOBUF_LIBRARY})
target_link_libraries(load-client ${Boost_LIBRARIES})
target_link_libraries(load-client ${SASL_LIBS})
target_link_libraries(load-client ${GFLAGS_SHARED_LIB})
target_link_libraries(load-client ${KRB5_LIBRARIES})
target_link_libraries(load-client ${ZOOKEEPER_LIBRARIES})
target_link_libraries(load-client hbaseclient-static ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(load-client ${WHOLE_ARCHIVE} ${Boost_context} ${NO_WHOLE_ARCHIVE})
if (JNI_FOUND)
message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
Expand All @@ -314,12 +322,19 @@ add_custom_target(
COMMAND ${CMAKE_SOURCE_DIR}/bin/cpplint.sh)

if (DOWNLOAD_DEPENDENCIES)
add_dependencies(hbaseclient-static Protobuf)
add_dependencies(hbaseclient-shared Protobuf)
## everything relies on folly. fizz relies on folly. wangle
## relies on folly and fizz
add_dependencies(facebook-folly-proj boost)
add_dependencies(hbaseclient-static boost)
add_dependencies(hbaseclient-shared boost)
add_dependencies(hbaseclient-static Protobuf)
add_dependencies(hbaseclient-shared Protobuf)
add_dependencies(facebook-folly-proj boost)
add_dependencies(facebook-folly-proj doubleconversion-proj)
add_dependencies(facebook-wangle-proj facebook-folly-proj)
add_dependencies(facebook-fizz-proj facebook-folly-proj)
add_dependencies(facebook-wangle-proj facebook-folly-proj)
add_dependencies(facebook-wangle-proj facebook-fizz-proj)
add_dependencies(hbaseclient-static facebook-wangle-proj)
add_dependencies(hbaseclient-shared facebook-wangle-proj)
add_dependencies(hbaseclient-static zookeeper)
Expand Down
13 changes: 4 additions & 9 deletions cmake/BuildTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -39,29 +39,24 @@ target_include_directories(testutil PRIVATE BEFORE${Zookeeper_INCLUDE_DIRS})
target_include_directories(testutil PRIVATE BEFORE${KRB5_INCLUDE_DIRS})
target_include_directories(testutil PRIVATE BEFORE${Java_INCLUDE_DIRS})
target_include_directories(testutil PRIVATE BEFORE${FOLLY_INCLUDE_DIRS})
target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${KRB5_LIBRARIES} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES})
target_link_libraries(testutil hbaseclient-static ${CMAKE_THREAD_LIBS_INIT} ${Java_LIBRARIES} ${JNI_LIBRARIES} ${PROTOBUF_LIBRARY} ${Boost_LIBRARIES} ${GFLAGS_SHARED_LIB} ${GMOCK_SHARED_LIB} ${GTEST_BOTH_LIBRARIES} ${KRB5_LIBRARIES} ${SASL_LIBS} ${GFLAGS_SHARED_LIB} ${OPENSSL_LIBRARIES} ${Zookeeper_LIBRARIES})
function(createTests testName)
message ("-- Including Test: ${testName}")
message (STATUS "Including Test: ${testName}")
target_include_directories(${testName} PRIVATE BEFORE "include")
target_include_directories(${testName} PRIVATE BEFORE "${Java_INCLUDE_DIRS}")
target_include_directories(${testName} PRIVATE BEFORE "${JNI_INCLUDE_DIRS}")
target_include_directories(${testName} PRIVATE BEFORE "${Boost_INCLUDE_DIR}")
target_include_directories(${testName} PRIVATE BEFORE "${GTEST_INCLUDE_DIRS}")
target_include_directories(${testName} PRIVATE BEFORE "${OPENSSL_INCLUDE_DIR}")


#target_link_libraries(${testName} ${PROTOBUF_LIBRARY})
#${PROTOBUF_LIBRARY}

target_link_libraries(${testName} hbaseclient-static testutil ${CMAKE_DL_LIBS}
target_link_libraries(${testName} hbaseclient-static testutil ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}
${Java_LIBRARIES}
${JNI_LIBRARIES}
${Boost_LIBRARIES}
${GFLAGS_SHARED_LIB}
${GTEST_BOTH_LIBRARIES}
${KRB5_LIBRARIES}
${SASL_LIBS}
${GFLAGS_SHARED_LIB}
${KRB5_LIBRARIES}
${ZOOKEEPER_LIBRARIES} ${OPENSSL_LIBRARIES}
${GLOG_SHARED_LIB}
${CMAKE_THREAD_LIBS_INIT})
Expand Down
3 changes: 3 additions & 0 deletions cmake/DownloadBoost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,7 @@ function(download_boost SOURCE_DIR BUILD_DIR BOOST_LIBS)
INSTALL_COMMAND ""
)
set(BOOST_ROOT ${BOOST_INSTALL_DIR} PARENT_SCOPE)
set(BOOST_INCLUDEDIR ${BOOST_ROOT}/include PARENT_SCOPE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are also true for system boost libs?

set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib PARENT_SCOPE)
set(Boost_FIND_COMPONENTS ${BOOST_LIBS} PARENT_SCOPE)
endfunction(download_boost)
34 changes: 34 additions & 0 deletions cmake/DownloadCyrusSasl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

## Download Cyrus SASL
## SOURCE_DIR is typically the cmake source directory
## BINARY_DIR is the build directory, typically 'build'

function(download_cyrus_sasl SOURCE_DIR BUILD_DIR)
ExternalProject_Add(
cyrussasl
URL "https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-2.1.27/cyrus-sasl-2.1.27.tar.gz"
PREFIX "${BUILD_DIR}/dependencies"
SOURCE_DIR "${BUILD_DIR}/dependencies/cyrussasl-src"
BINARY_DIR ${BUILD_DIR}/dependencies/cyrussasl-src/
CONFIGURE_COMMAND ./configure --enable-static --with-pic --prefix=${BUILD_DIR}/dependencies/cyrussasl-install
"CFLAGS=-fPIC"
"CXXFLAGS=${CMAKE_CXX_FLAGS} -fPIC"
)
set(SASL2_DIR "${BUILD_DIR}/dependencies/cyrussasl-install/" CACHE STRING "" FORCE)
endfunction(download_cyrus_sasl)
31 changes: 31 additions & 0 deletions cmake/DownloadDoubleConversion.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

## Download Double Conversion library.
## SOURCE_DIR is typically the cmake source directory
function(download_doubleconversion SOURCE_DIR BUILD_DIR)

ExternalProject_Add(
doubleconversion-proj
PREFIX "${BUILD_DIR}/dependencies"
GIT_REPOSITORY "https://github.com/google/double-conversion.git"
GIT_TAG "b1d531bfb130e7149ffe24bb0f1c5c01f20c3a5f" ## Commit hash from master
SOURCE_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-src"
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/doubleconversion-proj-install" -DCMAKE_POSITION_INDEPENDENT_CODE=ON "${BUILD_ARGS}")

set(DOUBLE_CONVERSION_ROOT_DIR "${BUILD_DIR}/dependencies/doubleconversion-proj-install" CACHE STRING "" FORCE)
endfunction(download_doubleconversion)
41 changes: 41 additions & 0 deletions cmake/DownloadFizz.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

## Download facebook's fizz library.
## SOURCE_DIR is typically the cmake source directory
## BINARY_DIR is the build directory, typically 'build'

function(download_fizz SOURCE_DIR BUILD_DIR)

ExternalProject_Add(
facebook-fizz-proj
GIT_REPOSITORY "https://github.com/facebookincubator/fizz.git"
PREFIX "${BUILD_DIR}/dependencies"
GIT_TAG "v2020.05.18.00"
SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-src"
PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/folly/local/FindFolly.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake/
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/cmake
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like FindBoost is being used anywhere AFAICT.

COMMAND patch ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz/CMakeLists.txt "${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/fizz.v2020.05.18.00.cmake"
INSTALL_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install"
CONFIGURE_COMMAND ${CMAKE_COMMAND} -DBUILD_EXAMPLES=OFF -DCMAKE_CROSSCOMPILING=ON -DBUILD_TESTS=OFF -DFOLLY_ROOT_DIR=${FOLLY_ROOT_DIR} -DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR} -DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX} -DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX} -DCMAKE_INSTALL_PREFIX:PATH=${BUILD_DIR}/dependencies/facebook-fizz-proj-install ${BUILD_DIR}/dependencies/facebook-fizz-proj-src/fizz # Tell CMake to use subdirectory as source.
)


set(FIZZ_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-fizz-proj-install" CACHE STRING "" FORCE)

endfunction(download_fizz)
41 changes: 18 additions & 23 deletions cmake/DownloadFolly.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,27 @@

## Download facebook's folly library.
## SOURCE_DIR is typically the cmake source directory
## BUILD_DIR is the build directory, typically 'build'

function(download_folly SOURCE_DIR BUILD_DIR)

if (DOWNLOAD_DEPENDENCIES)
# Add custom boost include and lib paths.
set(CFLAGS "-fPIC -I${BOOST_ROOT}/include -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}")
set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC -I${BOOST_ROOT}/include -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}")
set(LDFLAGS "-L${BOOST_ROOT}/lib")
set(CONFIGURE_CMD ./configure --prefix=${BUILD_DIR}/dependencies/facebook-folly-proj-install
--with-boost-libdir=${BOOST_ROOT}/lib CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS} LDFLAGS=${LDFLAGS})
else()
set(CFLAGS "-fPIC -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}")
set(CXXFLAGS "${CMAKE_CXX_FLAGS} -fPIC -lboost_context -lboost_coroutine -l${CMAKE_DL_LIBS}")
set(CONFIGURE_CMD ./configure --prefix=${BUILD_DIR}/dependencies/facebook-folly-proj-install CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS})
endif()

ExternalProject_Add(
facebook-folly-proj
# TODO: Source version information from cmake file.
URL "https://github.com/facebook/folly/archive/v2017.09.04.00.tar.gz"
PREFIX "${BUILD_DIR}/dependencies"
SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src"
BINARY_DIR ${BUILD_DIR}/dependencies/facebook-folly-proj-src/folly
CONFIGURE_COMMAND autoreconf -ivf COMMAND ${CONFIGURE_CMD}
UPDATE_COMMAND ""
facebook-folly-proj
PREFIX "${BUILD_DIR}/dependencies"
GIT_REPOSITORY "https://github.com/facebook/folly.git"
GIT_TAG "v2020.05.18.00"
SOURCE_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-src"
PATCH_COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/doubleconversion/local/FindDoubleConversion.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/cmake/boost/local/FindBoost.cmake" ${BUILD_DIR}/dependencies/facebook-folly-proj-src/CMake
CMAKE_ARGS ${PASSTHROUGH_CMAKE_ARGS}
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR}/dependencies/facebook-folly-proj-install
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DDOUBLE_CONVERSION_ROOT_DIR=${DOUBLE_CONVERSION_ROOT_DIR}
-DBYPRODUCT_PREFIX=${BYPRODUCT_PREFIX}
-DBYPRODUCT_SUFFIX=${BYPRODUCT_SUFFIX}
-DBOOST_ROOT=${BOOST_ROOT}
-DBOOST_INCLUDEDIR=${BOOST_ROOT}/include
-DBOOST_LIBRARYDIR=${BOOST_ROOT}/lib
-DBOOST_LIBRARIES=${BOOST_LIBRARIES}
"${BUILD_ARGS}"
)
set(FOLLY_ROOT_DIR "${BUILD_DIR}/dependencies/facebook-folly-proj-install" CACHE STRING "" FORCE)
endfunction(download_folly)
Loading