xref: /oneTBB/INSTALL.md (revision d5a5a723)
1# Installation from Sources
2
3
4## Prerequisites
5
6   - Make sure you have installed CMake version 3.1 (or newer) on your system. oneTBB uses CMake build configuration.
7   - Configure and build oneTBB. To work with build configurations, see [Build System Description](cmake/README.md).
8
9
10## Configure oneTBB
11
12At the command prompt, type:
13```
14cmake <options> <repo_root>
15```
16
17You may want to use some additional options for configuration:
18
19| Option                    | Purpose                   | Description                                                                        |
20| ------                    |------                     | ------                                                                             |
21| `-G <generator>`          | Specify project generator | For more information, run cmake `–help`.                                           |
22|`-DCMAKE_BUILD_TYPE=Debug` | Specify for Debug build   | Not applicable for multi-configuration generators such as Visual Studio generator. |
23
24
25## Build oneTBB
26
27To build the system, run:
28```
29cmake --build . <options>
30```
31
32Some useful build options:
33- `--target <target>` - specific target, "all" is default.
34-	`--config <Release|Debug>` - build configuration, applicable only for multi-config generators such as Visual Studio generator.
35
36
37## Install and Pack oneTBB
38
39---
40**NOTE**
41
42Be careful about installing prefix. It defaults to `/usr/local` on UNIX* and `c:/Program Files/${PROJECT_NAME}` on Windows* OS.
43You can define custom `CMAKE_INSTALL_PREFIX` during configuration:
44
45```
46cmake -DCMAKE_INSTALL_PREFIX=/my/install/prefix ..
47```
48
49---
50
51Installation can also be done using:
52
53```
54cmake --install <project-binary-dir>
55```
56
57Special ``--install`` target can alternatively be used for installation, e.g. ``make install``.
58
59You can use the ``install`` components for partial installation.
60
61The following install components are supported:
62- `runtime` - oneTBB runtime package (core shared libraries and `.dll` files on Windows* OS).
63- `devel` - oneTBB development package (header files, CMake integration files, library symbolic links, and `.lib` files on Windows* OS).
64- `tbb4py` - [oneTBB Module for Python](https://github.com/oneapi-src/oneTBB/blob/master/python/README.md).
65
66If you want to install specific components after configuration and build, run:
67
68```bash
69cmake -DCOMPONENT=<component> [-DBUILD_TYPE=<build-type>] -P cmake_install.cmake
70```
71
72Simple packaging using CPack is supported.
73The following commands allow you to create a simple portable package that includes header files, libraries, and integration files for CMake:
74
75```bash
76cmake <options> ..
77cpack
78```
79
80## Installation from vcpkg
81
82You can download and install oneTBB using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
83```sh
84  git clone https://github.com/Microsoft/vcpkg.git
85  cd vcpkg
86  ./bootstrap-vcpkg.sh #.\bootstrap-vcpkg.bat(for Windows)
87  ./vcpkg integrate install
88  ./vcpkg install tbb
89```
90
91The 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).
92
93## Example of Installation
94
95### Single-configuration generators
96
97The following example demonstrates how to install oneTBB for single-configuration generators (e.g. GNU Make, Ninja, etc.).
98```bash
99# Do our experiments in /tmp
100cd /tmp
101# Clone oneTBB repository
102git clone https://github.com/oneapi-src/oneTBB.git
103cd oneTBB
104# Create binary directory for out-of-source build
105mkdir build && cd build
106# Configure: customize CMAKE_INSTALL_PREFIX and disable TBB_TEST to avoid tests build
107cmake -DCMAKE_INSTALL_PREFIX=/tmp/my_installed_onetbb -DTBB_TEST=OFF ..
108# Build
109cmake --build .
110# Install
111cmake --install .
112# Well done! Your installed oneTBB is in /tmp/my_installed_onetbb
113```
114
115### Multi-configuration generators
116
117The following example demonstrates how to install oneTBB for multi-configuration generators such as Visual Studio*.
118
119Choose the configuration during the build and install steps:
120```batch
121REM Do our experiments in %TMP%
122cd %TMP%
123REM Clone oneTBB repository
124git clone https://github.com/oneapi-src/oneTBB.git
125cd oneTBB
126REM Create binary directory for out-of-source build
127mkdir build && cd build
128REM Configure: customize CMAKE_INSTALL_PREFIX and disable TBB_TEST to avoid tests build
129cmake -DCMAKE_INSTALL_PREFIX=%TMP%\my_installed_onetbb -DTBB_TEST=OFF ..
130REM Build "release with debug information" configuration
131cmake --build . --config relwithdebinfo
132REM Install "release with debug information" configuration
133cmake --install . --config relwithdebinfo
134REM Well done! Your installed oneTBB is in %TMP%\my_installed_onetbb
135```
136