-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Conan 1.x package manager for C++ is a bit easier to work with than the Bazel system. This allows us to more easily update dependencies, to keep them in-sync with the atlas-system-agent project, which also uses Conan. The Address Sanitizer has been disabled for MacOS as a part of this change, because there were some issues with segfaults when running tests locally on the Apple silicon platform. One line of thinking is that the Address Sanitizer compiler flags are not propagating fully through the dependency tree, but we also do not see this issue on Linux. Otherwise, the project builds and the tests pass. The Address Sanitizer remains engaged for the Linux builds triggered by the Github Actions.
- Loading branch information
1 parent
8d9ab60
commit d83036a
Showing
23 changed files
with
175 additions
and
277 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.clwb/ | ||
.DS_Store | ||
.idea/ | ||
.vscode/ | ||
bazel-* | ||
build-* | ||
cmake-build-debug/ | ||
cmake-build/ | ||
venv/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
|
||
project(spectator) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED True) | ||
|
||
if(APPLE) | ||
# Address Sanitizer is finicky on MacOS Apple Silicon, so skip it | ||
add_compile_options(-fno-omit-frame-pointer) | ||
add_link_options(-fno-omit-frame-pointer) | ||
else() | ||
add_compile_options(-fno-omit-frame-pointer "$<$<CONFIG:Debug>:-fsanitize=address>") | ||
add_link_options(-fno-omit-frame-pointer "$<$<CONFIG:Debug>:-fsanitize=address>") | ||
endif() | ||
|
||
include(CTest) | ||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
#-- spectator_test test executable | ||
file(GLOB spectator_test_source_files | ||
"spectator/*_test.cc" | ||
"spectator/test_*.cc" | ||
"spectator/test_*.h" | ||
) | ||
add_executable(spectator_test ${spectator_test_source_files}) | ||
target_link_libraries(spectator_test spectator ${CONAN_LIBS}) | ||
add_test( | ||
NAME spectator_test | ||
COMMAND spectator_test | ||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
) | ||
|
||
#-- spectator library | ||
add_library(spectator | ||
"spectator/logger.cc" | ||
"spectator/publisher.cc" | ||
"spectator/config.h" | ||
"spectator/id.h" | ||
"spectator/logger.h" | ||
"spectator/measurement.h" | ||
"spectator/meter_type.h" | ||
"spectator/publisher.h" | ||
"spectator/registry.h" | ||
"spectator/stateful_meters.h" | ||
"spectator/stateless_meters.h" | ||
) | ||
target_link_libraries(spectator ${CONAN_LIBS}) | ||
target_link_options(spectator PRIVATE "$<$<CONFIG:Release>:-static-libstdc++>") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,44 @@ | ||
#!/bin/bash | ||
#!/usr/bin/env bash | ||
|
||
bazel --output_user_root=$HOME/.cache/bazel --batch build --config asan spectator_test spectator | ||
GTEST_COLOR=1 ./bazel-bin/spectator_test | ||
BUILD_DIR=cmake-build | ||
# Choose: Debug, Release, RelWithDebInfo and MinSizeRel | ||
BUILD_TYPE=Debug | ||
|
||
BLUE="\033[0;34m" | ||
NC="\033[0m" | ||
|
||
if [[ "$1" == "clean" ]]; then | ||
echo -e "${BLUE}==== clean ====${NC}" | ||
rm -rf $BUILD_DIR | ||
fi | ||
|
||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
export CC=gcc-11 | ||
export CXX=g++-11 | ||
fi | ||
|
||
if [[ ! -d $BUILD_DIR ]]; then | ||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then | ||
echo -e "${BLUE}==== configure default profile ====${NC}" | ||
conan profile new default --detect | ||
conan profile update settings.compiler.libcxx=libstdc++11 default | ||
fi | ||
|
||
echo -e "${BLUE}==== install required dependencies ====${NC}" | ||
conan install . --build=missing --install-folder $BUILD_DIR | ||
fi | ||
|
||
pushd $BUILD_DIR || exit 1 | ||
|
||
echo -e "${BLUE}==== generate build files ====${NC}" | ||
cmake .. -DCMAKE_BUILD_TYPE=$BUILD_TYPE || exit 1 | ||
|
||
echo -e "${BLUE}==== build ====${NC}" | ||
cmake --build . || exit 1 | ||
|
||
if [[ "$1" != "skiptest" ]]; then | ||
echo -e "${BLUE}==== test ====${NC}" | ||
GTEST_COLOR=1 ctest --verbose | ||
fi | ||
|
||
popd || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from conans import ConanFile | ||
|
||
|
||
class SpectatorDConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
requires = ( | ||
"abseil/20230125.3", | ||
"asio/1.28.1", | ||
"backward-cpp/1.6", | ||
"benchmark/1.8.3", | ||
"fmt/10.1.1", | ||
"gtest/1.14.0", | ||
"spdlog/1.12.0" | ||
) | ||
generators = "cmake" | ||
default_options = {} |
Oops, something went wrong.