You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: android/README.md
+22-4Lines changed: 22 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,30 @@ These instructions describe how to build the OpenCilk runtime system for Android
8
8
## Setup Android Studio and NDK
9
9
10
10
1. Install [Android Studio](https://developer.android.com/studio) with [NDK](https://developer.android.com/studio/projects/install-ndk) onto your system.
11
-
2. Replace NDK's copy of `clang-<version>` with OpenCilk's `clang-<version>`. For example, for NDK version 28, which includes a prebuilt LLVM toolchain based on LLVM 19, replace the `clang-19` binary in that NDK with OpenCilk's `clang-19` binary.
11
+
2. Replace [NDK's copy of `clang-<version>`](https://developer.android.com/ndk/guides/other_build_systems#overview) with OpenCilk's `clang-<version>` binary. For example, for NDK version 28, which includes a prebuilt LLVM toolchain based on LLVM 19, replace the `clang-19` binary in that NDK with OpenCilk's `clang-19` binary.
12
12
> [!TIP]
13
13
> Save the distributed `clang-<version>` binary in the NDK somewhere before replacing it with the OpenCilk version, so you can restore it if anything goes wrong.
14
14
15
15
## Build the runtime system
16
16
17
-
1. Run `ndk-build` inside the `android/jni` subdirectory of this repository.
18
-
2. Make sure your Android project contains a `jniLibs` subdirectory in the [correct place](https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs), for example, as a subdirectory within `src/main`.
19
-
3. Copy `android/libs/*` into your Android project under the `jniLibs` subdirectory.
17
+
1. Export the `NDK` environment variable set to the path to the NDK in Android Studio.
18
+
2. Run `$NDK/ndk-build` inside the `android/jni` subdirectory of this repository.
19
+
3. Run `make -f libopencilk-abi.mk` inside the `android/jni` subdirectory.
20
+
21
+
## Use OpenCilk in your Android project
22
+
23
+
1. Make sure your Android project contains a `jniLibs` subdirectory in the [correct place](https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs), for example, as a subdirectory within `src/main`.
24
+
2. Copy `android/libs/*` in your copy of this repository into the `jniLibs` subdirectory of your Android project.
25
+
3. To compile the Cilk parts of your Android project, add these flags to `CMAKE_C_FLAGS` or `CMAKE_CXX_FLAGS`:
5. [Optional] To use OpenCilk runtime headers, first copy the contents of the `include/cilk` subdirectory in this repository into an `include/cilk` subdirectory in your Android project, such as in `app/src/main/cpp/include/cilk`. Then use `include_directories()` to add that `include` directory, such as via `include_directories(${CMAKE_SOURCE_DIR}/include)`.
0 commit comments