1414# limitations under the License.
1515# ~~~
1616
17- include (GoogleapisConfig )
18- set (DOXYGEN_PROJECT_NAME "Dialogflow API C++ Client" )
19- set (DOXYGEN_PROJECT_BRIEF "A C++ Client Library for the Dialogflow API" )
20- set (DOXYGEN_PROJECT_NUMBER "${PROJECT_VERSION} " )
21- set (DOXYGEN_EXCLUDE_SYMBOLS "internal" "dialogflow_cx_internal"
22- "dialogflow_cx_testing" "examples" )
23- set (DOXYGEN_EXAMPLE_PATH ${CMAKE_CURRENT_SOURCE_DIR} /samples
24- ${CMAKE_CURRENT_SOURCE_DIR} /quickstart)
17+ include (GoogleCloudCppLibrary )
2518
26- include (GoogleCloudCppDoxygen )
27- google_cloud_cpp_doxygen_targets ("dialogflow_cx" DEPENDS cloud-docs
28- google-cloud-cpp::dialogflow_cx_protos )
19+ set (GOOGLE_CLOUD_CPP_SERVICE_DIRS "__EMPTY__" )
2920
30- include (GoogleCloudCppCommon )
31-
32- include (CompileProtos )
33- google_cloud_cpp_find_proto_include_dir (PROTO_INCLUDE_DIR )
34- google_cloud_cpp_load_protolist (
35- proto_list
36- "${PROJECT_SOURCE_DIR} /external/googleapis/protolists/dialogflow_cx.list" )
37- google_cloud_cpp_load_protodeps (
38- proto_deps
39- "${PROJECT_SOURCE_DIR} /external/googleapis/protodeps/dialogflow_cx.deps" )
40- google_cloud_cpp_grpcpp_library (
41- google_cloud_cpp_dialogflow_cx_protos # cmake-format: sort
42- ${proto_list} PROTO_PATH_DIRECTORIES "${EXTERNAL_GOOGLEAPIS_SOURCE} "
43- "${PROTO_INCLUDE_DIR} " )
44- external_googleapis_set_version_and_alias (dialogflow_cx_protos )
45- target_link_libraries (google_cloud_cpp_dialogflow_cx_protos
46- PUBLIC ${proto_deps} )
47-
48- file (
49- GLOB source_files
50- RELATIVE "${CMAKE_CURRENT_SOURCE_DIR} "
51- "*.h" "*.cc" "internal/*.h" "internal/*.cc" )
52- list (SORT source_files)
53- add_library (google_cloud_cpp_dialogflow_cx ${source_files} )
54- target_include_directories (
55- google_cloud_cpp_dialogflow_cx
56- PUBLIC $<BUILD_INTERFACE :${PROJECT_SOURCE_DIR} >
57- $<BUILD_INTERFACE :${PROJECT_BINARY_DIR} >
58- $<INSTALL_INTERFACE :include >)
59- target_link_libraries (
60- google_cloud_cpp_dialogflow_cx
61- PUBLIC google-cloud-cpp::grpc_utils google-cloud-cpp::common
62- google-cloud-cpp::dialogflow_cx_protos )
63- google_cloud_cpp_add_common_options (google_cloud_cpp_dialogflow_cx )
64- set_target_properties (
65- google_cloud_cpp_dialogflow_cx
66- PROPERTIES EXPORT_NAME google-cloud-cpp::dialogflow_cx
67- VERSION "${PROJECT_VERSION} "
68- SOVERSION "${PROJECT_VERSION_MAJOR} " )
69- target_compile_options (google_cloud_cpp_dialogflow_cx
70- PUBLIC ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG} )
71-
72- add_library (google-cloud-cpp::dialogflow_cx ALIAS
73- google_cloud_cpp_dialogflow_cx )
74-
75- # Create a header-only library for the mocks. We use a CMake `INTERFACE` library
76- # for these, a regular library would not work on macOS (where the library needs
77- # at least one .o file). Unfortunately INTERFACE libraries are a bit weird in
78- # that they need absolute paths for their sources.
79- file (
80- GLOB relative_mock_files
81- RELATIVE "${CMAKE_CURRENT_SOURCE_DIR} "
82- "mocks/*.h" )
83- list (SORT relative_mock_files)
84- set (mock_files)
85- foreach (file IN LISTS relative_mock_files)
86- list (APPEND mock_files "${CMAKE_CURRENT_SOURCE_DIR} /${file} " )
87- endforeach ()
88- add_library (google_cloud_cpp_dialogflow_cx_mocks INTERFACE )
89- target_sources (google_cloud_cpp_dialogflow_cx_mocks INTERFACE ${mock_files} )
90- target_link_libraries (
91- google_cloud_cpp_dialogflow_cx_mocks
92- INTERFACE google-cloud-cpp::dialogflow_cx GTest::gmock_main GTest::gmock
93- GTest::gtest )
94- set_target_properties (
95- google_cloud_cpp_dialogflow_cx_mocks
96- PROPERTIES EXPORT_NAME google-cloud-cpp::dialogflow_cx_mocks )
97- target_include_directories (
98- google_cloud_cpp_dialogflow_cx_mocks
99- INTERFACE $<BUILD_INTERFACE :${PROJECT_SOURCE_DIR} >
100- $<BUILD_INTERFACE :${PROJECT_BINARY_DIR} >
101- $<INSTALL_INTERFACE :include >)
102- target_compile_options (google_cloud_cpp_dialogflow_cx_mocks
103- INTERFACE ${GOOGLE_CLOUD_CPP_EXCEPTIONS_FLAG} )
21+ google_cloud_cpp_add_ga_grpc_library (dialogflow_cx "Dialogflow API" )
10422
10523if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
10624 add_executable (dialogflow_cx_quickstart "quickstart/quickstart.cc" )
@@ -116,69 +34,3 @@ if (BUILD_TESTING AND GOOGLE_CLOUD_CPP_ENABLE_CXX_EXCEPTIONS)
11634 set_tests_properties (dialogflow_cx_quickstart
11735 PROPERTIES LABELS "integration-test;quickstart" )
11836endif ()
119-
120- # Get the destination directories based on the GNU recommendations.
121- include (GNUInstallDirs )
122-
123- # Export the CMake targets to make it easy to create configuration files.
124- install (
125- EXPORT google_cloud_cpp_dialogflow_cx-targets
126- DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/google_cloud_cpp_dialogflow_cx"
127- COMPONENT google_cloud_cpp_development)
128-
129- # Install the libraries and headers in the locations determined by
130- # GNUInstallDirs
131- install (
132- TARGETS google_cloud_cpp_dialogflow_cx google_cloud_cpp_dialogflow_cx_protos
133- EXPORT google_cloud_cpp_dialogflow_cx-targets
134- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
135- COMPONENT google_cloud_cpp_runtime
136- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
137- COMPONENT google_cloud_cpp_runtime
138- NAMELINK_SKIP
139- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
140- COMPONENT google_cloud_cpp_development)
141- # With CMake-3.12 and higher we could avoid this separate command (and the
142- # duplication).
143- install (
144- TARGETS google_cloud_cpp_dialogflow_cx google_cloud_cpp_dialogflow_cx_protos
145- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
146- COMPONENT google_cloud_cpp_development
147- NAMELINK_ONLY
148- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
149- COMPONENT google_cloud_cpp_development)
150-
151- google_cloud_cpp_install_proto_library_protos (
152- "google_cloud_cpp_dialogflow_cx_protos" "${EXTERNAL_GOOGLEAPIS_SOURCE} " )
153- google_cloud_cpp_install_proto_library_headers (
154- "google_cloud_cpp_dialogflow_cx_protos" )
155- google_cloud_cpp_install_headers ("google_cloud_cpp_dialogflow_cx"
156- "include/google/cloud/dialogflow_cx" )
157- google_cloud_cpp_install_headers ("google_cloud_cpp_dialogflow_cx_mocks"
158- "include/google/cloud/dialogflow_cx" )
159-
160- google_cloud_cpp_add_pkgconfig (
161- dialogflow_cx
162- "The Dialogflow API C++ Client Library"
163- "Provides C++ APIs to use the Dialogflow API."
164- "google_cloud_cpp_grpc_utils"
165- "google_cloud_cpp_common"
166- "google_cloud_cpp_dialogflow_cx_protos" )
167-
168- # Create and install the CMake configuration files.
169- include (CMakePackageConfigHelpers )
170- configure_file ("config.cmake.in" "google_cloud_cpp_dialogflow_cx-config.cmake"
171- @ONLY )
172- write_basic_package_version_file (
173- "google_cloud_cpp_dialogflow_cx-config-version.cmake"
174- VERSION ${PROJECT_VERSION}
175- COMPATIBILITY ExactVersion )
176-
177- install (
178- FILES
179- "${CMAKE_CURRENT_BINARY_DIR} /google_cloud_cpp_dialogflow_cx-config.cmake"
180- "${CMAKE_CURRENT_BINARY_DIR} /google_cloud_cpp_dialogflow_cx-config-version.cmake"
181- DESTINATION "${CMAKE_INSTALL_LIBDIR} /cmake/google_cloud_cpp_dialogflow_cx"
182- COMPONENT google_cloud_cpp_development)
183-
184- external_googleapis_install_pc ("google_cloud_cpp_dialogflow_cx_protos" )
0 commit comments