2020-04-01 14:03:57 +02:00
|
|
|
# OR-Tools Bazel Build Instructions
|
2021-06-18 15:43:10 +02:00
|
|
|
| OS | C++ |
|
|
|
|
|
|:-------- | :---: |
|
|
|
|
|
| Linux | [![Status][linux_svg]][linux_link] |
|
|
|
|
|
| MacOS | [![Status][macos_svg]][macos_link] |
|
|
|
|
|
| Windows | [![Status][windows_svg]][windows_link] |
|
2020-04-01 14:03:57 +02:00
|
|
|
|
2023-07-06 17:36:53 +02:00
|
|
|
[linux_svg]: ./../../../actions/workflows/amd64_linux_bazel.yml/badge.svg?branch=main
|
|
|
|
|
[linux_link]: ./../../../actions/workflows/amd64_linux_bazel.yml
|
|
|
|
|
[macos_svg]: ./../../../actions/workflows/amd64_macos_bazel.yml/badge.svg?branch=main
|
|
|
|
|
[macos_link]: ./../../../actions/workflows/amd64_macos_bazel.yml
|
|
|
|
|
[windows_svg]: ./../../../actions/workflows/amd64_windows_bazel.yml/badge.svg?branch=main
|
|
|
|
|
[windows_link]: ./../../../actions/workflows/amd64_windows_bazel.yml
|
2020-04-01 14:03:57 +02:00
|
|
|
|
2021-06-18 15:43:10 +02:00
|
|
|
Dockers [Alpine, Archlinux, Centos, Debian, Fedora, OpenSuse, Ubuntu]: [![Status][docker_svg]][docker_link]
|
|
|
|
|
|
2023-07-06 17:36:53 +02:00
|
|
|
[docker_svg]: ./../../../actions/workflows/amd64_docker_bazel.yml/badge.svg?branch=main
|
|
|
|
|
[docker_link]: ./../../../actions/workflows/amd64_docker_bazel.yml
|
2021-06-18 15:43:10 +02:00
|
|
|
|
2020-04-01 14:03:57 +02:00
|
|
|
## Introduction
|
2021-11-19 14:52:25 +01:00
|
|
|
|
2020-04-01 14:03:57 +02:00
|
|
|
<nav for="bazel"> |
|
2022-01-26 10:26:04 +01:00
|
|
|
<a href="#requirement">Requirement</a> |
|
2021-11-19 14:52:25 +01:00
|
|
|
<a href="#dependencies">Dependencies</a> |
|
|
|
|
|
<a href="#compilation">Compilation</a> |
|
|
|
|
|
<a href="#testing">Testing</a> |
|
2020-04-01 14:03:57 +02:00
|
|
|
<a href="#integration">Integration</a> |
|
2022-01-06 17:05:18 +01:00
|
|
|
<a href="docs/ci.md">CI</a> |
|
2020-04-01 14:03:57 +02:00
|
|
|
</nav>
|
|
|
|
|
|
|
|
|
|
OR-Tools comes with a Bazel based build ([WORKSPACE](../WORKSPACE)) that can be
|
|
|
|
|
used on a wide range of platforms. If you don't have Bazel installed already,
|
|
|
|
|
you can download it for free from <https://bazel.build/>.
|
|
|
|
|
|
2020-11-05 16:25:48 +01:00
|
|
|
**warning: Currently OR-Tools Bazel doesn't support Python, Java nor .Net,
|
|
|
|
|
please use the Makefile or CMake based build instead.**
|
2020-04-01 14:03:57 +02:00
|
|
|
|
2022-01-26 10:26:04 +01:00
|
|
|
## Requirement
|
2023-04-12 11:41:49 +02:00
|
|
|
|
2022-01-26 10:26:04 +01:00
|
|
|
You'll need:
|
|
|
|
|
|
2023-04-12 11:41:49 +02:00
|
|
|
* `Bazel >= 5.4.0`.
|
|
|
|
|
* A compiler with C++17 support.
|
2022-01-26 10:26:04 +01:00
|
|
|
|
2022-06-16 22:56:55 +02:00
|
|
|
## Solvers supported
|
|
|
|
|
|
|
|
|
|
Here the list of supported solvers:
|
|
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
* CP-SAT
|
|
|
|
|
* GLOP
|
|
|
|
|
* GLPK
|
|
|
|
|
* PDLP
|
|
|
|
|
* SCIP
|
2022-06-16 22:56:55 +02:00
|
|
|
|
2021-01-14 21:59:32 +01:00
|
|
|
## Dependencies
|
2021-11-19 14:52:25 +01:00
|
|
|
|
2022-02-23 16:17:40 +01:00
|
|
|
OR-Tools depends on several mandatory libraries.
|
|
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
* Eigen
|
|
|
|
|
* Google Abseil-cpp,
|
|
|
|
|
* Google Protobuf,
|
|
|
|
|
* Google Gtest,
|
|
|
|
|
* Bliss,
|
|
|
|
|
* SCIP,
|
|
|
|
|
* GLPK (GNU Linear Programming Kit)
|
2020-04-01 14:03:57 +02:00
|
|
|
|
2020-08-11 12:19:52 +02:00
|
|
|
## Compilation
|
2021-11-19 14:52:25 +01:00
|
|
|
|
2023-04-12 11:41:49 +02:00
|
|
|
You must compile OR-Tools using at least C++17 (C++20 on windows):
|
2021-01-27 15:06:54 +01:00
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
* on UNIX:
|
2022-03-03 14:08:37 +01:00
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
```sh
|
2024-01-19 17:52:54 +01:00
|
|
|
bazel build -c opt --cxxopt=-std=c++17 ...
|
2022-06-22 17:51:14 +02:00
|
|
|
```
|
2022-03-03 14:08:37 +01:00
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
* on Windows when using MSVC:
|
|
|
|
|
|
|
|
|
|
```sh
|
2024-01-19 17:52:54 +01:00
|
|
|
bazel build -c opt --cxxopt="/std:c++20" ...
|
2022-06-22 17:51:14 +02:00
|
|
|
```
|
2020-08-11 12:19:52 +02:00
|
|
|
|
2021-11-19 14:52:25 +01:00
|
|
|
## Testing
|
|
|
|
|
|
2021-11-19 14:55:58 +01:00
|
|
|
You may run tests using:
|
2021-11-19 14:52:25 +01:00
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
* on UNIX:
|
|
|
|
|
|
|
|
|
|
```sh
|
2024-01-19 17:52:54 +01:00
|
|
|
bazel test -c opt --cxxopt=-std=c++17 ...
|
2022-06-22 17:51:14 +02:00
|
|
|
```
|
2022-03-03 14:08:37 +01:00
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
* on Windows when using MSVC:
|
2022-03-03 14:08:37 +01:00
|
|
|
|
2022-06-22 17:51:14 +02:00
|
|
|
```sh
|
2024-01-19 17:52:54 +01:00
|
|
|
bazel test -c opt --cxxopt="/std:c++20" ...
|
2022-06-22 17:51:14 +02:00
|
|
|
```
|
2021-11-19 14:52:25 +01:00
|
|
|
|
|
|
|
|
## Integration
|
|
|
|
|
|
|
|
|
|
To integrate OR-Tools in your own Bazel project,
|
|
|
|
|
you can take a look at the template project:
|
2021-01-14 21:59:32 +01:00
|
|
|
[or-tools/bazel\_or-tools](https://github.com/or-tools/bazel_or-tools).
|