|
| 1 | +cmake_minimum_required (VERSION 3.1) |
| 2 | +set (CMAKE_CXX_STANDARD 11) |
| 3 | + |
| 4 | +include(binary_to_array) |
| 5 | + |
| 6 | +project(firebase_testing NONE) |
| 7 | +enable_language(C) |
| 8 | +enable_language(CXX) |
| 9 | + |
| 10 | +# Build the testdata_config generated files using flatbuffers |
| 11 | +set(FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS |
| 12 | + "--no-union-value-namespacing" |
| 13 | + "--gen-object-api" |
| 14 | + "--cpp-ptr-type" "flatbuffers::unique_ptr") |
| 15 | +build_flatbuffers("${CMAKE_CURRENT_LIST_DIR}/testdata_config.fbs" |
| 16 | + "" |
| 17 | + "generate_testing_fps" |
| 18 | + "${FIREBASE_FLATBUFFERS_DEPENDENCIES}" |
| 19 | + "${FIREBASE_GEN_FILE_DIR}/testing" |
| 20 | + "" |
| 21 | + "") |
| 22 | +binary_to_array("testdata_config_resource" |
| 23 | + "${CMAKE_CURRENT_LIST_DIR}/testdata_config.fbs" |
| 24 | + "firebase::testing::cppsdk" |
| 25 | + "${FIREBASE_GEN_FILE_DIR}/testing") |
| 26 | + |
| 27 | + |
| 28 | +set(config_common_SRCS |
| 29 | + config.h |
| 30 | + config.cc |
| 31 | + config_test.cc |
| 32 | + ${FIREBASE_GEN_FILE_DIR}/testing/testdata_config_generated.h |
| 33 | + ${FIREBASE_GEN_FILE_DIR}/testing/testdata_config_resource.h |
| 34 | + ${FIREBASE_GEN_FILE_DIR}/testing/testdata_config_resource.cc) |
| 35 | +set(config_android_SRCS |
| 36 | + config_android.cc) |
| 37 | +set(config_ios_SRCS |
| 38 | + config_ios.h |
| 39 | + config_ios.mm) |
| 40 | +set(config_desktop_SRCS |
| 41 | + config_desktop.h |
| 42 | + config_desktop.cc) |
| 43 | +if(ANDROID) |
| 44 | + set(config_SRCS |
| 45 | + "${config_common_SRCS}" |
| 46 | + "${config_android_SRCS}") |
| 47 | +elseif(IOS) |
| 48 | + set(config_SRCS |
| 49 | + "${config_common_SRCS}" |
| 50 | + "${config_ios_SRCS}") |
| 51 | +else() |
| 52 | + set(config_SRCS |
| 53 | + "${config_common_SRCS}" |
| 54 | + "${config_desktop_SRCS}") |
| 55 | +endif() |
| 56 | + |
| 57 | +set(reporter_common_SRCS |
| 58 | + reporter.h |
| 59 | + reporter.cc |
| 60 | + reporter_test.cc |
| 61 | + reporter_impl.h |
| 62 | + reporter_impl.cc |
| 63 | + reporter_impl_test.cc |
| 64 | +) |
| 65 | +set(reporter_android_SRCS |
| 66 | + reporter_android.cc) |
| 67 | +if(ANDROID) |
| 68 | + set(reporter_SRCS |
| 69 | + "${reporter_common_SRCS}" |
| 70 | + "${reporter_android_SRCS}") |
| 71 | +else() |
| 72 | + set(reporter_SRCS |
| 73 | + "${reporter_common_SRCS}") |
| 74 | +endif() |
| 75 | + |
| 76 | +set(ticker_common_SRCS |
| 77 | + ticker.h |
| 78 | + ticker_test.cc) |
| 79 | +set(ticker_android_SRCS |
| 80 | + ticker_android.cc) |
| 81 | +set(ticker_ios_SRCS |
| 82 | + ticker_ios.h) |
| 83 | +set(ticker_desktop_SRCS |
| 84 | + ticker_desktop.h |
| 85 | + ticker_desktop.cc) |
| 86 | +if(ANDROID) |
| 87 | + set(ticker_SRCS |
| 88 | + "${ticker_common_SRCS}" |
| 89 | + "${ticker_android_SRCS}") |
| 90 | +elseif(IOS) |
| 91 | + set(ticker_SRCS |
| 92 | + "${ticker_common_SRCS}" |
| 93 | + "${ticker_ios_SRCS}") |
| 94 | +else() |
| 95 | + set(ticker_SRCS |
| 96 | + "${ticker_common_SRCS}" |
| 97 | + "${ticker_desktop_SRCS}") |
| 98 | +endif() |
| 99 | + |
| 100 | +set(util_android_SRCS |
| 101 | + util_android.h |
| 102 | + util_android.cc |
| 103 | + util_android_test.cc) |
| 104 | +set(util_ios_SRCS |
| 105 | + util_ios.h |
| 106 | + util_ios.mm |
| 107 | + util_ios_test.mm) |
| 108 | +if(ANDROID) |
| 109 | + set(util_SRCS |
| 110 | + "${util_android_SRCS}") |
| 111 | +elseif(IOS) |
| 112 | + set(util_SRCS |
| 113 | + "${util_ios_SRCS}") |
| 114 | +else() |
| 115 | + set(util_SRCS "") |
| 116 | +endif() |
| 117 | + |
| 118 | +add_library(firebase_testing STATIC |
| 119 | + ${config_SRCS} |
| 120 | + ${reporter_SRCS} |
| 121 | + ${ticker_SRCS} |
| 122 | + ${util_SRCS}) |
| 123 | + |
| 124 | +target_include_directories(firebase_testing |
| 125 | + PUBLIC |
| 126 | + ${FLATBUFFERS_SOURCE_DIR}/include |
| 127 | + PRIVATE |
| 128 | + ${FIREBASE_CPP_SDK_ROOT_DIR} |
| 129 | + ${FIREBASE_GEN_FILE_DIR} |
| 130 | +) |
| 131 | + |
| 132 | +target_link_libraries(firebase_testing |
| 133 | + PRIVATE |
| 134 | + gtest |
| 135 | + gmock |
| 136 | +) |
0 commit comments