Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53364 - in trunk/libs/graph_parallel: . example
From: ngedmond_at_[hidden]
Date: 2009-05-28 17:54:08


Author: ngedmond
Date: 2009-05-28 17:54:05 EDT (Thu, 28 May 2009)
New Revision: 53364
URL: http://svn.boost.org/trac/boost/changeset/53364

Log:
Made examples build correctly and added them as build tests when testing is enabled

Text files modified:
   trunk/libs/graph_parallel/CMakeLists.txt | 2
   trunk/libs/graph_parallel/example/CMakeLists.txt | 88 ++++++++++++++++++++++++---------------
   2 files changed, 54 insertions(+), 36 deletions(-)

Modified: trunk/libs/graph_parallel/CMakeLists.txt
==============================================================================
--- trunk/libs/graph_parallel/CMakeLists.txt (original)
+++ trunk/libs/graph_parallel/CMakeLists.txt 2009-05-28 17:54:05 EDT (Thu, 28 May 2009)
@@ -14,7 +14,7 @@
 boost_library_project(
   graph_parallel
   SRCDIRS src
- TESTDIRS test
+ TESTDIRS test example
   # HEADERS graph graph/parallel
   # DOCDIRS doc
   DESCRIPTION "Parallel support using MPI for Boost.Graph."

Modified: trunk/libs/graph_parallel/example/CMakeLists.txt
==============================================================================
--- trunk/libs/graph_parallel/example/CMakeLists.txt (original)
+++ trunk/libs/graph_parallel/example/CMakeLists.txt 2009-05-28 17:54:05 EDT (Thu, 28 May 2009)
@@ -4,38 +4,56 @@
 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
-add_executable(breadth_first_search breadth_first_search.cpp)
-target_link_libraries(breadth_first_search
- boost_graph_mpi ${MPI_LIBRARIES})
-
-set_target_properties(
- breadth_first_search
- PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}"
- COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
-
-if (BUILD_TESTING)
- add_test(breadth_first_search
- ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS}
- "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/${PROJECT_NAME}/breadth_first_search"
- ${MPIEXEC_POSTFLAGS}
- "${CMAKE_CURRENT_SOURCE_DIR}/weighted_graph.gr"
- "${CMAKE_BINARY_DIR}/test/weighted_graph-bfs.gr")
-endif (BUILD_TESTING)
-
-add_executable(dijkstra_shortest_paths dijkstra_shortest_paths.cpp)
-target_link_libraries(dijkstra_shortest_paths
- boost_graph_mpi ${MPI_LIBRARIES})
-
-set_target_properties(
- dijkstra_shortest_paths
- PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}"
- COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
-
-if (BUILD_TESTING)
- add_test(dijkstra_shortest_paths
- ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS}
- "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/${PROJECT_NAME}/dijkstra_shortest_paths"
- ${MPIEXEC_POSTFLAGS}
- "${CMAKE_CURRENT_SOURCE_DIR}/weighted_graph.gr"
- "${CMAKE_BINARY_DIR}/test/weighted_graph-dijkstra.gr")
-endif (BUILD_TESTING)
+if (MPI_FOUND)
+
+ boost_additional_test_dependencies(graph_parallel BOOST_DEPENDS test mpi filesystem system)
+
+ include_directories(${MPI_INCLUDE_PATH})
+
+ macro(boost_graph_parallel_example testname)
+ PARSE_ARGUMENTS(MPI_EXAMPLE "NUMPROCS;ARGS" "" ${ARGN})
+
+ # Determine the example sources
+ if (MPI_EXAMPLE_DEFAULT_ARGS)
+ set(MPI_EXAMPLE_SOURCES ${MPI_EXAMPLE_DEFAULT_ARGS})
+ else (MPI_EXAMPLE_DEFAULT_ARGS)
+ set(MPI_EXAMPLE_SOURCES "${testname}.cpp")
+ endif (MPI_EXAMPLE_DEFAULT_ARGS)
+
+ set(THIS_EXAMPLE_LOCATION tests/${PROJECT_NAME}/${testname})
+
+ # Build the example executable
+ boost_add_executable(${testname}
+ ${MPI_EXAMPLE_SOURCES}
+ OUTPUT_NAME ${THIS_EXAMPLE_LOCATION}
+ NO_INSTALL
+ DEPENDS boost_graph_parallel boost_system
+ COMPILE_FLAGS "${MPI_COMPILE_FLAGS}"
+ LINK_FLAGS "${MPI_LINK_FLAGS}"
+ LINK_LIBS ${MPI_LIBRARIES}
+ SHARED_COMPILE_FLAGS "-DBOOST_MPI_DYN_LINK=1")
+
+ if (BUILD_TESTING)
+
+ if (NOT MPI_EXAMPLE_NUMPROCS)
+ set(MPI_EXAMPLE_NUMPROCS ${MPIEXEC_MAX_NUMPROCS})
+ endif (NOT MPI_EXAMPLE_NUMPROCS)
+
+ foreach(PROCS ${MPI_EXAMPLE_NUMPROCS})
+ add_test("${PROJECT_NAME}-${testname}-${PROCS}"
+ ${MPIEXEC}
+ -n ${PROCS}
+ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${THIS_EXAMPLE_LOCATION}
+ ${MPI_EXAMPLE_ARGS}
+ ${BOOST_TEST_ARGS}
+ )
+ endforeach(PROCS)
+
+ endif(BUILD_TESTING)
+
+ endmacro(boost_graph_parallel_example)
+
+ boost_graph_parallel_example(breadth_first_search ARGS ${Boost_SOURCE_DIR}/libs/graph/test/weighted_graph.gr)
+ boost_graph_parallel_example(dijkstra_shortest_paths ARGS ${Boost_SOURCE_DIR}/libs/graph/test/weighted_graph.gr)
+
+endif (MPI_FOUND)


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