1# Copyright 2019 The Amber Authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15cmake_minimum_required(VERSION 3.1) 16 17# build native_app_glue as a static lib 18set(APP_GLUE_DIR ${ANDROID_NDK}/sources/android/native_app_glue) 19include_directories(${APP_GLUE_DIR}) 20add_library(app-glue STATIC 21 ${APP_GLUE_DIR}/android_native_app_glue.c) 22 23# build vulkan app 24set(SRC_DIR jni) 25 26add_library(amber_android SHARED 27 ${SRC_DIR}/main.cc 28 ${SRC_DIR}/amber_script.cc) 29 30include_directories(${SRC_DIR}) 31 32set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror \ 33 -DVK_USE_PLATFORM_ANDROID_KHR") 34set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} \ 35 -u ANativeActivity_onCreate") 36 37# Begin: include Amber 38set(AMBER_DIR ${CMAKE_SOURCE_DIR}/..) 39set(AMBER_SKIP_TESTS TRUE) 40set(AMBER_SKIP_SPIRV_TOOLS TRUE) 41set(Vulkan_FOUND TRUE) 42set(Dawn_FOUND FALSE) 43 44include_directories(${AMBER_DIR}/include) 45message("Android Amber adds header path: ${AMBER_DIR}/include") 46include_directories(${AMBER_DIR}) 47message("Android Amber adds header path: ${AMBER_DIR}") 48 49add_subdirectory(${AMBER_DIR} amber_vulkan) 50target_link_libraries(amber_android libamber vulkan) 51# End: include Amber 52 53target_link_libraries(amber_android app-glue log android) 54