Skip to content

Commit 35e20c2

Browse files
Merge pull request #392 from jeremy-murphy/CMake
Split CMake identities: superproject and developer
2 parents dde65fe + 7474f49 commit 35e20c2

2 files changed

Lines changed: 332 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 176 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# Distributed under the Boost Software License, Version 1.0.
33
# https://www.boost.org/LICENSE_1_0.txt
44

5+
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
6+
7+
# When we're part of the Boost super project.
58
cmake_minimum_required(VERSION 3.8...3.16)
69

710
project(boost_graph VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
@@ -11,8 +14,6 @@ add_library(boost_graph
1114
src/read_graphviz_new.cpp
1215
)
1316

14-
add_library(Boost::graph ALIAS boost_graph)
15-
1617
target_include_directories(boost_graph PUBLIC include)
1718

1819
target_link_libraries(boost_graph
@@ -66,6 +67,179 @@ target_compile_definitions(boost_graph
6667
# PRIVATE BOOST_GRAPH_SOURCE
6768
)
6869

70+
else()
71+
# When we're worked on by Boost.Graph developers.
72+
# Using 3.29 for now until I figure out the differences with the new Boost
73+
# config cmake introduced in 3.30.
74+
cmake_minimum_required(VERSION 3.29)
75+
project(boost_graph VERSION 1.0.0 LANGUAGES CXX)
76+
77+
set(CMAKE_CXX_STANDARD 14)
78+
79+
# TODO: The super-project version is set explicitly just like this, but we
80+
# should parse it from boost/version.hpp.
81+
find_package(Boost 1.90.0 REQUIRED COMPONENTS regex)
82+
83+
add_library(boost_graph)
84+
target_sources(boost_graph PUBLIC
85+
FILE_SET HEADERS
86+
BASE_DIRS "include"
87+
FILES
88+
include/boost/graph/adj_list_serialize.hpp
89+
include/boost/graph/adjacency_iterator.hpp
90+
include/boost/graph/adjacency_list.hpp
91+
include/boost/graph/adjacency_list_io.hpp
92+
include/boost/graph/adjacency_matrix.hpp
93+
include/boost/graph/astar_search.hpp
94+
include/boost/graph/bandwidth.hpp
95+
include/boost/graph/bc_clustering.hpp
96+
include/boost/graph/bellman_ford_shortest_paths.hpp
97+
include/boost/graph/betweenness_centrality.hpp
98+
include/boost/graph/biconnected_components.hpp
99+
include/boost/graph/bipartite.hpp
100+
include/boost/graph/boyer_myrvold_planar_test.hpp
101+
include/boost/graph/boykov_kolmogorov_max_flow.hpp
102+
include/boost/graph/breadth_first_search.hpp
103+
include/boost/graph/bron_kerbosch_all_cliques.hpp
104+
include/boost/graph/buffer_concepts.hpp
105+
include/boost/graph/chrobak_payne_drawing.hpp
106+
include/boost/graph/circle_layout.hpp
107+
include/boost/graph/closeness_centrality.hpp
108+
include/boost/graph/clustering_coefficient.hpp
109+
include/boost/graph/compressed_sparse_row_graph.hpp
110+
include/boost/graph/connected_components.hpp
111+
include/boost/graph/copy.hpp
112+
include/boost/graph/core_numbers.hpp
113+
include/boost/graph/create_condensation_graph.hpp
114+
include/boost/graph/cuthill_mckee_ordering.hpp
115+
include/boost/graph/cycle_canceling.hpp
116+
include/boost/graph/dag_shortest_paths.hpp
117+
include/boost/graph/degree_centrality.hpp
118+
include/boost/graph/depth_first_search.hpp
119+
include/boost/graph/dijkstra_shortest_paths.hpp
120+
include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp
121+
include/boost/graph/dimacs.hpp
122+
include/boost/graph/directed_graph.hpp
123+
include/boost/graph/dll_import_export.hpp
124+
include/boost/graph/dominator_tree.hpp
125+
include/boost/graph/eccentricity.hpp
126+
include/boost/graph/edge_coloring.hpp
127+
include/boost/graph/edge_connectivity.hpp
128+
include/boost/graph/edge_list.hpp
129+
include/boost/graph/edmonds_karp_max_flow.hpp
130+
include/boost/graph/edmunds_karp_max_flow.hpp
131+
include/boost/graph/erdos_renyi_generator.hpp
132+
include/boost/graph/exception.hpp
133+
include/boost/graph/exterior_property.hpp
134+
include/boost/graph/filtered_graph.hpp
135+
include/boost/graph/find_flow_cost.hpp
136+
include/boost/graph/floyd_warshall_shortest.hpp
137+
include/boost/graph/fruchterman_reingold.hpp
138+
include/boost/graph/geodesic_distance.hpp
139+
include/boost/graph/graph_archetypes.hpp
140+
include/boost/graph/graph_as_tree.hpp
141+
include/boost/graph/graph_concepts.hpp
142+
include/boost/graph/graph_mutability_traits.hpp
143+
include/boost/graph/graph_selectors.hpp
144+
include/boost/graph/graph_stats.hpp
145+
include/boost/graph/graph_traits.hpp
146+
include/boost/graph/graph_utility.hpp
147+
include/boost/graph/graphml.hpp
148+
include/boost/graph/graphviz.hpp
149+
include/boost/graph/grid_graph.hpp
150+
include/boost/graph/gursoy_atun_layout.hpp
151+
include/boost/graph/hawick_circuits.hpp
152+
include/boost/graph/howard_cycle_ratio.hpp
153+
include/boost/graph/incremental_components.hpp
154+
include/boost/graph/is_kuratowski_subgraph.hpp
155+
include/boost/graph/is_straight_line_drawing.hpp
156+
include/boost/graph/isomorphism.hpp
157+
include/boost/graph/iteration_macros.hpp
158+
include/boost/graph/iteration_macros_undef.hpp
159+
include/boost/graph/johnson_all_pairs_shortest.hpp
160+
include/boost/graph/kamada_kawai_spring_layout.hpp
161+
include/boost/graph/king_ordering.hpp
162+
include/boost/graph/kruskal_min_spanning_tree.hpp
163+
include/boost/graph/labeled_graph.hpp
164+
include/boost/graph/leda_graph.hpp
165+
include/boost/graph/lookup_edge.hpp
166+
include/boost/graph/loop_erased_random_walk.hpp
167+
include/boost/graph/make_biconnected_planar.hpp
168+
include/boost/graph/make_connected.hpp
169+
include/boost/graph/make_maximal_planar.hpp
170+
include/boost/graph/matrix_as_graph.hpp
171+
include/boost/graph/max_cardinality_matching.hpp
172+
include/boost/graph/maximum_adjacency_search.hpp
173+
include/boost/graph/maximum_weighted_matching.hpp
174+
include/boost/graph/mcgregor_common_subgraphs.hpp
175+
include/boost/graph/mesh_graph_generator.hpp
176+
include/boost/graph/metis.hpp
177+
include/boost/graph/metric_tsp_approx.hpp
178+
include/boost/graph/minimum_degree_ordering.hpp
179+
include/boost/graph/named_function_params.hpp
180+
include/boost/graph/named_graph.hpp
181+
include/boost/graph/neighbor_bfs.hpp
182+
include/boost/graph/numeric_values.hpp
183+
include/boost/graph/one_bit_color_map.hpp
184+
include/boost/graph/overloading.hpp
185+
include/boost/graph/page_rank.hpp
186+
include/boost/graph/planar_canonical_ordering.hpp
187+
include/boost/graph/planar_face_traversal.hpp
188+
include/boost/graph/plod_generator.hpp
189+
include/boost/graph/point_traits.hpp
190+
include/boost/graph/prim_minimum_spanning_tree.hpp
191+
include/boost/graph/profile.hpp
192+
include/boost/graph/properties.hpp
193+
include/boost/graph/property_iter_range.hpp
194+
include/boost/graph/push_relabel_max_flow.hpp
195+
include/boost/graph/r_c_shortest_paths.hpp
196+
include/boost/graph/random.hpp
197+
include/boost/graph/random_layout.hpp
198+
include/boost/graph/random_spanning_tree.hpp
199+
include/boost/graph/read_dimacs.hpp
200+
include/boost/graph/relax.hpp
201+
include/boost/graph/reverse_graph.hpp
202+
include/boost/graph/rmat_graph_generator.hpp
203+
include/boost/graph/sequential_vertex_coloring.hpp
204+
include/boost/graph/simple_point.hpp
205+
include/boost/graph/sloan_ordering.hpp
206+
include/boost/graph/small_world_generator.hpp
207+
include/boost/graph/smallest_last_ordering.hpp
208+
include/boost/graph/ssca_graph_generator.hpp
209+
include/boost/graph/st_connected.hpp
210+
include/boost/graph/stanford_graph.hpp
211+
include/boost/graph/stoer_wagner_min_cut.hpp
212+
include/boost/graph/strong_components.hpp
213+
include/boost/graph/subgraph.hpp
214+
include/boost/graph/successive_shortest_path_nonnegative_weights.hpp
215+
include/boost/graph/tiernan_all_cycles.hpp
216+
include/boost/graph/topological_sort.hpp
217+
include/boost/graph/topology.hpp
218+
include/boost/graph/transitive_closure.hpp
219+
include/boost/graph/transitive_reduction.hpp
220+
include/boost/graph/transpose_graph.hpp
221+
include/boost/graph/tree_traits.hpp
222+
include/boost/graph/two_bit_color_map.hpp
223+
include/boost/graph/two_graphs_common_spanning_trees.hpp
224+
include/boost/graph/undirected_dfs.hpp
225+
include/boost/graph/undirected_graph.hpp
226+
include/boost/graph/use_mpi.hpp
227+
include/boost/graph/vector_as_graph.hpp
228+
include/boost/graph/vertex_and_edge_range.hpp
229+
include/boost/graph/vf2_sub_graph_iso.hpp
230+
include/boost/graph/visitors.hpp
231+
include/boost/graph/wavefront.hpp
232+
include/boost/graph/write_dimacs.hpp
233+
PRIVATE
234+
src/graphml.cpp
235+
src/read_graphviz_new.cpp
236+
)
237+
target_link_libraries(boost_graph PUBLIC Boost::headers PRIVATE Boost::regex)
238+
include(CTest)
239+
endif()
240+
241+
add_library(Boost::graph ALIAS boost_graph)
242+
69243
if(BUILD_SHARED_LIBS)
70244
target_compile_definitions(boost_graph PUBLIC BOOST_GRAPH_DYN_LINK)
71245
else()

test/CMakeLists.txt

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
find_package(Boost 1.90.0 REQUIRED COMPONENTS filesystem serialization)
2+
3+
# These use Boost.Core's lightweight_test, one main() function per file.
4+
5+
set(TEST_SOURCES
6+
adj_list_cc.cpp
7+
adj_list_edge_list_set.cpp
8+
# adj_list_invalidation.cpp # ?
9+
adj_list_loops.cpp
10+
adj_matrix_cc.cpp
11+
adjacency_matrix_test.cpp
12+
astar_search_test.cpp
13+
basic_planarity_test.cpp
14+
bellman-test.cpp
15+
betweenness_centrality_test.cpp
16+
bfs.cpp
17+
bfs_cc.cpp
18+
biconnected_components_test.cpp
19+
bidir_remove_edge.cpp
20+
# bidir_vec_remove_edge.cpp # Not tested in Jamfile, fails to compile.
21+
bipartite_test.cpp
22+
boykov_kolmogorov_max_flow_test.cpp
23+
bron_kerbosch_all_cliques.cpp
24+
bundled_properties.cpp
25+
closeness_centrality.cpp
26+
clustering_coefficient.cpp
27+
copy.cpp
28+
core_numbers_test.cpp
29+
csr_graph_test.cpp
30+
cuthill_mckee_ordering.cpp
31+
cycle_canceling_test.cpp
32+
cycle_ratio_tests.cpp
33+
dag_longest_paths.cpp
34+
degree_centrality.cpp
35+
delete_edge.cpp
36+
dfs.cpp
37+
dfs_cc.cpp
38+
dijkstra_cc.cpp
39+
dijkstra_no_color_map_compare.cpp
40+
dimacs.cpp
41+
disjoint_set_test.cpp
42+
dominator_tree_test.cpp
43+
eccentricity.cpp
44+
edge_list_cc.cpp
45+
filter_graph_vp_test.cpp
46+
filtered_graph_cc.cpp
47+
# filtered_graph_properties_dijkstra.cpp # Compile-only, no link test??
48+
find_flow_cost_bundled_properties_and_named_params_test.cpp
49+
finish_edge_bug.cpp
50+
floyd_warshall_test.cpp
51+
generator_test.cpp
52+
graph_concepts.cpp
53+
graphml_test.cpp
54+
graphviz_test.cpp
55+
grid_graph_cc.cpp
56+
grid_graph_test.cpp
57+
gursoy_atun_layout_test.cpp
58+
hawick_circuits.cpp
59+
incremental_components_test.cpp
60+
index_graph.cpp
61+
is_straight_line_draw_test.cpp
62+
isomorphism.cpp
63+
johnson-test.cpp
64+
king_ordering.cpp
65+
labeled_graph.cpp
66+
layout_test.cpp
67+
lvalue_pmap.cpp
68+
make_bicon_planar_test.cpp
69+
make_connected_test.cpp
70+
make_maximal_planar_test.cpp
71+
mas_test.cpp
72+
matching_test.cpp
73+
max_flow_algorithms_bundled_properties_and_named_params.cpp
74+
max_flow_test.cpp
75+
mcgregor_subgraphs_test.cpp
76+
mean_geodesic.cpp
77+
metis_test.cpp
78+
min_degree_empty.cpp
79+
named_vertices_test.cpp
80+
r_c_shortest_paths_test.cpp
81+
random_matching_test.cpp
82+
random_spanning_tree_test.cpp
83+
rcsp_custom_vertex_id.cpp
84+
rcsp_single_solution.cpp
85+
read_propmap.cpp
86+
# reverse_graph_cc.cpp # compile-only
87+
sequential_vertex_coloring.cpp
88+
# serialize.cpp # Fails to link, but why?
89+
stoer_wagner_test.cpp
90+
strong_components_test.cpp
91+
subgraph.cpp
92+
subgraph_add.cpp
93+
subgraph_bundled.cpp
94+
subgraph_props.cpp
95+
successive_shortest_path_nonnegative_weights_test.cpp
96+
swap.cpp
97+
test_graphs.cpp
98+
tiernan_all_cycles.cpp
99+
# transitive_closure_test.cpp # Benchmark and test, need to separate.
100+
transitive_closure_test2.cpp
101+
two_graphs_common_spanning_trees_test.cpp
102+
undirected_dfs.cpp
103+
undirected_dfs_visitor.cpp
104+
# vector_graph_cc.cpp # compile-only
105+
vf2_sub_graph_iso_test.cpp
106+
vf2_sub_graph_iso_test_2.cpp
107+
weighted_matching_test.cpp
108+
)
109+
110+
foreach(SOURCE ${TEST_SOURCES})
111+
cmake_path(GET SOURCE STEM LAST_ONLY TEST)
112+
add_executable(${TEST} ${SOURCE})
113+
target_link_libraries(${TEST} Boost::graph)
114+
add_test(${TEST} ${TEST})
115+
endforeach()
116+
117+
# graph and property_iter are parameterized.
118+
119+
set(PARAMETERIZED_TEST_SOURCES graph.cpp property_iter.cpp)
120+
set(TEST_PARAMETERS 1 2 3 4 5 6 7 8 9)
121+
122+
foreach(SOURCE ${PARAMETERIZED_TEST_SOURCES})
123+
foreach(PARAMETER ${TEST_PARAMETERS})
124+
cmake_path(GET SOURCE STEM LAST_ONLY TEST)
125+
set(TEST_NAME ${TEST}_${PARAMETER})
126+
add_executable(${TEST_NAME} ${SOURCE})
127+
target_compile_definitions(${TEST_NAME} PUBLIC TEST=${PARAMETER})
128+
target_link_libraries(${TEST_NAME} Boost::graph Boost::serialization)
129+
add_test(${TEST_NAME} ${TEST_NAME})
130+
endforeach()
131+
endforeach()
132+
133+
# NOTE: Following note copied verbatim from Jamfile.v2.
134+
# The tests below started failing to compile for xcode with cxxstd=11
135+
# due to issues with constexpr ctors in Boost.Filesystem
136+
137+
# all_planar_input_files_test.cpp
138+
# parallel_edges_loops_test.cpp
139+
140+
# I don't know if these commercial packages have or will ever have a CMake config.
141+
142+
find_package(LEDA QUIET)
143+
if(LEDA_FOUND)
144+
add_executable(leda_graph_cc leda_graph_cc.cpp)
145+
target_compile_definitions(leda_graph_cc)
146+
target_link_libraries(leda_graph_cc Boost::graph LEDA)
147+
add_test(leda_graph_cc leda_graph_cc)
148+
endif()
149+
150+
find_package(StanfordGraphBase QUIET)
151+
if(StanfordGraphBase_FOUND)
152+
add_executable(stanford_graph_cc stanford_graph_cc.cpp)
153+
target_compile_definitions(stanford_graph_cc)
154+
target_link_libraries(stanford_graph_cc Boost::graph StanfordGraphBase)
155+
add_test(stanford_graph_cc stanford_graph_cc)
156+
endif()

0 commit comments

Comments
 (0)