Skip to content

Commit

Permalink
[opencensus-cpp]Add new port. (#8740)
Browse files Browse the repository at this point in the history
* [opencensus-cpp]Add new port.

* [opencensus-cpp]Update SHA512.

* [opencensus-cpp]Add patch.
  • Loading branch information
JackBoosY authored and vicroms committed Oct 30, 2019
1 parent d9ad7a5 commit 38109c4
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ports/opencensus-cpp/CONTROL
@@ -0,0 +1,8 @@
Source: opencensus-cpp
Version: 0.4.0
Homepage: https://github.com/census-instrumentation/opencensus-cpp
Description: OpenCensus is a toolkit for collecting application performance and behavior data. It currently includes an API for tracing and stats.
Build-Depends: abseil

Feature: test
Description: Build test
154 changes: 154 additions & 0 deletions ports/opencensus-cpp/fix-install.patch
@@ -0,0 +1,154 @@
diff --git a/cmake/OpenCensusHelpers.cmake b/cmake/OpenCensusHelpers.cmake
index c8d35e6..a15231a 100644
--- a/cmake/OpenCensusHelpers.cmake
+++ b/cmake/OpenCensusHelpers.cmake
@@ -38,6 +38,13 @@ function(opencensus_test NAME SRC)
gmock
gtest_main)
add_test(NAME ${_NAME} COMMAND ${_NAME})
+
+ install(
+ TARGETS ${_NAME}
+ RUNTIME DESTINATION tools
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
endif()
endfunction()

@@ -51,6 +58,13 @@ function(opencensus_benchmark NAME SRC)
add_executable(${_NAME} ${SRC})
prepend_opencensus(DEPS "${ARGN}")
target_link_libraries(${_NAME} "${DEPS}" benchmark)
+
+ install(
+ TARGETS ${_NAME}
+ RUNTIME DESTINATION tools
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
endif()
endfunction()

@@ -76,6 +90,13 @@ function(opencensus_lib NAME)
if(ARG_PUBLIC)
add_library(${PROJECT_NAME}::${NAME} ALIAS ${_NAME})
endif()
+
+ install(
+ TARGETS ${_NAME}
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
endfunction()

# Helper function for fuzzing. Usage:
@@ -88,5 +109,12 @@ function(opencensus_fuzzer NAME SRC)
prepend_opencensus(DEPS "${ARGN}")
target_link_libraries(${_NAME} "${DEPS}" ${FUZZER})
target_compile_options(${_NAME} PRIVATE ${FUZZER})
+
+ install(
+ TARGETS ${_NAME}
+ RUNTIME DESTINATION tools
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ )
endif()
endfunction()
diff --git a/examples/helloworld/CMakeLists.txt b/examples/helloworld/CMakeLists.txt
index 456169f..71e43d1 100644
--- a/examples/helloworld/CMakeLists.txt
+++ b/examples/helloworld/CMakeLists.txt
@@ -22,3 +22,10 @@ target_link_libraries(opencensus_examples_helloworld
opencensus-cpp::stats
opencensus-cpp::trace
Threads::Threads)
+
+install(
+ TARGETS opencensus_examples_helloworld
+ RUNTIME DESTINATION tools
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
\ No newline at end of file
diff --git a/opencensus/common/internal/CMakeLists.txt b/opencensus/common/internal/CMakeLists.txt
index c18859d..55a1121 100644
--- a/opencensus/common/internal/CMakeLists.txt
+++ b/opencensus/common/internal/CMakeLists.txt
@@ -21,6 +21,8 @@ opencensus_lib(common_random
absl::base
absl::synchronization
absl::time)
+
+install(FILES ${CMAKE_CURRENT_LIST_DIR}/../version.h DESTINATION include/opencensus-cpp/common/internal)

opencensus_lib(common_stats_object DEPS absl::time)

diff --git a/opencensus/context/CMakeLists.txt b/opencensus/context/CMakeLists.txt
index 525885b..537de02 100644
--- a/opencensus/context/CMakeLists.txt
+++ b/opencensus/context/CMakeLists.txt
@@ -21,6 +21,10 @@ opencensus_lib(context
tags
trace)

+install(FILES ${CMAKE_CURRENT_LIST_DIR}/context.h
+ ${CMAKE_CURRENT_LIST_DIR}/with_context.h
+ DESTINATION include/opencensus-cpp/context)
+
opencensus_test(context_context_test
internal/context_test.cc
context
diff --git a/opencensus/exporters/stats/prometheus/CMakeLists.txt b/opencensus/exporters/stats/prometheus/CMakeLists.txt
index 4da7de7..39121f5 100644
--- a/opencensus/exporters/stats/prometheus/CMakeLists.txt
+++ b/opencensus/exporters/stats/prometheus/CMakeLists.txt
@@ -28,6 +28,8 @@ opencensus_lib(exporters_stats_prometheus_utils
absl::strings
absl::time
prometheus-cpp::core)
+
+install(FILES ${CMAKE_CURRENT_LIST_DIR}/prometheus_exporter.h DESTINATION include/opencensus-cpp/exporters/stats/prometheus)

opencensus_test(exporters_stats_prometheus_utils_test
internal/prometheus_utils_test.cc
diff --git a/opencensus/exporters/stats/stdout/CMakeLists.txt b/opencensus/exporters/stats/stdout/CMakeLists.txt
index b4f3110..31bc991 100644
--- a/opencensus/exporters/stats/stdout/CMakeLists.txt
+++ b/opencensus/exporters/stats/stdout/CMakeLists.txt
@@ -21,6 +21,8 @@ opencensus_lib(exporters_stats_stdout
absl::memory
absl::strings
absl::time)
+
+install(FILES ${CMAKE_CURRENT_LIST_DIR}/stdout_exporter.h DESTINATION include/opencensus-cpp/exporters/stats/stdout)

opencensus_test(exporters_stats_stdout_test
internal/stdout_exporter_test.cc
diff --git a/opencensus/exporters/trace/stdout/CMakeLists.txt b/opencensus/exporters/trace/stdout/CMakeLists.txt
index 2b8bc78..fce50e7 100644
--- a/opencensus/exporters/trace/stdout/CMakeLists.txt
+++ b/opencensus/exporters/trace/stdout/CMakeLists.txt
@@ -21,6 +21,7 @@ opencensus_lib(exporters_trace_stdout
absl::base
absl::memory)

+install(FILES ${CMAKE_CURRENT_LIST_DIR}/stdout_exporter.h DESTINATION include/opencensus-cpp/exporters/trace/stdout)
opencensus_test(exporters_trace_stdout_test
internal/stdout_exporter_test.cc
exporters_trace_stdout
diff --git a/opencensus/tags/CMakeLists.txt b/opencensus/tags/CMakeLists.txt
index dbc4c9b..1b304ce 100644
--- a/opencensus/tags/CMakeLists.txt
+++ b/opencensus/tags/CMakeLists.txt
@@ -40,6 +40,8 @@ opencensus_lib(tags_with_tag_map
context
absl::strings)

+file(GLOB TAGS_HDRS ${CMAKE_CURRENT_LIST_DIR}/*.h)
+install(FILES ${TAGS_HDRS} DESTINATION include/opencensus-cpp/tags)
opencensus_test(tags_context_util_test
internal/context_util_test.cc
tags
28 changes: 28 additions & 0 deletions ports/opencensus-cpp/portfile.cmake
@@ -0,0 +1,28 @@
vcpkg_fail_port_install(ON_TARGET "Windows")

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO census-instrumentation/opencensus-cpp
REF 2b0725c2d0f809351300c634c54e70e0a8c3f4ed #v0.4.0
SHA512 16f3975ed0580aec83e0dd98f15a04d614cf45bfa7e07b0b94e881afc12e8e4bac3c0efde1f8e7da9f5dc66365415ae1e3ab10dfcbd9e078879246db6e81cd56
HEAD_REF master
PATCHES fix-install.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
test BUILD_TESTING
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS ${FEATURE_OPTIONS}
)

vcpkg_install_cmake()

vcpkg_copy_pdbs()

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

0 comments on commit 38109c4

Please sign in to comment.