-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathCMakeLists.txt
148 lines (131 loc) · 4.13 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# Copyright 2019 Google
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# CMake file for the firebase_storage library
# Common source files used by all platforms
set(common_SRCS
src/common/common.cc
src/common/controller.cc
src/common/listener.cc
src/common/metadata.cc
src/common/storage.cc
src/common/storage_reference.cc
src/common/storage_uri_parser.cc)
# Define the resource build needed for Android
firebase_cpp_gradle(":storage:storage_resources:generateDexJarRelease"
"${CMAKE_CURRENT_LIST_DIR}/storage_resources/build/storage_resources_lib.jar")
binary_to_array("storage_resources"
"${CMAKE_CURRENT_LIST_DIR}/storage_resources/build/storage_resources_lib.jar"
"firebase_storage_resources"
"${FIREBASE_GEN_FILE_DIR}/storage")
# Source files used by the Android implementation.
set(android_SRCS
${storage_resources_source}
src/android/controller_android.cc
src/android/metadata_android.cc
src/android/storage_android.cc
src/android/storage_reference_android.cc)
# Source files used by the iOS implementation.
set(ios_SRCS
src/ios/controller_ios.mm
src/ios/listener_ios.mm
src/ios/metadata_ios.mm
src/ios/storage_ios.mm
src/ios/storage_reference_ios.mm
src/ios/util_ios.mm)
# Source files used by the desktop implementation.
set(desktop_SRCS
src/desktop/controller_desktop.cc
src/desktop/curl_requests.cc
src/desktop/listener_desktop.cc
src/desktop/metadata_desktop.cc
src/desktop/rest_operation.cc
src/desktop/storage_desktop.cc
src/desktop/storage_path.cc
src/desktop/storage_reference_desktop.cc)
if(ANDROID)
set(storage_platform_SRCS
"${android_SRCS}")
elseif(IOS)
set(storage_platform_SRCS
"${ios_SRCS}")
else()
set(storage_platform_SRCS
"${desktop_SRCS}")
endif()
if(ANDROID OR IOS)
set(additional_link_LIB)
set(additional_DEFINES)
else()
set(additional_link_LIB
firebase_rest_lib)
set(additional_DEFINES
-DFIREBASE_TARGET_DESKTOP=1)
endif()
add_library(firebase_storage STATIC
${common_SRCS}
${storage_platform_SRCS})
set_property(TARGET firebase_storage PROPERTY FOLDER "Firebase Cpp")
# Set up the dependency on Firebase App.
target_link_libraries(firebase_storage
PUBLIC
firebase_app
PRIVATE
${additional_link_LIB}
)
# Public headers all refer to each other relative to the src/include directory,
# while private headers are relative to the entire C++ SDK directory.
target_include_directories(firebase_storage
PUBLIC
${CMAKE_CURRENT_LIST_DIR}/src/include
PRIVATE
${FIREBASE_CPP_SDK_ROOT_DIR}
${FIREBASE_CPP_SDK_ROOT_DIR}/ios_pod/swift_headers
)
target_compile_definitions(firebase_storage
PRIVATE
-DINTERNAL_EXPERIMENTAL=1
${additional_DEFINES}
)
# Automatically include headers that might not be declared.
if(MSVC)
add_definitions(/FI"assert.h" /FI"string.h" /FI"stdint.h")
else()
add_definitions(-include assert.h -include string.h)
endif()
if(ANDROID)
firebase_cpp_proguard_file(storage)
elseif(IOS)
# Enable Automatic Reference Counting (ARC) and Bitcode.
target_compile_options(firebase_storage
PUBLIC "-fobjc-arc" "-fembed-bitcode")
target_link_libraries(firebase_storage
PUBLIC "-fembed-bitcode")
setup_pod_headers(
firebase_storage
POD_NAMES
FirebaseCore
FirebaseStorage
)
if (FIREBASE_XCODE_TARGET_FORMAT STREQUAL "frameworks")
set_target_properties(firebase_storage PROPERTIES
FRAMEWORK TRUE
)
endif()
endif()
if(FIREBASE_CPP_BUILD_TESTS)
# Add the tests subdirectory
add_subdirectory(tests)
endif()
cpp_pack_library(firebase_storage "")
cpp_pack_public_headers()