From cd4f22524ea4f0855262c5e5419ab30108be3978 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Sat, 26 Nov 2022 16:58:44 +0000 Subject: [PATCH] Updated android test to work with source branch Signed-off-by: Alejandro Saucedo --- .../app/src/main/cpp/CMakeLists.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt b/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt index abdb5465..8b8ccd38 100644 --- a/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt +++ b/examples/android/android-simple/app/src/main/cpp/CMakeLists.txt @@ -2,13 +2,22 @@ cmake_minimum_required(VERSION 3.20) set(CMAKE_CXX_STANDARD 17) -include(FetchContent) -FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/KomputeProject/kompute.git - GIT_TAG 1344ece4ac278f9b3be3b4555ffaace7a032b91f) # The commit hash for a dev version before v0.9.0. Replace with the latest from: https://github.com/KomputeProject/kompute/releases +# Options +option(KOMPUTE_OPT_GIT_TAG "The tag of the repo to use for the example" 1344ece4ac278f9b3be3b4555ffaace7a032b91f) +option(KOMPUTE_OPT_FROM_SOURCE "Whether to build example from source or from git fetch repo" 0) + set(KOMPUTE_OPT_ANDROID_BUILD ON) set(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS ON) -FetchContent_MakeAvailable(kompute) -include_directories(${kompute_SOURCE_DIR}/src/include) + +if(KOMPUTE_OPT_FROM_SOURCE) + add_subdirectory(../../../../../../../ ${CMAKE_CURRENT_BINARY_DIR}/kompute_build) +else() + include(FetchContent) + FetchContent_Declare(kompute GIT_REPOSITORY https://github.com/KomputeProject/kompute.git + GIT_TAG ${KOMPUTE_OPT_GIT_TAG}) + FetchContent_MakeAvailable(kompute) + include_directories(${kompute_SOURCE_DIR}/src/include) +endif() # 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")