Boost logo

Boost-Commit :

From: dgregor_at_[hidden]
Date: 2008-04-03 22:14:14


Author: dgregor
Date: 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
New Revision: 44027
URL: http://svn.boost.org/trac/boost/changeset/44027

Log:
Describe inter-library dependency information, and use the reverse topological ordering of libraries based on those dependencies to include libraries in a logical order
Added:
   branches/CMake/release/libs/filesystem/filesystem.cmake (contents, props changed)
   branches/CMake/release/libs/mpi/mpi.cmake (contents, props changed)
   branches/CMake/release/libs/python/python.cmake (contents, props changed)
   branches/CMake/release/libs/wave/wave.cmake (contents, props changed)
Text files modified:
   branches/CMake/release/CMakeLists.txt | 16 ++++++-
   branches/CMake/release/libs/CMakeLists.txt | 24 ++++++++----
   branches/CMake/release/libs/filesystem/CMakeLists.txt | 1
   branches/CMake/release/libs/mpi/CMakeLists.txt | 1
   branches/CMake/release/libs/numeric/conversion/test/CMakeLists.txt | 2
   branches/CMake/release/libs/numeric/ublas/test/CMakeLists.txt | 12 +++---
   branches/CMake/release/libs/python/CMakeLists.txt | 1
   branches/CMake/release/libs/serialization/test/CMakeLists.txt | 2
   branches/CMake/release/libs/wave/CMakeLists.txt | 1
   branches/CMake/release/tools/build/CMake/BoostCore.cmake | 80 +++++++++++++++++++++++-----------------
   branches/CMake/release/tools/build/CMake/BoostTesting.cmake | 8 ++++
   branches/CMake/release/tools/build/CMake/BoostUtils.cmake | 3 +
   12 files changed, 94 insertions(+), 57 deletions(-)

Modified: branches/CMake/release/CMakeLists.txt
==============================================================================
--- branches/CMake/release/CMakeLists.txt (original)
+++ branches/CMake/release/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -98,6 +98,11 @@
         DESTINATION ${BOOST_HEADER_DIR}
         PATTERN "CVS" EXCLUDE
         REGEX ".svn" EXCLUDE)
+if (NOT TEST_INSTALLED_TREE)
+ # If I don't have if around this, I get a seg fault
+ # install(EXPORT boost-targets DESTINATION "lib/Boost${BOOST_VERSION}")
+endif (NOT TEST_INSTALLED_TREE)
+
 ##########################################################################
 
 ##########################################################################
@@ -147,9 +152,14 @@
 ##########################################################################
 # Building Boost libraries #
 ##########################################################################
-# Always include the Boost source directory, so that we can find
-# include files in boost/
-include_directories(${Boost_SOURCE_DIR})
+# Always include the directory where Boost's include files will be.
+if (TEST_INSTALLED_TREE)
+ # Use the headers from the installation directory
+ include_directories("${CMAKE_INSTALL_PREFIX}/${BOOST_HEADER_DIR}")
+else (TEST_INSTALLED_TREE)
+ # Use the headers directly from the Boost source tree (in boost/)
+ include_directories(${Boost_SOURCE_DIR})
+endif (TEST_INSTALLED_TREE)
 
 # Put the libaries and binaries that get built into directories at the
 # top of the build tree rather than in hard-to-find leaf

Modified: branches/CMake/release/libs/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/CMakeLists.txt (original)
+++ branches/CMake/release/libs/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -3,10 +3,9 @@
 # have CMakeLists.txt files.
 
 # return a list of directories that we should add_subdirectory()
