Skip to content

Commit 2e0d098

Browse files
committed
rework ABSL_DECLARE_FLAG and OR_DLL support
1 parent 34979ae commit 2e0d098

File tree

9 files changed

+32
-5
lines changed

9 files changed

+32
-5
lines changed

ortools/constraint_solver/constraint_solver.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@
104104
#include "ortools/util/sorted_interval_list.h"
105105
#include "ortools/util/tuple_set.h"
106106

107-
#if !defined(SWIG)
107+
#ifndef SWIG
108108
OR_DLL ABSL_DECLARE_FLAG(int64_t, cp_random_seed);
109109
OR_DLL ABSL_DECLARE_FLAG(bool, cp_disable_solve);
110-
#endif // !defined(SWIG)
110+
#endif // SWIG
111111

112112
class File;
113113

@@ -3609,7 +3609,11 @@ class Demon : public BaseObject {
36093609
};
36103610

36113611
/// Model visitor.
3612-
class OR_DLL ModelVisitor : public BaseObject {
3612+
class
3613+
#ifndef SWIG
3614+
OR_DLL
3615+
#endif
3616+
ModelVisitor : public BaseObject {
36133617
public:
36143618
/// Constraint and Expression types.
36153619
static const char kAbs[];
@@ -4825,7 +4829,11 @@ class ImprovementSearchLimit : public SearchLimit {
48254829
/// cannot be accessed any more. An interval var is automatically marked
48264830
/// as unperformed when it is not consistent anymore (start greater
48274831
/// than end, duration < 0...)
4828-
class OR_DLL IntervalVar : public PropagationBaseObject {
4832+
class
4833+
#ifndef SWIG
4834+
OR_DLL
4835+
#endif
4836+
IntervalVar : public PropagationBaseObject {
48294837
public:
48304838
/// The smallest acceptable value to be returned by StartMin()
48314839
static const int64_t kMinValidValue;

ortools/graph/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,7 @@ cc_library(
623623
visibility = ["//visibility:public"],
624624
deps = [
625625
"//ortools/base",
626+
"//ortools/base:base_export",
626627
"//ortools/graph:iterators",
627628
"//ortools/util:permutation",
628629
"//ortools/util:zvector",

ortools/linear_solver/linear_solver.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,11 @@
166166
#include "ortools/port/proto_utils.h"
167167
#include "ortools/util/lazy_mutable_copy.h"
168168

169+
#ifndef SWIG
169170
OR_DLL ABSL_DECLARE_FLAG(bool, linear_solver_enable_verbose_output);
170171
OR_DLL ABSL_DECLARE_FLAG(bool, log_verification_errors);
171172
OR_DLL ABSL_DECLARE_FLAG(bool, verify_solution);
173+
#endif
172174

173175
namespace operations_research {
174176

@@ -1470,7 +1472,11 @@ class MPConstraint {
14701472
* instead. We need to figure out how to deal with the subtleties of
14711473
* the default values.
14721474
*/
1473-
class OR_DLL MPSolverParameters {
1475+
class
1476+
#ifndef SWIG
1477+
OR_DLL
1478+
#endif
1479+
MPSolverParameters {
14741480
public:
14751481
/// Enumeration of parameters that take continuous values.
14761482
enum DoubleParam {

ortools/sat/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ cc_library(
330330
":cp_model_cc_proto",
331331
":drat_proof_handler",
332332
":sat_base",
333+
"//ortools/base:base_export",
333334
"//ortools/base:file",
334335
"//ortools/base:hash",
335336
"//ortools/base:stl_util",
@@ -855,6 +856,7 @@ cc_library(
855856
":util",
856857
":work_assignment",
857858
"//ortools/base",
859+
"//ortools/base:base_export",
858860
"//ortools/base:file",
859861
"//ortools/base:status_macros",
860862
"//ortools/base:strong_vector",
@@ -1094,6 +1096,7 @@ cc_library(
10941096
":sat_solver",
10951097
":solution_crush",
10961098
":util",
1099+
"//ortools/base:base_export",
10971100
"//ortools/base:logging",
10981101
"//ortools/port:proto_utils",
10991102
"//ortools/util:affine_relation",

ortools/sat/cp_model_solver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
#include "ortools/sat/model.h"
2525
#include "ortools/sat/sat_parameters.pb.h"
2626

27+
#ifndef SWIG
2728
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_response);
2829
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_drat_check);
2930
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_lrat_check);
31+
#endif
3032

3133
namespace operations_research {
3234
namespace sat {

ortools/sat/cp_model_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@
4242
#include "ortools/util/bitset.h"
4343
#include "ortools/util/sorted_interval_list.h"
4444

45+
#ifndef SWIG
4546
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_models);
4647
OR_DLL ABSL_DECLARE_FLAG(std::string, cp_model_dump_prefix);
4748
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_problematic_lns);
4849
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_dump_submodels);
50+
#endif
4951

5052
namespace operations_research {
5153
namespace sat {

ortools/sat/presolve_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
#include "ortools/util/sorted_interval_list.h"
4646
#include "ortools/util/time_limit.h"
4747

48+
#ifndef SWIG
4849
OR_DLL ABSL_DECLARE_FLAG(bool, cp_model_debug_postsolve);
50+
#endif
4951

5052
namespace operations_research {
5153
namespace sat {

ortools/util/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ cc_library(
183183
hdrs = ["time_limit.h"],
184184
deps = [
185185
":running_stat",
186+
"//ortools/base:base_export",
186187
"//ortools/base:timer",
187188
"//ortools/base:types",
188189
"@abseil-cpp//absl/base:core_headers",

ortools/util/time_limit.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
#include "ortools/base/types.h"
3636
#include "ortools/util/running_stat.h"
3737

38+
#ifndef SWIG
3839
/**
3940
* Enables changing the behavior of the TimeLimit class to use -b usertime
4041
* instead of \b walltime. This is mainly useful for benchmarks.
4142
*/
4243
OR_DLL ABSL_DECLARE_FLAG(bool, time_limit_use_usertime);
44+
#endif // SWIG
4345

4446
namespace operations_research {
4547

0 commit comments

Comments
 (0)