1#
2# Copyright (C) 2017 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17project(Smoke)
18cmake_minimum_required(VERSION 3.4.1)
19
20get_filename_component(demosDir "${CMAKE_SOURCE_DIR}/../.." ABSOLUTE)
21set(smokeDir "${demosDir}/smoke")
22get_filename_component(glmDir "${demosDir}/../libs" ABSOLUTE)
23get_filename_component(vulkanDir "${demosDir}/../include" ABSOLUTE)
24
25# build native_app_glue as a static lib
26add_library(native_activity_glue STATIC
27            ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
28
29# Build application's shared lib
30set(CMAKE_CXX_FLAGS
31            "${CMAKE_CXX_FLAGS} -std=c++11  -fexceptions -Wall \
32            -Wextra -Wno-unused-parameter \
33            -DVK_NO_PROTOTYPES -DVK_USE_PLATFORM_ANDROID_KHR \
34            -DGLM_FORCE_RADIANS")
35
36# Force export ANativeActivity_onCreate(),
37# Refer to: https://github.com/android-ndk/ndk/issues/381.
38set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
39
40add_library(Smoke SHARED
41            ${smokeDir}/Game.cpp
42            ${smokeDir}/Meshes.cpp
43            ${smokeDir}/Simulation.cpp
44            ${smokeDir}/HelpersDispatchTable.cpp
45            ${smokeDir}/Shell.cpp
46            ${smokeDir}/ShellAndroid.cpp
47            ${smokeDir}/Smoke.cpp
48            ${smokeDir}/Main.cpp)
49
50target_include_directories(Smoke PRIVATE
51            ${ANDROID_NDK}/sources/android/native_app_glue
52            ${vulkanDir}
53            ${glmDir}
54            ${CMAKE_SOURCE_DIR}/src/main/jni)
55
56target_link_libraries(Smoke
57            android
58            log
59            native_activity_glue)
60