From 76d9c5b23446328c26ecdbc180932979044613e6 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 10 Jan 2023 22:50:24 +0100 Subject: [PATCH 01/14] WIP --- CMakeLists.txt | 46 +++++++++++++--- examples/CMakeLists.txt | 5 +- examples/http/CMakeLists.txt | 29 +++++------ exporters/otlp/CMakeLists.txt | 4 +- exporters/zipkin/CMakeLists.txt | 1 - ext/src/CMakeLists.txt | 4 +- ext/src/http/client/curl/CMakeLists.txt | 52 +++++++++---------- ext/test/http/CMakeLists.txt | 5 +- ext/test/w3c_tracecontext_test/CMakeLists.txt | 25 ++++----- 9 files changed, 103 insertions(+), 68 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c010e6eea..732cf4b882 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + cmake_minimum_required(VERSION 3.1) # See https://cmake.org/cmake/help/v3.3/policy/CMP0057.html required by certain @@ -148,6 +151,9 @@ if(WITH_STL) endif() option(WITH_OTLP "Whether to include the OpenTelemetry Protocol in the SDK" OFF) + +option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK" OFF) + option(WITH_ZIPKIN "Whether to include the Zipkin exporter in the SDK" OFF) option(WITH_PROMETHEUS "Whether to include the Prometheus Client in the SDK" @@ -194,6 +200,7 @@ option( "Only build the API (use as a header-only library). Overrides WITH_EXAMPLES and all options to enable exporters" OFF) option(WITH_EXAMPLES "Whether to build examples" ON) +option(WITH_EXAMPLES_HTTP "Whether to build http client/server examples" ON) option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF) @@ -314,22 +321,47 @@ if(WITH_OTLP) endif() endif() include(CMakeDependentOption) - if(WITH_OTLP_HTTP OR (NOT DEFINED WITH_OTLP_HTTP AND NOT DEFINED - CACHE{WITH_OTLP_HTTP})) - find_package(CURL) - endif() cmake_dependent_option( WITH_OTLP_GRPC "Whether to include the OTLP gRPC exporter in the SDK" ON "gRPC_FOUND" OFF) - cmake_dependent_option( - WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK" ON - "CURL_FOUND" OFF) message(STATUS "PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}") include(cmake/opentelemetry-proto.cmake) endif() +# +# Do we need CURL ? +# + +if(WITH_ZIPKIN + OR WITH_OTLP_HTTP + OR WITH_EXAMPLES_HTTP + OR BUILD_W3CTRACECONTEXT_TEST) + set(USE_CURL ON) +else() + set(USE_CURL OFF) +endif() + +if((NOT WITH_API_ONLY) AND USE_CURL) + find_package(CURL REQUIRED) +endif() + +# +# Do we need HTTP CLIENT CURL ? +# + +if(WITH_OTLP_HTTP + OR WITH_HTTP_EXAMPLES) + set(WITH_HTTP_CLIENT_CURL ON) +else() + set(WITH_HTTP_CLIENT_CURL OFF) +endif() + +# +# Do we need NLOHMANN_JSON ? +# + if(WITH_ELASTICSEARCH OR WITH_ZIPKIN OR WITH_OTLP_HTTP diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 1f891f412d..201b00f1ce 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -24,4 +24,7 @@ add_subdirectory(batch) add_subdirectory(metrics_simple) add_subdirectory(multithreaded) add_subdirectory(multi_processor) -add_subdirectory(http) + +if(WITH_EXAMPLES_HTTP) + add_subdirectory(http) +endif() diff --git a/examples/http/CMakeLists.txt b/examples/http/CMakeLists.txt index a1181c93a4..3aeb2624a1 100644 --- a/examples/http/CMakeLists.txt +++ b/examples/http/CMakeLists.txt @@ -1,20 +1,17 @@ -find_package(CURL) +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 -if(NOT CURL_FOUND) - message(WARNING "Skipping http client/server example build: CURL not found") -else() - include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include - ${CMAKE_SOURCE_DIR}/ext/include ${CMAKE_SOURCE_DIR/}) +include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include + ${CMAKE_SOURCE_DIR}/ext/include ${CMAKE_SOURCE_DIR/}) - add_executable(http_client client.cc) - add_executable(http_server server.cc) +add_executable(http_client client.cc) +add_executable(http_server server.cc) - target_link_libraries( - http_client ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace - opentelemetry_http_client_curl opentelemetry_exporter_ostream_span - ${CURL_LIBRARIES}) +target_link_libraries( + http_client ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace + opentelemetry_http_client_curl opentelemetry_exporter_ostream_span + ${CURL_LIBRARIES}) - target_link_libraries( - http_server ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace - opentelemetry_http_client_curl opentelemetry_exporter_ostream_span) -endif() +target_link_libraries( + http_server ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace + opentelemetry_http_client_curl opentelemetry_exporter_ostream_span) diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 7cecab0eca..49db6058ae 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + add_library( opentelemetry_otlp_recordable src/otlp_log_recordable.cc src/otlp_recordable.cc @@ -94,7 +97,6 @@ if(WITH_OTLP_GRPC) endif() if(WITH_OTLP_HTTP) - find_package(CURL REQUIRED) add_library(opentelemetry_exporter_otlp_http_client src/otlp_http_client.cc) set_target_properties(opentelemetry_exporter_otlp_http_client PROPERTIES EXPORT_NAME otlp_http_client) diff --git a/exporters/zipkin/CMakeLists.txt b/exporters/zipkin/CMakeLists.txt index 0139a783e2..ce093f3e55 100644 --- a/exporters/zipkin/CMakeLists.txt +++ b/exporters/zipkin/CMakeLists.txt @@ -13,7 +13,6 @@ # limitations under the License. include_directories(include) -find_package(CURL REQUIRED) add_definitions(-DWITH_CURL) add_library( opentelemetry_exporter_zipkin_trace diff --git a/ext/src/CMakeLists.txt b/ext/src/CMakeLists.txt index 6d7a14be41..48389427cf 100644 --- a/ext/src/CMakeLists.txt +++ b/ext/src/CMakeLists.txt @@ -2,4 +2,6 @@ if(WITH_ZPAGES) add_subdirectory(zpages) endif() -add_subdirectory(http/client/curl) +if(WITH_HTTP_CLIENT_CURL) + add_subdirectory(http/client/curl) +endif() diff --git a/ext/src/http/client/curl/CMakeLists.txt b/ext/src/http/client/curl/CMakeLists.txt index 836cd019b4..38fdad4030 100644 --- a/ext/src/http/client/curl/CMakeLists.txt +++ b/ext/src/http/client/curl/CMakeLists.txt @@ -1,30 +1,30 @@ -find_package(CURL) -if(CURL_FOUND) - add_library( - opentelemetry_http_client_curl http_client_factory_curl.cc - http_client_curl.cc http_operation_curl.cc) +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 - set_target_properties(opentelemetry_http_client_curl - PROPERTIES EXPORT_NAME http_client_curl) +add_library( + opentelemetry_http_client_curl http_client_factory_curl.cc + http_client_curl.cc http_operation_curl.cc) - if(TARGET CURL::libcurl) - target_link_libraries( - opentelemetry_http_client_curl - PUBLIC opentelemetry_ext - PRIVATE CURL::libcurl) - else() - target_include_directories(opentelemetry_http_client_curl - INTERFACE "${CURL_INCLUDE_DIRS}") - target_link_libraries( - opentelemetry_http_client_curl - PUBLIC opentelemetry_ext - PRIVATE ${CURL_LIBRARIES}) - endif() +set_target_properties(opentelemetry_http_client_curl + PROPERTIES EXPORT_NAME http_client_curl) - install( - TARGETS opentelemetry_http_client_curl - EXPORT "${PROJECT_NAME}-target" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +if(TARGET CURL::libcurl) + target_link_libraries( + opentelemetry_http_client_curl + PUBLIC opentelemetry_ext + PRIVATE CURL::libcurl) +else() + target_include_directories(opentelemetry_http_client_curl + INTERFACE "${CURL_INCLUDE_DIRS}") + target_link_libraries( + opentelemetry_http_client_curl + PUBLIC opentelemetry_ext + PRIVATE ${CURL_LIBRARIES}) endif() + +install( + TARGETS opentelemetry_http_client_curl + EXPORT "${PROJECT_NAME}-target" + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/ext/test/http/CMakeLists.txt b/ext/test/http/CMakeLists.txt index 341648085d..654e490376 100644 --- a/ext/test/http/CMakeLists.txt +++ b/ext/test/http/CMakeLists.txt @@ -1,4 +1,6 @@ -find_package(CURL) +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + if(CURL_FOUND) set(FILENAME curl_http_test) add_compile_definitions(WITH_CURL) @@ -19,6 +21,7 @@ if(CURL_FOUND) TEST_PREFIX ext.http.curl. TEST_LIST ${FILENAME}) endif() + set(URL_PARSER_FILENAME url_parser_test) add_executable(${URL_PARSER_FILENAME} ${URL_PARSER_FILENAME}.cc) target_link_libraries(${URL_PARSER_FILENAME} ${GTEST_BOTH_LIBRARIES} diff --git a/ext/test/w3c_tracecontext_test/CMakeLists.txt b/ext/test/w3c_tracecontext_test/CMakeLists.txt index ea74a8eeb0..cc2ae43b1c 100644 --- a/ext/test/w3c_tracecontext_test/CMakeLists.txt +++ b/ext/test/w3c_tracecontext_test/CMakeLists.txt @@ -1,17 +1,14 @@ -include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include) +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 -find_package(CURL) -if(NOT CURL_FOUND) - message(WARNING "Skipping example_w3c_tracecontext_test: CURL not found") -else() - add_executable(w3c_tracecontext_test main.cc) - target_link_libraries( - w3c_tracecontext_test - PRIVATE ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace - opentelemetry_http_client_curl opentelemetry_exporter_ostream_span - ${CURL_LIBRARIES} nlohmann_json::nlohmann_json) - if(nlohmann_json_clone) - add_dependencies(w3c_tracecontext_test nlohmann_json::nlohmann_json) - endif() +include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include) +add_executable(w3c_tracecontext_test main.cc) +target_link_libraries( + w3c_tracecontext_test + PRIVATE ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace + opentelemetry_http_client_curl opentelemetry_exporter_ostream_span + ${CURL_LIBRARIES} nlohmann_json::nlohmann_json) +if(nlohmann_json_clone) + add_dependencies(w3c_tracecontext_test nlohmann_json::nlohmann_json) endif() From ccc880556c3bf5d7d5067d6f1e5487f5eb9ceaa9 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 10 Jan 2023 23:59:56 +0100 Subject: [PATCH 02/14] Format cleanup Explicitly ask for OTLP_HTTP --- CMakeLists.txt | 6 +++--- ci/do_ci.sh | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b5126e56b..d698939a5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,8 @@ endif() option(WITH_OTLP "Whether to include the OpenTelemetry Protocol in the SDK" OFF) -option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK" OFF) +option(WITH_OTLP_HTTP "Whether to include the OTLP http exporter in the SDK" + OFF) option(WITH_ZIPKIN "Whether to include the Zipkin exporter in the SDK" OFF) @@ -351,8 +352,7 @@ endif() # Do we need HTTP CLIENT CURL ? # -if(WITH_OTLP_HTTP - OR WITH_HTTP_EXAMPLES) +if(WITH_OTLP_HTTP OR WITH_EXAMPLES_HTTP) set(WITH_HTTP_CLIENT_CURL ON) else() set(WITH_HTTP_CLIENT_CURL OFF) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6c80c0efe6..3ffbbd42e5 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -94,6 +94,8 @@ elif [[ "$1" == "cmake.maintainer.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ + -DWITH_OTLP=ON \ + -DWITH_OTLP_HTTP=ON \ -DWITH_PROMETHEUS=ON \ -DWITH_ZIPKIN=ON \ -DWITH_JAEGER=ON \ @@ -180,6 +182,7 @@ elif [[ "$1" == "cmake.legacy.exporter.otprotocol.test" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=11 \ -DWITH_OTLP=ON \ + -DWITH_OTLP_HTTP=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ "${SRC_DIR}" grpc_cpp_plugin=`which grpc_cpp_plugin` @@ -193,6 +196,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.test" ]]; then rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ -DWITH_OTLP=ON \ + -DWITH_OTLP_HTTP=ON \ "${SRC_DIR}" grpc_cpp_plugin=`which grpc_cpp_plugin` proto_make_file="CMakeFiles/opentelemetry_proto.dir/build.make" @@ -205,6 +209,7 @@ elif [[ "$1" == "cmake.exporter.otprotocol.with_async_export.test" ]]; then rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ -DWITH_OTLP=ON \ + -DWITH_OTLP_HTTP=ON \ -DWITH_ASYNC_EXPORT_PREVIEW=ON \ "${SRC_DIR}" grpc_cpp_plugin=`which grpc_cpp_plugin` From 36b78afba5cbcdf53d372e7cffe532e71e2881eb Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 12 Jan 2023 11:15:49 +0100 Subject: [PATCH 03/14] Don't require CURL by default. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d698939a5f..94050c1321 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -201,7 +201,9 @@ option( "Only build the API (use as a header-only library). Overrides WITH_EXAMPLES and all options to enable exporters" OFF) option(WITH_EXAMPLES "Whether to build examples" ON) -option(WITH_EXAMPLES_HTTP "Whether to build http client/server examples" ON) + +# This requires CURL, OFF by default. +option(WITH_EXAMPLES_HTTP "Whether to build http client/server examples" OFF) option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF) @@ -346,6 +348,7 @@ endif() if((NOT WITH_API_ONLY) AND USE_CURL) find_package(CURL REQUIRED) + message(STATUS "Found CURL ${CURL_VERSION}" endif() # From 1da8230431b1a75928e98e34f37f3e29fb334d13 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 12 Jan 2023 11:18:41 +0100 Subject: [PATCH 04/14] Typo --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94050c1321..85b4e11bea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -348,7 +348,7 @@ endif() if((NOT WITH_API_ONLY) AND USE_CURL) find_package(CURL REQUIRED) - message(STATUS "Found CURL ${CURL_VERSION}" + message(STATUS "Found CURL ${CURL_VERSION}") endif() # From 4557babefec1898cde146b3bd58f8e2224b75d13 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 12 Jan 2023 11:48:21 +0100 Subject: [PATCH 05/14] Cleanup --- ci/do_ci.sh | 2 -- ext/test/http/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 3ffbbd42e5..01a40ddfe7 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -94,8 +94,6 @@ elif [[ "$1" == "cmake.maintainer.test" ]]; then cd "${BUILD_DIR}" rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ - -DWITH_OTLP=ON \ - -DWITH_OTLP_HTTP=ON \ -DWITH_PROMETHEUS=ON \ -DWITH_ZIPKIN=ON \ -DWITH_JAEGER=ON \ diff --git a/ext/test/http/CMakeLists.txt b/ext/test/http/CMakeLists.txt index 654e490376..268c91cbf2 100644 --- a/ext/test/http/CMakeLists.txt +++ b/ext/test/http/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -if(CURL_FOUND) +if(WITH_HTTP_CLIENT_CURL) set(FILENAME curl_http_test) add_compile_definitions(WITH_CURL) add_executable(${FILENAME} ${FILENAME}.cc) From 1dbd2208735b41955673653d7cf30e11742405b5 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 12 Jan 2023 12:13:46 +0100 Subject: [PATCH 06/14] Reordered dependencies, start from client curl --- CMakeLists.txt | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85b4e11bea..ea9ff1d9f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -333,14 +333,26 @@ if(WITH_OTLP) include(cmake/opentelemetry-proto.cmake) endif() +# +# Do we need HTTP CLIENT CURL ? +# + +if(WITH_OTLP_HTTP + OR WITH_ELASTICSEARCH + OR WITH_JAEGER + OR WITH_ZIPKIN + OR BUILD_W3CTRACECONTEXT_TEST + OR WITH_EXAMPLES_HTTP) + set(WITH_HTTP_CLIENT_CURL ON) +else() + set(WITH_HTTP_CLIENT_CURL OFF) +endif() + # # Do we need CURL ? # -if(WITH_ZIPKIN - OR WITH_OTLP_HTTP - OR WITH_EXAMPLES_HTTP - OR BUILD_W3CTRACECONTEXT_TEST) +if(WITH_HTTP_CLIENT_CURL) set(USE_CURL ON) else() set(USE_CURL OFF) @@ -348,17 +360,7 @@ endif() if((NOT WITH_API_ONLY) AND USE_CURL) find_package(CURL REQUIRED) - message(STATUS "Found CURL ${CURL_VERSION}") -endif() - -# -# Do we need HTTP CLIENT CURL ? -# - -if(WITH_OTLP_HTTP OR WITH_EXAMPLES_HTTP) - set(WITH_HTTP_CLIENT_CURL ON) -else() - set(WITH_HTTP_CLIENT_CURL OFF) + message(STATUS "Found CURL: ${CURL_LIBRARIES}, version ${CURL_VERSION}") endif() # From 270138ca6c75a064a1b75f71cbbb82a250d5e5be Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 12 Jan 2023 14:30:02 +0100 Subject: [PATCH 07/14] Added CHANGELOG --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee58553c3d..f8365c3da1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,34 @@ Increment the: to enable Bazel 6.0.0 compatibility [#1873](https://github.com/open-telemetry/opentelemetry-cpp/pull/1873) * [BUILD] Cleanup CMake makefiles for nlohmann_json [#1912](https://github.com/open-telemetry/opentelemetry-cpp/pull/1912) +* [BUILD] Cleanup CMake makefiles for CURL usage + [#1916](https://github.com/open-telemetry/opentelemetry-cpp/pull/1916) + +Important changes: + +* [BUILD] Cleanup CMake makefiles for CURL usage + [#1916](https://github.com/open-telemetry/opentelemetry-cpp/pull/1916) + * CMake option `WITH_OTLP_HTTP` + * Before this change, the CMake option `WITH_OTLP_HTTP` was unpredictable, + sometime set to ON and sometime set to OFF by default, + depending on whether a CURL package was found or not. + The option `WITH_OTLP_HTTP` was sometime not displayed in the ccmake + UI, making it impossible to even discover there is an option of that name. + * With this change, CMake option `WITH_OTLP_HTTP` is always OFF by + default. WITH_OTLP_HTTP MUST be set to ON explicitly to build the + OTLP HTTP exporter. The option is always visible in the ccmake UI. + * CMake option `BUILD_W3CTRACECONTEXT_TEST` + * Before this change, the W3C trace context tests were built, or + not, in an unpredictable way, depending on the presence, or not, of a + CURL package. In particular, the build could ignore the W3C trace + context tests even when BUILD_W3CTRACECONTEXT_TEST=ON. + * With this change, option BUILD_W3CTRACECONTEXT_TEST is honored. + * HTTP client/server examples + * Before this change, the HTTP client/server examples were built, or + not, in an unpredictable way, depending on the presence, or not, of a + CURL package. + * With this change, a new option `WITH_EXAMPLES_HTTP` is used to + build the HTTP client/server examples. ## [1.8.1] 2022-12-04 From 69d18613f6a05c6c140ff4567db9924ad554e272 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Thu, 12 Jan 2023 14:44:15 +0100 Subject: [PATCH 08/14] Fixed format. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ea9ff1d9f8..19b9a3687a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.1) cmake_policy(SET CMP0057 NEW) # See https://cmake.org/cmake/help/v3.12/policy/CMP0074.html required by certain -# version of zlib which is dependeded by cURL. +# version of zlib which CURL depends on. if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") cmake_policy(SET CMP0074 NEW) endif() @@ -341,8 +341,8 @@ if(WITH_OTLP_HTTP OR WITH_ELASTICSEARCH OR WITH_JAEGER OR WITH_ZIPKIN - OR BUILD_W3CTRACECONTEXT_TEST - OR WITH_EXAMPLES_HTTP) + OR BUILD_W3CTRACECONTEXT_TEST + OR WITH_EXAMPLES_HTTP) set(WITH_HTTP_CLIENT_CURL ON) else() set(WITH_HTTP_CLIENT_CURL OFF) From 4f2434a46fbe093e59cae00e27ba8142bd785029 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 13 Jan 2023 23:11:10 +0100 Subject: [PATCH 09/14] Test examples in maintainer mode --- ci/do_ci.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 01a40ddfe7..873c53b587 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -95,6 +95,8 @@ elif [[ "$1" == "cmake.maintainer.test" ]]; then rm -rf * cmake -DCMAKE_BUILD_TYPE=Debug \ -DWITH_PROMETHEUS=ON \ + -DWITH_EXAMPLES=ON \ + -DWITH_EXAMPLES_HTTP=ON \ -DWITH_ZIPKIN=ON \ -DWITH_JAEGER=ON \ -DBUILD_W3CTRACECONTEXT_TEST=ON \ From 2e03d763da858b1ea418114ecdd9a4b4125bf55d Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 16 Jan 2023 11:22:31 +0100 Subject: [PATCH 10/14] Review comments --- CMakeLists.txt | 10 +++++++++- examples/CMakeLists.txt | 3 +++ examples/otlp/CMakeLists.txt | 3 +++ examples/zipkin/CMakeLists.txt | 3 +++ ext/src/CMakeLists.txt | 3 +++ 5 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 19b9a3687a..14823b8d13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,7 +203,7 @@ option( option(WITH_EXAMPLES "Whether to build examples" ON) # This requires CURL, OFF by default. -option(WITH_EXAMPLES_HTTP "Whether to build http client/server examples" OFF) +option(WITH_EXAMPLES_HTTP "Whether to build http client/server examples. Requires WITH_EXAMPLES and CURL" OFF) option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF) @@ -211,6 +211,14 @@ option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF) option(WITH_METRICS_EXEMPLAR_PREVIEW "Whethere to enable exemplar within metrics" OFF) +# +# Verify options dependencies +# + +if(WITH_EXAMPLES_HTTP AND NOT WITH_EXAMPLES) + message(FATAL_ERROR "WITH_EXAMPLES_HTTP=ON requires WITH_EXAMPLES=ON") +endif() + find_package(Threads) function(install_windows_deps) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 201b00f1ce..f1a4ec20e5 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + add_subdirectory(common) include_directories(common) if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP) diff --git a/examples/otlp/CMakeLists.txt b/examples/otlp/CMakeLists.txt index 30ce3cab48..bcf387a108 100644 --- a/examples/otlp/CMakeLists.txt +++ b/examples/otlp/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + include_directories( ${CMAKE_BINARY_DIR}/generated/third_party/opentelemetry-proto ${CMAKE_SOURCE_DIR}/exporters/otlp/include) diff --git a/examples/zipkin/CMakeLists.txt b/examples/zipkin/CMakeLists.txt index f55f363d72..e3e3a5f55f 100644 --- a/examples/zipkin/CMakeLists.txt +++ b/examples/zipkin/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + include_directories(${CMAKE_SOURCE_DIR}/exporters/zipkin/include) add_executable(example_zipkin main.cc) diff --git a/ext/src/CMakeLists.txt b/ext/src/CMakeLists.txt index 48389427cf..84f30dd906 100644 --- a/ext/src/CMakeLists.txt +++ b/ext/src/CMakeLists.txt @@ -1,3 +1,6 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + if(WITH_ZPAGES) add_subdirectory(zpages) endif() From b1b36d4c57e7cebc6fcbe6e94638e9bcc04d0940 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 16 Jan 2023 11:37:11 +0100 Subject: [PATCH 11/14] Review comments. --- CMakeLists.txt | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14823b8d13..9d82f8d99c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,13 +360,7 @@ endif() # Do we need CURL ? # -if(WITH_HTTP_CLIENT_CURL) - set(USE_CURL ON) -else() - set(USE_CURL OFF) -endif() - -if((NOT WITH_API_ONLY) AND USE_CURL) +if((NOT WITH_API_ONLY) AND WITH_HTTP_CLIENT_CURL) find_package(CURL REQUIRED) message(STATUS "Found CURL: ${CURL_LIBRARIES}, version ${CURL_VERSION}") endif() From 2771103a822a8304391fc74340c3adae91385563 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 16 Jan 2023 14:27:27 +0100 Subject: [PATCH 12/14] Fixed format --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d82f8d99c..857d5df3ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,7 +203,10 @@ option( option(WITH_EXAMPLES "Whether to build examples" ON) # This requires CURL, OFF by default. -option(WITH_EXAMPLES_HTTP "Whether to build http client/server examples. Requires WITH_EXAMPLES and CURL" OFF) +option( + WITH_EXAMPLES_HTTP + "Whether to build http client/server examples. Requires WITH_EXAMPLES and CURL" + OFF) option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF) From 1301d221cf8f3c198600c8d1a5cb1b91d1ca33f2 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 17 Jan 2023 14:23:02 +0100 Subject: [PATCH 13/14] Added comments. This is to force CI to rebuild in github, stuck with no recovery in github UI. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 857d5df3ab..f47a49ab79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,6 +364,7 @@ endif() # if((NOT WITH_API_ONLY) AND WITH_HTTP_CLIENT_CURL) + # No specific version required. find_package(CURL REQUIRED) message(STATUS "Found CURL: ${CURL_LIBRARIES}, version ${CURL_VERSION}") endif() From 8e17b6c2e5b889389423700e35e9f3599fba5bc9 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Tue, 17 Jan 2023 14:25:46 +0100 Subject: [PATCH 14/14] Format. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f47a49ab79..6429162d05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,7 +206,7 @@ option(WITH_EXAMPLES "Whether to build examples" ON) option( WITH_EXAMPLES_HTTP "Whether to build http client/server examples. Requires WITH_EXAMPLES and CURL" - OFF) + OFF) option(WITH_LOGS_PREVIEW "Whether to build logs preview" OFF) option(WITH_ASYNC_EXPORT_PREVIEW "Whether enable async export" OFF)