- Currently not implemented... Add abseil patch - Add patches/absl-config.cmake Makefile: Add abseil-cpp on unix - Force abseil-cpp SHA1 to 45221cc note: Just before the PR #136 which break all CMake Makefile: Add abseil-cpp on windows - Force abseil-cpp SHA1 to 45221cc note: Just before the PR #136 which break all CMake CMake: Add abseil-cpp - Force abseil-cpp SHA1 to 45221cc note: Just before the PR #136 which break all CMake port to absl: C++ Part - Fix warning with the use of ABSL_MUST_USE_RESULT > The macro must appear as the very first part of a function declaration or definition: ... Note: past advice was to place the macro after the argument list. src: dependencies/sources/abseil-cpp-master/absl/base/attributes.h:418 - Rename enum after windows clash - Remove non compact table constraints - Change index type from int64 to int in routing library - Fix file_nonport compilation on windows - Fix another naming conflict with windows (NO_ERROR is a macro) - Cleanup hash containers; work on sat internals - Add optional_boolean sub-proto Sync cpp examples with internal code - reenable issue173 after reducing number of loops port to absl: Python Part - Add back cp_model.INT32_MIN|MAX for examples Update Python examples - Add random_tsp.py - Run words_square example - Run magic_square in python tests port to absl: Java Part - Fix compilation of the new routing parameters in java - Protect some code from SWIG parsing Update Java Examples port to absl: .Net Part Update .Net examples work on sat internals; Add C++ CP-SAT CpModelBuilder API; update sample code and recipes to use the new API; sync with internal code Remove VS 2015 in Appveyor-CI - abseil-cpp does not support VS 2015... improve tables upgrade C++ sat examples to use the new API; work on sat internals update license dates rewrite jobshop_ft06_distance.py to use the CP-SAT solver rename last example revert last commit more work on SAT internals fix
OR-Tools CMake Build Instructions
OR-Tools comes with a CMake build script (CMakeLists.txt) that can be used on a wide range of platforms (the "C" stands for cross-platform). If you don't have CMake installed already, you can download it for free from http://www.cmake.org/.
CMake works by generating native Makefiles or build projects that can be used in
the compiler environment of your choice.
You can either build OR-Tools with
CMake as a standalone project or it can be incorporated into an existing CMake
project.
warning: Currently OR-Tools CMake doesn't support Java nor C#.
Table of Contents
- Building OR-Tools with CMake
- Consuming OR-Tools in a CMake Project
- Incorporating OR-Tools into a CMake Project
For API/ABI compatibility reasons, if you will be using OR-Tools inside a larger
C++ project, we recommend using CMake and incorporate OR-Tools as a CMake
subproject (i.e. using add_sudirectory()).
Building OR-Tools with CMake
When building OR-Tools as a standalone project on Unix-like systems with GNU Make, the typical workflow is:
- Get the source code and change to it.
git clone https://github.com/google/or-tools.git
cd or-tools
- Run CMake to configure the build tree.
cmake -H. -Bbuild -G "Unix Makefiles"
note: To get the list of available generators (e.g. Visual Studio), use -G ""
- Afterwards, generated files can be used to compile the project.
cmake --build build
- Test the build software (optional).
cmake --build build --target test
- Install the built files (optional).
cmake --build build --target install
Consuming OR-Tools in a CMake Project
If you already have OR-Tools installed in your system, you can use the CMake
command
find_package()
to include OR-Tools in your C++ CMake Project.
cmake_minimum_required(VERSION 3.0.2)
project(myproj VERSION 1.0)
find_package(ortools CONFIG REQUIRED)
add_executable(myapp main.cpp)
target_link_libraries(myapp ortools::ortools)
Include directories, compile definitions and compile options will be added automatically to your target as needed.
Incorporating OR-Tools into a CMake Project
The recommendations below are similar to those for using CMake within the googletest framework (https://github.com/google/googletest/blob/master/googletest/README.md#incorporating-into-an-existing-cmake-project)
Thus, you can use the CMake command
add_subdirectory()
to include OR-Tools directly from a subdirectory of your C++ CMake project.
Note: The ortools::ortools target is in this case an ALIAS library target
for the ortools library target.
cmake_minimum_required(VERSION 3.0.2)
project(myproj VERSION 1.0)
add_subdirectory(or-tools)
add_executable(myapp main.cpp)
target_link_libraries(myapp ortools::ortools)
Again, include directories, compile definitions and compile options will be added automatically to your target as needed.