xref: /oneTBB/INSTALL.md (revision d5a5a723)
125f8494fSAlexandra# Installation from Sources
225f8494fSAlexandra
325f8494fSAlexandra
425f8494fSAlexandra## Prerequisites
525f8494fSAlexandra
625f8494fSAlexandra   - Make sure you have installed CMake version 3.1 (or newer) on your system. oneTBB uses CMake build configuration.
725f8494fSAlexandra   - Configure and build oneTBB. To work with build configurations, see [Build System Description](cmake/README.md).
825f8494fSAlexandra
925f8494fSAlexandra
10fc824596Sandreastedile## Configure oneTBB
1125f8494fSAlexandra
1225f8494fSAlexandraAt the command prompt, type:
1325f8494fSAlexandra```
1425f8494fSAlexandracmake <options> <repo_root>
1525f8494fSAlexandra```
1625f8494fSAlexandra
1725f8494fSAlexandraYou may want to use some additional options for configuration:
1825f8494fSAlexandra
1925f8494fSAlexandra| Option                    | Purpose                   | Description                                                                        |
2025f8494fSAlexandra| ------                    |------                     | ------                                                                             |
2125f8494fSAlexandra| `-G <generator>`          | Specify project generator | For more information, run cmake `–help`.                                           |
2225f8494fSAlexandra|`-DCMAKE_BUILD_TYPE=Debug` | Specify for Debug build   | Not applicable for multi-configuration generators such as Visual Studio generator. |
2325f8494fSAlexandra
2425f8494fSAlexandra
2525f8494fSAlexandra## Build oneTBB
2625f8494fSAlexandra
2725f8494fSAlexandraTo build the system, run:
2825f8494fSAlexandra```
2925f8494fSAlexandracmake --build . <options>
3025f8494fSAlexandra```
3125f8494fSAlexandra
3225f8494fSAlexandraSome useful build options:
3325f8494fSAlexandra- `--target <target>` - specific target, "all" is default.
3425f8494fSAlexandra-	`--config <Release|Debug>` - build configuration, applicable only for multi-config generators such as Visual Studio generator.
3525f8494fSAlexandra
3625f8494fSAlexandra
3725f8494fSAlexandra## Install and Pack oneTBB
3825f8494fSAlexandra
3925f8494fSAlexandra---
4025f8494fSAlexandra**NOTE**
4125f8494fSAlexandra
4225f8494fSAlexandraBe careful about installing prefix. It defaults to `/usr/local` on UNIX* and `c:/Program Files/${PROJECT_NAME}` on Windows* OS.
4325f8494fSAlexandraYou can define custom `CMAKE_INSTALL_PREFIX` during configuration:
4425f8494fSAlexandra
4525f8494fSAlexandra```
4625f8494fSAlexandracmake -DCMAKE_INSTALL_PREFIX=/my/install/prefix ..
4725f8494fSAlexandra```
4825f8494fSAlexandra
4925f8494fSAlexandra---
5025f8494fSAlexandra
5125f8494fSAlexandraInstallation can also be done using:
5225f8494fSAlexandra
5325f8494fSAlexandra```
5425f8494fSAlexandracmake --install <project-binary-dir>
5525f8494fSAlexandra```
5625f8494fSAlexandra
5725f8494fSAlexandraSpecial ``--install`` target can alternatively be used for installation, e.g. ``make install``.
5825f8494fSAlexandra
5925f8494fSAlexandraYou can use the ``install`` components for partial installation.
6025f8494fSAlexandra
6125f8494fSAlexandraThe following install components are supported:
6225f8494fSAlexandra- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows* OS).
6325f8494fSAlexandra- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links, and `.lib` files on Windows* OS).
64*d5a5a723SAlexandra- `tbb4py` - [oneTBB Module for Python](https://github.com/oneapi-src/oneTBB/blob/master/python/README.md).
6525f8494fSAlexandra
6625f8494fSAlexandraIf you want to install specific components after configuration and build, run:
6725f8494fSAlexandra
6825f8494fSAlexandra```bash
6925f8494fSAlexandracmake -DCOMPONENT=<component> [-DBUILD_TYPE=<build-type>] -P cmake_install.cmake
7025f8494fSAlexandra```
7125f8494fSAlexandra
7225f8494fSAlexandraSimple packaging using CPack is supported.
7325f8494fSAlexandraThe following commands allow you to create a simple portable package that includes header files, libraries, and integration files for CMake:
7425f8494fSAlexandra
7525f8494fSAlexandra```bash
7625f8494fSAlexandracmake <options> ..
7725f8494fSAlexandracpack
7825f8494fSAlexandra```
7925f8494fSAlexandra
80dece0169SCheney Wang## Installation from vcpkg
81dece0169SCheney Wang
82dece0169SCheney WangYou can download and install oneTBB using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
83dece0169SCheney Wang```sh
84dece0169SCheney Wang  git clone https://github.com/Microsoft/vcpkg.git
85dece0169SCheney Wang  cd vcpkg
86dece0169SCheney Wang  ./bootstrap-vcpkg.sh #.\bootstrap-vcpkg.bat(for Windows)
87dece0169SCheney Wang  ./vcpkg integrate install
88dece0169SCheney Wang  ./vcpkg install tbb
89dece0169SCheney Wang```
90dece0169SCheney Wang
91dece0169SCheney WangThe oneTBB port in vcpkg is kept up to date by Microsoft* team members and community contributors. If the version is out of date, create an issue or pull request on the [vcpkg repository](https://github.com/Microsoft/vcpkg).
92dece0169SCheney Wang
9325f8494fSAlexandra## Example of Installation
9425f8494fSAlexandra
9570ac2444SAlexey Veprev### Single-configuration generators
9670ac2444SAlexey Veprev
9770ac2444SAlexey VeprevThe following example demonstrates how to install oneTBB for single-configuration generators (e.g. GNU Make, Ninja, etc.).
9825f8494fSAlexandra```bash
9925f8494fSAlexandra# Do our experiments in /tmp
10025f8494fSAlexandracd /tmp
10125f8494fSAlexandra# Clone oneTBB repository
10225f8494fSAlexandragit clone https://github.com/oneapi-src/oneTBB.git
10325f8494fSAlexandracd oneTBB
10425f8494fSAlexandra# Create binary directory for out-of-source build
10525f8494fSAlexandramkdir build && cd build
10670ac2444SAlexey Veprev# Configure: customize CMAKE_INSTALL_PREFIX and disable TBB_TEST to avoid tests build
10725f8494fSAlexandracmake -DCMAKE_INSTALL_PREFIX=/tmp/my_installed_onetbb -DTBB_TEST=OFF ..
10825f8494fSAlexandra# Build
10925f8494fSAlexandracmake --build .
11025f8494fSAlexandra# Install
11125f8494fSAlexandracmake --install .
11225f8494fSAlexandra# Well done! Your installed oneTBB is in /tmp/my_installed_onetbb
11325f8494fSAlexandra```
11470ac2444SAlexey Veprev
11570ac2444SAlexey Veprev### Multi-configuration generators
11670ac2444SAlexey Veprev
11770ac2444SAlexey VeprevThe following example demonstrates how to install oneTBB for multi-configuration generators such as Visual Studio*.
11870ac2444SAlexey Veprev
11970ac2444SAlexey VeprevChoose the configuration during the build and install steps:
12070ac2444SAlexey Veprev```batch
12170ac2444SAlexey VeprevREM Do our experiments in %TMP%
12270ac2444SAlexey Veprevcd %TMP%
12370ac2444SAlexey VeprevREM Clone oneTBB repository
12470ac2444SAlexey Veprevgit clone https://github.com/oneapi-src/oneTBB.git
12570ac2444SAlexey Veprevcd oneTBB
12670ac2444SAlexey VeprevREM Create binary directory for out-of-source build
12770ac2444SAlexey Veprevmkdir build && cd build
12870ac2444SAlexey VeprevREM Configure: customize CMAKE_INSTALL_PREFIX and disable TBB_TEST to avoid tests build
12970ac2444SAlexey Veprevcmake -DCMAKE_INSTALL_PREFIX=%TMP%\my_installed_onetbb -DTBB_TEST=OFF ..
13070ac2444SAlexey VeprevREM Build "release with debug information" configuration
13170ac2444SAlexey Veprevcmake --build . --config relwithdebinfo
13270ac2444SAlexey VeprevREM Install "release with debug information" configuration
13370ac2444SAlexey Veprevcmake --install . --config relwithdebinfo
13470ac2444SAlexey VeprevREM Well done! Your installed oneTBB is in %TMP%\my_installed_onetbb
13570ac2444SAlexey Veprev```
136