|
| 1 | +# Copyright 2022 Google |
| 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 | +# CMake file for the firebase_app_check library |
| 16 | + |
| 17 | +# Common source files used by all platforms |
| 18 | +set(common_SRCS |
| 19 | + src/common/app_check.cc |
| 20 | + src/common/common.h |
| 21 | + src/include/firebase/app_check.h |
| 22 | + src/include/firebase/app_check/debug_provider.h |
| 23 | + src/include/firebase/app_check/play_integrity_provider.h |
| 24 | + src/include/firebase/app_check/safety_net_provider.h |
| 25 | + src/include/firebase/app_check/device_check_provider.h |
| 26 | + src/include/firebase/app_check/app_attest_provider.h |
| 27 | +) |
| 28 | + |
| 29 | +# Source files used by the Android implementation. |
| 30 | +set(android_SRCS |
| 31 | + src/android/app_check_android.cc |
| 32 | + src/android/app_check_android.h |
| 33 | +) |
| 34 | + |
| 35 | +# Source files used by the iOS implementation. |
| 36 | +set(ios_SRCS |
| 37 | + src/ios/app_check_ios.mm |
| 38 | + src/ios/app_check_ios.h |
| 39 | +) |
| 40 | + |
| 41 | +# Source files used by the desktop implementation. |
| 42 | +set(desktop_SRCS |
| 43 | + src/desktop/app_check_desktop.cc |
| 44 | + src/desktop/app_check_desktop.h |
| 45 | +) |
| 46 | + |
| 47 | +if(ANDROID) |
| 48 | + set(app_check_platform_SRCS |
| 49 | + "${android_SRCS}") |
| 50 | +elseif(IOS) |
| 51 | + set(app_check_platform_SRCS |
| 52 | + "${ios_SRCS}") |
| 53 | +else() |
| 54 | + set(app_check_platform_SRCS |
| 55 | + "${desktop_SRCS}") |
| 56 | +endif() |
| 57 | + |
| 58 | +if(ANDROID OR IOS) |
| 59 | + set(additional_link_LIB) |
| 60 | +else() |
| 61 | + set(additional_link_LIB |
| 62 | + firebase_rest_lib) |
| 63 | +endif() |
| 64 | + |
| 65 | +add_library(firebase_app_check STATIC |
| 66 | + ${common_SRCS} |
| 67 | + ${app_check_platform_SRCS} |
| 68 | + ${app_check_HDRS}) |
| 69 | + |
| 70 | +set_property(TARGET firebase_app_check PROPERTY FOLDER "Firebase Cpp") |
| 71 | + |
| 72 | +# Set up the dependency on Firebase App. |
| 73 | +target_link_libraries(firebase_app_check |
| 74 | + PUBLIC |
| 75 | + firebase_app |
| 76 | + PRIVATE |
| 77 | + ${additional_link_LIB} |
| 78 | +) |
| 79 | +# Public headers all refer to each other relative to the src/include directory, |
| 80 | +# while private headers are relative to the entire C++ SDK directory. |
| 81 | +target_include_directories(firebase_app_check |
| 82 | + PUBLIC |
| 83 | + ${CMAKE_CURRENT_LIST_DIR}/src/include |
| 84 | + PRIVATE |
| 85 | + ${FIREBASE_CPP_SDK_ROOT_DIR} |
| 86 | + ${FIREBASE_CPP_SDK_ROOT_DIR}/ios_pod/swift_headers |
| 87 | +) |
| 88 | +target_compile_definitions(firebase_app_check |
| 89 | + PRIVATE |
| 90 | + -DINTERNAL_EXPERIMENTAL=1 |
| 91 | +) |
| 92 | +# Automatically include headers that might not be declared. |
| 93 | +if(MSVC) |
| 94 | + add_definitions(/FI"assert.h" /FI"string.h" /FI"stdint.h") |
| 95 | +else() |
| 96 | + add_definitions(-include assert.h -include string.h) |
| 97 | +endif() |
| 98 | + |
| 99 | +if(ANDROID) |
| 100 | + firebase_cpp_proguard_file(app_check) |
| 101 | +elseif(IOS) |
| 102 | + # Enable Automatic Reference Counting (ARC) and Bitcode. |
| 103 | + target_compile_options(firebase_app_check |
| 104 | + PUBLIC "-fobjc-arc" "-fembed-bitcode") |
| 105 | + target_link_libraries(firebase_app_check |
| 106 | + PUBLIC "-fembed-bitcode") |
| 107 | + |
| 108 | + setup_pod_headers( |
| 109 | + firebase_app_check |
| 110 | + POD_NAMES |
| 111 | + FirebaseCore |
| 112 | + FirebaseAppCheck |
| 113 | + ) |
| 114 | + |
| 115 | + if (FIREBASE_XCODE_TARGET_FORMAT STREQUAL "frameworks") |
| 116 | + set_target_properties(firebase_app_check PROPERTIES |
| 117 | + FRAMEWORK TRUE |
| 118 | + ) |
| 119 | + endif() |
| 120 | +endif() |
| 121 | + |
| 122 | +cpp_pack_library(firebase_app_check "") |
| 123 | +cpp_pack_public_headers() |
0 commit comments