Skip to content

Commit

Permalink
Fix compile and link issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Murphy committed Oct 31, 2024
1 parent d3f7d13 commit ed3ad56
Showing 1 changed file with 50 additions and 15 deletions.
65 changes: 50 additions & 15 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
find_package(Boost REQUIRED COMPONENTS filesystem serialization)

# These use Boost.Core's lightweight_test, one main() function per file.

set(TEST_SOURCES
adj_list_cc.cpp
adj_list_edge_list_set.cpp
adj_list_invalidation.cpp
# adj_list_invalidation.cpp # ?
adj_list_loops.cpp
adj_matrix_cc.cpp
adjacency_matrix_test.cpp
all_planar_input_files_test.cpp
astar_search_test.cpp
basic_planarity_test.cpp
bellman-test.cpp
Expand All @@ -16,7 +17,7 @@ set(TEST_SOURCES
bfs_cc.cpp
biconnected_components_test.cpp
bidir_remove_edge.cpp
bidir_vec_remove_edge.cpp
# bidir_vec_remove_edge.cpp # Not tested in Jamfile, fails to compile.
bipartite_test.cpp
boykov_kolmogorov_max_flow_test.cpp
bron_kerbosch_all_cliques.cpp
Expand All @@ -35,7 +36,6 @@ set(TEST_SOURCES
dfs.cpp
dfs_cc.cpp
dijkstra_cc.cpp
dijkstra_heap_performance.cpp
dijkstra_no_color_map_compare.cpp
dimacs.cpp
disjoint_set_test.cpp
Expand All @@ -44,12 +44,11 @@ set(TEST_SOURCES
edge_list_cc.cpp
filter_graph_vp_test.cpp
filtered_graph_cc.cpp
filtered_graph_properties_dijkstra.cpp
# filtered_graph_properties_dijkstra.cpp # Compile-only, no link test??
find_flow_cost_bundled_properties_and_named_params_test.cpp
finish_edge_bug.cpp
floyd_warshall_test.cpp
generator_test.cpp
graph.cpp
graph_concepts.cpp
graphml_test.cpp
graphviz_test.cpp
Expand All @@ -65,7 +64,6 @@ set(TEST_SOURCES
king_ordering.cpp
labeled_graph.cpp
layout_test.cpp
leda_graph_cc.cpp
lvalue_pmap.cpp
make_bicon_planar_test.cpp
make_connected_test.cpp
Expand All @@ -77,21 +75,17 @@ set(TEST_SOURCES
mcgregor_subgraphs_test.cpp
mean_geodesic.cpp
metis_test.cpp
metric_tsp_approx.cpp
min_degree_empty.cpp
named_vertices_test.cpp
parallel_edges_loops_test.cpp
property_iter.cpp
r_c_shortest_paths_test.cpp
random_matching_test.cpp
random_spanning_tree_test.cpp
rcsp_custom_vertex_id.cpp
rcsp_single_solution.cpp
read_propmap.cpp
reverse_graph_cc.cpp
# reverse_graph_cc.cpp # compile-only
sequential_vertex_coloring.cpp
serialize.cpp
stanford_graph_cc.cpp
# serialize.cpp # Fails to link, but why?
stoer_wagner_test.cpp
strong_components_test.cpp
subgraph.cpp
Expand All @@ -102,12 +96,12 @@ set(TEST_SOURCES
swap.cpp
test_graphs.cpp
tiernan_all_cycles.cpp
transitive_closure_test.cpp
# transitive_closure_test.cpp # Benchmark and test, need to separate.
transitive_closure_test2.cpp
two_graphs_common_spanning_trees_test.cpp
undirected_dfs.cpp
undirected_dfs_visitor.cpp
vector_graph_cc.cpp
# vector_graph_cc.cpp # compile-only
vf2_sub_graph_iso_test.cpp
vf2_sub_graph_iso_test_2.cpp
weighted_matching_test.cpp
Expand All @@ -119,3 +113,44 @@ foreach(SOURCE ${TEST_SOURCES})
target_link_libraries(${TEST} Boost::graph)
add_test(${TEST} ${TEST})
endforeach()

# graph and property_iter are parameterized.

set(PARAMETERIZED_TEST_SOURCES graph.cpp property_iter.cpp)
set(TEST_PARAMETERS 1 2 3 4 5 6 7 8 9)

foreach(SOURCE ${PARAMETERIZED_TEST_SOURCES})
foreach(PARAMETER ${TEST_PARAMETERS})
cmake_path(GET SOURCE STEM LAST_ONLY TEST)
set(TEST_NAME ${TEST}_${PARAMETER})
add_executable(${TEST_NAME} ${SOURCE})
target_compile_definitions(${TEST_NAME} PUBLIC TEST=${PARAMETER})
target_link_libraries(${TEST_NAME} Boost::graph Boost::serialization)
add_test(${TEST_NAME} ${TEST_NAME})
endforeach()
endforeach()

# NOTE: Following note copied verbatim from Jamfile.v2.
# The tests below started failing to compile for xcode with cxxstd=11
# due to issues with constexpr ctors in Boost.Filesystem

# all_planar_input_files_test.cpp
# parallel_edges_loops_test.cpp

# I don't know if these commercial packages have or will ever have a CMake config.

find_package(LEDA QUIET)
if(LEDA_FOUND)
add_executable(leda_graph_cc leda_graph_cc.cpp)
target_compile_definitions(leda_graph_cc)
target_link_libraries(leda_graph_cc Boost::graph LEDA)
add_test(leda_graph_cc leda_graph_cc)
endif()

find_package(StanfordGraphBase QUIET)
if(StanfordGraphBase_FOUND)
add_executable(stanford_graph_cc stanford_graph_cc.cpp)
target_compile_definitions(stanford_graph_cc)
target_link_libraries(stanford_graph_cc Boost::graph StanfordGraphBase)
add_test(stanford_graph_cc stanford_graph_cc)
endif()

0 comments on commit ed3ad56

Please sign in to comment.