-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#18816) dd-opentracing-cpp: migrate to Conan v2
* dd-opentracing-cpp: migrate to Conan v2 * dd-opentracing-cpp: fix msgpack dependency * dd-opentracing-cpp: bump deps * dd-opentracing-cpp: transitive_libs=True * dd-opentracing-cpp: drop the invalid target names * dd-opentracing-cpp: add v1.3.7 * Remove clang-specific compiler flag * Apply suggestions from code review Co-authored-by: Uilian Ries <uilianries@gmail.com> * dd-opentracing-cpp: fix patch * Minor refactors before merging --------- Co-authored-by: Rubén Rincón Blanco <rubenrb@jfrog.com> Co-authored-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
- Loading branch information
1 parent
bb8d59a
commit 63c3ee8
Showing
10 changed files
with
180 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
sources: | ||
"1.3.7": | ||
url: "https://github.com/DataDog/dd-opentracing-cpp/archive/refs/tags/v1.3.7.tar.gz" | ||
sha256: "8d39c6b23f941a2d11571daaccc04e69539a3fcbcc50a631837560d5861a7b96" | ||
"1.3.0": | ||
url: https://github.com/DataDog/dd-opentracing-cpp/archive/refs/tags/v1.3.0.tar.gz | ||
sha256: 16aad0c0daed054d4bcdf68cf069956e8d3b0c60a33c2162ad655a17b33b65e4 | ||
url: "https://github.com/DataDog/dd-opentracing-cpp/archive/refs/tags/v1.3.0.tar.gz" | ||
sha256: "16aad0c0daed054d4bcdf68cf069956e8d3b0c60a33c2162ad655a17b33b65e4" | ||
patches: | ||
"1.3.7": | ||
- patch_file: "patches/1.3.7/0001-Find-packages-setup.patch" | ||
"1.3.0": | ||
- base_path: "source_subfolder" | ||
patch_file: "patches/0001-Find-packages-setup.patch" | ||
- patch_file: "patches/1.3.0/0001-Find-packages-setup.patch" |
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
45 changes: 17 additions & 28 deletions
45
...ll/patches/0001-Find-packages-setup.patch → ...ches/1.3.0/0001-Find-packages-setup.patch
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,65 +1,54 @@ | ||
--- | ||
CMakeLists.txt | 30 ++++++++++-------------------- | ||
1 file changed, 10 insertions(+), 20 deletions(-) | ||
|
||
--- CMakeLists.txt | ||
+++ CMakeLists.txt | ||
@@ -34,17 +34,12 @@ include_directories(include) | ||
@@ -34,16 +34,11 @@ | ||
set(CMAKE_LIBRARY_PATH deps/lib) | ||
|
||
# Dependencies | ||
-find_path(OPENTRACING_INCLUDE_DIR NAMES opentracing/tracer.h) | ||
-find_library(OPENTRACING_LIB opentracing) | ||
+find_package(OpenTracing REQUIRED) | ||
+find_package(OpenTracing REQUIRED CONFIG) | ||
find_package(ZLIB REQUIRED) | ||
-find_library(MSGPACK_LIB msgpack) | ||
-find_package(CURL) | ||
+find_package(msgpack REQUIRED) | ||
+find_package(CURL REQUIRED) | ||
+find_package(msgpack REQUIRED CONFIG) | ||
+find_package(CURL REQUIRED CONFIG) | ||
find_package(Threads REQUIRED) | ||
- | ||
-# Code Sanitizers | ||
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rd_party/sanitizers-cmake" ${CMAKE_MODULE_PATH}) | ||
-find_package(Sanitizers) | ||
- | ||
# Code | ||
install(DIRECTORY include/datadog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
file(GLOB DD_OPENTRACING_SOURCES "src/*.cpp") | ||
@@ -58,29 +53,24 @@ else() | ||
@@ -58,16 +53,16 @@ | ||
endif() | ||
|
||
# Outputs | ||
-set(DATADOG_LINK_LIBRARIES ${OPENTRACING_LIB} ${CURL_LIBRARIES} ${ZLIB_LIBRARIES} Threads::Threads) | ||
+set(DATADOG_LINK_LIBRARIES OpenTracing::OpenTracing CURL::CURL msgpack::msgpack ZLIB::ZLIB Threads::Threads) | ||
+set(DATADOG_LINK_LIBRARIES OpenTracing::OpenTracing CURL::libcurl msgpack-cxx ZLIB::ZLIB Threads::Threads) | ||
|
||
## Shared lib | ||
if(BUILD_SHARED) | ||
add_library(dd_opentracing SHARED ${DD_OPENTRACING_SOURCES}) | ||
- add_sanitizers(dd_opentracing) | ||
target_link_libraries(dd_opentracing ${DATADOG_LINK_LIBRARIES}) | ||
set_target_properties(dd_opentracing PROPERTIES SOVERSION ${SOVERSION}) | ||
- target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_SHARED) | ||
- install(TARGETS dd_opentracing | ||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
+ target_compile_definitions(dd_opentracing PUBLIC DD_OPENTRACING_SHARED) | ||
+ install(TARGETS dd_opentracing) | ||
target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_SHARED) | ||
install(TARGETS dd_opentracing | ||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
@@ -75,9 +70,9 @@ | ||
## Static lib | ||
if(BUILD_STATIC) | ||
add_library(dd_opentracing-static STATIC ${DD_OPENTRACING_SOURCES}) | ||
- add_sanitizers(dd_opentracing-static) | ||
- set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing POSITION_INDEPENDENT_CODE ON) | ||
- target_compile_definitions(dd_opentracing PRIVATE DD_OPENTRACING_STATIC) | ||
- install(TARGETS dd_opentracing-static | ||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
+ target_link_libraries(dd_opentracing-static ${DATADOG_LINK_LIBRARIES}) | ||
+ set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing) | ||
+ target_compile_definitions(dd_opentracing-static PUBLIC DD_OPENTRACING_STATIC) | ||
+ install(TARGETS dd_opentracing-static) | ||
endif() | ||
|
||
## Plugin | ||
|
||
install(TARGETS dd_opentracing-static | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
60 changes: 60 additions & 0 deletions
60
recipes/dd-opentracing-cpp/all/patches/1.3.7/0001-Find-packages-setup.patch
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,60 @@ | ||
--- CMakeLists.txt | ||
+++ CMakeLists.txt | ||
@@ -35,15 +35,10 @@ | ||
set(CMAKE_LIBRARY_PATH deps/lib) | ||
|
||
# Dependencies | ||
-find_path(OPENTRACING_INCLUDE_DIR NAMES opentracing/tracer.h) | ||
-find_library(OPENTRACING_LIB opentracing) | ||
-find_library(MSGPACK_LIB msgpack) | ||
-find_package(CURL) | ||
+find_package(OpenTracing REQUIRED CONFIG) | ||
+find_package(msgpack REQUIRED CONFIG) | ||
+find_package(CURL REQUIRED CONFIG) | ||
find_package(Threads REQUIRED) | ||
- | ||
-# Code Sanitizers | ||
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/3rd_party/sanitizers-cmake" ${CMAKE_MODULE_PATH}) | ||
-find_package(Sanitizers) | ||
|
||
# Code | ||
install(DIRECTORY include/datadog DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
@@ -64,12 +59,12 @@ | ||
if(BUILD_COVERAGE) | ||
set(COVERAGE_LIBRARIES gcov) | ||
endif() | ||
-set(DATADOG_LINK_LIBRARIES ${OPENTRACING_LIB} ${CURL_LIBRARIES} Threads::Threads ${COVERAGE_LIBRARIES}) | ||
+set(DATADOG_LINK_LIBRARIES OpenTracing::OpenTracing CURL::libcurl ${msgpack_LIBRARIES} ZLIB::ZLIB Threads::Threads) | ||
+include_directories(${msgpack_INCLUDE_DIRS}) | ||
|
||
## Shared lib | ||
if(BUILD_SHARED) | ||
add_library(dd_opentracing SHARED ${DD_OPENTRACING_SOURCES}) | ||
- add_sanitizers(dd_opentracing) | ||
if(BUILD_COVERAGE) | ||
target_link_options(dd_opentracing PRIVATE -fprofile-arcs -ftest-coverage) | ||
endif() | ||
@@ -77,6 +72,7 @@ | ||
set_target_properties(dd_opentracing PROPERTIES SOVERSION ${SOVERSION}) | ||
target_compile_definitions(dd_opentracing PUBLIC DD_OPENTRACING_SHARED) | ||
install(TARGETS dd_opentracing | ||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
endif() | ||
@@ -84,13 +80,10 @@ | ||
## Static lib | ||
if(BUILD_STATIC) | ||
add_library(dd_opentracing-static STATIC ${DD_OPENTRACING_SOURCES}) | ||
- add_sanitizers(dd_opentracing-static) | ||
target_link_libraries(dd_opentracing-static ${DATADOG_LINK_LIBRARIES}) | ||
- set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing POSITION_INDEPENDENT_CODE ON) | ||
+ set_target_properties(dd_opentracing-static PROPERTIES OUTPUT_NAME dd_opentracing) | ||
target_compile_definitions(dd_opentracing-static PUBLIC DD_OPENTRACING_STATIC) | ||
- install(TARGETS dd_opentracing-static | ||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
+ install(TARGETS dd_opentracing-static) | ||
endif() | ||
|
||
## Object lib |
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,9 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(dd-opentracing-cpp REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE dd-opentracing-cpp::dd-opentracing-cpp) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) |
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,17 +1,26 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "cmake" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "test_package") | ||
self.run(bin_path, env="conanrun") |
8 changes: 8 additions & 0 deletions
8
recipes/dd-opentracing-cpp/all/test_v1_package/CMakeLists.txt
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,8 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ | ||
${CMAKE_CURRENT_BINARY_DIR}/test_package/) |
Oops, something went wrong.