# Copyright 2021 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. load("@rules_cc//cc:cc_binary.bzl", "cc_binary") load("@rules_cc//cc:cc_library.bzl", "cc_library") load("@rules_cc//cc:cc_test.bzl", "cc_test") # Description: # LEMON is an open source C++ library of graph and optimization algorithms. package( features = [ "-layering_check", "-parse_headers", ], ) filegroup( name = "headers", srcs = glob(["lemon/**/*.h"]), ) cc_library( name = "lemon", srcs = [ "lemon/arg_parser.cc", "lemon/base.cc", "lemon/color.cc", "lemon/glpk.cc", "lemon/lp_base.cc", "lemon/lp_skeleton.cc", "lemon/random.cc", ], hdrs = [ "lemon/config.h", ":headers", ], copts = [ "-fexceptions", ], features = ["-use_header_modules"], # Incompatible with -fexception. visibility = [ "//visibility:public", ], deps = ["@glpk"], ) cc_library( name = "test_tools", hdrs = [ "test/graph_test.h", "test/test_tools.h", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. visibility = ["//visibility:private"], ) cc_binary( name = "arg_parser_demo", srcs = ["demo/arg_parser_demo.cc"], deps = [ ":lemon", ], ) cc_binary( name = "dimacs-solver", srcs = ["tools/dimacs-solver.cc"], copts = [ "-fexceptions", "-Wno-implicit-fallthrough", ], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ], ) cc_binary( name = "dimacs-to-lgf", srcs = ["tools/dimacs-to-lgf.cc"], copts = [ "-fexceptions", "-Wno-implicit-fallthrough", ], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [":lemon"], ) cc_binary( name = "lgf-gen", srcs = ["tools/lgf-gen.cc"], deps = [":lemon"], ) cc_binary( name = "graph_to_eps_demo", srcs = ["demo/graph_to_eps_demo.cc"], deps = [":lemon"], ) cc_binary( name = "lgf_demo", srcs = ["demo/lgf_demo.cc"], copts = ["-fexceptions"], data = ["demo/digraph.lgf"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [":lemon"], ) cc_test( name = "adaptors_test", srcs = ["test/adaptors_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "arc_look_up_test", srcs = ["test/arc_look_up_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "bellman_ford_test", srcs = ["test/bellman_ford_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "bfs_test", srcs = ["test/bfs_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "bpgraph_test", srcs = ["test/bpgraph_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "circulation_test", srcs = ["test/circulation_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "connectivity_test", srcs = ["test/connectivity_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "counter_test", srcs = ["test/counter_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "dfs_test", srcs = ["test/dfs_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "dim_test", srcs = ["test/dim_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "edge_set_test", srcs = ["test/edge_set_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "error_test", srcs = ["test/error_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "euler_test", srcs = ["test/euler_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "dijkstra_test", srcs = ["test/dijkstra_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "digraph_test", srcs = ["test/digraph_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "fractional_matching_test", srcs = ["test/fractional_matching_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "gomory_hu_test", srcs = [ "lemon/gomory_hu.h", "test/gomory_hu_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "graph_test", srcs = [ "lemon/hypercube_graph.h", "test/graph_test.cc", "test/graph_test.h", ], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "graph_copy_test", srcs = ["test/graph_copy_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "graph_utils_test", srcs = ["test/graph_utils_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "hao_orlin_test", srcs = [ "lemon/hao_orlin.h", "test/hao_orlin_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "heap_test", srcs = [ "lemon/binomial_heap.h", "lemon/dheap.h", "lemon/fib_heap.h", "lemon/pairing_heap.h", "lemon/quad_heap.h", "lemon/radix_heap.h", "test/heap_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "kruskal_test", srcs = ["test/kruskal_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "lgf_reader_writer_test", srcs = ["test/lgf_reader_writer_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "lgf_test", srcs = ["test/lgf_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "lp_test", srcs = ["test/lp_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "maps_test", srcs = ["test/maps_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "matching_test", srcs = ["test/matching_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "max_cardinality_search_test", srcs = [ "lemon/max_cardinality_search.h", "test/max_cardinality_search_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "max_clique_test", srcs = [ "lemon/grosso_locatelli_pullan_mc.h", "test/max_clique_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "max_flow_test", srcs = [ "lemon/edmonds_karp.h", "test/max_flow_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "min_cost_arborescence_test", srcs = [ "lemon/min_cost_arborescence.h", "test/min_cost_arborescence_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "min_cost_flow_test", srcs = [ "lemon/capacity_scaling.h", "lemon/cost_scaling.h", "lemon/cycle_canceling.h", "test/min_cost_flow_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "min_mean_cycle_test", srcs = [ "lemon/karp_mmc.h", "test/min_mean_cycle_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "mip_test", srcs = ["test/mip_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "nagamochi_ibaraki_test", srcs = [ "lemon/nagamochi_ibaraki.h", "test/nagamochi_ibaraki_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "path_test", srcs = ["test/path_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "planarity_test", srcs = [ "lemon/planarity.h", "test/planarity_test.cc", ], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "radix_sort_test", srcs = ["test/radix_sort_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "random_test", srcs = ["test/random_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "suurballe_test", srcs = ["test/suurballe_test.cc"], copts = ["-fexceptions"], features = ["-use_header_modules"], # Incompatible with -fexception. deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "test_tools_pass", srcs = [ "test/test_tools.h", "test/test_tools_pass.cc", ], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "time_measure_test", srcs = ["test/time_measure_test.cc"], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "tsp_test", srcs = [ "lemon/christofides_tsp.h", "lemon/greedy_tsp.h", "lemon/insertion_tsp.h", "lemon/nearest_neighbor_tsp.h", "lemon/opt2_tsp.h", "test/tsp_test.cc", ], deps = [ ":lemon", ":test_tools", ], ) cc_test( name = "unionfind_test", srcs = ["test/unionfind_test.cc"], deps = [ ":lemon", ":test_tools", ], )