Add Boost the new way

This commit is contained in:
tamasmeszaros 2021-03-22 14:35:49 +01:00
parent 8753c63e72
commit b82aa065ae
9 changed files with 1308 additions and 79 deletions

132
deps/Boost/Boost.cmake vendored Normal file
View File

@ -0,0 +1,132 @@
include(ExternalProject)
if (WIN32)
set(_bootstrap_cmd bootstrap.bat)
set(_build_cmd b2.exe)
else()
set(_bootstrap_cmd ./bootstrap.sh)
set(_build_cmd ./b2)
endif()
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/common.jam ./tools/build/src/tools/common.jam)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam boost-user-config.jam)
set(_boost_toolset gcc)
set(_patch_command ${_patch_command} && ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/boost-user-config.jam ./tools/build/src/tools/user-config.jam)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
if (MSVC_VERSION EQUAL 1800)
# 1800 = VS 12.0 (v120 toolset)
set(_boost_toolset "msvc-12.0")
elseif (MSVC_VERSION EQUAL 1900)
# 1900 = VS 14.0 (v140 toolset)
set(_boost_toolset "msvc-14.0")
elseif (MSVC_VERSION LESS 1920)
# 1910-1919 = VS 15.0 (v141 toolset)
set(_boost_toolset "msvc-14.1")
elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset)
set(_boost_toolset "msvc-14.2")
else ()
message(FATAL_ERROR "Unsupported MSVC version")
endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (WIN32)
set(_boost_toolset "clang-win")
else()
set(_boost_toolset "clang")
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(_boost_toolset "intel")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(_boost_toolset "clang")
endif()
message(STATUS "Deduced boost toolset: ${_boost_toolset} based on ${CMAKE_CXX_COMPILER_ID} compiler")
set(_libs "")
foreach(_comp ${DEP_Boost_COMPONENTS})
list(APPEND _libs "--with-${_comp}")
endforeach()
if (BUILD_SHARED_LIBS)
set(_link shared)
else()
set(_link static)
endif()
set(_bits "")
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_bits 64)
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(_bits 32)
endif ()
include(ProcessorCount)
ProcessorCount(NPROC)
file(TO_NATIVE_PATH ${DESTDIR}/usr/local/ _prefix)
set(_boost_flags "")
if (UNIX)
set(_boost_flags "cflags=-fPIC;cxxflags=-fPIC")
elseif(APPLE)
set(_boost_flags
"cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
"cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
"mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
"mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}")
endif()
set(_boost_variants "")
if(CMAKE_BUILD_TYPE)
list(APPEND CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
endif()
list(FIND CMAKE_CONFIGURATION_TYPES "Release" _cfg_rel)
list(FIND CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" _cfg_relwdeb)
list(FIND CMAKE_CONFIGURATION_TYPES "MinSizeRel" _cfg_minsizerel)
list(FIND CMAKE_CONFIGURATION_TYPES "Debug" _cfg_deb)
if (_cfg_rel GREATER -1 OR _cfg_relwdeb GREATER -1 OR _cfg_minsizerel GREATER -1)
list(APPEND _boost_variants release)
endif()
if (_cfg_deb GREATER -1 OR (MSVC AND ${DEP_DEBUG}) )
list(APPEND _boost_variants debug)
endif()
if (NOT _boost_variants)
set(_boost_variants release)
endif()
set(_build_cmd ${_build_cmd}
${_boost_flags}
-j${NPROC}
${_libs}
--layout=versioned
--debug-configuration
toolset=${_boost_toolset}
address-model=${_bits}
link=${_link}
threading=multi
boost.locale.icu=off
--disable-icu
${_boost_variants}
stage)
set(_install_cmd ${_build_cmd} --prefix=${_prefix} install)
ExternalProject_Add(
dep_Boost
URL "file:///home/quarky/Workspace/prusa3d/PrusaSlicer/deps-src-local/boost_1_70_0.tar.gz"
#"https://dl.bintray.com/boostorg/release/1.70.0/source/boost_1_70_0.tar.gz"
URL_HASH SHA256=882b48708d211a5f48e60b0124cf5863c1534cd544ecd0664bb534a4b5d506e9
CONFIGURE_COMMAND "${_bootstrap_cmd}"
PATCH_COMMAND ${_patch_command}
BUILD_COMMAND "${_build_cmd}"
BUILD_IN_SOURCE ON
INSTALL_COMMAND "${_install_cmd}"
)

1095
deps/Boost/common.jam vendored Normal file

File diff suppressed because it is too large Load Diff

1
deps/Boost/user-config.jam vendored Normal file
View File

@ -0,0 +1 @@
using gcc : : @CMAKE_CXX_COMPILER@ ;

View File

@ -5,7 +5,7 @@ prusaslicer_add_cmake_project(
# For whatever reason, this keeps downloading forever (repeats downloads if finished) # For whatever reason, this keeps downloading forever (repeats downloads if finished)
# URL https://github.com/CGAL/cgal/archive/releases/CGAL-5.0.zip # URL https://github.com/CGAL/cgal/archive/releases/CGAL-5.0.zip
# URL_HASH SHA256=bd9327be903ab7ee379a8a7a0609eba0962f5078d2497cf8e13e8e1598584154 # URL_HASH SHA256=bd9327be903ab7ee379a8a7a0609eba0962f5078d2497cf8e13e8e1598584154
DEPENDS dep_boost dep_GMP dep_MPFR DEPENDS dep_Boost dep_GMP dep_MPFR
) )
include(GNUInstallDirs) include(GNUInstallDirs)

9
deps/CMakeLists.txt vendored
View File

@ -146,6 +146,9 @@ if (NOT EXPAT_FOUND)
set(EXPAT_PKG dep_EXPAT) set(EXPAT_PKG dep_EXPAT)
endif () endif ()
set(DEP_Boost_COMPONENTS system iostreams filesystem thread log locale regex date_time)
include(Boost/Boost.cmake)
# The order of includes respects the dependencies between libraries # The order of includes respects the dependencies between libraries
include(Cereal/Cereal.cmake) include(Cereal/Cereal.cmake)
include(Qhull/Qhull.cmake) include(Qhull/Qhull.cmake)
@ -169,10 +172,8 @@ include(CURL/CURL.cmake)
include(wxWidgets/wxWidgets.cmake) include(wxWidgets/wxWidgets.cmake)
add_dependencies(dep_OpenVDB dep_boost)
set(_dep_list set(_dep_list
dep_boost dep_Boost
dep_TBB dep_TBB
dep_CURL dep_CURL
dep_wxWidgets dep_wxWidgets
@ -192,7 +193,7 @@ if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
EXCLUDE_FROM_ALL ON EXCLUDE_FROM_ALL ON
GIT_REPOSITORY "https://github.com/prusa3d/polygon" GIT_REPOSITORY "https://github.com/prusa3d/polygon"
GIT_TAG prusaslicer_gmp GIT_TAG prusaslicer_gmp
DEPENDS dep_boost DEPENDS dep_Boost
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND "" BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory

View File

@ -9,7 +9,7 @@ endif()
prusaslicer_add_cmake_project(OpenVDB prusaslicer_add_cmake_project(OpenVDB
GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git
GIT_TAG aebaf8d95be5e57fd33949281ec357db4a576c2e #v6.2.1 GIT_TAG aebaf8d95be5e57fd33949281ec357db4a576c2e #v6.2.1
DEPENDS dep_TBB dep_Blosc dep_OpenEXR #dep_Boost DEPENDS dep_TBB dep_Blosc dep_OpenEXR dep_Boost
PATCH_COMMAND ${GIT_EXECUTABLE} reset --hard && ${GIT_EXECUTABLE} clean -df && PATCH_COMMAND ${GIT_EXECUTABLE} reset --hard && ${GIT_EXECUTABLE} clean -df &&
${GIT_EXECUTABLE} apply --whitespace=nowarn ${CMAKE_CURRENT_LIST_DIR}/openvdb-mods.patch ${GIT_EXECUTABLE} apply --whitespace=nowarn ${CMAKE_CURRENT_LIST_DIR}/openvdb-mods.patch
CMAKE_ARGS CMAKE_ARGS

42
deps/deps-linux.cmake vendored
View File

@ -11,27 +11,27 @@ include("deps-unix-common.cmake")
#TODO UDEV #TODO UDEV
ExternalProject_Add(dep_boost # ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1 # EXCLUDE_FROM_ALL 1
URL "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz" # URL "https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.gz"
URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a # URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
BUILD_IN_SOURCE 1 # BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./bootstrap.sh # CONFIGURE_COMMAND ./bootstrap.sh
--with-libraries=system,iostreams,filesystem,thread,log,locale,regex,date_time # --with-libraries=system,iostreams,filesystem,thread,log,locale,regex,date_time
"--prefix=${DESTDIR}/usr/local" # "--prefix=${DESTDIR}/usr/local"
BUILD_COMMAND ./b2 # BUILD_COMMAND ./b2
-j ${NPROC} # -j ${NPROC}
--reconfigure # --reconfigure
link=static # link=static
variant=release # variant=release
threading=multi # threading=multi
boost.locale.icu=off # boost.locale.icu=off
--disable-icu # --disable-icu
cflags=-fPIC # cflags=-fPIC
cxxflags=-fPIC # cxxflags=-fPIC
install # install
INSTALL_COMMAND "" # b2 does that already # INSTALL_COMMAND "" # b2 does that already
) # )
# ExternalProject_Add(dep_libopenssl # ExternalProject_Add(dep_libopenssl
# EXCLUDE_FROM_ALL 1 # EXCLUDE_FROM_ALL 1

50
deps/deps-macos.cmake vendored
View File

@ -16,31 +16,31 @@ set(DEP_CMAKE_OPTS
include("deps-unix-common.cmake") include("deps-unix-common.cmake")
ExternalProject_Add(dep_boost # ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1 # EXCLUDE_FROM_ALL 1
URL "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz" # URL "https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.gz"
URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a # URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
BUILD_IN_SOURCE 1 # BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./bootstrap.sh # CONFIGURE_COMMAND ./bootstrap.sh
--with-toolset=clang # --with-toolset=clang
--with-libraries=system,iostreams,filesystem,thread,log,locale,regex,date_time # --with-libraries=system,iostreams,filesystem,thread,log,locale,regex,date_time
"--prefix=${DESTDIR}/usr/local" # "--prefix=${DESTDIR}/usr/local"
BUILD_COMMAND ./b2 # BUILD_COMMAND ./b2
-j ${NPROC} # -j ${NPROC}
--reconfigure # --reconfigure
toolset=clang # toolset=clang
link=static # link=static
variant=release # variant=release
threading=multi # threading=multi
boost.locale.icu=off # boost.locale.icu=off
--disable-icu # --disable-icu
"cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" # "cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
"cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" # "cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
"mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" # "mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
"mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}" # "mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}"
install # install
INSTALL_COMMAND "" # b2 does that already # INSTALL_COMMAND "" # b2 does that already
) # )
# ExternalProject_Add(dep_libcurl # ExternalProject_Add(dep_libcurl
# EXCLUDE_FROM_ALL 1 # EXCLUDE_FROM_ALL 1

View File

@ -53,33 +53,33 @@ if (${DEP_DEBUG})
endif () endif ()
endmacro() endmacro()
ExternalProject_Add(dep_boost # ExternalProject_Add(dep_boost
EXCLUDE_FROM_ALL 1 # EXCLUDE_FROM_ALL 1
URL "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.gz" # URL "https://dl.bintray.com/boostorg/release/1.75.0/source/boost_1_75_0.tar.gz"
URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a # URL_HASH SHA256=aeb26f80e80945e82ee93e5939baebdca47b9dee80a07d3144be1e1a6a66dd6a
BUILD_IN_SOURCE 1 # BUILD_IN_SOURCE 1
CONFIGURE_COMMAND bootstrap.bat # CONFIGURE_COMMAND bootstrap.bat
BUILD_COMMAND b2.exe # BUILD_COMMAND b2.exe
-j "${NPROC}" # -j "${NPROC}"
--with-system # --with-system
--with-iostreams # --with-iostreams
--with-filesystem # --with-filesystem
--with-thread # --with-thread
--with-log # --with-log
--with-locale # --with-locale
--with-regex # --with-regex
--with-date_time # --with-date_time
"--prefix=${DESTDIR}/usr/local" # "--prefix=${DESTDIR}/usr/local"
"address-model=${DEPS_BITS}" # "address-model=${DEPS_BITS}"
"toolset=${DEP_BOOST_TOOLSET}" # "toolset=${DEP_BOOST_TOOLSET}"
link=static # link=static
variant=release # variant=release
threading=multi # threading=multi
boost.locale.icu=off # boost.locale.icu=off
--disable-icu # --disable-icu
"${DEP_BOOST_DEBUG}" release install # "${DEP_BOOST_DEBUG}" release install
INSTALL_COMMAND "" # b2 does that already # INSTALL_COMMAND "" # b2 does that already
) # )
# ExternalProject_Add(dep_cereal # ExternalProject_Add(dep_cereal
# EXCLUDE_FROM_ALL 1 # EXCLUDE_FROM_ALL 1