Skip to content

Commit 74585b4

Browse files
committed
many small fixes
1 parent c38c95e commit 74585b4

12 files changed

Lines changed: 38 additions & 25 deletions

File tree

examples/cpp/BUILD.bazel

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
1515
load("@rules_cc//cc:cc_library.bzl", "cc_library")
16+
load("//bazel:compilation_flags.bzl", "SAFE_FP_CODE")
1617
load("//tools/testing:bintest.bzl", "bintest")
1718

1819
# Description:
@@ -178,12 +179,14 @@ cc_binary(
178179
srcs = ["dobble_ls.cc"],
179180
deps = [
180181
"//ortools/base",
181-
"//ortools/base:map_util",
182-
"//ortools/base:types",
183182
"//ortools/constraint_solver:cp",
184183
"//ortools/util:bitset",
184+
"@abseil-cpp//absl/flags:flag",
185+
"@abseil-cpp//absl/log",
186+
"@abseil-cpp//absl/log:check",
185187
"@abseil-cpp//absl/random",
186188
"@abseil-cpp//absl/strings:str_format",
189+
"@abseil-cpp//absl/time",
187190
"@abseil-cpp//absl/types:span",
188191
],
189192
)
@@ -452,9 +455,9 @@ cc_binary(
452455
deps = [
453456
"//ortools/base",
454457
"//ortools/base:map_util",
455-
"//ortools/base:types",
456458
"//ortools/constraint_solver:cp",
457459
"@abseil-cpp//absl/container:flat_hash_map",
460+
"@abseil-cpp//absl/flags:flag",
458461
"@abseil-cpp//absl/log:check",
459462
"@abseil-cpp//absl/strings:str_format",
460463
],
@@ -614,6 +617,7 @@ cc_binary(
614617
"//ortools/base",
615618
"//ortools/linear_solver:linear_solver_cc_proto",
616619
"//ortools/linear_solver:solve_mp_model",
620+
"@abseil-cpp//absl/log",
617621
"@abseil-cpp//absl/log:check",
618622
],
619623
)
@@ -715,7 +719,7 @@ bintest(
715719
cc_binary(
716720
name = "mps_driver",
717721
srcs = ["mps_driver.cc"],
718-
copts = ["-Wfloat-conversion"],
722+
copts = SAFE_FP_CODE,
719723
deps = [
720724
"//ortools/base",
721725
"//ortools/base:file",
@@ -724,7 +728,7 @@ cc_binary(
724728
"//ortools/glop:lp_solver",
725729
"//ortools/glop:parameters_cc_proto",
726730
"//ortools/lp_data",
727-
"//ortools/lp_data:base",
731+
"//ortools/lp_data:lp_types",
728732
"//ortools/lp_data:mps_reader",
729733
"//ortools/lp_data:proto_utils",
730734
"//ortools/util:file_util",
@@ -901,7 +905,9 @@ cc_binary(
901905
"//ortools/sat:cp_model",
902906
"//ortools/sat:sat_parameters_cc_proto",
903907
"//ortools/util:qap_reader",
908+
"@abseil-cpp//absl/container:flat_hash_map",
904909
"@abseil-cpp//absl/flags:flag",
910+
"@abseil-cpp//absl/log",
905911
"@abseil-cpp//absl/log:check",
906912
"@abseil-cpp//absl/strings",
907913
"@protobuf",

examples/cpp/dobble_ls.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
// The purpose of the example is to demonstrates how to write local
3030
// search operators and local search filters.
3131

32-
#include <algorithm>
3332
#include <cstdint>
3433
#include <cstdlib>
3534
#include <random>
3635
#include <utility>
3736
#include <vector>
3837

38+
#include "absl/flags/flag.h"
39+
#include "absl/log/check.h"
40+
#include "absl/log/log.h"
3941
#include "absl/random/random.h"
4042
#include "absl/strings/str_format.h"
43+
#include "absl/time/time.h"
4144
#include "absl/types/span.h"
42-
#include "ortools/base/commandlineflags.h"
4345
#include "ortools/base/init_google.h"
44-
#include "ortools/base/map_util.h"
45-
#include "ortools/base/types.h"
4646
#include "ortools/constraint_solver/constraint_solver.h"
4747
#include "ortools/constraint_solver/local_search.h"
4848
#include "ortools/util/bitset.h"

examples/cpp/linear_solver_protocol_buffers.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
#include <cstdlib>
1415
#include <limits>
1516
#include <string>
1617

1718
#include "absl/log/check.h"
19+
#include "absl/log/log.h"
1820
#include "ortools/base/init_google.h"
1921
#include "ortools/linear_solver/linear_solver.pb.h"
2022
#include "ortools/linear_solver/solve_mp_model.h"

examples/cpp/nqueens.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@
1717
// distinct solutions: http://www.research.att.com/~njas/sequences/A002562
1818

1919
#include <cstdint>
20-
#include <cstdio>
21-
#include <map>
2220
#include <vector>
2321

2422
#include "absl/container/flat_hash_map.h"
23+
#include "absl/flags/flag.h"
2524
#include "absl/log/check.h"
2625
#include "absl/strings/str_format.h"
27-
#include "ortools/base/commandlineflags.h"
2826
#include "ortools/base/init_google.h"
2927
#include "ortools/base/map_util.h"
30-
#include "ortools/base/types.h"
3128
#include "ortools/constraint_solver/constraint_solver.h"
3229
#include "ortools/constraint_solver/search.h"
3330

examples/cpp/qap_sat.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111
// See the License for the specific language governing permissions and
1212
// limitations under the License.
1313

14+
#include <cstdlib>
1415
#include <string>
1516
#include <tuple>
1617
#include <vector>
1718

19+
#include "absl/container/flat_hash_map.h"
1820
#include "absl/flags/flag.h"
1921
#include "absl/log/check.h"
22+
#include "absl/log/log.h"
2023
#include "absl/strings/str_cat.h"
2124
#include "google/protobuf/text_format.h"
22-
#include "ortools/base/commandlineflags.h"
2325
#include "ortools/base/init_google.h"
2426
#include "ortools/sat/cp_model.h"
2527
#include "ortools/sat/sat_parameters.pb.h"

ortools/graph/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ cc_test(
459459
"//ortools/base:gmock_main",
460460
"//ortools/graph_base:graph",
461461
"//ortools/linear_solver:linear_solver_base",
462+
"//ortools/linear_solver:linear_solver_glop",
462463
"@abseil-cpp//absl/log",
463464
"@abseil-cpp//absl/log:check",
464465
"@abseil-cpp//absl/random:distributions",

ortools/graph/java/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
load("@contrib_rules_jvm//java:defs.bzl", "java_junit5_test")
1717
load("//bazel:swig_java.bzl", "java_wrap_cc")
1818

19+
package(default_visibility = ["//visibility:public"])
20+
1921
java_wrap_cc(
2022
name = "graph",
2123
srcs = ["graph.swig"],

ortools/sat/java/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ load("//bazel:swig_java.bzl", "java_wrap_cc")
2020
package(default_visibility = ["//visibility:public"])
2121

2222
cc_binary(
23-
name = "gen_sat_java_swig",
24-
srcs = ["gen_sat_java_swig.cc"],
23+
name = "gen_cp_model_proto_swig",
24+
srcs = ["gen_cp_model_proto_swig.cc"],
2525
deps = [
2626
"//ortools/sat:cp_model_cc_proto",
2727
"//ortools/sat:sat_parameters_cc_proto",
@@ -35,10 +35,10 @@ cc_binary(
3535
)
3636

3737
genrule(
38-
name = "run_gen_sat_java_swig",
38+
name = "run_gen_cp_model_proto_swig",
3939
outs = ["cp_model_proto.swig"],
40-
cmd = "$(location :gen_sat_java_swig) > $@",
41-
tools = [":gen_sat_java_swig"],
40+
cmd = "$(location :gen_cp_model_proto_swig) > $@",
41+
tools = [":gen_cp_model_proto_swig"],
4242
)
4343

4444
java_wrap_cc(

ortools/sat/java/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ set_property(SOURCE sat.swig PROPERTY COMPILE_OPTIONS
1919
-package ${JAVA_PACKAGE}.sat)
2020

2121
# SWIG generator
22-
add_executable(gen_sat_java_swig gen_sat_java_swig.cc)
23-
target_link_libraries(gen_sat_java_swig PRIVATE
22+
add_executable(gen_cp_model_proto_swig gen_cp_model_proto_swig.cc)
23+
target_link_libraries(gen_cp_model_proto_swig PRIVATE
2424
ortools::ortools
2525
${PROJECT_NAMESPACE}::util_java_wrappers
2626
absl::flags_parse
@@ -31,21 +31,21 @@ target_link_libraries(gen_sat_java_swig PRIVATE
3131

3232
include(GNUInstallDirs)
3333
if(APPLE)
34-
set_target_properties(gen_sat_java_swig PROPERTIES INSTALL_RPATH
34+
set_target_properties(gen_cp_model_proto_swig PROPERTIES INSTALL_RPATH
3535
"@loader_path/../${CMAKE_INSTALL_LIBDIR};@loader_path")
3636
elseif(UNIX)
3737
cmake_path(RELATIVE_PATH CMAKE_INSTALL_FULL_LIBDIR
3838
BASE_DIRECTORY ${CMAKE_INSTALL_FULL_BINDIR}
3939
OUTPUT_VARIABLE libdir_relative_path)
40-
set_target_properties(gen_sat_java_swig PROPERTIES
40+
set_target_properties(gen_cp_model_proto_swig PROPERTIES
4141
INSTALL_RPATH "$ORIGIN/${libdir_relative_path}")
4242
endif()
4343

4444
add_custom_command(
4545
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/java_cp_model_proto_timestamp
46-
COMMAND gen_sat_java_swig > "${CMAKE_CURRENT_BINARY_DIR}/cp_model_proto.swig"
46+
COMMAND gen_cp_model_proto_swig > "${CMAKE_CURRENT_BINARY_DIR}/cp_model_proto.swig"
4747
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/java_cp_model_proto_timestamp
48-
DEPENDS gen_sat_java_swig
48+
DEPENDS gen_cp_model_proto_swig
4949
BYPRODUCTS
5050
${CMAKE_CURRENT_BINARY_DIR}/cp_model_proto.swig
5151
COMMENT "Generate java/cp_model_proto.swig (java_cp_model_proto_timestamp)"
File renamed without changes.

0 commit comments

Comments
 (0)