From e66e8e891454b4addcb7dbd57a8bdc5eeaf7bff3 Mon Sep 17 00:00:00 2001 From: Roger Leigh Date: Tue, 22 Aug 2017 15:11:22 +0100 Subject: BoostScanDeps: Special case python and numpy and variants --- Utilities/Scripts/BoostScanDeps.cmake | 39 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'Utilities') diff --git a/Utilities/Scripts/BoostScanDeps.cmake b/Utilities/Scripts/BoostScanDeps.cmake index 2fd8f86332..bd2e6a8792 100644 --- a/Utilities/Scripts/BoostScanDeps.cmake +++ b/Utilities/Scripts/BoostScanDeps.cmake @@ -39,29 +39,40 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) # Start by finding all headers for the component; header # dependencies via #include will be solved by future passes + file(GLOB_RECURSE _boost_mpi_python_headers + RELATIVE "${includedir}" + "${includedir}/boost/mpi/python/*") + list(INSERT _boost_mpi_python_headers 0 "boost/mpi/python.hpp") + + file(GLOB_RECURSE _boost_python_numpy_headers + RELATIVE "${includedir}" + "${includedir}/boost/python/numpy/*") + list(INSERT _boost_python_numpy_headers 0 "boost/python/numpy.hpp") # Special-case since it is part of mpi; look only in boost/mpi/python* if(component STREQUAL "mpi_python") set(_boost_DEPS "python") set(library_component TRUE) - file(GLOB_RECURSE _boost_unprocessed_headers - RELATIVE "${includedir}" - "${includedir}/boost/mpi/python/*") - list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/mpi/python.hpp") + set(_boost_unprocessed_headers ${_boost_mpi_python_headers}) + # Special-case since it is part of python; look only in boost/python/numpy* + elseif(component STREQUAL "numpy") + set(_boost_DEPS "python") + set(library_component TRUE) + set(_boost_unprocessed_headers ${_boost_python_numpy_headers}) # Special-case since it is a serialization variant; look in boost/serialization elseif(component STREQUAL "wserialization") set(library_component TRUE) file(GLOB_RECURSE _boost_unprocessed_headers RELATIVE "${includedir}" "${includedir}/boost/serialization/*") - list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/serialization.hpp") + list(INSERT _boost_unprocessed_headers 0 "boost/serialization.hpp") # Not really a library in its own right, but treat it as one elseif(component STREQUAL "math") set(library_component TRUE) file(GLOB_RECURSE _boost_unprocessed_headers RELATIVE "${includedir}" "${includedir}/boost/math/*") - list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/math.hpp") + list(INSERT _boost_unprocessed_headers 0 "boost/math.hpp") # Single test header elseif(component STREQUAL "unit_test_framework") set(library_component TRUE) @@ -79,7 +90,8 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) file(GLOB_RECURSE _boost_unprocessed_headers RELATIVE "${includedir}" "${includedir}/boost/${component}/*") - list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/${component}.hpp") + list(INSERT _boost_unprocessed_headers 0 "boost/${component}.hpp") + list(REMOVE_ITEM _boost_unprocessed_headers ${_boost_mpi_python_headers} ${_boost_python_numpy_headers}) endif() while(_boost_unprocessed_headers) @@ -102,6 +114,8 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) foreach(line ${_boost_header_deps}) string(REGEX REPLACE "^[ \t]*#[ \t]*define[ \t][ \t]*BOOST_LIB_NAME[ \t][ \t]*boost_([^ \t][^ \t]*).*" "\\1" _boost_component_match "${line}") + string(REPLACE "python3" "python" _boost_component_match "${_boost_component_match}") + string(REPLACE "numpy3" "numpy" _boost_component_match "${_boost_component_match}") list(FIND _boost_DEPS "${_boost_component_match}" _boost_dep_found) if(_boost_component_match STREQUAL "bzip2" OR _boost_component_match STREQUAL "zlib") @@ -119,6 +133,12 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs) # hard dependency (handle as special-case for mpi_python). continue() endif() + if(component STREQUAL "python" AND + boost_component_match STREQUAL "numpy") + # Optional python dependency; skip to avoid making it a + # hard dependency (handle as special-case for numpy). + continue() + endif() if (_boost_dep_found EQUAL -1 AND NOT "${_boost_component_match}" STREQUAL "${component}") list(APPEND _boost_DEPS "${_boost_component_match}") @@ -168,6 +188,11 @@ if(IS_DIRECTORY "${BOOST_DIR}/boost/mpi" AND IS_DIRECTORY "${BOOST_DIR}/boost/python") list(APPEND boost_components "mpi_python") endif() +# Special-case numpy, since it's a part of python +if(IS_DIRECTORY "${BOOST_DIR}/boost/python" AND + IS_DIRECTORY "${BOOST_DIR}/boost/python/numpy") + list(APPEND boost_components "numpy") +endif() # Special-case wserialization, which is a variant of serialization if(IS_DIRECTORY "${BOOST_DIR}/boost/serialization") list(APPEND boost_components "wserialization") -- cgit v1.2.1