Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
bbbf850
Collection of build tools (no code changes)
maxgolov Oct 27, 2020
aae1c68
Merge branch 'master' into maxgolov/build_tools
maxgolov Nov 2, 2020
50ca4f3
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 7, 2020
5e00ae2
Merge branch 'master' into maxgolov/build_tools
maxgolov Nov 7, 2020
f4e6c90
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 9, 2020
7c46e02
Add docker files for developer build
maxgolov Nov 14, 2020
b810c97
Move bazel-specific build files into bazel-specific directory.
maxgolov Nov 14, 2020
5e91eeb
Remove opentelemetry-proto - use submodule instead
maxgolov Nov 16, 2020
4efeee7
Modules
maxgolov Nov 16, 2020
f05e9e9
Move JSON bazel file to /bazel build files directory
maxgolov Nov 16, 2020
64bd715
Allow building with Docker
maxgolov Nov 16, 2020
0113aed
Clean-up Unix build tools
maxgolov Nov 16, 2020
71136a5
Add Windows build tools
maxgolov Nov 16, 2020
54cc0dd
Fix dependency issue for build on Windows with OTLP exporter enabled
maxgolov Nov 16, 2020
6a22842
Update benchmark to latest
maxgolov Nov 16, 2020
6b11443
Ignore scripts copied into docker build from /tools
maxgolov Nov 16, 2020
b72ddd9
Rework CMakeLists.txt to:
maxgolov Nov 16, 2020
c4d5675
Clean-up Dockerfile for Ubuntu 16/18/20 to make sure we do not unnece…
maxgolov Nov 16, 2020
68a4461
Clean modules
maxgolov Nov 16, 2020
de67ca5
Add submodule for opentelemetry-proto
maxgolov Nov 16, 2020
66489b9
Fix permissions and attributes
maxgolov Nov 16, 2020
c19519d
Initial implementation of VCPKG support
maxgolov Nov 16, 2020
c68bce5
Merge branch 'maxgolov/build_tools' of https://github.com/open-teleme…
maxgolov Nov 16, 2020
dea2d1a
Merge branch 'master' into maxgolov/build_tools
maxgolov Nov 16, 2020
b782d8d
Apply latest cmake format 0.6.13 - it looks much cleaner
maxgolov Nov 16, 2020
d3a06d0
Merge branch 'maxgolov/build_tools' of https://github.com/open-teleme…
maxgolov Nov 16, 2020
d171ad5
Add submodules to .bazelignore
maxgolov Nov 16, 2020
377640a
Try bazel clean builds to remove stale cache entries
maxgolov Nov 16, 2020
2b31204
Merge branch 'master' into maxgolov/build_tools
maxgolov Nov 17, 2020
03ff3c7
Trying to fix the Bazel build failure by recursively cloning with sub…
maxgolov Nov 17, 2020
220db8c
Don't clone submodules for DocFX and code format runs
maxgolov Nov 17, 2020
72f1c11
No need to clone it anymore: it's now there in the build tree as subm…
maxgolov Nov 17, 2020
9c2c607
Submit submodule updated to latest version v0.10.0
maxgolov Nov 17, 2020
a88a49c
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 17, 2020
177a3cf
Fix formatting issue after rebase
maxgolov Nov 17, 2020
53a94f8
nit: formatting
maxgolov Nov 17, 2020
6ccac73
Previous prometheus-cpp had a bug, update to latest
maxgolov Nov 17, 2020
7a8f2eb
Trying to fix a quirk with prometheus exporter build (shot in the dar…
maxgolov Nov 17, 2020
16cbf59
Recursively init just this module instead of full set from the top
maxgolov Nov 17, 2020
9a638ee
Merge branch 'master' into maxgolov/build_tools
reyang Nov 23, 2020
b70a402
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 23, 2020
6b614ad
Merge branch 'maxgolov/build_tools' of https://github.com/open-teleme…
maxgolov Nov 23, 2020
8873214
Fix formatting issue and export in `build.sh` for legacy gcc
maxgolov Nov 23, 2020
f810368
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 26, 2020
aa5bb96
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 26, 2020
83e7924
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
maxgolov Nov 30, 2020
72d590c
Address code review comments
maxgolov Nov 30, 2020
a3b9f4b
Apply suggestions from code review
maxgolov Nov 30, 2020
42c4d1c
Merge branch 'maxgolov/build_tools' of https://github.com/open-teleme…
maxgolov Nov 30, 2020
61d16cb
Address code review comments
maxgolov Nov 30, 2020
fbb73bc
Move bazel build files to /bazel directory -- keep third_party dir ig…
maxgolov Nov 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
third_party
tools
out
6 changes: 3 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ LICENSE* text
*.pdf binary
*.rtf binary

## Self-reference =)
.gitignore text
.gitattributes text
## git files
.gitignore text eol=lf
.gitattributes text eol=lf
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -26,6 +28,8 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
Expand All @@ -44,6 +48,8 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
Expand All @@ -56,6 +62,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -68,6 +76,8 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_ci_environment.sh
Expand All @@ -83,6 +93,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -96,6 +108,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -109,6 +123,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -122,6 +138,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -135,6 +153,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand All @@ -148,6 +168,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand Down Expand Up @@ -178,6 +200,8 @@ jobs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: run tests
run: ./ci/do_ci.sh bazel.test

Expand All @@ -186,6 +210,8 @@ jobs:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
./ci/setup_windows_cmake.ps1
Expand All @@ -201,6 +227,8 @@ jobs:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: ./ci/install_windows_bazelisk.ps1
- name: run tests
Expand All @@ -211,6 +239,8 @@ jobs:
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
./ci/setup_windows_cmake.ps1
Expand All @@ -223,6 +253,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: setup
run: |
sudo ./ci/setup_cmake.sh
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@

# Mac
.DS_Store

# Output directories
/out
/out.*
# Indicator that the tools were deployed
.buildtools
28 changes: 27 additions & 1 deletion .gitmodules
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
Comment thread
maxgolov marked this conversation as resolved.

[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
73 changes: 60 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Comment thread
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this logic can be simplified a little bit:

Suggested change
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()
if(NOT protobuf_FOUND)
if(WIN32)
install_windows_deps()
find_package(Protobuf REQUIRED)
# 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()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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)
Comment thread
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)
Comment thread
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)
Expand Down
51 changes: 51 additions & 0 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"configurations": [
Comment thread
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",
Comment thread
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"
}
]
}
]
}
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ http_archive(

http_archive(
name = "github_nlohmann_json",
build_file = "//third_party/json:nlohmann_json.BUILD",
build_file = "//bazel:nlohmann_json.BUILD",
Comment thread
maxgolov marked this conversation as resolved.
sha256 = "69cc88207ce91347ea530b227ff0776db82dcb8de6704e1a3d74f4841bc651cf",
urls = [
"https://github.com/nlohmann/json/releases/download/v3.6.1/include.zip",
Expand All @@ -106,7 +106,7 @@ prometheus_cpp_repositories()
# libcurl - An optional dependency we pull in for tests.
http_archive(
name = "curl",
build_file = "@//third_party:curl.BUILD",
build_file = "@//bazel:curl.BUILD",
sha256 = "ba98332752257b47b9dea6d8c0ad25ec1745c20424f1dd3ff2c99ab59e97cf91",
strip_prefix = "curl-7.73.0",
urls = ["https://curl.haxx.se/download/curl-7.73.0.tar.gz"],
Expand Down
5 changes: 4 additions & 1 deletion api/test/context/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ foreach(testname context_test runtime_context_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(TARGET ${testname} TEST_PREFIX context. TEST_LIST ${testname})
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX context.
TEST_LIST ${testname})
endforeach()
6 changes: 4 additions & 2 deletions api/test/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ include(GoogleTest)
add_executable(timestamp_test timestamp_test.cc)
target_link_libraries(timestamp_test ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(TARGET timestamp_test TEST_PREFIX trace. TEST_LIST
timestamp_test)
gtest_add_tests(
TARGET timestamp_test
TEST_PREFIX trace.
TEST_LIST timestamp_test)
Loading