Skip to content

Commit

Permalink
[rivers] add new port (microsoft#34701)
Browse files Browse the repository at this point in the history
* [rivers] add new port

* versions

* [rivers] add new port

* [rivers] add new port

* [rivers] add new port

* [rivers] add new port

* [rivers] add new port

* [rivers] add new port

* [rivers] delete default-features
  • Loading branch information
jiayuehua authored Oct 28, 2023
1 parent 2b1fd46 commit ff9b47f
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 0 deletions.
76 changes: 76 additions & 0 deletions ports/rivers/add-install-configuration.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 981ef20..89c5a6e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,20 +9,45 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

add_library(rivers INTERFACE)
add_library(rivers::rivers ALIAS rivers)
-target_include_directories(rivers INTERFACE include)
+target_include_directories(rivers
+ INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>
+ )

option(RVR_IMPORT_FMT Off)
if(RVR_IMPORT_FMT)
- include(FetchContent)
- FetchContent_Declare(
- fmt
- GIT_REPOSITORY https://github.com/fmtlib/fmt.git
- GIT_TAG 713c7c7c62044329d26c19323ffa0e64d69d2d64
- )
- FetchContent_MakeAvailable(fmt)
-
+ find_package(fmt CONFIG REQUIRED)
target_link_libraries(rivers INTERFACE fmt::fmt)
endif()

-add_subdirectory(bench)
-add_subdirectory(test)
+include(CMakePackageConfigHelpers)
+
+configure_package_config_file(
+ cmake/unofficial-rivers-config.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake/unofficial-rivers-config.cmake"
+ INSTALL_DESTINATION lib/cmake/unofficial-rivers/
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
+
+
+# Export.
+export(
+ TARGETS rivers
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/unofficial-rivers-targets.cmake")
+
+# Install.
+install(TARGETS rivers EXPORT unofficial-rivers)
+
+install(
+ EXPORT unofficial-rivers
+ NAMESPACE unofficial-rivers::
+ FILE unofficial-rivers-targets.cmake
+ DESTINATION lib/cmake/unofficial-rivers)
+
+install(DIRECTORY include/rivers DESTINATION include)
+
+install(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake/unofficial-rivers-config.cmake"
+ DESTINATION lib/cmake/unofficial-rivers)
+
diff --git a/cmake/unofficial-rivers-config.cmake.in b/cmake/unofficial-rivers-config.cmake.in
new file mode 100644
index 0000000..a347972
--- /dev/null
+++ b/cmake/unofficial-rivers-config.cmake.in
@@ -0,0 +1,9 @@
+
+@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+
+include("${CMAKE_CURRENT_LIST_DIR}/unofficial-rivers-targets.cmake")
+if(@RVR_IMPORT_FMT@)
+ find_dependency(fmt CONFIG)
+endif()
+
28 changes: 28 additions & 0 deletions ports/rivers/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO brevzin/rivers
REF cfbd4c3e0ca9fcde03075327d6dd628e57589342
SHA512 4dfa4a1e657c6a12446abe6d7c54d5bc3d47d82e8639eb91f98c7120b3ca79a6cfa761a357dc2285027823177ee76be346adddc7861f0f213cd0bc7cde041ab8
HEAD_REF main
PATCHES add-install-configuration.patch
)

set(VCPKG_BUILD_TYPE release) # header-only

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
fmt RVR_IMPORT_FMT
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT} CONFIG_PATH "lib/cmake/unofficial-rivers")

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
25 changes: 25 additions & 0 deletions ports/rivers/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "rivers",
"version-date": "2022-05-16",
"description": "A C++ internal iteration library based loosely on Java Streams",
"homepage": "https://github.com/brevzin/rivers/",
"license": "BSL-1.0",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"fmt": {
"description": "Use fmt as rivers fommatter",
"dependencies": [
"fmt"
]
}
}
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -7400,6 +7400,10 @@
"baseline": "0.2.1",
"port-version": 0
},
"rivers": {
"baseline": "2022-05-16",
"port-version": 0
},
"rkcommon": {
"baseline": "1.10.0",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/r-/rivers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "9a0a33765347e8652eecf77097b57cfdbc7e4184",
"version-date": "2022-05-16",
"port-version": 0
}
]
}

0 comments on commit ff9b47f

Please sign in to comment.