Files
ortools-clone/bazel/README.md

110 lines
2.8 KiB
Markdown
Raw Normal View History

# OR-Tools Bazel Build Instructions
2024-09-18 11:56:41 +02:00
| OS | C++ |
|:---- | :---: |
| amd64 Linux | [![Status][linux_svg]][linux_link] |
| arm64 MacOS | [![Status][arm64_macos_svg]][arm64_macos_link] |
| amd64 MacOS | [![Status][amd64_macos_svg]][amd64_macos_link] |
| amd64 Windows | [![Status][windows_svg]][windows_link] |
[linux_svg]: ./../../../actions/workflows/amd64_linux_bazel.yml/badge.svg?branch=main
[linux_link]: ./../../../actions/workflows/amd64_linux_bazel.yml
2024-09-18 11:56:41 +02:00
[arm64_macos_svg]: ./../../../actions/workflows/arm64_macos_bazel.yml/badge.svg?branch=main
[arm64_macos_link]: ./../../../actions/workflows/arm64_macos_bazel.yml
[amd64_macos_svg]: ./../../../actions/workflows/amd64_macos_bazel.yml/badge.svg?branch=main
[amd64_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
2021-06-18 15:43:10 +02:00
Dockers [Alpine, Archlinux, Centos, Debian, Fedora, OpenSuse, Ubuntu]: [![Status][docker_svg]][docker_link]
[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
## Introduction
2021-11-19 14:52:25 +01: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> |
<a href="#integration">Integration</a> |
2022-01-06 17:05:18 +01:00
<a href="docs/ci.md">CI</a> |
</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.**
2022-01-26 10:26:04 +01:00
## Requirement
2022-01-26 10:26:04 +01:00
You'll need:
* `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)
## Compilation
2021-11-19 14:52:25 +01: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
```
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).