From 6a95f05d65b5fc192d9689ca653e5b4e19a50cad Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Wed, 12 Aug 2020 10:17:38 -0600 Subject: deps_builder: Optionally build boost::python This this adds the option of building boost::python in the libs builder, in preparation for future dependencies that require it (ie pyopenvdb) disabled by default, can be enabled with the `WITH_BOOST_PYTHON` cmake option. Differential Revision: https://developer.blender.org/D8212 Reviewed by: brecht --- build_files/build_environment/CMakeLists.txt | 3 ++- build_files/build_environment/cmake/boost.cmake | 18 ++++++++++++++++++ build_files/build_environment/cmake/options.cmake | 1 + .../build_environment/patches/boost.user.jam.in | 4 ++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 build_files/build_environment/patches/boost.user.jam.in (limited to 'build_files') diff --git a/build_files/build_environment/CMakeLists.txt b/build_files/build_environment/CMakeLists.txt index c26b90637c3..6415d270773 100644 --- a/build_files/build_environment/CMakeLists.txt +++ b/build_files/build_environment/CMakeLists.txt @@ -57,7 +57,6 @@ include(cmake/zlib.cmake) include(cmake/openal.cmake) include(cmake/png.cmake) include(cmake/jpeg.cmake) -include(cmake/boost.cmake) include(cmake/blosc.cmake) include(cmake/pthreads.cmake) include(cmake/openexr.cmake) @@ -89,6 +88,8 @@ include(cmake/python_site_packages.cmake) include(cmake/package_python.cmake) include(cmake/numpy.cmake) include(cmake/usd.cmake) +# Boost needs to be included after python.cmake due to the PYTHON_BINARY variable being needed. +include(cmake/boost.cmake) if(UNIX) # Rely on PugiXML compiled with OpenImageIO else() diff --git a/build_files/build_environment/cmake/boost.cmake b/build_files/build_environment/cmake/boost.cmake index 062bdeb2473..22b5f33e690 100644 --- a/build_files/build_environment/cmake/boost.cmake +++ b/build_files/build_environment/cmake/boost.cmake @@ -49,6 +49,15 @@ else() endif() endif() +if(WITH_BOOST_PYTHON) + set(JAM_FILE ${BUILD_DIR}/boost.user-config.jam) + configure_file(${PATCH_DIR}/boost.user.jam.in ${JAM_FILE}) + set(BOOST_PYTHON_OPTIONS + --with-python + --user-config=${JAM_FILE} + ) +endif() + set(BOOST_OPTIONS --with-filesystem --with-locale @@ -65,6 +74,7 @@ set(BOOST_OPTIONS -sNO_LZMA=1 -sNO_ZSTD=1 ${BOOST_TOOLSET} + ${BOOST_PYTHON_OPTIONS} ) string(TOLOWER ${BUILD_MODE} BOOST_BUILD_TYPE) @@ -81,3 +91,11 @@ ExternalProject_Add(external_boost BUILD_IN_SOURCE 1 INSTALL_COMMAND "${BOOST_HARVEST_CMD}" ) + +if(WITH_BOOST_PYTHON) + add_dependencies( + external_boost + external_python + external_numpy + ) +endif() diff --git a/build_files/build_environment/cmake/options.cmake b/build_files/build_environment/cmake/options.cmake index 2542f723845..29e2ffc7ed8 100644 --- a/build_files/build_environment/cmake/options.cmake +++ b/build_files/build_environment/cmake/options.cmake @@ -20,6 +20,7 @@ if(WIN32) option(ENABLE_MINGW64 "Enable building of ffmpeg/iconv/libsndfile/fftw3 by installing mingw64" ON) endif() option(WITH_WEBP "Enable building of oiio with webp support" OFF) +option(WITH_BOOST_PYTHON "Enable building of boost with python support" OFF) set(MAKE_THREADS 1 CACHE STRING "Number of threads to run make with") if(NOT BUILD_MODE) diff --git a/build_files/build_environment/patches/boost.user.jam.in b/build_files/build_environment/patches/boost.user.jam.in new file mode 100644 index 00000000000..b615b0cafad --- /dev/null +++ b/build_files/build_environment/patches/boost.user.jam.in @@ -0,0 +1,4 @@ +using python : @PYTHON_SHORT_VERSION@ : @PYTHON_BINARY@ + : @LIBDIR@/python/include @LIBDIR@/python/include/python@PYTHON_SHORT_VERSION@m/ + : @LIBDIR@/python/libs +; \ No newline at end of file -- cgit v1.2.3