|
| 1 | +# Copyright 2020 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_installations library |
| 16 | + |
| 17 | +# Common source files used by all platforms |
| 18 | +set(common_SRCS |
| 19 | + src/installations.cc) |
| 20 | + |
| 21 | +# Source files used by the Android implementation. |
| 22 | +set(android_SRCS |
| 23 | + src/android/installations_android.cc) |
| 24 | + |
| 25 | +# Source files used by the iOS implementation. |
| 26 | +set(ios_SRCS |
| 27 | + src/ios/installations_ios.mm) |
| 28 | + |
| 29 | +# Source files used by the desktop implementation. |
| 30 | +set(desktop_SRCS |
| 31 | + src/desktop/installations_stub.cc) |
| 32 | + |
| 33 | +if(ANDROID) |
| 34 | + set(installations_platform_SRCS |
| 35 | + "${android_SRCS}") |
| 36 | +elseif(IOS) |
| 37 | + set(installations_platform_SRCS |
| 38 | + "${ios_SRCS}") |
| 39 | +else() |
| 40 | + set(installations_platform_SRCS |
| 41 | + "${desktop_SRCS}") |
| 42 | +endif() |
| 43 | + |
| 44 | +if(ANDROID OR IOS OR use_stub) |
| 45 | + set(additional_link_LIB) |
| 46 | +else() |
| 47 | + set(additional_link_LIB |
| 48 | + firebase_installations_desktop_impl) |
| 49 | +endif() |
| 50 | + |
| 51 | +add_library(firebase_installations STATIC |
| 52 | + ${common_SRCS} |
| 53 | + ${installations_platform_SRCS}) |
| 54 | + |
| 55 | +set_property(TARGET firebase_installations PROPERTY FOLDER "Firebase Cpp") |
| 56 | + |
| 57 | +# Set up the dependency on Firebase App. |
| 58 | +target_link_libraries(firebase_installations |
| 59 | + PUBLIC |
| 60 | + firebase_app |
| 61 | + PRIVATE |
| 62 | + ${additional_link_LIB} |
| 63 | +) |
| 64 | +# Public headers all refer to each other relative to the src/include directory, |
| 65 | +# while private headers are relative to the entire C++ SDK directory. |
| 66 | +target_include_directories(firebase_installations |
| 67 | + PUBLIC |
| 68 | + ${CMAKE_CURRENT_LIST_DIR}/src/include |
| 69 | + PRIVATE |
| 70 | + ${FIREBASE_CPP_SDK_ROOT_DIR} |
| 71 | +) |
| 72 | +target_compile_definitions(firebase_installations |
| 73 | + PRIVATE |
| 74 | + -DINTERNAL_EXPERIMENTAL=1 |
| 75 | +) |
| 76 | +# Automatically include headers that might not be declared. |
| 77 | +if(MSVC) |
| 78 | + add_definitions(/FI"assert.h" /FI"string.h" /FI"stdint.h") |
| 79 | +else() |
| 80 | + add_definitions(-include assert.h -include string.h) |
| 81 | +endif() |
| 82 | + |
| 83 | +if(ANDROID) |
| 84 | + firebase_cpp_proguard_file(installations) |
| 85 | +elseif(IOS) |
| 86 | + # Enable Automatic Reference Counting (ARC). |
| 87 | + set_property( |
| 88 | + TARGET firebase_installations |
| 89 | + APPEND_STRING PROPERTY |
| 90 | + COMPILE_FLAGS "-fobjc-arc") |
| 91 | + |
| 92 | + setup_pod_headers( |
| 93 | + firebase_installations |
| 94 | + POD_NAMES |
| 95 | + FirebaseCore |
| 96 | + FirebaseInstallations |
| 97 | + ) |
| 98 | +endif() |
| 99 | + |
| 100 | +if(FIREBASE_CPP_BUILD_TESTS) |
| 101 | + # Add the tests subdirectory |
| 102 | + add_subdirectory(tests) |
| 103 | +endif() |
| 104 | + |
| 105 | +cpp_pack_library(firebase_installations "") |
| 106 | +cpp_pack_public_headers() |
0 commit comments