boost.cmake 2.6 KB
Newer Older
1
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
2 3 4 5 6 7 8 9 10 11 12 13 14
#
# 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.

15
include(ExternalProject)
16 17

set(BOOST_PROJECT       "extern_boost")
18 19 20 21 22 23 24
# To release PaddlePaddle as a pip package, we have to follow the
# manylinux1 standard, which features as old Linux kernels and
# compilers as possible and recommends CentOS 5. Indeed, the earliest
# CentOS version that works with NVIDIA CUDA is CentOS 6.  And a new
# version of boost, say, 1.66.0, doesn't build on CentOS 6.  We
# checked that the devtools package of CentOS 6 installs boost 1.41.0.
# So we use 1.41.0 here.
25
set(BOOST_VER   "1.41.0")
26 27 28 29
# boost_1_41_0_2021_10.tar.gz is almost the same with boost_1_41_0.tar.gz,
# except in visualc.hpp i comment a warning of "unknown compiler version",
# so if you need to change boost, you may need to block the warning similarly.
set(BOOST_TAR   "boost_1_41_0_2021_10" CACHE STRING "" FORCE)
30
set(BOOST_URL   "http://paddlepaddledeps.bj.bcebos.com/${BOOST_TAR}.tar.gz" CACHE STRING "" FORCE)
P
peizhilin 已提交
31

32
MESSAGE(STATUS "BOOST_VERSION: ${BOOST_VER}, BOOST_URL: ${BOOST_URL}")
D
dzhwinter 已提交
33

34
set(BOOST_PREFIX_DIR ${THIRD_PARTY_PATH}/boost)
35
set(BOOST_SOURCE_DIR ${THIRD_PARTY_PATH}/boost/src/extern_boost)
36 37
cache_third_party(${BOOST_PROJECT}
        URL       ${BOOST_URL}
38
        DIR       BOOST_SOURCE_DIR)
39

40
set(BOOST_INCLUDE_DIR "${BOOST_SOURCE_DIR}" CACHE PATH "boost include directory." FORCE)
41
set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1)
42
include_directories(${BOOST_INCLUDE_DIR})
43

Z
Zhou Wei 已提交
44 45 46 47
if(WIN32 AND MSVC_VERSION GREATER_EQUAL 1600)
    add_definitions(-DBOOST_HAS_STATIC_ASSERT)
endif()

48 49 50
ExternalProject_Add(
    ${BOOST_PROJECT}
    ${EXTERNAL_PROJECT_LOG_ARGS}
51
    "${BOOST_DOWNLOAD_CMD}"
52
    URL_MD5               51be7cc203628dc0848e97eee32d79e3
53 54 55
    PREFIX                ${BOOST_PREFIX_DIR}
    DOWNLOAD_DIR          ${BOOST_SOURCE_DIR}
    SOURCE_DIR            ${BOOST_SOURCE_DIR}
56
    DOWNLOAD_NO_PROGRESS  1
57 58
    CONFIGURE_COMMAND     ""
    BUILD_COMMAND         ""
59 60
    INSTALL_COMMAND       ""
    UPDATE_COMMAND        ""
61
    )
62

63
add_library(boost INTERFACE)
64

65 66
add_dependencies(boost ${BOOST_PROJECT})
set(Boost_INCLUDE_DIR ${BOOST_INCLUDE_DIR})