download boost using cmake

This commit is contained in:
alemuntoni 2022-10-29 12:55:11 +02:00
parent 683502837c
commit 5b008e41cd
3 changed files with 23 additions and 14 deletions

View File

@ -6,10 +6,6 @@ $EXTERNAL_PATH = Join-Path $SCRIPTS_PATH ..\..\src\external
cd $EXTERNAL_PATH
Invoke-WebRequest -Uri "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.zip" -OutFile "boost_1_75_0.zip"
Expand-Archive -Path boost_1_75_0.zip -DestinationPath .\
Remove-Item boost_1_75_0.zip
Invoke-WebRequest -Uri "https://github.com/CGAL/cgal/releases/download/v5.2.1/CGAL-5.2.1.zip" -OutFile "CGAL-5.2.1.zip"
Expand-Archive -Path CGAL-5.2.1.zip -DestinationPath .\
Remove-Item CGAL-5.2.1.zip

View File

@ -6,10 +6,6 @@ EXTERNAL_PATH=$SCRIPTS_PATH/../../src/external
cd $EXTERNAL_PATH
wget https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.zip
unzip boost_1_75_0.zip
rm boost_1_75_0.zip
wget https://github.com/CGAL/cgal/releases/download/v5.2.1/CGAL-5.2.1.zip
unzip CGAL-5.2.1.zip
rm CGAL-5.2.1.zip

View File

@ -2,21 +2,38 @@
# Copyright 2019, 2021, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
option(ALLOW_BUNDLED_BOOST "Allow use of bundled boost source" ON)
option(ALLOW_SYSTEM_BOOST "Allow use of system-provided boost" ON)
option(MESHLAB_ALLOW_DOWNLOAD_SOURCE_BOOST "Allow download and use of boost source" ON)
option(MESHLAB_ALLOW_SYSTEM_BOOST "Allow use of system-provided boost" ON)
find_package(Boost COMPONENTS thread)
set(BOOST_DIR ${CMAKE_CURRENT_LIST_DIR}/boost_1_75_0)
if(ALLOW_SYSTEM_BOOST AND TARGET Boost::boost)
if(MESHLAB_ALLOW_SYSTEM_BOOST AND TARGET Boost::boost)
message(STATUS "- Boost - using system-provided library")
add_library(external-boost INTERFACE)
target_link_libraries(external-boost INTERFACE Boost::boost)
if (TARGET Boost::thread)
target_link_libraries(external-boost INTERFACE Boost::thread)
endif()
elseif(ALLOW_BUNDLED_BOOST AND EXISTS "${BOOST_DIR}/boost/version.hpp")
message(STATUS "- Boost - using bundled source")
elseif(MESHLAB_ALLOW_DOWNLOAD_SOURCE_BOOST )
set(BOOST_DIR ${CMAKE_CURRENT_LIST_DIR}/boost_1_75_0)
if (NOT EXISTS "${BOOST_DIR}/boost/version.hpp")
message("Downloading Boost....")
set(BOOST_LINK https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.zip)
file(DOWNLOAD ${BOOST_LINK} ${CMAKE_CURRENT_LIST_DIR}/boost_1_75_0.zip)
message("Boost downloaded.")
message("Extracting Boost archive...")
file(ARCHIVE_EXTRACT
INPUT ${CMAKE_CURRENT_LIST_DIR}/boost_1_75_0.zip
DESTINATION ${CMAKE_CURRENT_LIST_DIR})
message("Boost archive extracted.")
file(REMOVE ${CMAKE_CURRENT_LIST_DIR}/boost_1_75_0.zip)
endif()
message(STATUS "- Boost - using downloaded source")
add_library(external-boost INTERFACE)
target_include_directories(external-boost INTERFACE "${BOOST_DIR}")
endif()