forked from KomputeProject/kompute
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Fabian Sauter <[email protected]>
- Loading branch information
Showing
19 changed files
with
158 additions
and
1,558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
examples/android/android-simple/app/src/main/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 16 additions & 21 deletions
37
examples/android/android-simple/app/src/main/cpp/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
cmake_minimum_required(VERSION 3.4.1) | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
add_subdirectory(../../../../../../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build) | ||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
set(VK_ANDROID_INCLUDE_DIR ${ANDROID_NDK}/sources/third_party/vulkan/src/include) | ||
include(FetchContent) | ||
FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/COM8/kompute.git | ||
GIT_TAG b28d4ae0bec1d39003b97574623a52b0b5f7494d) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases | ||
set(KOMPUTE_OPT_ANDROID_BUILD ON) | ||
set(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS ON) | ||
FetchContent_MakeAvailable(kompute) | ||
include_directories(${kompute_SOURCE_DIR}/src/include) | ||
|
||
add_library(kompute-jni SHARED | ||
KomputeJniNative.cpp | ||
KomputeModelML.cpp) | ||
# Add to the list, so CMake can later find the code to compile shaders to header files | ||
list(APPEND CMAKE_PREFIX_PATH "${kompute_SOURCE_DIR}/cmake") | ||
add_subdirectory(shader) | ||
|
||
include_directories( | ||
${VK_ANDROID_COMMON_DIR} | ||
${VK_ANDROID_INCLUDE_DIR} | ||
../../../../../../../single_include/ | ||
../../../../../../../vk_ndk_wrapper_include/) | ||
add_library(kompute-jni SHARED KomputeJniNative.cpp | ||
KomputeModelML.cpp | ||
KomputeModelML.hpp) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 \ | ||
-DVK_USE_PLATFORM_ANDROID_KHR=1 \ | ||
-DKOMPUTE_DISABLE_VK_DEBUG_LAYERS=1") | ||
target_link_libraries(kompute-jni PRIVATE kompute::kompute shader log android) | ||
|
||
target_link_libraries(kompute-jni | ||
# Libraries from kompute build | ||
kompute | ||
kompute_vk_ndk_wrapper | ||
# Libraries from android build | ||
log | ||
android) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
examples/android/android-simple/app/src/main/cpp/shader/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
cmake_minimum_required(VERSION 3.20) | ||
|
||
# To add more shaders simply copy the vulkan_compile_shader command and replace it with your new shader | ||
vulkan_compile_shader(INFILE my_shader.comp | ||
OUTFILE my_shader.hpp | ||
NAMESPACE "shader" | ||
RELATIVE_PATH "${kompute_SOURCE_DIR}/cmake") | ||
|
||
# Then add it to the library, so you can access it later in your code | ||
add_library(shader INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/my_shader.hpp" | ||
|
||
# "${CMAKE_CURRENT_BINARY_DIR}/my_shader2.hpp" | ||
) | ||
|
||
target_include_directories(shader INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>) |
Oops, something went wrong.