Skip to content

Commit 16d3a41

Browse files
committed
glpk: move it to third_party_solvers/
1 parent c0070c2 commit 16d3a41

File tree

14 files changed

+28
-23
lines changed

14 files changed

+28
-23
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 {

ortools/math_opt/solvers/glpk_solver.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
#include "absl/types/span.h"
4343
#include "ortools/base/protoutil.h"
4444
#include "ortools/base/status_macros.h"
45-
#include "ortools/glpk/glpk_env_deleter.h"
46-
#include "ortools/glpk/glpk_formatters.h"
4745
#include "ortools/math_opt/callback.pb.h"
4846
#include "ortools/math_opt/core/empty_bounds.h"
4947
#include "ortools/math_opt/core/inverted_bounds.h"
@@ -66,6 +64,8 @@
6664
#include "ortools/math_opt/sparse_containers.pb.h"
6765
#include "ortools/math_opt/validators/callback_validator.h"
6866
#include "ortools/port/proto_utils.h"
67+
#include "ortools/third_party_solvers/glpk/glpk_env_deleter.h"
68+
#include "ortools/third_party_solvers/glpk/glpk_formatters.h"
6969
#include "ortools/util/solve_interrupter.h"
7070

7171
namespace operations_research {
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

0 commit comments

Comments
 (0)