1
0
Эх сурвалжийг харах

Merge topic 'boost-1.65'

fa114e7d FindBoost: Add Boost 1.65 dependencies
e66e8e89 BoostScanDeps: Special case python and numpy and variants

Acked-by: Kitware Robot <[email protected]>
Merge-request: !1172
Brad King 8 жил өмнө
parent
commit
65ca67cef1

+ 27 - 3
Modules/FindBoost.cmake

@@ -554,7 +554,10 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
   # The addition of a new release should only require it to be run
   # against the new release.
   set(_Boost_IMPORTED_TARGETS TRUE)
-  if(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500)
+  if(Boost_VERSION VERSION_LESS 103300)
+    message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)")
+    set(_Boost_IMPORTED_TARGETS FALSE)
+  elseif(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500)
     set(_Boost_IOSTREAMS_DEPENDENCIES regex thread)
     set(_Boost_REGEX_DEPENDENCIES thread)
     set(_Boost_WAVE_DEPENDENCIES filesystem thread)
@@ -768,8 +771,27 @@ function(_Boost_COMPONENT_DEPENDENCIES component _ret)
     set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
     set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
   else()
-    message(WARNING "Imported targets not available for Boost version ${Boost_VERSION}")
-    set(_Boost_IMPORTED_TARGETS FALSE)
+    if(NOT Boost_VERSION VERSION_LESS 106500)
+      set(_Boost_CHRONO_DEPENDENCIES system)
+      set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time)
+      set(_Boost_COROUTINE_DEPENDENCIES context system)
+      set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time)
+      set(_Boost_FILESYSTEM_DEPENDENCIES system)
+      set(_Boost_IOSTREAMS_DEPENDENCIES regex)
+      set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic)
+      set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic)
+      set(_Boost_MPI_DEPENDENCIES serialization)
+      set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization)
+      set(_Boost_NUMPY_DEPENDENCIES python)
+      set(_Boost_RANDOM_DEPENDENCIES system)
+      set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic)
+      set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic)
+      set(_Boost_WSERIALIZATION_DEPENDENCIES serialization)
+    endif()
+    if(NOT Boost_VERSION VERSION_LESS 106600)
+      message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets")
+      set(_Boost_IMPORTED_TARGETS FALSE)
+    endif()
   endif()
 
   string(TOUPPER ${component} uppercomponent)
@@ -819,6 +841,7 @@ function(_Boost_COMPONENT_HEADERS component _hdrs)
   set(_Boost_MATH_TR1L_HEADERS           "boost/math/tr1.hpp")
   set(_Boost_MPI_HEADERS                 "boost/mpi.hpp")
   set(_Boost_MPI_PYTHON_HEADERS          "boost/mpi/python/config.hpp")
+  set(_Boost_NUMPY_HEADERS               "boost/python/numpy.hpp")
   set(_Boost_PRG_EXEC_MONITOR_HEADERS    "boost/test/prg_exec_monitor.hpp")
   set(_Boost_PROGRAM_OPTIONS_HEADERS     "boost/program_options.hpp")
   set(_Boost_PYTHON_HEADERS              "boost/python.hpp")
@@ -1000,6 +1023,7 @@ else()
   # _Boost_COMPONENT_HEADERS.  See the instructions at the top of
   # _Boost_COMPONENT_DEPENDENCIES.
   set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS}
+    "1.65.0" "1.65"
     "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60"
     "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55"
     "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51"

+ 32 - 7
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")