Skip to content

Commit 7d3719c

Browse files
committed
Merge branch 'pstl' into erfan_merge
2 parents 7889d26 + a019b48 commit 7d3719c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+783
-500
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# CEGUI's downloaded dependencies on Windows
1717
3rdparty/CEGUI/cegui-deps-0.8.x-src.zip
1818
# usually where people build
19+
android_build/*
1920
build*/*
2021
# default install paths
2122
install/*

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,9 @@
8686
[submodule "3rdparty/nbl_spirv_cross"]
8787
path = 3rdparty/nbl_spirv_cross
8888
url = https://github.com/devshgraphicsprogramming/SPIRV-Cross.git
89+
[submodule "3rdparty/pstl/oneTBB"]
90+
path = 3rdparty/pstl/oneTBB
91+
url = https://github.com/Devsh-Graphics-Programming/oneTBB.git
92+
[submodule "3rdparty/pstl/oneDPL/oneDPL"]
93+
path = 3rdparty/pstl/oneDPL/oneDPL
94+
url = https://github.com/Devsh-Graphics-Programming/oneDPL.git

3rdparty/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ if(NBL_UPDATE_GIT_SUBMODULE)
3131
update_git_submodule(./portable-file-dialogs)
3232
update_git_submodule(./simdjson)
3333
update_git_submodule(./glTFSampleModels)
34+
update_git_submodule(./pstl/oneTBB)
35+
update_git_submodule(./pstl/oneDPL/oneDPL)
3436
endif()
3537

3638
# simdjson
@@ -62,6 +64,10 @@ if(DEFINED ENV{VULKAN_SDK})
6264
target_include_directories(volk_headers INTERFACE "$ENV{VULKAN_SDK}/include")
6365
endif()
6466

67+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
68+
add_subdirectory(pstl pstl)
69+
endif()
70+
6571
# SDL2
6672
if (NBL_COMPILE_WITH_SDL2)
6773
set(SDL_STATIC_ENABLED_BY_DEFAULT ON)

3rdparty/openssl/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ elseif(ANDROID) # cross-compile
5757
# ATTENTION - it used to work but ENV variable doesn't work while building https://cmake.org/cmake/help/latest/command/set.html#set-environment-variable, TODO check after changes one more time
5858
add_custom_command(
5959
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/build/lib/libcrypto.a" "${CMAKE_CURRENT_BINARY_DIR}/build/lib/libssl.a"
60-
COMMAND make clean
6160
# not sure if linux-generic64 is right (https://stackoverflow.com/questions/26779531/openssl-for-android-x86-64-and-mips64)
6261
# but android-x86_64 is not even recognized (should be according to this https://github.com/openssl/openssl/blob/master/NOTES-ANDROID.md)
6362
COMMAND "${PERL_EXECUTABLE}" "${_COPY_BIN_SOURCE_}/Configure" linux-generic64 no-asm no-shared -D__ANDROID_API__=${ANDROID_API_LEVEL} --openssldir=${CMAKE_CURRENT_BINARY_DIR}/build
@@ -120,4 +119,4 @@ else()
120119
"${CMAKE_CURRENT_BINARY_DIR}/build/lib/libcrypto.a"
121120
"${CMAKE_CURRENT_BINARY_DIR}/build/lib/libssl.a"
122121
)
123-
endif()
122+
endif()

3rdparty/pstl/CMakeLists.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") # only non-multi-generators and clang supported
2+
get_filename_component(CCBD_ABSOLUTE "${CMAKE_CURRENT_BINARY_DIR}" ABSOLUTE)
3+
4+
set(TBB_INSTALL_VARS ON CACHE BOOL "" FORCE)
5+
set(TBB_TEST OFF CACHE BOOL "" FORCE)
6+
set(TBB_STRICT ON CACHE BOOL "" FORCE)
7+
set(PREVIOUS_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS})
8+
set(BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
9+
set(TBB_SANITIZE "" CACHE STRING "" FORCE)
10+
add_subdirectory(oneTBB oneTBB)
11+
12+
if(PREVIOUS_BUILD_SHARED_LIBS)
13+
set(BUILD_SHARED_LIBS ${PREVIOUS_BUILD_SHARED_LIBS} CACHE BOOL "" FORCE)
14+
else()
15+
unset(BUILD_SHARED_LIBS CACHE)
16+
endif()
17+
18+
set(ONETBB_BUILD ${CCBD_ABSOLUTE}/oneTBB)
19+
set(ONETBB_INSTALL_DIR ${ONETBB_BUILD}/install CACHE STRING "oneTBB install directory" FORCE)
20+
21+
add_custom_target(onetbb_build
22+
COMMAND ${CMAKE_COMMAND} --install ${ONETBB_BUILD} --component devel -v --config $<CONFIG> --prefix ${ONETBB_INSTALL_DIR}
23+
COMMAND ${CMAKE_COMMAND} --install ${ONETBB_BUILD} --component runtime -v --config $<CONFIG> --prefix ${ONETBB_INSTALL_DIR}
24+
DEPENDS tbb tbbmalloc tbbmalloc_proxy
25+
COMMENT "Building oneTBB..."
26+
)
27+
28+
set(ONEDPL_BUILD ${CCBD_ABSOLUTE}/oneDPL/build)
29+
set(ONEDPL_INSTALL_DIR ${ONEDPL_BUILD}/install CACHE STRING "oneDPL install directory" FORCE)
30+
31+
set(CMAKE_ARGS_ONEDPL
32+
-DCMAKE_BUILD_TYPE:STRING=$<CONFIG>
33+
-DONETBB_INSTALL_DIR:PATH=${ONETBB_INSTALL_DIR}
34+
)
35+
36+
if(ANDROID)
37+
list(APPEND CMAKE_ARGS_ONEDPL
38+
-DCMAKE_TOOLCHAIN_FILE:FILEPATH=${CMAKE_TOOLCHAIN_FILE}
39+
-DANDROID_ABI:STRING=${ANDROID_ABI}
40+
-DANDROID_PLATFORM:STRING=${ANDROID_PLATFORM}
41+
)
42+
endif()
43+
44+
ExternalProject_Add(oneDPL
45+
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/oneDPL
46+
BINARY_DIR ${ONEDPL_BUILD}
47+
CMAKE_ARGS ${CMAKE_ARGS_ONEDPL}
48+
BUILD_COMMAND cmake --build ${ONEDPL_BUILD} --target build-all
49+
INSTALL_COMMAND cmake --install ${ONEDPL_BUILD} --prefix ${ONEDPL_INSTALL_DIR}
50+
USES_TERMINAL_BUILD 1
51+
COMMENT "Building oneDPL..."
52+
)
53+
54+
add_dependencies(oneDPL onetbb_build)
55+
endif()

3rdparty/pstl/oneDPL/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cmake_minimum_required(VERSION 3.20)
2+
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/toolchains/android/build.cmake)
3+
4+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
5+
if(NOT DEFINED ONETBB_INSTALL_DIR)
6+
message(FATAL_ERROR "oneDPL submodule requires valid ONETBB_INSTALL_DIR!")
7+
endif()
8+
9+
set(TBB_DIR ${ONETBB_INSTALL_DIR}/lib/cmake/TBB CACHE INTERNAL "" FORCE)
10+
set(ONEDPL_BACKEND tbb CACHE STRING "" FORCE)
11+
add_subdirectory(oneDPL oneDPL)
12+
13+
if(ANDROID)
14+
add_compile_options(
15+
$<$<CONFIG:DEBUG>:-glldb>
16+
)
17+
endif()
18+
endif()

3rdparty/pstl/oneDPL/oneDPL

Submodule oneDPL added at 0bd676a

3rdparty/pstl/oneTBB

Submodule oneTBB added at 3df08fe

CMakeLists.txt

Lines changed: 2 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -7,188 +7,9 @@ cmake_minimum_required(VERSION 3.20)
77
cmake_policy(SET CMP0072 OLD) #not yet, would need to get pointers to all OpenGL functions
88
set(OpenGL_GL_PREFERENCE LEGACY)
99
#cmake_policy(SET CMP )
10-
option(NBL_BUILD_ANDROID "Build for Android?" OFF)
1110

12-
if(DEFINED CMAKE_TOOLCHAIN_FILE) # TODO - validate paths due to CMake path-policy (errors when no path passed in)
13-
cmake_path(GET CMAKE_TOOLCHAIN_FILE FILENAME _NBL_CMAKE_TOOLCHAIN_FILENAME_)
14-
15-
if(${_NBL_CMAKE_TOOLCHAIN_FILENAME_} STREQUAL "android.toolchain.cmake")
16-
message(STATUS "Found Android toolchain! Validating...")
17-
18-
set(_NBL_SUPPORTED_NDK_ "android-ndk-r22b") # supported NDK version
19-
set(_NBL_SUPPORTED_ABI_ "x86_64") # supported ABI
20-
21-
# quering ${_NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_}/${_NBL_SUPPORTED_NDK_}/build/cmake/android.toolchain.cmake
22-
cmake_path(GET CMAKE_TOOLCHAIN_FILE PARENT_PATH _NBL_TOOLCHAIN_NDK_CMAKE_DIRECTORY_)
23-
cmake_path(GET _NBL_TOOLCHAIN_NDK_CMAKE_DIRECTORY_ PARENT_PATH _NBL_TOOLCHAIN_NDK_BUILD_DIRECTORY_)
24-
cmake_path(GET _NBL_TOOLCHAIN_NDK_BUILD_DIRECTORY_ PARENT_PATH _NBL_TOOLCHAIN_NDK_ROOT_DIRECTORY_)
25-
cmake_path(GET _NBL_TOOLCHAIN_NDK_ROOT_DIRECTORY_ PARENT_PATH _NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_)
26-
27-
string(LENGTH ${CMAKE_TOOLCHAIN_FILE} _NBL_CMAKE_TOOLCHAIN_FILE_LENGTH_)
28-
string(LENGTH ${_NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_} _NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_LENGTH_)
29-
math(EXPR _NBL_PARENT_NDK_TO_TOOLCHAIN_FILE_LENGTH_ "${_NBL_CMAKE_TOOLCHAIN_FILE_LENGTH_} - ${_NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_LENGTH_}" OUTPUT_FORMAT DECIMAL)
30-
string(SUBSTRING ${CMAKE_TOOLCHAIN_FILE} ${_NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_LENGTH_} ${_NBL_PARENT_NDK_TO_TOOLCHAIN_FILE_LENGTH_} _NBL_PARENT_NDK_TO_TOOLCHAIN_FILEPATH_)
31-
32-
if(${_NBL_PARENT_NDK_TO_TOOLCHAIN_FILEPATH_} STREQUAL "/${_NBL_SUPPORTED_NDK_}/build/cmake/android.toolchain.cmake")
33-
message(STATUS "Found Android NDK '${_NBL_SUPPORTED_NDK_}' is appropriate!")
34-
else()
35-
message(FATAL_ERROR "Found Android NDK version isn't appropriate. Use '${_NBL_SUPPORTED_NDK_}'!")
36-
endif()
37-
38-
if(EXISTS "${_NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_}/build-tools")
39-
if(DEFINED ANDROID_ABI)
40-
if(${ANDROID_ABI} STREQUAL ${_NBL_SUPPORTED_ABI_})
41-
message(STATUS "Supported '${_NBL_SUPPORTED_ABI_}' ABI!")
42-
43-
else()
44-
message(FATAL_ERROR "Found '${ANDROID_ABI}' isn't appropriate. Use '${_NBL_SUPPORTED_ABI_}'!")
45-
endif()
46-
else()
47-
message(STATUS "Could not find 'ANDROID_ABI', using supported ABI: '${_NBL_SUPPORTED_ABI_}'")
48-
set(ANDROID_ABI ${_NBL_SUPPORTED_ABI_} CACHE INTERNAL "" FORCE)
49-
endif()
50-
51-
message(STATUS "'${_NBL_SUPPORTED_NDK_}' located in Android SDK path. Building Nabla with Android toolchain!")
52-
53-
set(ANDROID_SDK_ROOT_PATH "${_NBL_EXPECTED_ANDROID_SDK_ROOT_DIRECTORY_}")
54-
set(ANDROID_NDK_ROOT_PATH ${ANDROID_SDK_ROOT_PATH}/${_NBL_SUPPORTED_NDK_})
55-
56-
set(NBL_BUILD_ANDROID ON)
57-
set(_NBL_ANDROID_VALIDATED_ ON)
58-
else()
59-
message(FATAL_ERROR "${_NBL_SUPPORTED_NDK_} must be placed in Android SDK path!")
60-
endif()
61-
endif()
62-
63-
# TODO - another toolchains in future
64-
65-
endif()
66-
67-
if(NBL_BUILD_ANDROID)
68-
if(NOT DEFINED _NBL_ANDROID_VALIDATED_)
69-
message(FATAL_ERROR "Android toolchain hasn't been validated properly. Pass an appropriate path to CMAKE_TOOLCHAIN_FILE!")
70-
endif()
71-
72-
if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux")
73-
message(STATUS "Using Linux as a host OS for Android cross-compiling!")
74-
elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows")
75-
message(STATUS "Using Windows as a host OS for Android cross-compiling!")
76-
else()
77-
message(FATAL_ERROR "Current host OS for Android cross-compiling isn't allowed!")
78-
endif()
79-
80-
# TODO - remove those bellow in future
81-
set(_NBL_COMPILE_WITH_OPEN_EXR_ OFF CACHE BOOL "Off for Android purposes at the moment" FORCE) # TODO - check it out
82-
set(_NBL_COMPILE_WITH_BAW_LOADER_ OFF CACHE BOOL "Off for Android purposes at the moment" FORCE) # TODO - remove when BAW-v4 is done
83-
set(_NBL_COMPILE_WITH_BAW_WRITER_ OFF CACHE BOOL "Off for Android purposes at the moment" FORCE) # TODO - remove when BAW-v4 is done
84-
set(_NBL_COMPILE_WITH_OBJ_LOADER_ ON CACHE BOOL "Off for Android purposes at the moment" FORCE)
85-
set(NBL_BUILD_MITSUBA_LOADER OFF CACHE BOOL "Off for Android purposes at the moment" FORCE) # TODO - compile/linker errors
86-
87-
find_package(Java 1.8)
88-
89-
if(DEFINED Java_JAVA_EXECUTABLE)
90-
message(STATUS "Found Java executable!: ${Java_JAVA_EXECUTABLE}")
91-
else()
92-
message(FATAL_ERROR "Could not find java executable for Android build!")
93-
endif()
94-
95-
string(LENGTH ${Java_JAVA_EXECUTABLE} Java_JAVA_EXECUTABLE_LENGTH)
96-
if(MSVC)
97-
set(Java_JAVA_EXE_BIN_LENGTH 13)
98-
else()
99-
set(Java_JAVA_EXE_BIN_LENGTH 9)
100-
endif()
101-
math(EXPR JAVA_HOME_LENGTH "${Java_JAVA_EXECUTABLE_LENGTH} - ${Java_JAVA_EXE_BIN_LENGTH}" OUTPUT_FORMAT DECIMAL)
102-
string(SUBSTRING ${Java_JAVA_EXECUTABLE} 0 ${JAVA_HOME_LENGTH} JAVA_HOME)
103-
104-
message(STATUS "Using JAVA_HOME = ${JAVA_HOME}")
105-
106-
execute_process(COMMAND ${JAVA_HOME}/bin/java -version
107-
RESULT_VARIABLE _result
108-
OUTPUT_VARIABLE _output
109-
ERROR_VARIABLE _output
110-
OUTPUT_STRIP_TRAILING_WHITESPACE
111-
ERROR_STRIP_TRAILING_WHITESPACE)
112-
113-
if(NOT _result AND _output MATCHES "version \"([0-9]+).([0-9]+)")
114-
message(STATUS "Java in JAVA_HOME is ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}")
115-
else()
116-
message(STATUS "Java in JAVA_HOME is unknown version ${_output} ${_result}")
117-
endif()
118-
119-
#option(STRIP_ANDROID_LIBRARY "Strip the resulting android library" OFF)
120-
121-
if(NOT ANDROID_PLATFORM)
122-
set(ANDROID_PLATFORM "android-25")
123-
endif()
124-
string(SUBSTRING
125-
"${ANDROID_PLATFORM}"
126-
8 # length of "android-"
127-
-1 # take remainder
128-
ANDROID_API_LEVEL
129-
)
130-
131-
# default to libc++_static as the other options can cause crashes
132-
if(NOT ANDROID_STL)
133-
set(ANDROID_STL "c++_static")
134-
endif()
135-
136-
# Choose clang if the NDK has both gcc and clang, since gcc sometimes fails
137-
# iirc api levels > 21 have only clang available
138-
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION "clang")
139-
140-
#
141-
# android-specific utils and build tools
142-
#
143-
set(ANDROID_BUILD_TOOLS_VERSION "" CACHE STRING "Version of Android build-tools to use instead of the default")
144-
# take most recent version of build tools, if not set explicitely
145-
if(ANDROID_BUILD_TOOLS_VERSION STREQUAL "")
146-
file(GLOB __buildTools RELATIVE "${ANDROID_SDK_ROOT_PATH}/build-tools" "${ANDROID_SDK_ROOT_PATH}/build-tools/*")
147-
list(SORT __buildTools)
148-
149-
list(GET __buildTools -1 ANDROID_BUILD_TOOLS_VERSION)
150-
151-
unset(__buildTools)
152-
endif()
153-
set(ANDROID_BUILD_TOOLS "${ANDROID_SDK_ROOT_PATH}/build-tools/${ANDROID_BUILD_TOOLS_VERSION}")
154-
set(ANDROID_JAVA_BIN "${JAVA_HOME}")
155-
set(ANDROID_JAVA_RT_JAR "${JAVA_HOME}/jre/lib/rt.jar")
156-
157-
set(ANDROID_APK_TARGET_ID "" CACHE STRING "The Target ID to build the APK for like 'android-99', use <android list targets> to choose another one.")
158-
if(ANDROID_APK_TARGET_ID STREQUAL "")
159-
# This seems different from the platform we're targetting,
160-
# default to the latest available that's greater or equal to our target platform
161-
file(GLOB __platforms RELATIVE "${ANDROID_SDK_ROOT_PATH}/platforms" "${ANDROID_SDK_ROOT_PATH}/platforms/*")
162-
list(SORT __platforms)
163-
164-
# In case we don't find one, target the latest platform
165-
list(GET __platforms -1 ANDROID_APK_TARGET_ID)
166-
167-
string(REPLACE "android-" "" __targetPlat "${ANDROID_PLATFORM}")
168-
169-
# TODO we might want to adjust min version in the future
170-
# We require at least android 23 for Activity.requestPermissions
171-
if(__targetPlat LESS 23)
172-
set(__targetPlat 23)
173-
endif()
174-
175-
foreach( __plat ${__platforms})
176-
string(REPLACE "android-" "" __curPlat "${__plat}")
177-
178-
if(NOT (__curPlat LESS __targetPlat) )
179-
set(ANDROID_APK_TARGET_ID "android-${__curPlat}")
180-
break()
181-
endif()
182-
endforeach()
183-
184-
unset(__platforms)
185-
unset(__targetPlat)
186-
unset(__curPlat)
187-
endif()
188-
189-
message(STATUS "Using android.jar from platform ${ANDROID_APK_TARGET_ID}")
190-
set(ANDROID_JAR "${ANDROID_SDK_ROOT_PATH}/platforms/${ANDROID_APK_TARGET_ID}/android.jar")
191-
endif()
11+
include(ExternalProject)
12+
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchains/android/build.cmake)
19213

19314
project(Nabla LANGUAGES CXX C)
19415

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Contact ***[@devshgraphicsprogramming](https://github.com/devshgraphicsprogrammi
177177
- **[CMake](https://cmake.org/download/)**
178178
- **[MSVC](https://visualstudio.microsoft.com/pl/downloads/)** or **[GCC](https://sourceforge.net/projects/mingw-w64/)**
179179
- **[Vulkan SDK](https://vulkan.lunarg.com/sdk/home)**
180-
- **[Perl](https://www.perl.org/get.html)**
180+
- **[Perl 5.28 executable version](https://www.perl.org/get.html)**
181181
- **[NASM](https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D)**
182182
- **[Python 3.8](https://www.python.org/downloads/release/python-380/)** or later
183183

@@ -208,20 +208,27 @@ After dealing with *CUDA* installing just install *Optix SKD*.
208208
**Required:**
209209

210210
- **[Android Studio](https://developer.android.com/studio)**
211-
- **[NDK r22b](https://developer.android.com/ndk/downloads#stable-downloads)**
212-
- **[Java 8](https://www.java.com/download/)**
211+
- **[JDK 8](https://www.java.com/download/)**
213212

214-
The first step is to install Android Studio and Java 8. When done, extract NDK r22b into *Android SDK root directory* usually located at `C:/Users/<your_user>/AppData/Local/AndroidSdk`. If you however can't find it, open Android Studio and go to **File** and **Project Structure** that will show you where your Android SDKs are installed.
213+
The first step is to install Android Studio and JDK 8. When done, open Android Studio and navigate to **Tools** -> **SDK Manager** -> **System Settings** -> **Android SDK**.
214+
Select *SDK Platforms* and install proper individual SDK components - install Android version with Android API level you will be targeting. Then switch to *SDK Tools* and make sure to install **Android SDK Build-Tools 32** and **NDK (Side by side)** - it's a *requirement*! Also you must make sure that your **JAVA_HOME** enviroment variable is set to proper JDK installation path.
215215

216-
Now you can begin CMake generating. On Android Build there is an extra optional Ninja generator available. *Important note is that Nabla Android Build has been performed and tested so far on Windows as cross compile OS with **ninja** generator and on Linux as cross compile OS with **makefile** and **ninja** generators.* Before configuring you need to specify toolchain file for cross-compiling by passing path to `android.toolchain.cmake`. You can find it in NDK directory in `build/cmake/android.toolchain.cmake` and according to example of Android SDK root directory path it should look entirely like `C:/Users/<your_user>/AppData/Local/AndroidSdk/android-ndk-r22b/build/cmake/android.toolchain.cmake`.
216+
Now you can begin CMake'ing. We use **Ninja** generator tools as a generator for building Nabla for Android on both Windows and Linux Host-OSes. *Note that Nabla Android build has been performed and tested so far on Windows as cross compile OS with **Ninja** generator and on Linux as cross compile OS with **Makefile** and **Ninja** generators, but we recommend using **Ninja** for both OSes.*
217+
218+
Before configuring CMake you must add 2 cache variables:
219+
220+
- **ANDROID_PLATFORM**
221+
- **ANDROID_ABI**
222+
223+
**ANDROID_PLATFORM** is a target API platform that you pass as `android-x` where `x` is your android API level (you can pass 28 for instance). **ANDROID_ABI** is Application Binary Interface and note, that we support only `x86_64` currently. Those 2 cache variables *must be* specified before CMake configuration. Having done it you can specify toolchain file for cross-compiling by passing path to `android.toolchain.cmake`. You can find it in Android Studio's SDK directory in `ndk/<version>/build/cmake/android.toolchain.cmake`. Basically the entire path should look like this one `C:/Users/<your_user>/AppData/Local/AndroidSdk/ndk/<version>/build/cmake/android.toolchain.cmake`. With all of this feel free to generate.
217224

218225
Having Nabla generated you need to enter build directory, launch the terminal and type `cmake --build . --target Nabla -j4 -v` or if you want build android sample example you would type `cmake --build . --target android_sample_apk -j4 -v`. The android sample example produces *.apk* file you can use for debugging and profiling.
219226

220-
**Note:** each example provided by the engine builds as an executable with non-cross builds and with target of a name called *"a_target"*, in following example above it would be *"android_sample"*. When building cross-compile for android **to produce the APK file you need to add *"_apk"* postfix to the "*a_target"***, because "*a_target*" gets built then as a library.
227+
**Note:** each example provided by the engine builds as an executable with non-cross builds and with target of a name called `a_target`, in following example above it would be `android_sample`. When building cross-compile for android **to produce the APK file you need to add `_apk` postfix to the `a_target`, because `a_target` gets built then as a library.
221228

222229
#### Chrome Book SDK version
223230

224-
In order for the chromebook to work with the apk you build you need to install the right SDK version. Go to *Tools -> SDK Manager ->System and Settings -> Android SDK* then Select the *SDK Platforms* tab and tick the "Show Packake Details" checkbox in the bottom-right corner. After that select *Android 9.0 (Pie) -> Android SDK Platform 28* and hit "OK".
231+
In order for the chromebook to work with the apk you build you need to install the right SDK version. Go to **Tools** -> **SDK Manager** -> **System Settings** -> **Android SDK** then select the *SDK Platforms* tab and tick the "Show Packake Details" checkbox in the bottom-right corner. After that select *Android 9.0 (Pie) -> Android SDK Platform 28* and hit "OK".
225232

226233
#### Chrome Book upload
227234

0 commit comments

Comments
 (0)