Skip to content

Commit deda181

Browse files
committed
glpk: move it to third_party_solvers/
1 parent a12f870 commit deda181

File tree

13 files changed

+26
-21
lines changed

13 files changed

+26
-21
lines changed

cmake/cpp.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ if(USE_GLOP)
7979
endif()
8080
if(USE_GLPK)
8181
list(APPEND OR_TOOLS_COMPILE_DEFINITIONS "USE_GLPK")
82-
set(GLPK_DIR glpk)
8382
endif()
8483
if(USE_GUROBI)
8584
set(GUROBI_DIR gurobi)
@@ -532,7 +531,6 @@ foreach(SUBPROJECT IN ITEMS
532531
linear_solver
533532
bop
534533
glop
535-
${GLPK_DIR}
536534
${GUROBI_DIR}
537535
${PDLP_DIR}
538536
sat
@@ -550,6 +548,13 @@ foreach(SUBPROJECT IN ITEMS
550548
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_${SUBPROJECT})
551549
endforeach()
552550

551+
if(USE_GLPK)
552+
add_subdirectory(ortools/third_party_solvers/glpk)
553+
#target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_glpk)
554+
target_sources(${PROJECT_NAME} PRIVATE $<TARGET_OBJECTS:${PROJECT_NAME}_glpk>)
555+
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}_glpk)
556+
endif()
557+
553558
if(BUILD_MATH_OPT)
554559
add_subdirectory(ortools/${MATH_OPT_DIR})
555560
target_link_libraries(${PROJECT_NAME} PRIVATE ${PROJECT_NAME}_math_opt)

ortools/linear_solver/glpk_interface.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include "absl/strings/str_format.h"
2727
#include "ortools/base/logging.h"
2828
#include "ortools/base/timer.h"
29-
#include "ortools/glpk/glpk_env_deleter.h"
3029
#include "ortools/linear_solver/linear_solver.h"
30+
#include "ortools/third_party_solvers/glpk/glpk_env_deleter.h"
3131

3232
extern "C" {
3333
#include "glpk.h"

ortools/math_opt/solvers/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,6 @@ cc_library(
442442
"//ortools/base:protoutil",
443443
"//ortools/base:status_macros",
444444
"//ortools/base:sysinfo",
445-
"//ortools/glpk:glpk_env_deleter",
446-
"//ortools/glpk:glpk_formatters",
447445
"//ortools/math_opt:callback_cc_proto",
448446
"//ortools/math_opt:infeasible_subsystem_cc_proto",
449447
"//ortools/math_opt:model_cc_proto",
@@ -464,6 +462,8 @@ cc_library(
464462
"//ortools/math_opt/solvers/glpk:rays",
465463
"//ortools/math_opt/validators:callback_validator",
466464
"//ortools/port:proto_utils",
465+
"//ortools/third_party_solvers/glpk:glpk_env_deleter",
466+
"//ortools/third_party_solvers/glpk:glpk_formatters",
467467
"//ortools/util:solve_interrupter",
468468
"@abseil-cpp//absl/cleanup",
469469
"@abseil-cpp//absl/container:flat_hash_map",

ortools/math_opt/solvers/glpk/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ cc_library(
2929
deps = [
3030
"//ortools/base:logging",
3131
"//ortools/base:status_macros",
32-
"//ortools/glpk:glpk_computational_form",
33-
"//ortools/glpk:glpk_formatters",
32+
"//ortools/third_party_solvers/glpk:glpk_computational_form",
33+
"//ortools/third_party_solvers/glpk:glpk_formatters",
3434
"@abseil-cpp//absl/log:check",
3535
"@abseil-cpp//absl/status",
3636
"@abseil-cpp//absl/status:statusor",

ortools/math_opt/solvers/glpk/rays.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include "absl/strings/str_cat.h"
2424
#include "ortools/base/logging.h"
2525
#include "ortools/base/status_macros.h"
26-
#include "ortools/glpk/glpk_computational_form.h"
27-
#include "ortools/glpk/glpk_formatters.h"
26+
#include "ortools/third_party_solvers/glpk/glpk_computational_form.h"
27+
#include "ortools/third_party_solvers/glpk/glpk_formatters.h"
2828

2929
namespace operations_research::math_opt {
3030
namespace {
File renamed without changes.
File renamed without changes.

ortools/glpk/glpk_computational_form.h renamed to ortools/third_party_solvers/glpk/glpk_computational_form.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@
6464
//
6565
// This logic is usually necessary when using advanced APIs that deal with
6666
// indices in the computational form.
67-
#ifndef ORTOOLS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
68-
#define ORTOOLS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
67+
#ifndef ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
68+
#define ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
6969

7070
extern "C" {
7171
#include <glpk.h>
@@ -133,4 +133,4 @@ inline double ComputeFormVarUpperBound(glp_prob* const problem,
133133

134134
} // namespace operations_research
135135

136-
#endif // ORTOOLS_GLPK_GLPK_COMPUTATIONAL_FORM_H_
136+
#endif // ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_COMPUTATIONAL_FORM_H_

ortools/glpk/glpk_env_deleter.cc renamed to ortools/third_party_solvers/glpk/glpk_env_deleter.cc

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

14-
#include "ortools/glpk/glpk_env_deleter.h"
14+
#include "ortools/third_party_solvers/glpk/glpk_env_deleter.h"
1515

1616
#include "ortools/base/logging.h"
1717

ortools/glpk/glpk_env_deleter.h renamed to ortools/third_party_solvers/glpk/glpk_env_deleter.h

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

14-
#ifndef ORTOOLS_GLPK_GLPK_ENV_DELETER_H_
15-
#define ORTOOLS_GLPK_GLPK_ENV_DELETER_H_
14+
#ifndef ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_ENV_DELETER_H_
15+
#define ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_ENV_DELETER_H_
1616

1717
namespace operations_research {
1818

@@ -27,4 +27,4 @@ void SetupGlpkEnvAutomaticDeletion();
2727

2828
} // namespace operations_research
2929

30-
#endif // ORTOOLS_GLPK_GLPK_ENV_DELETER_H_
30+
#endif // ORTOOLS_THIRD_PARTY_SOLVERS_GLPK_GLPK_ENV_DELETER_H_

0 commit comments

Comments
 (0)