Skip to content

Commit

Permalink
[BUILD] CMake cleanup for message() (#2582)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Mar 8, 2024
1 parent e5c2e25 commit ac7ee5f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
29 changes: 15 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -301,15 +301,16 @@ function(install_windows_deps)
set(VCPKG_TARGET_ARCHITECTURE
${ARCH}
PARENT_SCOPE)
message("Installing build tools and dependencies...")
message(STATUS "Installing build tools and dependencies...")
set(ENV{ARCH} ${ARCH})
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
CACHE FILEPATH "")
message(
"Make sure that vcpkg.cmake is set as the CMAKE_TOOLCHAIN_FILE at the START of the cmake build process!
STATUS
"Make sure that vcpkg.cmake is set as the CMAKE_TOOLCHAIN_FILE at the START of the cmake build process!
Can be command-line arg (cmake -DCMAKE_TOOLCHAIN_FILE=...) or set in your editor of choice."
)

Expand Down Expand Up @@ -347,7 +348,7 @@ include(GNUInstallDirs)
if(WITH_PROMETHEUS)
find_package(prometheus-cpp CONFIG QUIET)
if(NOT prometheus-cpp_FOUND)
message("Trying to use local prometheus-cpp from submodule")
message(STATUS "Trying to use local prometheus-cpp from submodule")
if(EXISTS ${PROJECT_SOURCE_DIR}/third_party/prometheus-cpp/.git)
set(SAVED_ENABLE_TESTING ${ENABLE_TESTING})
set(ENABLE_TESTING OFF)
Expand All @@ -361,7 +362,7 @@ if(WITH_PROMETHEUS)
"git submodule update --init --recursive")
endif()
else()
message("Using external prometheus-cpp")
message(STATUS "Using external prometheus-cpp")
endif()
endif()

Expand Down Expand Up @@ -389,7 +390,7 @@ if(WITH_OTLP_GRPC OR WITH_OTLP_HTTP)
endif()

if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE))
message(STATUS_FATAL "Windows dependency installation failed!")
message(FATAL_ERROR "Windows dependency installation failed!")
endif()
if(WIN32)
include(${CMAKE_TOOLCHAIN_FILE})
Expand Down Expand Up @@ -485,15 +486,15 @@ endif()

if(OTELCPP_MAINTAINER_MODE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("Building with gcc in maintainer mode.")
message(STATUS "Building with gcc in maintainer mode.")

add_compile_options(-Wall)
add_compile_options(-Werror)
add_compile_options(-Wextra)

# Tested with GCC 9.4 on github.
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.4)
message("Building with additional warnings for gcc.")
message(STATUS "Building with additional warnings for gcc.")

# Relaxed warnings

Expand All @@ -518,15 +519,15 @@ if(OTELCPP_MAINTAINER_MODE)
add_compile_options(-Wvla)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message("Building with clang in maintainer mode.")
message(STATUS "Building with clang in maintainer mode.")

add_compile_options(-Wall)
add_compile_options(-Werror)
add_compile_options(-Wextra)

# Tested with Clang 11.0 on github.
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11.0)
message("Building with additional warnings for clang.")
message(STATUS "Building with additional warnings for clang.")

# Relaxed warnings
add_compile_options(-Wno-error=unused-private-field)
Expand All @@ -549,7 +550,7 @@ if(OTELCPP_MAINTAINER_MODE)
add_compile_options(-Wold-style-cast)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("Building with msvc in maintainer mode.")
message(STATUS "Building with msvc in maintainer mode.")

add_compile_options(/WX)
add_compile_options(/W4)
Expand Down Expand Up @@ -619,8 +620,8 @@ if(BUILD_TESTING)
if(GTEST_INCLUDE_DIRS)
include_directories(SYSTEM ${GTEST_INCLUDE_DIRS})
endif()
message("GTEST_INCLUDE_DIRS = ${GTEST_INCLUDE_DIRS}")
message("GTEST_BOTH_LIBRARIES = ${GTEST_BOTH_LIBRARIES}")
message(STATUS "GTEST_INCLUDE_DIRS = ${GTEST_INCLUDE_DIRS}")
message(STATUS "GTEST_BOTH_LIBRARIES = ${GTEST_BOTH_LIBRARIES}")
enable_testing()
if(WITH_BENCHMARK)
# Benchmark respects the CMAKE_PREFIX_PATH
Expand Down Expand Up @@ -652,7 +653,7 @@ if(WITH_OPENTRACING)
find_package(OpenTracing CONFIG QUIET)
if(NOT OpenTracing_FOUND)
set(OPENTRACING_DIR "third_party/opentracing-cpp")
message("Trying to use local ${OPENTRACING_DIR} from submodule")
message(STATUS "Trying to use local ${OPENTRACING_DIR} from submodule")
if(EXISTS "${PROJECT_SOURCE_DIR}/${OPENTRACING_DIR}/.git")
set(SAVED_BUILD_TESTING ${BUILD_TESTING})
set(BUILD_TESTING OFF)
Expand All @@ -666,7 +667,7 @@ if(WITH_OPENTRACING)
"git submodule update --init --recursive")
endif()
else()
message("Using external opentracing-cpp")
message(STATUS "Using external opentracing-cpp")
endif()
add_subdirectory(opentracing-shim)
endif()
Expand Down
2 changes: 1 addition & 1 deletion examples/grpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
get_filename_component(proto_file "./protos/messages.proto" ABSOLUTE)
get_filename_component(proto_file_path "${proto_file}" PATH)

message("PATH:${proto_file_path}:${proto_file}")
message(STATUS "PATH:${proto_file_path}:${proto_file}")
# Generated sources
set(example_proto_srcs "${CMAKE_CURRENT_BINARY_DIR}/messages.pb.cc")
set(example_proto_hdrs "${CMAKE_CURRENT_BINARY_DIR}/messages.pb.h")
Expand Down

2 comments on commit ac7ee5f

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: ac7ee5f Previous: e5c2e25 Ratio
BM_BaselineBuffer/4 14625229.835510254 ns/iter 7019505.500793457 ns/iter 2.08
BM_LockFreeBuffer/2 6320216.655731201 ns/iter 973956.3585650612 ns/iter 6.49
BM_LockFreeBuffer/4 7760865.688323975 ns/iter 1091797.2495808827 ns/iter 7.11

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp api Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: ac7ee5f Previous: e5c2e25 Ratio
BM_ProcYieldSpinLockThrashing/4/process_time/real_time 4.862983226776123 ms/iter 1.164414882659912 ms/iter 4.18
BM_NaiveSpinLockThrashing/1/process_time/real_time 10.11286463056292 ms/iter 0.09379159061575099 ms/iter 107.82
BM_NaiveSpinLockThrashing/2/process_time/real_time 11.3869309425354 ms/iter 0.1763439666904347 ms/iter 64.57
BM_NaiveSpinLockThrashing/4/process_time/real_time 11.02609634399414 ms/iter 0.5768905451268326 ms/iter 19.11
BM_ThreadYieldSpinLockThrashing/1/process_time/real_time 27.521514892578125 ms/iter 7.027924060821533 ms/iter 3.92

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.