Skip to content

Commit

Permalink
Merge branch 'master' into reyang/maintainer
Browse files Browse the repository at this point in the history
  • Loading branch information
reyang authored Nov 30, 2020
2 parents f15f880 + 2a516ad commit 39fed2d
Show file tree
Hide file tree
Showing 89 changed files with 1,480 additions and 1,089 deletions.
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

[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.
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()
message("PROTOBUF_PROTOC_EXECUTABLE=${PROTOBUF_PROTOC_EXECUTABLE}")
endif()

if(WITH_OTLP)
include(third_party/opentelemetry-proto/Protobuf.cmake)
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)
# 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": [
{
"name": "nostd-x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\vs2019\\${name}",
"installRoot": "${projectDir}\\out\\vs2019\\${name}\\install",
"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",
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

0 comments on commit 39fed2d

Please sign in to comment.