提交 564c6abd 编写于 作者: D dangqingqing

Add cmake for extern project of boost.

上级 8e08b0a2
......@@ -134,6 +134,7 @@ include(external/openblas) # download, build, install openblas
include(external/mkldnn) # download, build, install mkldnn
include(external/swig) # download, build, install swig
include(external/warpctc) # download, build, install warpctc
include(external/boost) # download, build, install boost
include(external/any) # download libn::any
include(external/eigen) # download eigen3
include(external/pybind11) # download pybind11
......
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed 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.
INCLUDE(ExternalProject)
set(BOOST_PROJECT "extern_boost")
set(BOOST_VER "1.66.0")
set(BOOST_TAR "boost_1_66_0")
set(BOOST_URL "https://dl.bintray.com/boostorg/release/${BOOST_VER}/source/${BOOST_TAR}.tar.gz")
set(BOOST_SOURCES_DIR ${THIRD_PARTY_PATH}/boost)
set(BOOST_DOWNLOAD_DIR "${BOOST_SOURCES_DIR}/src/${BOOST_PROJECT}")
set(BOOST_INSTALL_DIR ${THIRD_PARTY_PATH}/install/boost)
set(BOOST_ROOT ${BOOST_INSTALL_DIR} CACHE FILEPATH "boost root directory." FORCE)
set(BOOST_INCLUDE_DIR "${BOOST_INSTALL_DIR}/include" CACHE PATH "boost include directory." FORCE)
set(BOOST_BOOTSTRAP_CMD)
set(BOOST_B2_CMD)
if(UNIX)
set(BOOST_BOOTSTRAP_CMD ./bootstrap.sh)
set(BOOST_B2_CMD ./b2)
else()
if(WIN32)
set(BOOST_BOOTSTRAP_CMD bootstrap.bat)
set(BOOST_B2_CMD b2.exe)
endif()
endif()
INCLUDE_DIRECTORIES(${BOOST_INCLUDE_DIR})
ExternalProject_Add(
${BOOST_PROJECT}
${EXTERNAL_PROJECT_LOG_ARGS}
DOWNLOAD_DIR ${BOOST_DOWNLOAD_DIR}
DOWNLOAD_COMMAND wget --no-check-certificate ${BOOST_URL} -c -q -O ${BOOST_TAR}.tar.gz
&& tar zxf ${BOOST_TAR}.tar.gz
DOWNLOAD_NO_PROGRESS 1
PREFIX ${BOOST_SOURCES_DIR}
CONFIGURE_COMMAND sh -c "cd <SOURCE_DIR>/${BOOST_TAR} && ${BOOST_BOOTSTRAP_CMD} --prefix=${BOOST_INSTALL_DIR}"
BUILD_COMMAND cd <SOURCE_DIR>/${BOOST_TAR} && ${BOOST_B2_CMD} install --prefix=${BOOST_INSTALL_DIR} --with-program_options
INSTALL_COMMAND ""
UPDATE_COMMAND ""
)
if (${CMAKE_VERSION} VERSION_LESS "3.3.0")
set(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/boost_dummy.c)
file(WRITE ${dummyfile} "const char *dummy = \"${dummyfile}\";")
add_library(boost STATIC ${dummyfile})
else()
add_library(boost INTERFACE)
endif()
ADD_DEPENDENCIES(boost ${BOOST_PROJECT})
LIST(APPEND external_project_dependencies boost)
if(WIN32)
set(Boost_INCLUDE_DIR ${BOOST_INSTALL_DIR}/include/boost)
set(BOOST_ROOT ${BOOST_INSTALL_DIR} )
else()
set(Boost_INCLUDE_DIR ${BOOST_INSTALL_DIR}/include)
endif()
set(Boost_LIBRARY_DIR ${BOOST_INSTALL_DIR}/lib)
# ddim lib
proto_library(framework_proto SRCS framework.proto)
cc_library(ddim SRCS ddim.cc DEPS eigen3)
cc_library(ddim SRCS ddim.cc DEPS eigen3 boost)
cc_test(ddim_test SRCS ddim_test.cc DEPS ddim)
nv_test(dim_test SRCS dim_test.cu DEPS ddim)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册