|
| 1 | +# Copyright (C) 2017 Google LLC |
| 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 | +# http://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 | +## |
| 15 | + |
| 16 | +cmake_minimum_required(VERSION 3.4.1) |
| 17 | + |
| 18 | +# Import the GPGS C++ SDK library |
| 19 | +add_library(gpg_sdk STATIC IMPORTED) |
| 20 | +set_target_properties(gpg_sdk PROPERTIES IMPORTED_LOCATION |
| 21 | + ${GPG_SDK_PATH}/lib/c++/${ANDROID_ABI}/libgpg.a) |
| 22 | + |
| 23 | +# build native_app_glue as a static lib |
| 24 | +add_library(native_app_glue STATIC |
| 25 | + ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c) |
| 26 | + |
| 27 | +# build cpufeatures as a static lib |
| 28 | +add_library(cpufeatures STATIC |
| 29 | + ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) |
| 30 | + |
| 31 | +#include the native part of JUI Helper |
| 32 | +add_subdirectory (${JUI_HELPER_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/libs/${ANDROID_ABI}/libjuihelper") |
| 33 | + |
| 34 | +#include the native part of NDKHelper |
| 35 | +add_subdirectory (${NDK_HELPER_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/libs/${ANDROID_ABI}/libndkhelper") |
| 36 | + |
| 37 | +#JSON library |
| 38 | +add_library(json STATIC |
| 39 | + ${JSON_PATH}/src/lib_json/json_writer.cpp |
| 40 | + ${JSON_PATH}/src/lib_json/json_reader.cpp |
| 41 | + ${JSON_PATH}/src/lib_json/json_value.cpp |
| 42 | + ) |
| 43 | + target_include_directories(json PRIVATE |
| 44 | + ${JSON_PATH}/include |
| 45 | + ) |
| 46 | + |
| 47 | +# Export ANativeActivity_onCreate(), |
| 48 | +# Refer to: https://github.com/android-ndk/ndk/issues/381. |
| 49 | +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate") |
| 50 | + |
| 51 | + |
| 52 | +add_library(TBMPSkeletonNativeActivity |
| 53 | + SHARED |
| 54 | + src/main/jni/TBMPSkeletonNativeActivity.cpp |
| 55 | + src/main/jni/TBMPSkeletonNativeActivity_Engine.cpp |
| 56 | + ${TEAPOT_RENDERER_PATH}/TeapotRenderer.cpp |
| 57 | + ) |
| 58 | + |
| 59 | +target_include_directories(TBMPSkeletonNativeActivity PRIVATE |
| 60 | + ${ANDROID_NDK}/sources/android/native_app_glue |
| 61 | + ${ANDROID_NDK}/sources/android/cpufeatures |
| 62 | + ${GPG_SDK_PATH}/include |
| 63 | + ${JSON_PATH}/include |
| 64 | + ${juihelper_SOURCE_DIR}/src/main/cpp |
| 65 | + ${ndkhelper_SOURCE_DIR}/src/main/cpp |
| 66 | + ${TEAPOT_RENDERER_PATH} |
| 67 | +) |
| 68 | + |
| 69 | +# Specifies libraries CMake should link to your target library. You |
| 70 | +# can link multiple libraries, such as libraries you define in this |
| 71 | +# build script, prebuilt third-party libraries, or system libraries. |
| 72 | + |
| 73 | +target_link_libraries(TBMPSkeletonNativeActivity |
| 74 | + gpg_sdk |
| 75 | + native_app_glue |
| 76 | + cpufeatures |
| 77 | + juihelper |
| 78 | + ndkhelper |
| 79 | + json |
| 80 | + log |
| 81 | + android |
| 82 | + EGL |
| 83 | + GLESv2 |
| 84 | + z) |
0 commit comments