-macro(BOOST_COLLECT_SUBPROJECT_DIRECTORY_NAMES varname)
+macro(BOOST_COLLECT_SUBPROJECT_DIRECTORY_NAMES varname filename)
   file(GLOB BOOST_LIBRARY_CMAKE_FILES
- RELATIVE "${CMAKE_SOURCE_DIR}/libs" "*/CMakeLists.txt")
- MESSAGE(STATUS "Scanning subdirectories:")
+ RELATIVE "${CMAKE_SOURCE_DIR}/libs" "*/${filename}")
   foreach(BOOST_LIB_CMAKE_FILE ${BOOST_LIBRARY_CMAKE_FILES})
     get_filename_component(BOOST_LIB_DIR ${BOOST_LIB_CMAKE_FILE} PATH)
     set(${varname} ${${varname}} ${BOOST_LIB_DIR})
@@ -20,10 +19,19 @@
   endforeach(subdir ${ARGN})
 endmacro(ADD_SUBDIRECTORIES prefix)
 
-boost_collect_subproject_directory_names(BOOST_SUBPROJECT_DIRS)
-list(SORT BOOST_SUBPROJECT_DIRS)
-add_subdirectories(" + " ${BOOST_SUBPROJECT_DIRS})
+# Find all of the subdirectories with .cmake files in them. These are
+# the libraries with dependencies.
+boost_collect_subproject_directory_names(BOOST_MODULE_DIRS "*.cmake")
+foreach(subdir ${BOOST_MODULE_DIRS})
+ include("${CMAKE_SOURCE_DIR}/libs/${subdir}/${subdir}.cmake")
+endforeach(subdir)
+
+# Find all of the subdirectories with CMakeLists.txt files in
+# them. This contains all of the Boost libraries.
+boost_collect_subproject_directory_names(BOOST_SUBPROJECT_DIRS "CMakeLists.txt")
 
-# Compute the topological ordering of Boost projects
+# Add all of the Boost projects in reverse topological order, so that
+# a library's dependencies show up before the library itself.
+list(SORT BOOST_SUBPROJECT_DIRS)
 topological_sort(BOOST_SUBPROJECT_DIRS BOOST_ _DEPENDS)
-message(STATUS "${BOOST_SUBPROJECT_DIRS}")
+add_subdirectories(" + " ${BOOST_SUBPROJECT_DIRS})

Modified: branches/CMake/release/libs/filesystem/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/filesystem/CMakeLists.txt (original)
+++ branches/CMake/release/libs/filesystem/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -2,7 +2,6 @@
   Filesystem
   SRCDIRS src
   TESTDIRS test
- DEPENDS system
   MODULAR
   )
 

Added: branches/CMake/release/libs/filesystem/filesystem.cmake
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/filesystem/filesystem.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -0,0 +1 @@
+boost_module(Filesystem DEPENDS system)
\ No newline at end of file

Modified: branches/CMake/release/libs/mpi/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/mpi/CMakeLists.txt (original)
+++ branches/CMake/release/libs/mpi/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -5,7 +5,6 @@
     MPI
     SRCDIRS src
     TESTDIRS test
- DEPENDS serialization
     )
 endif(MPI_FOUND)
 

Added: branches/CMake/release/libs/mpi/mpi.cmake
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/mpi/mpi.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -0,0 +1 @@
+boost_module(MPI DEPENDS serialization)

Modified: branches/CMake/release/libs/numeric/conversion/test/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/numeric/conversion/test/CMakeLists.txt (original)
+++ branches/CMake/release/libs/numeric/conversion/test/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -2,5 +2,5 @@
 boost_test_run(traits_test)
 boost_test_run(converter_test)
 boost_test_run(udt_support_test)
-boost_test_run(numeric_cast_test)
+boost_test_run(numeric_conv_cast_test numeric_cast_test.cpp)
 boost_test_run(udt_example_0)

Modified: branches/CMake/release/libs/numeric/ublas/test/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/numeric/ublas/test/CMakeLists.txt (original)
+++ branches/CMake/release/libs/numeric/ublas/test/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -20,27 +20,27 @@
 add_definitions(-DBOOST_UBLAS_NO_EXCEPTIONS)
 # TODO: <toolset>vacpp:<define>"BOOST_UBLAS_NO_ELEMENT_PROXIES"
 
