Skip to content

Commit 4592cb3

Browse files
committed
clean up comments on third_party_release file. Fix installing third party projects using the git submodules
1 parent ff3e13b commit 4592cb3

File tree

2 files changed

+154
-152
lines changed

2 files changed

+154
-152
lines changed

install/cmake/CMakeLists.txt

Lines changed: 141 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ include(ExternalProject)
2525
set(OTELCPP_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/../..")
2626
get_filename_component(OTELCPP_SOURCE_DIR "${OTELCPP_SOURCE_DIR}" ABSOLUTE)
2727

28-
if(NOT DEFINED OTELCPP_THIRDPARTY_FILE)
28+
if(NOT OTELCPP_THIRDPARTY_FILE)
2929
set(OTELCPP_THIRDPARTY_FILE "${OTELCPP_SOURCE_DIR}/third_party_release")
3030
elseif(NOT IS_ABSOLUTE OTELCPP_THIRDPARTY_FILE)
3131
string(PREPEND OTELCPP_THIRDPARTY_FILE "${OTELCPP_SOURCE_DIR}/")
@@ -59,8 +59,7 @@ foreach(_raw_line IN LISTS _THIRDPARTY_FILE_CONTENT)
5959
endif()
6060
endforeach()
6161

62-
if(OTELCPP_THIRDPARTY_FILE STREQUAL
63-
"${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party_release")
62+
if(OTELCPP_THIRDPARTY_FILE STREQUAL "${OTELCPP_SOURCE_DIR}/third_party_release")
6463
set(USE_SUBMODULES ON)
6564
else()
6665
set(USE_SUBMODULES OFF)
@@ -182,123 +181,122 @@ ExternalProject_Add(
182181
"-DgRPC_ZLIB_PROVIDER=package"
183182
"-DgRPC_PROTOBUF_PROVIDER=package"
184183
"-DgRPC_ABSL_PROVIDER=package")
184+
185185
add_dependencies(grpc-build zlib-install abseil-install protobuf-install)
186186

187187
# ------------------------------------------------------------------------
188188
# ---- benchmark ----
189-
set(benchmark_ARGS
190-
PREFIX
191-
${CMAKE_BINARY_DIR}/external/benchmark
192-
INSTALL_DIR
193-
${CMAKE_INSTALL_PREFIX}
194-
CMAKE_ARGS
195-
"${CMAKE_OPTIONS}"
196-
"-DBENCHMARK_ENABLE_TESTING=OFF"
197-
"-DBENCHMARK_ENABLE_INSTALL=ON"
198-
"-DBUILD_SHARED_LIBS=ON")
199-
200-
if(USE_SUBMODULES
201-
AND EXISTS "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/benchmark/.git")
189+
190+
set(benchmark_ARGS "")
191+
if(USE_SUBMODULES AND EXISTS "${OTELCPP_SOURCE_DIR}/third_party/benchmark/.git")
202192
message(STATUS "Using submodule for benchmark")
203-
ExternalProject_Add(
204-
benchmark
205-
SOURCE_DIR "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/benchmark"
206-
${benchmark_ARGS})
193+
list(APPEND benchmark_ARGS SOURCE_DIR
194+
"${OTELCPP_SOURCE_DIR}/third_party/benchmark")
207195
else()
208-
ExternalProject_Add(
209-
benchmark
210-
GIT_REPOSITORY "https://github.com/google/benchmark.git"
211-
GIT_TAG ${benchmark_GIT_TAG}
212-
GIT_SHALLOW ON
213-
${benchmark_ARGS})
196+
list(
197+
APPEND
198+
benchmark_ARGS
199+
SOURCE_DIR
200+
GIT_REPOSITORY
201+
"https://github.com/google/benchmark.git"
202+
GIT_TAG
203+
${benchmark_GIT_TAG}
204+
GIT_SHALLOW
205+
ON)
214206
endif()
215207

208+
ExternalProject_Add(
209+
benchmark
210+
${benchmark_ARGS}
211+
PREFIX ${CMAKE_BINARY_DIR}/external/benchmark
212+
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
213+
CMAKE_ARGS "${CMAKE_OPTIONS}" "-DBENCHMARK_ENABLE_TESTING=OFF"
214+
"-DBENCHMARK_ENABLE_INSTALL=ON" "-DBUILD_SHARED_LIBS=ON")
215+
216216
# -----------------------------------------------------------------------
217217
# ---- googletest ----
218-
set(googletest_ARGS
219-
PREFIX
220-
${CMAKE_BINARY_DIR}/external/googletest
221-
INSTALL_DIR
222-
${CMAKE_INSTALL_PREFIX}
223-
CMAKE_ARGS
224-
"${CMAKE_OPTIONS}"
225-
"-DINSTALL_GTEST=ON"
226-
"-DBUILD_GMOCK=ON"
227-
"-DBUILD_SHARED_LIBS=ON")
228-
229-
if(USE_SUBMODULES
230-
AND EXISTS "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/googletest/.git")
218+
219+
set(googletest_ARGS "")
220+
if(USE_SUBMODULES AND EXISTS
221+
"${OTELCPP_SOURCE_DIR}/third_party/googletest/.git")
231222
message(STATUS "Using submodule for googletest")
232-
ExternalProject_Add(
233-
googletest
234-
SOURCE_DIR "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/googletest"
235-
${googletest_ARGS})
223+
list(APPEND googletest_ARGS SOURCE_DIR
224+
"${OTELCPP_SOURCE_DIR}/third_party/googletest")
236225
else()
237-
ExternalProject_Add(
238-
googletest
239-
GIT_REPOSITORY "https://github.com/google/googletest.git"
240-
GIT_TAG ${googletest_GIT_TAG}
241-
GIT_SHALLOW ON
242-
${googletest_ARGS})
226+
list(
227+
APPEND
228+
googletest_ARGS
229+
GIT_REPOSITORY
230+
"https://github.com/google/googletest.git"
231+
GIT_TAG
232+
${googletest_GIT_TAG}
233+
GIT_SHALLOW
234+
ON)
243235
endif()
244236

237+
ExternalProject_Add(
238+
googletest
239+
${googletest_ARGS}
240+
PREFIX ${CMAKE_BINARY_DIR}/external/googletest
241+
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
242+
CMAKE_ARGS "${CMAKE_OPTIONS}" "-DINSTALL_GTEST=ON" "-DBUILD_GMOCK=ON"
243+
"-DBUILD_SHARED_LIBS=ON")
244+
245245
# ----------------------------------------------------------------------
246246
# ---- Microsoft.GSL ----
247-
set(ms-gsl_ARGS
248-
PREFIX
249-
${CMAKE_BINARY_DIR}/external/ms-gsl
250-
INSTALL_DIR
251-
${CMAKE_INSTALL_PREFIX}
252-
CMAKE_ARGS
253-
"${CMAKE_OPTIONS}"
254-
"-DGSL_TEST=OFF"
255-
"-DGSL_INSTALL=ON")
256247

257-
if(USE_SUBMODULES AND EXISTS
258-
"${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/ms-gsl/.git")
248+
set(ms-gsl_ARGS "")
249+
if(USE_SUBMODULES AND EXISTS "${OTELCPP_SOURCE_DIR}/third_party/ms-gsl/.git")
259250
message(STATUS "Using submodule for ms-gsl")
260-
ExternalProject_Add(
261-
ms-gsl
262-
SOURCE_DIR "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/ms-gsl"
263-
${ms-gsl_ARGS})
251+
list(APPEND ms-gsl_ARGS SOURCE_DIR "${OTELCPP_SOURCE_DIR}/third_party/ms-gsl")
264252
else()
265-
ExternalProject_Add(
266-
ms-gsl
267-
GIT_REPOSITORY "https://github.com/microsoft/GSL.git"
268-
GIT_TAG ${ms-gsl_GIT_TAG}
269-
GIT_SHALLOW ON
270-
${ms-gsl_ARGS})
253+
list(
254+
APPEND
255+
ms-gsl_ARGS
256+
GIT_REPOSITORY
257+
"https://github.com/microsoft/GSL.git"
258+
GIT_TAG
259+
${ms-gsl_GIT_TAG}
260+
GIT_SHALLOW
261+
ON)
271262
endif()
272263

264+
ExternalProject_Add(
265+
ms-gsl
266+
${ms-gsl_ARGS}
267+
PREFIX ${CMAKE_BINARY_DIR}/external/ms-gsl
268+
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
269+
CMAKE_ARGS "${CMAKE_OPTIONS}" "-DGSL_TEST=OFF" "-DGSL_INSTALL=ON")
270+
273271
# ----------------------------------------------------------------------
274272
# ---- nlohmann-json ----
275-
set(nhlohmann-json_ARGS
276-
PREFIX
277-
${CMAKE_BINARY_DIR}/external/nlohmann-json
278-
INSTALL_DIR
279-
${CMAKE_INSTALL_PREFIX}
280-
CMAKE_ARGS
281-
"${CMAKE_OPTIONS}"
282-
"-DJSON_BuildTests=OFF"
283-
"-DJSON_Install=ON"
284-
"-DJSON_MultipleHeaders=OFF")
285-
286-
if(USE_SUBMODULES
287-
AND EXISTS "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/nlohmann-json/.git")
273+
274+
set(nhlohmann-json_ARGS "")
275+
if(USE_SUBMODULES AND EXISTS
276+
"${OTELCPP_SOURCE_DIR}/third_party/nlohmann-json/.git")
288277
message(STATUS "Using submodule for nlohmann-json")
289-
ExternalProject_Add(
290-
nlohmann-json
291-
SOURCE_DIR "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/nlohmann-json"
292-
${nhlohmann-json_ARGS})
278+
list(APPEND nhlohmann-json_ARGS SOURCE_DIR
279+
"${OTELCPP_SOURCE_DIR}/third_party/nlohmann-json")
293280
else()
294-
ExternalProject_Add(
295-
nlohmann-json
296-
GIT_REPOSITORY "https://github.com/nlohmann/json.git"
297-
GIT_TAG ${nhlohmann-json_GIT_TAG}
298-
GIT_SHALLOW ON
299-
${nhlohmann-json_ARGS})
281+
list(
282+
APPEND
283+
nhlohmann-json_ARGS
284+
GIT_REPOSITORY
285+
"https://github.com/nlohmann/json.git"
286+
GIT_TAG
287+
${nhlohmann-json_GIT_TAG}
288+
GIT_SHALLOW
289+
ON)
300290
endif()
301291

292+
ExternalProject_Add(
293+
nlohmann-json
294+
${nhlohmann-json_ARGS}
295+
PREFIX ${CMAKE_BINARY_DIR}/external/nlohmann-json
296+
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
297+
CMAKE_ARGS "${CMAKE_OPTIONS}" "-DJSON_BuildTests=OFF" "-DJSON_Install=ON"
298+
"-DJSON_MultipleHeaders=OFF")
299+
302300
# ----------------------------------------------------------------------
303301
# ---- opentelemetry-proto ----
304302
if(DEFINED OTELCPP_PROTO_PATH)
@@ -319,64 +317,64 @@ endif()
319317
# ----------------------------------------------------------------------
320318
# ---- opentracing-cpp ----
321319

322-
set(opentracing-cpp_ARGS
323-
PREFIX
324-
${CMAKE_BINARY_DIR}/external/opentracing-cpp
325-
INSTALL_DIR
326-
${CMAKE_INSTALL_PREFIX}
327-
CMAKE_ARGS
328-
"${CMAKE_OPTIONS}"
329-
"-DBUILD_TESTING=OFF")
330-
331-
if(USE_SUBMODULES
332-
AND EXISTS
333-
"${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/opentracing-cpp/.git")
320+
set(opentracing-cpp_ARGS "")
321+
if(USE_SUBMODULES AND EXISTS
322+
"${OTELCPP_SOURCE_DIR}/third_party/opentracing-cpp/.git")
334323
message(STATUS "Using submodule for opentracing-cpp")
335-
ExternalProject_Add(
336-
opentracing-cpp
337-
SOURCE_DIR "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/opentracing-cpp"
338-
${opentracing-cpp_ARGS})
324+
list(APPEND opentracing-cpp_ARGS SOURCE_DIR
325+
"${OTELCPP_SOURCE_DIR}/third_party/opentracing-cpp"
326+
${opentracing-cpp_ARGS})
339327
else()
340-
ExternalProject_Add(
341-
opentracing-cpp
342-
GIT_REPOSITORY "https://github.com/opentracing/opentracing-cpp.git"
343-
GIT_TAG ${opentracing-cpp_GIT_TAG}
344-
GIT_SHALLOW ON
345-
${opentracing-cpp_ARGS})
328+
list(
329+
APPEND
330+
opentracing-cpp_ARGS
331+
GIT_REPOSITORY
332+
"https://github.com/opentracing/opentracing-cpp.git"
333+
GIT_TAG
334+
${opentracing-cpp_GIT_TAG}
335+
GIT_SHALLOW
336+
ON)
346337
endif()
347338

339+
ExternalProject_Add(
340+
opentracing-cpp
341+
${opentracing-cpp_ARGS}
342+
PREFIX ${CMAKE_BINARY_DIR}/external/opentracing-cpp
343+
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
344+
CMAKE_ARGS "${CMAKE_OPTIONS}" "-DBUILD_TESTING=OFF")
345+
348346
# ----------------------------------------------------------------------
349347
# ---- prometheus-cpp ----
350-
set(prometheus-cpp_ARGS
351-
PREFIX
352-
${CMAKE_BINARY_DIR}/external/prometheus-cpp
353-
INSTALL_DIR
354-
${CMAKE_INSTALL_PREFIX}
355-
STEP_TARGETS
356-
build
357-
DEPENDS
358-
zlib
359-
curl
360-
CMAKE_ARGS
361-
"${CMAKE_OPTIONS}"
362-
"-DENABLE_TESTING=OFF"
363-
"-DENABLE_PUSH=ON"
364-
"-DENABLE_PULL=ON")
365-
366-
if(USE_SUBMODULES
367-
AND EXISTS "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/prometheus-cpp/.git")
348+
349+
set(prometheus-cpp_ARGS "")
350+
if(USE_SUBMODULES AND EXISTS
351+
"${OTELCPP_SOURCE_DIR}/third_party/prometheus-cpp/.git")
368352
message(STATUS "Using submodule for prometheus-cpp")
369-
ExternalProject_Add(
370-
prometheus-cpp
371-
SOURCE_DIR "${OPENTELEMETRY_CPP_SOURCE_DIR}/third_party/prometheus-cpp"
372-
${prometheus-cpp_ARGS})
353+
list(APPEND prometheus-cpp_ARGS SOURCE_DIR
354+
"${OTELCPP_SOURCE_DIR}/third_party/prometheus-cpp")
373355
else()
374-
ExternalProject_Add(
375-
prometheus-cpp
376-
GIT_REPOSITORY "https://github.com/jupp0r/prometheus-cpp.git"
377-
GIT_TAG ${prometheus-cpp_GIT_TAG}
378-
GIT_SHALLOW ON
379-
GIT_SUBMODULES "3rdparty/civetweb" ${prometheus-cpp_ARGS})
356+
357+
list(
358+
APPEND
359+
prometheus-cpp_ARGS
360+
GIT_REPOSITORY
361+
"https://github.com/jupp0r/prometheus-cpp.git"
362+
GIT_TAG
363+
"${prometheus-cpp_GIT_TAG}"
364+
GIT_SHALLOW
365+
ON
366+
GIT_SUBMODULES
367+
"3rdparty/civetweb")
380368
endif()
381369

370+
ExternalProject_Add(
371+
prometheus-cpp
372+
${prometheus-cpp_ARGS}
373+
PREFIX ${CMAKE_BINARY_DIR}/external/prometheus-cpp
374+
INSTALL_DIR ${CMAKE_INSTALL_PREFIX}
375+
STEP_TARGETS build
376+
DEPENDS zlib curl
377+
CMAKE_ARGS "${CMAKE_OPTIONS}" "-DENABLE_TESTING=OFF" "-DENABLE_PUSH=ON"
378+
"-DENABLE_PULL=ON")
379+
382380
add_dependencies(prometheus-cpp-build zlib-install curl-install)

third_party_release

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
# Copyright The OpenTelemetry Authors
22
# SPDX-License-Identifier: Apache-2.0
3-
4-
# Git tags of third-party dependencies
5-
6-
# This file is used to:
7-
# - Install third-party dependencies with the opentelemetry-cpp-thirdparty-install project (./install/cmake/CMakeLists.txt)
8-
# - Fetch third-party dependencies with FetchContent when using CMake to build opentelemetry-cpp
9-
10-
# To update a dependency version, manually edit the release git tag below.
11-
# If the dependency is also a submodule, please manually update it to the new tag.
3+
#
4+
# MAINTAINER
5+
#
6+
# This file is used for the CMake build.
7+
# Format: <dependency_name>=<release_git_tag>
8+
#
9+
# When changing (add, upgrade, remove) dependencies
10+
# please update:
11+
# - manually edit the release git tag below.
12+
# - update the matching git submodule to the new tag.
13+
# - update the Bazel build files
14+
# - opentelemetry-cpp/MODULE.bazel
15+
# - opentelemetry-cpp/bazel/repository.bzl
1216

1317
abseil=20220623.2
1418
zlib=v1.3.1

0 commit comments

Comments
 (0)