|
| 1 | +# The OpenCilk runtime system |
| 2 | + |
| 3 | +This repository contains the source code of the OpenCilk runtime system. This library is intended to be used with the [OpenCilk compiler](https://github.com/OpenCilk/opencilk-project) and can either be built [together with the compiler](https://www.opencilk.org/doc/users-guide/build-opencilk-from-source/) or as a standalone library. |
| 4 | + |
1 | 5 | ## Building a standalone copy of the OpenCilk runtime |
2 | 6 |
|
3 | | -These instructions assume that you are building the OpenCilk runtime system |
4 | | -using the OpenCilk compiler. |
| 7 | +These instructions assume that you are building the OpenCilk runtime system using the OpenCilk compiler. |
5 | 8 |
|
6 | 9 | ### Using Makefiles |
7 | 10 |
|
8 | | -1. If necessary, update the `COMPILER_BASE` variable in `config.mk` to point |
9 | | - to the directory containing the OpenCilk compiler binaries, e.g., |
10 | | - `/path/to/opencilk-project/build/bin/`. When it executes `clang` and other |
11 | | - OpenCilk compiler binaries, the Makefile prepends this path to those |
12 | | - binaries. |
| 11 | +1. If necessary, update the `COMPILER_BASE` variable in `config.mk` to point to the directory containing the OpenCilk compiler binaries, e.g., `/path/to/opencilk-project/build/bin/`. When it executes `clang` and other OpenCilk compiler binaries, the Makefile prepends this path to those binaries. |
13 | 12 | 2. Run `make`. |
14 | 13 |
|
15 | 14 | To clean the build, run `make clean`. |
16 | 15 |
|
17 | 16 | ### Using CMake |
18 | 17 |
|
19 | 18 | 1. Make a build directory at the top level and enter it: |
20 | | -``` |
21 | | -$ mkdir build |
22 | | -$ cd build |
23 | | -``` |
24 | | -2. Configure CMake. Make sure to specify `CMAKE_C_COMPILER` and |
25 | | -`LLVM_CMAKE_DIR` to point to the corresponding build or installation |
26 | | -of the OpenCilk compiler binaries. In addition, set |
27 | | -`CMAKE_BUILD_TYPE` to specify the build type, such as, `Debug`, for an |
28 | | -unoptimized build with all assertions enabled; `Release`, for an fully |
29 | | -optimized build with assertions disabled; or `RelWithDebInfo`, to |
30 | | -enable some optimizations and assertions. (The default build type is |
31 | | -`Debug`.) |
32 | | - |
33 | | -Example configuration: |
34 | | -``` |
35 | | -$ cmake -DCMAKE_C_COMPILER=/path/to/opencilk-project/build/bin/clang -DCMAKE_BUILD_TYPE=Release -DLLVM_CMAKE_DIR=/path/to/opencilk-project/build ../ |
36 | | -``` |
| 19 | + |
| 20 | + ```console |
| 21 | + mkdir build |
| 22 | + cd build |
| 23 | + ``` |
| 24 | + |
| 25 | +2. Configure CMake. Make sure to specify `CMAKE_C_COMPILER`, `CMAKE_CXX_COMPILER`, and `LLVM_CMAKE_DIR` to point to the corresponding build or installation of the OpenCilk compiler binaries. In addition, set `CMAKE_BUILD_TYPE` to specify the build type, such as: |
| 26 | + |
| 27 | + - `Debug`, for an unoptimized build with all assertions enabled (default); |
| 28 | + - `Release`, for an fully optimized build with assertions disabled; or |
| 29 | + - `RelWithDebInfo`, to enable some optimizations and assertions. |
| 30 | + |
| 31 | + ```console |
| 32 | + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/path/to/opencilk-project/build/bin/clang -DCMAKE_CXX_COMPILER=/path/to/opencilk-project/build/bin/clang++ -DLLVM_CMAKE_DIR=/path/to/opencilk-project/build ../ |
| 33 | + ``` |
| 34 | + |
37 | 35 | 3. Build the runtime: |
38 | | -``` |
39 | | -$ cmake --build . -- -j<number of build threads> |
40 | | -``` |
41 | 36 |
|
42 | | -To clean the build, run `cmake --build . --target clean` from the build |
43 | | -directory. |
| 37 | + ```console |
| 38 | + cmake --build . -- -j<number of build threads> |
| 39 | + ``` |
44 | 40 |
|
45 | | -## Linking against a standalone build of the OpenCilk runtime |
| 41 | +To clean the build, run `cmake --build . --target clean` from the build directory. |
46 | 42 |
|
47 | | -The OpenCilk compiler accepts the flag |
48 | | -`--opencilk-resource-dir=/path/to/cheetah` to specify where to find all |
49 | | -relevant OpenCilk runtime files, including the runtime library, the |
50 | | -bitcode ABI file, and associated header files. This resource directory |
51 | | -should have `include/` and `lib/<target triple>` as subdirectories. For |
52 | | -example, if you built the standalone OpenCilk runtime using CMake, then |
53 | | -pass the flag `--opencilk-resource-dir=/path/to/cheetah/build` to the |
54 | | -OpenCilk compiler to link against that standalone build, e.g., |
55 | | -``` |
| 43 | +## Using a standalone build of the OpenCilk runtime |
| 44 | + |
| 45 | +The OpenCilk compiler accepts the flag `--opencilk-resource-dir=/path/to/cheetah` to specify where to find all relevant OpenCilk runtime files, including the runtime library, the bitcode ABI file, and associated header files. This resource directory should have `include/` and `lib/<target triple>` as subdirectories. For example, if you built the standalone OpenCilk runtime using CMake, then pass the flag `--opencilk-resource-dir=/path/to/cheetah/build` to the OpenCilk compiler to link against that standalone build as follows: |
| 46 | + |
| 47 | +```console |
56 | 48 | /path/to/opencilk-project/build/bin/clang -o fib fib.c -fopencilk -O3 --opencilk-resource-dir=/path/to/cheetah/build |
57 | 49 | ``` |
0 commit comments