-boost_test_run(test1
+boost_test_run(ublas_test1
   test1.cpp test11.cpp test12.cpp test13.cpp
   COMPILE_FLAGS "${UBLAS_TESTSET_DEFINES}")
 
-boost_test_run(test2
+boost_test_run(ublas_test2
   test2.cpp test21.cpp test22.cpp test23.cpp
   COMPILE_FLAGS "${UBLAS_TESTSET_DEFINES}")
 
-boost_test_run(test3
+boost_test_run(ublas_test3
   test3.cpp test31.cpp test32.cpp test33.cpp
   COMPILE_FLAGS "${UBLAS_TESTSET_SPARSE_DEFINES}")
 
-boost_test_run(test4
+boost_test_run(ublas_test4
   test4.cpp test42.cpp test43.cpp
   COMPILE_FLAGS "${UBLAS_TESTSET_DEFINES}")
 
-boost_test_run(test5
+boost_test_run(ublas_test5
   test5.cpp test52.cpp test53.cpp
   COMPILE_FLAGS "${UBLAS_TESTSET_DEFINES}")
 
-boost_test_run(test6
+boost_test_run(ublas_test6
   test6.cpp test62.cpp test63.cpp
   COMPILE_FLAGS "${UBLAS_TESTSET_DEFINES}")
 

Modified: branches/CMake/release/libs/python/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/python/CMakeLists.txt (original)
+++ branches/CMake/release/libs/python/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -62,6 +62,5 @@
     Python
     SRCDIRS src
     TESTDIRS test
- DEPENDS graph
     )
 endif (PYTHON_LIBRARIES)

Added: branches/CMake/release/libs/python/python.cmake
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/python/python.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -0,0 +1 @@
+boost_module(Python DEPENDS graph)

Modified: branches/CMake/release/libs/serialization/test/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/serialization/test/CMakeLists.txt (original)
+++ branches/CMake/release/libs/serialization/test/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -128,7 +128,7 @@
 serialization_test_allarchives(test_shared_ptr_132)
 serialization_test_allarchives(test_polymorphic POLYMORPHIC
   test_polymorphic.cpp test_polymorphic_A.cpp)
-serialization_test(test_iterators NO_LIBS)
+serialization_test(test_serialization_iterators test_iterators.cpp NO_LIBS)
 serialization_test(test_iterators_base64 NO_LIBS)
 serialization_test(test_inclusion NO_LIBS)
 serialization_test(test_private_ctor)

Modified: branches/CMake/release/libs/wave/CMakeLists.txt
==============================================================================
--- branches/CMake/release/libs/wave/CMakeLists.txt (original)
+++ branches/CMake/release/libs/wave/CMakeLists.txt 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -2,5 +2,4 @@
   Wave
   SRCDIRS src
   TESTDIRS test
- DEPENDS filesystem thread date_time
   )
\ No newline at end of file

Added: branches/CMake/release/libs/wave/wave.cmake
==============================================================================
--- (empty file)
+++ branches/CMake/release/libs/wave/wave.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -0,0 +1 @@
+boost_module(Wave DEPENDS filesystem thread date_time)
\ No newline at end of file

Modified: branches/CMake/release/tools/build/CMake/BoostCore.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostCore.cmake (original)
+++ branches/CMake/release/tools/build/CMake/BoostCore.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -60,14 +60,15 @@
 # )
 macro(boost_library_project LIBNAME)
   parse_arguments(THIS_PROJECT
- "SRCDIRS;TESTDIRS;DEPENDS"
+ "SRCDIRS;TESTDIRS"
     "MODULAR"
     ${ARGN}
     )
 
   set(THIS_PROJECT_OKAY ON)
+ string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_PROJECT_DEPENDS)
   set(THIS_PROJECT_FAILED_DEPS "")
- foreach(DEP ${THIS_PROJECT_DEPENDS})
+ foreach(DEP ${${THIS_PROJECT_DEPENDS}})
     string(TOUPPER "BUILD_BOOST_${DEP}" BOOST_LIB_DEP)
     if (NOT ${BOOST_LIB_DEP})
       set(THIS_PROJECT_OKAY OFF)
@@ -75,10 +76,6 @@
     endif (NOT ${BOOST_LIB_DEP})
   endforeach(DEP)
 
- # Export BOOST_${LIBNAME}_DEPENDS
- string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_PROJECT_LIBNAME_DEPENDS)
- set(${THIS_PROJECT_LIBNAME_DEPENDS} ${THIS_PROJECT_DEPENDS} PARENT_SCOPE)
-
   string(TOUPPER "BUILD_BOOST_${LIBNAME}" BOOST_BUILD_LIB_OPTION)
   if (THIS_PROJECT_SRCDIRS)
     # This Boost library has source directories, so provide an option
@@ -105,7 +102,7 @@
     set(${BOOST_BUILD_LIB_OPTION} ${THIS_PROJECT_OKAY})
   endif (THIS_PROJECT_SRCDIRS)
 
- if(${BOOST_BUILD_LIB_OPTION})
+ if(${BOOST_BUILD_LIB_OPTION} AND THIS_PROJECT_OKAY)
     string(TOLOWER "${LIBNAME}" libname)
     project(${libname})
 
@@ -164,9 +161,21 @@
         endforeach(SUBDIR ${THIS_PROJECT_TESTDIRS})
       endif(${BOOST_TEST_LIB_OPTION})
     endif(BUILD_TESTING AND THIS_PROJECT_TESTDIRS)
- endif(${BOOST_BUILD_LIB_OPTION})
+ endif(${BOOST_BUILD_LIB_OPTION} AND THIS_PROJECT_OKAY)
 endmacro(boost_library_project)
 
+macro(boost_module LIBNAME)
+ parse_arguments(THIS_MODULE
+ "DEPENDS"
+ ""
+ ${ARGN}
+ )
+
+ # Export BOOST_${LIBNAME}_DEPENDS
+ string(TOUPPER "BOOST_${LIBNAME}_DEPENDS" THIS_MODULE_LIBNAME_DEPENDS)
+ set(${THIS_MODULE_LIBNAME_DEPENDS} "${THIS_MODULE_DEPENDS}")
+endmacro(boost_module)
+
 # This macro is an internal utility macro that builds the name of a
 # particular variant of a library
 #
@@ -443,6 +452,7 @@
 
     # Installation of this library variant
     install(TARGETS ${VARIANT_LIBNAME} DESTINATION lib)
+# EXPORT boost-targets)
   endif (THIS_VARIANT_OKAY)
 endmacro(boost_library_variant)
 
@@ -719,32 +729,34 @@
     )
   set(THIS_LIB_SOURCES ${THIS_LIB_DEFAULT_ARGS})
 
- # A top-level target that refers to all of the variants of the
- # library, collectively.
- add_custom_target(${LIBNAME})
-
- if (THIS_LIB_EXTRA_VARIANTS)
- # Build the set of variants that we will generate for this library
- set(THIS_LIB_VARIANTS)
- foreach(VARIANT ${BOOST_DEFAULT_VARIANTS})
- foreach(EXTRA_VARIANT ${THIS_LIB_EXTRA_VARIANTS})
- string(REPLACE ":" ";" FEATURES "${EXTRA_VARIANT}")
- separate_arguments(FEATURES)
- foreach(FEATURE ${FEATURES})
- list(APPEND THIS_LIB_VARIANTS "${VARIANT}:${FEATURE}")
- endforeach(FEATURE ${FEATURES})
- endforeach(EXTRA_VARIANT ${THIS_LIB_EXTRA_VARIANTS})
- endforeach(VARIANT ${BOOST_DEFAULT_VARIANTS})
- else (THIS_LIB_EXTRA_VARIANTS)
- set(THIS_LIB_VARIANTS ${BOOST_DEFAULT_VARIANTS})
- endif (THIS_LIB_EXTRA_VARIANTS)
-
- # Build each of the library variants
- foreach(VARIANT_STR ${THIS_LIB_VARIANTS})
- string(REPLACE ":" ";" VARIANT ${VARIANT_STR})
- separate_arguments(VARIANT)
- boost_library_variant(${LIBNAME} ${VARIANT})
- endforeach(VARIANT_STR ${THIS_LIB_VARIANTS})
+ if (NOT TEST_INSTALLED_TREE)
+ # A top-level target that refers to all of the variants of the
+ # library, collectively.
+ add_custom_target(${LIBNAME})
+
+ if (THIS_LIB_EXTRA_VARIANTS)
+ # Build the set of variants that we will generate for this library
+ set(THIS_LIB_VARIANTS)
+ foreach(VARIANT ${BOOST_DEFAULT_VARIANTS})
+ foreach(EXTRA_VARIANT ${THIS_LIB_EXTRA_VARIANTS})
+ string(REPLACE ":" ";" FEATURES "${EXTRA_VARIANT}")
+ separate_arguments(FEATURES)
+ foreach(FEATURE ${FEATURES})
+ list(APPEND THIS_LIB_VARIANTS "${VARIANT}:${FEATURE}")
+ endforeach(FEATURE ${FEATURES})
+ endforeach(EXTRA_VARIANT ${THIS_LIB_EXTRA_VARIANTS})
+ endforeach(VARIANT ${BOOST_DEFAULT_VARIANTS})
+ else (THIS_LIB_EXTRA_VARIANTS)
+ set(THIS_LIB_VARIANTS ${BOOST_DEFAULT_VARIANTS})
+ endif (THIS_LIB_EXTRA_VARIANTS)
+
+ # Build each of the library variants
+ foreach(VARIANT_STR ${THIS_LIB_VARIANTS})
+ string(REPLACE ":" ";" VARIANT ${VARIANT_STR})
+ separate_arguments(VARIANT)
+ boost_library_variant(${LIBNAME} ${VARIANT})
+ endforeach(VARIANT_STR ${THIS_LIB_VARIANTS})
+ endif (NOT TEST_INSTALLED_TREE)
 endmacro(boost_add_library)
 
 # Creates a new executable from source files.

Modified: branches/CMake/release/tools/build/CMake/BoostTesting.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostTesting.cmake (original)
+++ branches/CMake/release/tools/build/CMake/BoostTesting.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -37,6 +37,14 @@
 option(BUILD_TESTING "Enable testing" OFF)
 include(CTest)
 
+if (BUILD_TESTING)
+ option(TEST_INSTALLED_TREE "Enable testing of an already-installed tree" OFF)
+
+ if (TEST_INSTALLED_TREE)
+ include("${CMAKE_INSTALL_PREFIX}/lib/Boost${BOOST_VERSION}/boost-targets.cmake")
+ endif (TEST_INSTALLED_TREE)
+endif (BUILD_TESTING)
+
 # This macro is an internal utility macro that helps parse the
 # arguments passed to the Boost testing commands. It will generally
 # not be used by Boost developers.

Modified: branches/CMake/release/tools/build/CMake/BoostUtils.cmake
==============================================================================
--- branches/CMake/release/tools/build/CMake/BoostUtils.cmake (original)
+++ branches/CMake/release/tools/build/CMake/BoostUtils.cmake 2008-04-03 22:14:12 EDT (Thu, 03 Apr 2008)
@@ -151,6 +151,9 @@
         "${VERTEX};${${PREFIX}${UPPER_VERTEX}${SUFFIX}}")
       list(APPEND STACK ${NEW_ELEMENT})
 
+ # We've now seen this vertex
+ set(FOUND_${UPPER_VERTEX} TRUE)
+
       # While the depth-first search stack is not empty
       list(LENGTH STACK STACK_LENGTH)
       while(STACK_LENGTH GREATER 0)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk