Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Commit

Permalink
Remove C++98 directory. (#18)
Browse files Browse the repository at this point in the history
* Remove C++98 directory.
* Add note about C/C++98.
  • Loading branch information
rnburn authored and tedsuo committed Sep 25, 2017
1 parent 42cbb35 commit 56d89ab
Show file tree
Hide file tree
Showing 26 changed files with 115 additions and 88 deletions.
112 changes: 107 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,120 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.1)
enable_testing()

project(opentracing-cpp)

# ==============================================================================
# Version information

set(OPENTRACING_ABI_VERSION "1")
set(OPENTRACING_VERSION_MAJOR "0")
set(OPENTRACING_VERSION_MINOR "1")
set(OPENTRACING_VERSION_PATCH "0")
set(OPENTRACING_VERSION_STRING
"${OPENTRACING_VERSION_MAJOR}.${OPENTRACING_VERSION_MINOR}.${OPENTRACING_VERSION_PATCH}")

# ==============================================================================
# Set up cpack

SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "C++ implementation of the OpenTracing API")
SET(CPACK_PACKAGE_VENDOR "opentracing.io")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")

SET(CPACK_PACKAGE_VERSION_MAJOR "0")
SET(CPACK_PACKAGE_VERSION_MINOR "1")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_VERSION_MAJOR ${OPENTRACING_VERSION_MAJOR})
SET(CPACK_PACKAGE_VERSION_MINOR ${OPENTRACING_VERSION_MINOR})
SET(CPACK_PACKAGE_VERSION_PATCH ${OPENTRACING_VERSION_PATCH})
include(CPack)

add_subdirectory(c++11)
# ==============================================================================
# Set up generated version.h

configure_file(version.h.in include/opentracing/version.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/opentracing
DESTINATION include)

# ==============================================================================
# Configure compilers

set(CMAKE_CXX_STANDARD 11)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything \
-Wno-c++98-compat \
-Wno-c++98-compat-bind-to-temporary-copy \
-Wno-weak-vtables \
-Wno-exit-time-destructors \
-Wno-global-constructors \
-Wno-padded")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()

# ==============================================================================
# Set up linter

find_program(CLANG_TIDY_EXE NAMES "clang-tidy"
DOC "Path to clang-tidy executable")
if(NOT CLANG_TIDY_EXE)
message(STATUS "clang-tidy not found.")
else()
message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
set(DO_CLANG_TIDY "${CLANG_TIDY_EXE}" "-checks=*,-clang-analyzer-alpha.*")
endif()

# ==============================================================================
# OpenTracing library targets

include_directories(include)
include_directories(SYSTEM 3rd_party/include)

set(SRCS src/propagation.cpp src/noop.cpp src/tracer.cpp)
add_library(opentracing SHARED ${SRCS})
target_include_directories(opentracing INTERFACE "$<INSTALL_INTERFACE:include/>")
set_target_properties(opentracing PROPERTIES VERSION ${OPENTRACING_VERSION_STRING}
SOVERSION ${OPENTRACING_VERSION_MAJOR})
add_library(opentracing-static STATIC ${SRCS})
set_target_properties(opentracing-static PROPERTIES OUTPUT_NAME opentracing)
target_include_directories(opentracing-static INTERFACE "$<INSTALL_INTERFACE:include/>")
if (CLANG_TIDY_EXE)
set_target_properties(opentracing PROPERTIES
CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()


install(DIRECTORY 3rd_party/include/opentracing DESTINATION include
FILES_MATCHING PATTERN "*.hpp"
PATTERN "*.h")
install(DIRECTORY include/opentracing DESTINATION include
FILES_MATCHING PATTERN "*.h")
install(TARGETS opentracing opentracing-static EXPORT OpenTracingTargets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

# ==============================================================================
# Package configuration setup

include(CMakePackageConfigHelpers)
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/OpenTracingConfigVersion.cmake"
VERSION ${OPENTRACING_VERSION_STRING}
COMPATIBILITY AnyNewerVersion)
export(EXPORT OpenTracingTargets
FILE "${CMAKE_CURRENT_BINARY_DIR}/OpenTracingTargets.cmake"
NAMESPACE OpenTracing::)
configure_file(cmake/OpenTracingConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/OpenTracingConfig.cmake"
COPYONLY)
set(ConfigPackageLocation lib/cmake/OpenTracing)
install(EXPORT OpenTracingTargets
FILE OpenTracingTargets.cmake
NAMESPACE OpenTracing::
DESTINATION ${ConfigPackageLocation})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/OpenTracingConfig.cmake
"${CMAKE_CURRENT_BINARY_DIR}/OpenTracingConfigVersion.cmake"
DESTINATION ${ConfigPackageLocation}
COMPONENT Devel)

# ==============================================================================
# Testing

add_subdirectory(test)
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,10 @@ reference.
For the time being, "mild" backwards-incompatible changes may be made without
changing the major version number. As OpenTracing and `opentracing-cpp` mature,
backwards compatibility will become more of a priority.
## C/C++98
This library requires C++11 or later. But if you're interested in a C or C++98
API contact us on [gitter](https://gitter.im/opentracing/opentracing-cpp?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge).
We're open to supporting additional APIs in a separate repository if there's
people willing to maintain it.
78 changes: 0 additions & 78 deletions c++11/CMakeLists.txt

This file was deleted.

2 changes: 0 additions & 2 deletions c++98/README.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 1 addition & 3 deletions c++11/version.h.in → version.h.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#ifndef OPENTRACING_VERSION_H
#define OPENTRACING_VERSION_H

#define OPENTRACING_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}." \
"${CPACK_PACKAGE_VERSION_MINOR}." \
"${CPACK_PACKAGE_VERSION_PATCH}"
#define OPENTRACING_VERSION "${OPENTRACING_VERSION_STRING}"

// clang-format off
#define BEGIN_OPENTRACING_ABI_NAMESPACE \
Expand Down

0 comments on commit 56d89ab

Please sign in to comment.