blob: 0bf829505c787fc087a64d423f26823d7aa5d546 [file] [log] [blame]
Austin Schuh99f7c6a2024-06-25 22:07:44 -07001diff --git a/BUILD b/BUILD
2index 652c4b17..9c7a799c 100644
3--- a/BUILD
4+++ b/BUILD
Austin Schuh68156cb2024-06-25 21:24:29 -07005@@ -32,6 +32,7 @@
6 # not support parameterization around threading choice or sparse backends.
7
8 load("//:bazel/ceres.bzl", "ceres_library")
9+load("@org_frc971//tools/build_rules:select.bzl", "compiler_select")
10
11 ceres_library(
12 name = "ceres",
Austin Schuh99f7c6a2024-06-25 22:07:44 -070013@@ -48,6 +49,7 @@ cc_library(
14 ]],
Austin Schuh68156cb2024-06-25 21:24:29 -070015 copts = [
16 "-Wno-sign-compare",
17+ "-Wno-unused-but-set-variable",
18 "-DCERES_TEST_SRCDIR_SUFFIX=\\\"data/\\\"",
19 ],
20 includes = [
Austin Schuh99f7c6a2024-06-25 22:07:44 -070021@@ -158,12 +160,16 @@ TEST_COPTS = [
Austin Schuh68156cb2024-06-25 21:24:29 -070022 # but in the future disable these warnings only for rotation_test.
23 # TODO(keir): When the tests are macro-ified, apply these selectively.
24 "-Wno-address",
25-]
26+ "-Wno-unused-parameter",
27+] + compiler_select({
28+ "gcc": ["-Wno-use-after-free"],
29+ "clang": [],
30+})
31
32 TEST_DEPS = [
33 "//:ceres",
34 "//:test_util",
35- "@com_gitlab_libeigen_eigen//:eigen",
36+ "@org_tuxfamily_eigen//:eigen",
Austin Schuh99f7c6a2024-06-25 22:07:44 -070037 "@com_google_absl//absl/flags:flag",
Austin Schuh68156cb2024-06-25 21:24:29 -070038 ]
39
Austin Schuh99f7c6a2024-06-25 22:07:44 -070040diff --git a/bazel/ceres.bzl b/bazel/ceres.bzl
41index ed4d66d9..be8948d7 100644
42--- a/bazel/ceres.bzl
43+++ b/bazel/ceres.bzl
44@@ -190,6 +190,9 @@ def ceres_library(
45 "-I" + internal,
46 "-Wunused-parameter",
47 "-Wno-sign-compare",
48+ "-Wno-format-nonliteral",
49+ "-Wno-unused-parameter",
50+ "-Wno-unused-but-set-variable",
51 ] + schur_eliminator_copts,
52
53 # These include directories and defines are propagated to other targets
54@@ -215,7 +218,7 @@ def ceres_library(
55 ],
56 visibility = ["//visibility:public"],
57 deps = [
58- "@com_gitlab_libeigen_eigen//:eigen",
59+ "@org_tuxfamily_eigen//:eigen",
60 "@com_google_absl//absl/flags:flag",
61 "@com_google_absl//absl/log",
62 "@com_google_absl//absl/log:check",
63diff --git a/examples/BUILD b/examples/BUILD
64index e45fe318..6296417a 100644
65--- a/examples/BUILD
66+++ b/examples/BUILD
Austin Schuh68156cb2024-06-25 21:24:29 -070067@@ -31,13 +31,14 @@
68 EXAMPLE_COPTS = [
69 # Needed to silence GFlags complaints.
70 "-Wno-sign-compare",
71+ "-Wno-unused-parameter",
72 # Needed to put fscanf in a function.
73 "-Wno-format-nonliteral",
74 ]
75
76 EXAMPLE_DEPS = [
77 "//:ceres",
78- "@com_gitlab_libeigen_eigen//:eigen",
79+ "@org_tuxfamily_eigen//:eigen",
Austin Schuh99f7c6a2024-06-25 22:07:44 -070080 "@com_google_absl//absl/flags:flag",
81 "@com_google_absl//absl/log:log",
82 "@com_google_absl//absl/log:check",
83diff --git a/internal/ceres/autodiff_test.cc b/internal/ceres/autodiff_test.cc
84index b50327cb..19adcae0 100644
85--- a/internal/ceres/autodiff_test.cc
86+++ b/internal/ceres/autodiff_test.cc
87@@ -647,6 +647,10 @@ TEST(AutoDiff, VariadicAutoDiff) {
Austin Schuh68156cb2024-06-25 21:24:29 -070088 }
89 }
90
91+#ifdef __clang__
92+#pragma clang diagnostic push
93+#pragma clang diagnostic ignored "-Wunused-but-set-variable"
94+#endif
95 // This is fragile test that triggers the alignment bug on
96 // i686-apple-darwin10-llvm-g++-4.2 (GCC) 4.2.1. It is quite possible,
97 // that other combinations of operating system + compiler will
Austin Schuh99f7c6a2024-06-25 22:07:44 -070098@@ -671,5 +675,8 @@ TEST(AutoDiff, AlignedAllocationTest) {
Austin Schuh68156cb2024-06-25 21:24:29 -070099 // Need this to makes sure that x does not get optimized out.
100 x[0] = x[0] + JetT(1.0);
101 }
102+#ifdef __clang__
103+#pragma clang diagnostic pop
104+#endif
105
106 } // namespace ceres::internal
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700107diff --git a/internal/ceres/bundle_adjustment_test_util.h b/internal/ceres/bundle_adjustment_test_util.h
108index fb2ac719..993863a2 100644
109--- a/internal/ceres/bundle_adjustment_test_util.h
110+++ b/internal/ceres/bundle_adjustment_test_util.h
111@@ -98,7 +98,8 @@ class BundleAdjustmentProblem {
Austin Schuh68156cb2024-06-25 21:24:29 -0700112
113 private:
114 void ReadData(const std::string& filename) {
115- FILE* fptr = fopen(filename.c_str(), "r");
116+ FILE* fptr = fopen(
117+ (std::string("../com_google_ceres_solver/") + filename).c_str(), "r");
118
119 if (!fptr) {
120 LOG(FATAL) << "File Error: unable to open file " << filename;
Austin Schuh99f7c6a2024-06-25 22:07:44 -0700121diff --git a/internal/ceres/triplet_sparse_matrix_test.cc b/internal/ceres/triplet_sparse_matrix_test.cc
122index e145c1a2..bde9a6ed 100644
123--- a/internal/ceres/triplet_sparse_matrix_test.cc
124+++ b/internal/ceres/triplet_sparse_matrix_test.cc
125@@ -184,8 +184,15 @@ TEST(TripletSparseMatrix, AssignmentOperatorSelfAssignment) {
Austin Schuh68156cb2024-06-25 21:24:29 -0700126 orig.mutable_values()[1] = 5.2;
127 orig.set_num_nonzeros(2);
128
129+#ifdef __clang__
130+#pragma clang diagnostic push
131+#pragma clang diagnostic ignored "-Wself-assign-overloaded"
132+#endif
133 // Who's on earth gonna do this?
134 orig = orig;
135+#ifdef __clang__
136+#pragma clang diagnostic pop
137+#endif
138
139 EXPECT_EQ(orig.num_rows(), 2);
140 EXPECT_EQ(orig.num_cols(), 5);