-
Notifications
You must be signed in to change notification settings - Fork 559
Build tools: build configurations, vcpkg support, vcpkg port file for OpenTelemetry, use submodules for CMake deps #377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bbbf850
aae1c68
50ca4f3
5e00ae2
f4e6c90
7c46e02
b810c97
5e91eeb
4efeee7
f05e9e9
64bd715
0113aed
71136a5
54cc0dd
6a22842
6b11443
b72ddd9
c4d5675
68a4461
de67ca5
66489b9
c19519d
c68bce5
dea2d1a
b782d8d
d3a06d0
d171ad5
377640a
2b31204
03ff3c7
220db8c
72f1c11
9c2c607
a88a49c
177a3cf
53a94f8
6ccac73
7a8f2eb
16cbf59
9a638ee
b70a402
6b614ad
8873214
f810368
aa5bb96
83e7924
72d590c
a3b9f4b
42c4d1c
61d16cb
fbb73bc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| third_party | ||
| tools | ||
| out |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,3 +37,9 @@ | |
|
|
||
| # Mac | ||
| .DS_Store | ||
|
|
||
| # Output directories | ||
| /out | ||
| /out.* | ||
| # Indicator that the tools were deployed | ||
| .buildtools | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,29 @@ | ||
| [submodule "third_party/prometheus-cpp"] | ||
| path = third_party/prometheus-cpp | ||
| url = https://github.com/jupp0r/prometheus-cpp.git | ||
| url = https://github.com/jupp0r/prometheus-cpp | ||
| branch = master | ||
|
|
||
| [submodule "tools/vcpkg"] | ||
| path = tools/vcpkg | ||
| url = https://github.com/Microsoft/vcpkg | ||
| branch = master | ||
|
|
||
| [submodule "third_party/ms-gsl"] | ||
| path = third_party/ms-gsl | ||
| url = https://github.com/microsoft/GSL | ||
| branch = master | ||
|
|
||
| [submodule "third_party/googletest"] | ||
| path = third_party/googletest | ||
| url = https://github.com/google/googletest | ||
| branch = master | ||
|
|
||
| [submodule "third_party/benchmark"] | ||
| path = third_party/benchmark | ||
| url = https://github.com/google/benchmark | ||
| branch = master | ||
|
|
||
| [submodule "third_party/opentelemetry-proto"] | ||
| path = third_party/opentelemetry-proto | ||
| url = https://github.com/open-telemetry/opentelemetry-proto | ||
| branch = master | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,44 +15,91 @@ option(WITH_OTLP "Whether to include the OpenTelemetry Protocol in the SDK" OFF) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| option(WITH_PROMETHEUS "Whether to include the Prometheus Client in the SDK" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| OFF) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| option(WITH_TESTS "Whether to enable tests" ON) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| option(BUILD_TESTING "Whether to enable tests" ON) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| option(WITH_EXAMPLES "Whether to build examples" ON) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(WITH_PROTOBUF OFF) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WITH_OTLP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(WITH_PROTOBUF ON) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WITH_TESTS) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include(CTest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(Threads) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| function(install_windows_deps) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Bootstrap vcpkg from CMake and auto-install deps in case if we are missing | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # deps on Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message("Installing build tools and dependencies...") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| execute_process( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/tools/setup-buildtools.cmd) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(CMAKE_TOOLCHAIN_FILE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/tools/vcpkg/scripts/buildsystems/vcpkg.cmake) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endfunction() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(MSVC) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Options for Visual C++ compiler: /Zc:__cplusplus - report an updated value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # for recent C++ language standards. Without this option MSVC returns the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # value of __cplusplus="199711L" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WITH_OTLP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(WITH_PROTOBUF ON) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WITH_PROTOBUF) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(protobuf_MODULE_COMPATIBLE ON) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(Protobuf CONFIG NAMES protobuf) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Older versions of protobuf don't use cmake config files. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
maxgolov marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(Protobuf REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(NOT protobuf_FOUND) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WIN32) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_windows_deps() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(Protobuf REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WIN32) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Always use x64 protoc.exe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(NOT EXISTS "${Protobuf_PROTOC_EXECUTABLE}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(Protobuf_PROTOC_EXECUTABLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/tools/vcpkg/packages/protobuf_x64-windows/tools/protobuf/protoc.exe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Latest Protobuf uses mixed case instead of uppercase | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(PROTOBUF_PROTOC_EXECUTABLE ${Protobuf_PROTOC_EXECUTABLE}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
49
to
64
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this logic can be simplified a little bit:
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember about it. I'll organize this better in a separate PR, where I'll add nlohmann JSON dependency. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message("PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(WITH_OTLP) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include(third_party/opentelemetry-proto/Protobuf.cmake) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
maxgolov marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include(cmake/opentelemetry-proto.cmake) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(BUILD_TESTING) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(GTest REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(benchmark REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include(CTest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(EXISTS ${CMAKE_BINARY_DIR}/lib/libgtest.a) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
maxgolov marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Prefer GTest from build tree. GTest is not always working with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # CMAKE_PREFIX_PATH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(GTEST_INCLUDE_DIRS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest/googletest/include | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googletest/googlemock/include) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set(GTEST_BOTH_LIBRARIES | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_BINARY_DIR}/lib/libgtest.a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_BINARY_DIR}/lib/libgtest_main.a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${CMAKE_BINARY_DIR}/lib/libgmock.a) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| elseif(WIN32) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Make sure we are always bootsrapped with vcpkg on Windows | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(GTest) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if(NOT GTEST_FOUND) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| install_windows_deps() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(GTest REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Prefer GTest installed by OS distro, brew or vcpkg package manager | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(GTest REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include_directories(SYSTEM ${GTEST_INCLUDE_DIRS}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message("GTEST_INCLUDE_DIRS = ${GTEST_INCLUDE_DIRS}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| message("GTEST_BOTH_LIBRARIES = ${GTEST_BOTH_LIBRARIES}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| enable_testing() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Benchmark respects the CMAKE_PREFIX_PATH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| find_package(benchmark CONFIG REQUIRED) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endif() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| include_directories(api/include) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| { | ||
| "configurations": [ | ||
|
maxgolov marked this conversation as resolved.
|
||
| { | ||
| "name": "nostd-x64-Debug", | ||
| "generator": "Ninja", | ||
| "configurationType": "Debug", | ||
| "inheritEnvironments": [ "msvc_x64_x64" ], | ||
| "buildRoot": "${projectDir}\\out\\vs2019\\${name}", | ||
| "installRoot": "${projectDir}\\out\\vs2019\\${name}\\install", | ||
|
maxgolov marked this conversation as resolved.
|
||
| "cmakeCommandArgs": "", | ||
| "buildCommandArgs": "", | ||
| "ctestCommandArgs": "", | ||
| "variables": [ | ||
| { | ||
| "name": "WITH_OTLP", | ||
| "value": "True", | ||
| "type": "BOOL" | ||
| }, | ||
| { | ||
| "name": "WITH_EXAMPLES", | ||
| "value": "true", | ||
| "type": "BOOL" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "name": "nostd-x64-Release", | ||
| "generator": "Ninja", | ||
| "configurationType": "RelWithDebInfo", | ||
| "inheritEnvironments": [ "msvc_x64_x64" ], | ||
| "buildRoot": "${projectDir}\\out\\vs2019\\${name}", | ||
| "installRoot": "${projectDir}\\out\\vs2019\\${name}\\install", | ||
| "cmakeCommandArgs": "", | ||
| "buildCommandArgs": "", | ||
| "ctestCommandArgs": "", | ||
| "cmakeToolchain": "", | ||
| "variables": [ | ||
| { | ||
| "name": "WITH_OTLP", | ||
| "value": "True", | ||
| "type": "BOOL" | ||
| }, | ||
| { | ||
| "name": "WITH_EXAMPLES", | ||
| "value": "true", | ||
| "type": "BOOL" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.