diff --git a/.github/workflows/centos.yml b/.github/workflows/centos.yml
index 8ba54643bc..6b9d3019e5 100644
--- a/.github/workflows/centos.yml
+++ b/.github/workflows/centos.yml
@@ -87,7 +87,6 @@ jobs:
-DBUILD_JAVA=${{ matrix.java }} \
-DBUILD_DOTNET=${{ matrix.dotnet }} \
-DBUILD_EXAMPLES=ON \
- -DBUILD_XPRESS_TEST_AND_EXAMPLES=ON \
-DBUILD_DEPS=ON \
-DCMAKE_INSTALL_PREFIX="build/install" \
-DBUILD_SAMPLES=OFF \
diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml
index 124bc40e61..23b1fdc615 100644
--- a/.github/workflows/oracle.yml
+++ b/.github/workflows/oracle.yml
@@ -113,7 +113,6 @@ jobs:
-DBUILD_JAVA=${{ matrix.cmake.java }} \
-DBUILD_DOTNET=${{ matrix.cmake.dotnet }} \
-DBUILD_EXAMPLES=ON \
- -DBUILD_XPRESS_TEST_AND_EXAMPLES=ON \
-DBUILD_DEPS=ON \
-DCMAKE_INSTALL_PREFIX="build/install" \
-DBUILD_SAMPLES=OFF \
diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml
index 72a29756ac..85b99296bc 100644
--- a/.github/workflows/ubuntu.yml
+++ b/.github/workflows/ubuntu.yml
@@ -87,7 +87,6 @@ jobs:
-DBUILD_EXAMPLES=ON
-DBUILD_DEPS=ON
-DBUILD_SAMPLES=OFF
- -DBUILD_XPRESS_TEST_AND_EXAMPLES=ON
-DCMAKE_INSTALL_PREFIX="build/install"
- name: Build OR-Tools Linux
diff --git a/.github/workflows/windows-cpp.yml b/.github/workflows/windows-cpp.yml
index b07a5dac9c..817a2deec2 100644
--- a/.github/workflows/windows-cpp.yml
+++ b/.github/workflows/windows-cpp.yml
@@ -44,7 +44,6 @@ jobs:
run: >
cmake -S. -Bbuild
-DCMAKE_BUILD_TYPE=Release
- -DBUILD_XPRESS_TEST_AND_EXAMPLES=ON
-DBUILD_DEPS=ON
-DCMAKE_INSTALL_PREFIX="install"
-DBUILD_FLATZINC=OFF
diff --git a/.github/workflows/windows-java-dotnet.yml b/.github/workflows/windows-java-dotnet.yml
index 8fc603fbdd..86a56051de 100644
--- a/.github/workflows/windows-java-dotnet.yml
+++ b/.github/workflows/windows-java-dotnet.yml
@@ -62,7 +62,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Release
-DBUILD_JAVA=ON
-DBUILD_DOTNET=ON
- -DBUILD_XPRESS_TEST_AND_EXAMPLES=ON
-DBUILD_CXX_SAMPLES=OFF
-DBUILD_SAMPLES=OFF
-DCMAKE_INSTALL_PREFIX="install"
diff --git a/.github/workflows/windows-python.yml b/.github/workflows/windows-python.yml
index 763c36dc52..8b8933d020 100644
--- a/.github/workflows/windows-python.yml
+++ b/.github/workflows/windows-python.yml
@@ -72,7 +72,6 @@ jobs:
-DCMAKE_BUILD_TYPE=Release
-DBUILD_CXX_SAMPLES=OFF
-DBUILD_PYTHON=ON
- -DBUILD_XPRESS_TEST_AND_EXAMPLES=ON
-DBUILD_SAMPLES=OFF
-DBUILD_FLATZINC=OFF
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d12b55fa9a..275ff23983 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -281,7 +281,6 @@ message(STATUS "CPLEX support: ${USE_CPLEX}")
## XPRESS
# Since it is dynamicaly loaded upon use, OFF is currently not supported.
CMAKE_DEPENDENT_OPTION(USE_XPRESS "Use the Xpress solver" ON "BUILD_CXX" OFF)
-CMAKE_DEPENDENT_OPTION(BUILD_XPRESS_TEST_AND_EXAMPLES "Build Xpress-specific tests" OFF "USE_XPRESS" OFF)
# Language specific options
if(BUILD_CXX)
@@ -439,6 +438,3 @@ endforeach()
# Add tests in examples/tests
add_subdirectory(examples/tests)
-
-# Add Xpress specific tests
-add_subdirectory(examples/xpress_tests)
diff --git a/cmake/README.md b/cmake/README.md
index e3824dbce0..4d09125fcc 100644
--- a/cmake/README.md
+++ b/cmake/README.md
@@ -172,84 +172,82 @@ Following is a list of available options, for the full list run:
cmake -S. -Bbuild -LH
```
-| CMake Option | Default Value | Note |
-|:-------------|:----------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `CMAKE_BUILD_TYPE` | Release | see CMake documentation [here](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) |
-| `BUILD_CXX` | ON | Build C++ |
-| `BUILD_DOTNET` | OFF | Build .Net wrapper and packages |
-| `BUILD_JAVA` | OFF | Build Java wrapper and packages |
-| `BUILD_PYTHON` | OFF | Build Python wrapper and package |
-| | | |
-| `BUILD_FLATZINC` | ON\* | Build the flatzinc library
**Forced** to OFF if `BUILD_CXX=OFF` |
-| `BUILD_GLOP` | OFF\* | Build the standalone Glop library
**Forced** to OFF if `BUILD_CXX=ON`, otherwise default to ON |
-| | | |
-| `BUILD_DEPS` | OFF* | Default to ON if `BUILD_JAVA=ON` or `BUILD_PYTHON=ON` or `BUILD_DOTNET=ON` |
-| `BUILD_ZLIB` | OFF* | Static build the zlib library
**Forced** to ON if `BUILD_DEPS=ON` |
-| `BUILD_absl` | OFF* | Static build the abseil-cpp libraries
**Forced** to ON if `BUILD_DEPS=ON` |
-| `BUILD_Protobuf` | OFF* | Static build the protobuf libraries
**Forced** to ON if `BUILD_DEPS=ON` |
-| `BUILD_re2` | OFF* | Static build the re2 libraries
**Forced** to ON if `BUILD_DEPS=ON` |
-| `BUILD_Eigen3` | OFF* | Static build the Eigen3 libraries
**Forced** to ON if `BUILD_DEPS=ON` |
-| | | |
-| `USE_COINOR` | ON\* | Enable Coin-OR support
**Forced** to OFF if `BUILD_CXX=OFF` |
-| `BUILD_CoinUtils` | OFF\* | Static build the CoinUtils library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
-| `BUILD_Osi` | OFF\* | Static build the Osi library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
-| `BUILD_Clp` | OFF\* | Static build the Clp library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
-| `BUILD_Cgl` | OFF\* | Static build the Cgl library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
-| `BUILD_Cbc` | OFF\* | Static build the Cbc library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
-| | | |
-| `USE_GLPK` | OFF\* | Enable GLPK support
**Forced** to OFF if `BUILD_CXX=OFF` |
-| `BUILD_GLPK` | OFF\* | Static build the GLPK libraries
**Forced** to ON if `USE_GLPK=ON` **and** `BUILD_DEPS=ON` |
-| | | |
-| `USE_HIGHS` | ON\* | Enable HIGHS support
**Forced** to OFF if `BUILD_CXX=OFF` |
-| `BUILD_HIGHS` | OFF\* | Static build the HiGHS libraries
**Forced** to ON if `USE_HIGHS=ON` **and** `BUILD_DEPS=ON` |
-| | | |
-| `USE_SCIP` | ON\* | Enable SCIP support
**Forced** to OFF if `BUILD_CXX=OFF` |
-| `BUILD_SCIP` | OFF\* | Static build the SCIP libraries
**Forced** to ON if `USE_SCIP=ON` **and** `BUILD_DEPS=ON` |
-| | | |
-| `USE_CPLEX` | OFF | Enable CPLEX support |
-| | | |
-| `BUILD_DOC` | OFF\* | Build all documentations |
-| `BUILD_CXX_DOC` | OFF\* | Build C++ documentation
**Forced** to ON if `BUILD_DOC=ON` |
-| `BUILD_DOTNET_DOC` | OFF\* | Build .Net documentation
**Forced** to ON if `BUILD_DOC=ON` |
-| `BUILD_JAVA_DOC` | OFF\* | Build Java documentation
**Forced** to ON if `BUILD_DOC=ON` |
-| `BUILD_PYTHON_DOC` | OFF\* | Build Python documentation
**Forced** to ON if `BUILD_DOC=ON` |
-| `INSTALL_DOC` | OFF\* | Install all documentations
**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_DOC=OFF` |
-| | | |
-| `BUILD_SAMPLES` | ON\* | Build all samples
Default to ON if `BUILD_DEPS=ON` |
-| `BUILD_CXX_SAMPLES` | ON\* | Build all C++ samples
**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_SAMPLE=OFF` |
-| `BUILD_DOTNET_SAMPLES` | ON\* | Build all .Net samples
**Forced** to OFF if `BUILD_DOTNET=OFF` or `BUILD_SAMPLE=OFF` |
-| `BUILD_JAVA_SAMPLES` | ON\* | Build all Java samples
**Forced** to OFF if `BUILD_JAVA=OFF` or `BUILD_SAMPLE=OFF` |
-| `BUILD_PYTHON_SAMPLES` | ON\* | Build all Python samples
**Forced** to OFF if `BUILD_PYTHON=OFF` or `BUILD_SAMPLE=OFF` |
-| | | |
-| `BUILD_EXAMPLES` | ON\* | Build all examples
Default to ON if `BUILD_DEPS=ON` |
-| `BUILD_CXX_EXAMPLES` | ON\* | Build all C++ examples
**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_SAMPLE=OFF` |
-| `BUILD_DOTNET_EXAMPLES` | ON\* | Build all .Net examples
**Forced** to OFF if `BUILD_DOTNET=OFF` or `BUILD_SAMPLE=OFF` |
-| `BUILD_JAVA_EXAMPLES` | ON\* | Build all Java examples
**Forced** to OFF if `BUILD_JAVA=OFF` or `BUILD_SAMPLE=OFF` |
-| `BUILD_PYTHON_EXAMPLES` | ON\* | Build all Python examples
**Forced** to OFF if `BUILD_PYTHON=OFF` or `BUILD_SAMPLE=OFF` |
-| | | |
-| `BUILD_XPRESS_TEST_AND_EXAMPLES` | OFF\* | Build Xpress specific tests (C++, Java and Python)
tests and example for each language are built **only** if the respective language support is `ON`
These tests and examples don't need Xpress for the compilation but they need a valid Xpress installation for a succesful execution (a cummunity licence is sufficient). |
-| | | |
-| `USE_DOTNET_46` | OFF | Enable .Net Framework 4.6 support
Only available if `BUILD_DOTNET=ON` |
-| `USE_DOTNET_461` | OFF | Enable .Net Framework 4.6.1 support
Only available if `BUILD_DOTNET=ON` |
-| `USE_DOTNET_462` | OFF | Enable .Net Framework 4.6.2 support
Only available if `BUILD_DOTNET=ON` |
-| `USE_DOTNET_48` | OFF | Enable .Net Framework 4.8 support
Only available if `BUILD_DOTNET=ON` |
-| `USE_DOTNET_STD_21` | OFF | Enable .Net Standard 2.1 support
Only available if `BUILD_DOTNET=ON` and not targeting arm64 platform |
-| `USE_DOTNET_CORE_31` | OFF | Enable .Net Core 3.1 LTS support
Only available if `BUILD_DOTNET=ON` and not targeting arm64 platform |
-| `USE_DOTNET_6` | ON | Enable .Net 6 LTS support
Only available if `BUILD_DOTNET=ON` |
-| `USE_DOTNET_7` | OFF | Enable .Net 7 support
Only available if `BUILD_DOTNET=ON` |
-| `UNIVERSAL_DOTNET_PACKAGE` | OFF | Build a multi platform package (i.e. `Google.OrTools` will depends on all runtime packages)
Only available if `BUILD_DOTNET=ON` |
-| | | |
-| `SKIP_GPG` | ON | Disable GPG sign
Only available if `BUILD_JAVA=ON` |
-| `UNIVERSAL_JAVA_PACKAGE` | OFF | Build a multi platform package (i.e. `ortools-java` will depends on all native packages)
Only available if `BUILD_JAVA=ON` |
-| `BUILD_FAT_JAR` | OFF | Build a `ortools-java` .jar that includes all of its own Maven dependencies, including the native package
Only available if `BUILD_JAVA=ON` |
-| | | |
-| `BUILD_pybind11` | `BUILD_DEPS` | Static build the pybind11 libraries
**Forced** to ON if `BUILD_DEPS=ON`
Only available if `BUILD_PYTHON=ON` |
-| `BUILD_pybind11_protobuf` | `BUILD_DEPS` | Static build the pybind11_protobuf libraries
**Forced** to ON if `BUILD_DEPS=ON`
Only available if `BUILD_PYTHON=ON` |
-| `GENERATE_PYTHON_STUB` | ON | Generate python stub files
Only available if `BUILD_PYTHON=ON` |
-| `BUILD_VENV` | `BUILD_TESTING` | Create python venv in `BINARY_DIR/python/venv`
**Forced** to ON if `BUILD_TESTING=ON`
Only available if `BUILD_PYTHON=ON` |
-| `VENV_USE_SYSTEM_SITE_PACKAGES` | OFF | Python venv can use system site package (e.g. `py3-numpy` on Alpine)
Only available if `BUILD_PYTHON=ON` and `BUILD_VENV=ON` |
-| `FETCH_PYTHON_DEPS` | `BUILD_DEPS` | Fetch python modules needed to build ortools package
Only available if `BUILD_PYTHON=ON` |
-| | | |
+| CMake Option | Default Value | Note |
+|:-------------|:--------------|:-----|
+| `CMAKE_BUILD_TYPE` | Release | see CMake documentation [here](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html) |
+| `BUILD_CXX` | ON | Build C++ |
+| `BUILD_DOTNET` | OFF | Build .Net wrapper and packages |
+| `BUILD_JAVA` | OFF | Build Java wrapper and packages |
+| `BUILD_PYTHON` | OFF | Build Python wrapper and package |
+| | | |
+| `BUILD_FLATZINC` | ON\* | Build the flatzinc library
**Forced** to OFF if `BUILD_CXX=OFF` |
+| `BUILD_GLOP` | OFF\* | Build the standalone Glop library
**Forced** to OFF if `BUILD_CXX=ON`, otherwise default to ON |
+| | | |
+| `BUILD_DEPS` | OFF* | Default to ON if `BUILD_JAVA=ON` or `BUILD_PYTHON=ON` or `BUILD_DOTNET=ON` |
+| `BUILD_ZLIB` | OFF* | Static build the zlib library
**Forced** to ON if `BUILD_DEPS=ON` |
+| `BUILD_absl` | OFF* | Static build the abseil-cpp libraries
**Forced** to ON if `BUILD_DEPS=ON` |
+| `BUILD_Protobuf` | OFF* | Static build the protobuf libraries
**Forced** to ON if `BUILD_DEPS=ON` |
+| `BUILD_re2` | OFF* | Static build the re2 libraries
**Forced** to ON if `BUILD_DEPS=ON` |
+| `BUILD_Eigen3` | OFF* | Static build the Eigen3 libraries
**Forced** to ON if `BUILD_DEPS=ON` |
+| | | |
+| `USE_COINOR` | ON\* | Enable Coin-OR support
**Forced** to OFF if `BUILD_CXX=OFF` |
+| `BUILD_CoinUtils` | OFF\* | Static build the CoinUtils library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
+| `BUILD_Osi` | OFF\* | Static build the Osi library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
+| `BUILD_Clp` | OFF\* | Static build the Clp library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
+| `BUILD_Cgl` | OFF\* | Static build the Cgl library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
+| `BUILD_Cbc` | OFF\* | Static build the Cbc library
**Forced** to ON if `USE_COINOR=ON` **and** `BUILD_DEPS=ON` |
+| | | |
+| `USE_GLPK` | OFF\* | Enable GLPK support
**Forced** to OFF if `BUILD_CXX=OFF` |
+| `BUILD_GLPK` | OFF\* | Static build the GLPK libraries
**Forced** to ON if `USE_GLPK=ON` **and** `BUILD_DEPS=ON` |
+| | | |
+| `USE_HIGHS` | ON\* | Enable HIGHS support
**Forced** to OFF if `BUILD_CXX=OFF` |
+| `BUILD_HIGHS` | OFF\* | Static build the HiGHS libraries
**Forced** to ON if `USE_HIGHS=ON` **and** `BUILD_DEPS=ON` |
+| | | |
+| `USE_SCIP` | ON\* | Enable SCIP support
**Forced** to OFF if `BUILD_CXX=OFF` |
+| `BUILD_SCIP` | OFF\* | Static build the SCIP libraries
**Forced** to ON if `USE_SCIP=ON` **and** `BUILD_DEPS=ON` |
+| | | |
+| `USE_CPLEX` | OFF | Enable CPLEX support |
+| | | |
+| `BUILD_DOC` | OFF\* | Build all documentations |
+| `BUILD_CXX_DOC` | OFF\* | Build C++ documentation
**Forced** to ON if `BUILD_DOC=ON` |
+| `BUILD_DOTNET_DOC` | OFF\* | Build .Net documentation
**Forced** to ON if `BUILD_DOC=ON` |
+| `BUILD_JAVA_DOC` | OFF\* | Build Java documentation
**Forced** to ON if `BUILD_DOC=ON` |
+| `BUILD_PYTHON_DOC` | OFF\* | Build Python documentation
**Forced** to ON if `BUILD_DOC=ON` |
+| `INSTALL_DOC` | OFF\* | Install all documentations
**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_DOC=OFF` |
+| | | |
+| `BUILD_SAMPLES` | ON\* | Build all samples
Default to ON if `BUILD_DEPS=ON` |
+| `BUILD_CXX_SAMPLES` | ON\* | Build all C++ samples
**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_SAMPLE=OFF` |
+| `BUILD_DOTNET_SAMPLES` | ON\* | Build all .Net samples
**Forced** to OFF if `BUILD_DOTNET=OFF` or `BUILD_SAMPLE=OFF` |
+| `BUILD_JAVA_SAMPLES` | ON\* | Build all Java samples
**Forced** to OFF if `BUILD_JAVA=OFF` or `BUILD_SAMPLE=OFF` |
+| `BUILD_PYTHON_SAMPLES` | ON\* | Build all Python samples
**Forced** to OFF if `BUILD_PYTHON=OFF` or `BUILD_SAMPLE=OFF` |
+| | | |
+| `BUILD_EXAMPLES` | ON\* | Build all examples
Default to ON if `BUILD_DEPS=ON` |
+| `BUILD_CXX_EXAMPLES` | ON\* | Build all C++ examples
**Forced** to OFF if `BUILD_CXX=OFF` or `BUILD_SAMPLE=OFF` |
+| `BUILD_DOTNET_EXAMPLES` | ON\* | Build all .Net examples
**Forced** to OFF if `BUILD_DOTNET=OFF` or `BUILD_SAMPLE=OFF` |
+| `BUILD_JAVA_EXAMPLES` | ON\* | Build all Java examples
**Forced** to OFF if `BUILD_JAVA=OFF` or `BUILD_SAMPLE=OFF` |
+| `BUILD_PYTHON_EXAMPLES` | ON\* | Build all Python examples
**Forced** to OFF if `BUILD_PYTHON=OFF` or `BUILD_SAMPLE=OFF` |
+| | | |
+| `USE_DOTNET_46` | OFF | Enable .Net Framework 4.6 support
Only available if `BUILD_DOTNET=ON` |
+| `USE_DOTNET_461` | OFF | Enable .Net Framework 4.6.1 support
Only available if `BUILD_DOTNET=ON` |
+| `USE_DOTNET_462` | OFF | Enable .Net Framework 4.6.2 support
Only available if `BUILD_DOTNET=ON` |
+| `USE_DOTNET_48` | OFF | Enable .Net Framework 4.8 support
Only available if `BUILD_DOTNET=ON` |
+| `USE_DOTNET_STD_21` | OFF | Enable .Net Standard 2.1 support
Only available if `BUILD_DOTNET=ON` and not targeting arm64 platform |
+| `USE_DOTNET_CORE_31` | OFF | Enable .Net Core 3.1 LTS support
Only available if `BUILD_DOTNET=ON` and not targeting arm64 platform |
+| `USE_DOTNET_6` | ON | Enable .Net 6 LTS support
Only available if `BUILD_DOTNET=ON` |
+| `USE_DOTNET_7` | OFF | Enable .Net 7 support
Only available if `BUILD_DOTNET=ON` |
+| `UNIVERSAL_DOTNET_PACKAGE` | OFF | Build a multi platform package (i.e. `Google.OrTools` will depends on all runtime packages)
Only available if `BUILD_DOTNET=ON` |
+| | | |
+| `SKIP_GPG` | ON | Disable GPG sign
Only available if `BUILD_JAVA=ON` |
+| `UNIVERSAL_JAVA_PACKAGE` | OFF | Build a multi platform package (i.e. `ortools-java` will depends on all native packages)
Only available if `BUILD_JAVA=ON` |
+| `BUILD_FAT_JAR` | OFF | Build a `ortools-java` .jar that includes all of its own Maven dependencies, including the native package
Only available if `BUILD_JAVA=ON` |
+| | | |
+| `BUILD_pybind11` | `BUILD_DEPS` | Static build the pybind11 libraries
**Forced** to ON if `BUILD_DEPS=ON`
Only available if `BUILD_PYTHON=ON` |
+| `BUILD_pybind11_protobuf` | `BUILD_DEPS` | Static build the pybind11_protobuf libraries
**Forced** to ON if `BUILD_DEPS=ON`
Only available if `BUILD_PYTHON=ON` |
+| `GENERATE_PYTHON_STUB` | ON | Generate python stub files
Only available if `BUILD_PYTHON=ON` |
+| `BUILD_VENV` | `BUILD_TESTING` | Create python venv in `BINARY_DIR/python/venv`
**Forced** to ON if `BUILD_TESTING=ON`
Only available if `BUILD_PYTHON=ON` |
+| `VENV_USE_SYSTEM_SITE_PACKAGES` | OFF | Python venv can use system site package (e.g. `py3-numpy` on Alpine)
Only available if `BUILD_PYTHON=ON` and `BUILD_VENV=ON` |
+| `FETCH_PYTHON_DEPS` | `BUILD_DEPS` | Fetch python modules needed to build ortools package
Only available if `BUILD_PYTHON=ON` |
+| | | |
## Integrating OR-Tools in your CMake Project
diff --git a/examples/cpp/integer_programming.cc b/examples/cpp/integer_programming.cc
index 86400484f4..58b22fb332 100644
--- a/examples/cpp/integer_programming.cc
+++ b/examples/cpp/integer_programming.cc
@@ -87,6 +87,7 @@ void RunAllExamples() {
RunIntegerProgrammingExample("GUROBI");
RunIntegerProgrammingExample("GLPK");
RunIntegerProgrammingExample("CPLEX");
+ RunIntegerProgrammingExample("XPRESS");
}
} // namespace operations_research
diff --git a/examples/xpress_tests/xpress_use.cc b/examples/cpp/xpress_use.cc
similarity index 98%
rename from examples/xpress_tests/xpress_use.cc
rename to examples/cpp/xpress_use.cc
index 0cc328adf4..600918e762 100644
--- a/examples/xpress_tests/xpress_use.cc
+++ b/examples/cpp/xpress_use.cc
@@ -50,7 +50,8 @@ void useXpressSolver(bool solveAsMip, bool useFactory) {
}
}
if (solver == nullptr) {
- LOG(FATAL) << "Xpress solver is not available";
+ LOG(WARNING) << "Xpress solver is not available";
+ return;
}
// Use the solver
/*
diff --git a/examples/xpress_tests/CMakeLists.txt b/examples/xpress_tests/CMakeLists.txt
deleted file mode 100644
index fafb954426..0000000000
--- a/examples/xpress_tests/CMakeLists.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-if (NOT BUILD_XPRESS_TEST_AND_EXAMPLES)
- return()
-endif ()
-
-if (BUILD_CXX_EXAMPLES)
- add_cxx_example(${CMAKE_CURRENT_SOURCE_DIR}/xpress_use.cc)
-endif ()
-
-# disable python callback test
-#if (BUILD_PYTHON_EXAMPLES)
-# add_python_example(${CMAKE_CURRENT_SOURCE_DIR}/callback_xpress.py)
-#endif ()
-
-include(CTest)
-if (BUILD_CXX_EXAMPLES)
- if (APPLE)
- set(CMAKE_INSTALL_RPATH
- "@loader_path/../${CMAKE_INSTALL_LIBDIR};@loader_path")
- elseif (UNIX)
- set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:$ORIGIN:$ORIGIN/../lib:$ORIGIN")
- endif ()
-
- add_executable(test_xprs_interface test/test_xpress_interface.cc)
- target_compile_features(test_xprs_interface PRIVATE cxx_std_17)
- target_link_libraries(test_xprs_interface PRIVATE ortools::ortools GTest::gtest_main)
-
- add_test(NAME cxx_unittests_xpress_interface COMMAND test_xprs_interface)
-endif ()
\ No newline at end of file
diff --git a/ortools/linear_solver/CMakeLists.txt b/ortools/linear_solver/CMakeLists.txt
index 3ae9a6a262..6a3ccfdeb5 100644
--- a/ortools/linear_solver/CMakeLists.txt
+++ b/ortools/linear_solver/CMakeLists.txt
@@ -16,6 +16,7 @@ list(REMOVE_ITEM _SRCS
${CMAKE_CURRENT_SOURCE_DIR}/solve.cc
)
list(FILTER _SRCS EXCLUDE REGEX "/model_exporter_main\\.cc")
+list(FILTER _SRCS EXCLUDE REGEX ".*/.*_test.cc")
if(USE_SCIP)
list(APPEND _SRCS ${LPI_GLOP_SRC})
endif()
@@ -67,3 +68,18 @@ elseif(UNIX)
endif()
install(TARGETS solve)
+
+if (BUILD_CXX_EXAMPLES)
+ if (APPLE)
+ set(CMAKE_INSTALL_RPATH
+ "@loader_path/../${CMAKE_INSTALL_LIBDIR};@loader_path")
+ elseif (UNIX)
+ set(CMAKE_INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}:$ORIGIN:$ORIGIN/../lib:$ORIGIN")
+ endif ()
+
+ add_executable(test_xprs_interface xpress_interface_test.cc)
+ target_compile_features(test_xprs_interface PRIVATE cxx_std_17)
+ target_link_libraries(test_xprs_interface PRIVATE ortools::ortools GTest::gtest_main)
+
+ add_test(NAME cxx_unittests_xpress_interface COMMAND test_xprs_interface)
+endif ()
diff --git a/examples/xpress_tests/test/test_xpress_interface.cc b/ortools/linear_solver/xpress_interface_test.cc
similarity index 98%
rename from examples/xpress_tests/test/test_xpress_interface.cc
rename to ortools/linear_solver/xpress_interface_test.cc
index 8529ec126c..df56239546 100644
--- a/examples/xpress_tests/test/test_xpress_interface.cc
+++ b/ortools/linear_solver/xpress_interface_test.cc
@@ -1,3 +1,4 @@
+#include
#include
#include
@@ -652,14 +653,17 @@ TEST(XpressInterface, Write) {
obj->SetCoefficient(x1, 1);
obj->SetCoefficient(x2, 2);
- std::string tmpName = std::string(std::tmpnam(nullptr)) + ".mps";
+ const std::filesystem::path temporary_working_dir =
+ std::filesystem::temp_directory_path() / "temporary_working_dir";
+ std::filesystem::create_directories(temporary_working_dir);
+
+ std::string tmpName = temporary_working_dir / "dummy.mps";
solver.Write(tmpName);
std::ifstream tmpFile(tmpName);
std::stringstream tmpBuffer;
tmpBuffer << tmpFile.rdbuf();
- tmpFile.close();
- std::remove(tmpName.c_str());
+ std::filesystem::remove_all(temporary_working_dir);
EXPECT_EQ(tmpBuffer.str(), R"(NAME newProb
OBJSENSE MAXIMIZE
@@ -1305,5 +1309,12 @@ int main(int argc, char** argv) {
InitGoogle(argv[0], &argc, &argv, true);
absl::SetFlag(&FLAGS_logtostderr, 1);
testing::InitGoogleTest(&argc, argv);
- return RUN_ALL_TESTS();
+ auto solver = operations_research::MPSolver::CreateSolver("XPRESS_LP");
+ if (solver == nullptr) {
+ LOG(ERROR) << "Xpress solver is not available";
+ return EXIT_SUCCESS;
+ }
+ else{
+ return RUN_ALL_TESTS();
+ }
}
diff --git a/ortools/xpress/environment.cc b/ortools/xpress/environment.cc
index 924897e085..0f3fcbba4d 100644
--- a/ortools/xpress/environment.cc
+++ b/ortools/xpress/environment.cc
@@ -340,7 +340,7 @@ bool initXpressEnv(bool verbose, int xpress_oem_license_key) {
}
}
void log_full_license_error(int code, const std::string& xpress_lib_dir) {
- LOG(ERROR) << "XpressInterface: Xpress found at " << xpress_lib_dir
+ LOG(WARNING) << "XpressInterface: Xpress found at " << xpress_lib_dir
<< "\n";
char errmsg[256];
XPRSgetlicerrmsg(errmsg, 256);