mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-18 17:31:57 +08:00
BoostScanDeps: Special case python and numpy and variants
This commit is contained in:
@@ -39,29 +39,40 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs)
|
|||||||
|
|
||||||
# Start by finding all headers for the component; header
|
# Start by finding all headers for the component; header
|
||||||
# dependencies via #include will be solved by future passes
|
# 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*
|
# Special-case since it is part of mpi; look only in boost/mpi/python*
|
||||||
if(component STREQUAL "mpi_python")
|
if(component STREQUAL "mpi_python")
|
||||||
set(_boost_DEPS "python")
|
set(_boost_DEPS "python")
|
||||||
set(library_component TRUE)
|
set(library_component TRUE)
|
||||||
file(GLOB_RECURSE _boost_unprocessed_headers
|
set(_boost_unprocessed_headers ${_boost_mpi_python_headers})
|
||||||
RELATIVE "${includedir}"
|
# Special-case since it is part of python; look only in boost/python/numpy*
|
||||||
"${includedir}/boost/mpi/python/*")
|
elseif(component STREQUAL "numpy")
|
||||||
list(INSERT _boost_unprocessed_headers 0 "${includedir}/boost/mpi/python.hpp")
|
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
|
# Special-case since it is a serialization variant; look in boost/serialization
|
||||||
elseif(component STREQUAL "wserialization")
|
elseif(component STREQUAL "wserialization")
|
||||||
set(library_component TRUE)
|
set(library_component TRUE)
|
||||||
file(GLOB_RECURSE _boost_unprocessed_headers
|
file(GLOB_RECURSE _boost_unprocessed_headers
|
||||||
RELATIVE "${includedir}"
|
RELATIVE "${includedir}"
|
||||||
"${includedir}/boost/serialization/*")
|
"${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
|
# Not really a library in its own right, but treat it as one
|
||||||
elseif(component STREQUAL "math")
|
elseif(component STREQUAL "math")
|
||||||
set(library_component TRUE)
|
set(library_component TRUE)
|
||||||
file(GLOB_RECURSE _boost_unprocessed_headers
|
file(GLOB_RECURSE _boost_unprocessed_headers
|
||||||
RELATIVE "${includedir}"
|
RELATIVE "${includedir}"
|
||||||
"${includedir}/boost/math/*")
|
"${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
|
# Single test header
|
||||||
elseif(component STREQUAL "unit_test_framework")
|
elseif(component STREQUAL "unit_test_framework")
|
||||||
set(library_component TRUE)
|
set(library_component TRUE)
|
||||||
@@ -79,7 +90,8 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs)
|
|||||||
file(GLOB_RECURSE _boost_unprocessed_headers
|
file(GLOB_RECURSE _boost_unprocessed_headers
|
||||||
RELATIVE "${includedir}"
|
RELATIVE "${includedir}"
|
||||||
"${includedir}/boost/${component}/*")
|
"${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()
|
endif()
|
||||||
|
|
||||||
while(_boost_unprocessed_headers)
|
while(_boost_unprocessed_headers)
|
||||||
@@ -102,6 +114,8 @@ function(_Boost_FIND_COMPONENT_DEPENDENCIES component includedir _ret_libs)
|
|||||||
|
|
||||||
foreach(line ${_boost_header_deps})
|
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(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)
|
list(FIND _boost_DEPS "${_boost_component_match}" _boost_dep_found)
|
||||||
if(_boost_component_match STREQUAL "bzip2" OR
|
if(_boost_component_match STREQUAL "bzip2" OR
|
||||||
_boost_component_match STREQUAL "zlib")
|
_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).
|
# hard dependency (handle as special-case for mpi_python).
|
||||||
continue()
|
continue()
|
||||||
endif()
|
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
|
if (_boost_dep_found EQUAL -1 AND
|
||||||
NOT "${_boost_component_match}" STREQUAL "${component}")
|
NOT "${_boost_component_match}" STREQUAL "${component}")
|
||||||
list(APPEND _boost_DEPS "${_boost_component_match}")
|
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")
|
IS_DIRECTORY "${BOOST_DIR}/boost/python")
|
||||||
list(APPEND boost_components "mpi_python")
|
list(APPEND boost_components "mpi_python")
|
||||||
endif()
|
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
|
# Special-case wserialization, which is a variant of serialization
|
||||||
if(IS_DIRECTORY "${BOOST_DIR}/boost/serialization")
|
if(IS_DIRECTORY "${BOOST_DIR}/boost/serialization")
|
||||||
list(APPEND boost_components "wserialization")
|
list(APPEND boost_components "wserialization")
|
||||||
|
Reference in New Issue
Block a user