aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/ryu
diff options
context:
space:
mode:
Diffstat (limited to 'vcpkg/ports/ryu')
-rw-r--r--vcpkg/ports/ryu/CMakeLists.txt53
-rw-r--r--vcpkg/ports/ryu/portfile.cmake22
-rw-r--r--vcpkg/ports/ryu/usage4
-rw-r--r--vcpkg/ports/ryu/vcpkg.json18
4 files changed, 97 insertions, 0 deletions
diff --git a/vcpkg/ports/ryu/CMakeLists.txt b/vcpkg/ports/ryu/CMakeLists.txt
new file mode 100644
index 0000000..2a7b5a1
--- /dev/null
+++ b/vcpkg/ports/ryu/CMakeLists.txt
@@ -0,0 +1,53 @@
+cmake_minimum_required(VERSION 3.30)
+project(ryu LANGUAGES C)
+
+add_library(ryu
+ "ryu/f2s.c"
+ "ryu/d2s.c"
+ "ryu/d2s.h"
+ "ryu/d2s_full_table.h"
+ "ryu/d2s_intrinsics.h"
+ "ryu/digit_table.h"
+ "ryu/common.h"
+ "ryu/ryu.h"
+)
+
+target_include_directories(ryu PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>
+)
+
+add_library(ryu_printf
+ "ryu/d2fixed.c"
+ "ryu/d2s_intrinsics.h"
+ "ryu/d2fixed_full_table.h"
+ "ryu/digit_table.h"
+ "ryu/common.h"
+ "ryu/ryu2.h"
+)
+
+target_include_directories(ryu_printf PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>
+)
+
+if(NOT "${CMAKE_STATIC_LIBRARY_SUFFIX}" STREQUAL ".lib")
+ set_target_properties(ryu PROPERTIES OUTPUT_NAME "libryu")
+ set_target_properties(ryu_printf PROPERTIES OUTPUT_NAME "libryu_printf")
+endif()
+
+if(INSTALL_HEADERS)
+ install(FILES "ryu/ryu.h" "ryu/ryu2.h" DESTINATION "include/ryu")
+endif()
+
+install(TARGETS ryu ryu_printf EXPORT ryuTargets
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
+
+install(EXPORT ryuTargets
+ FILE ryuConfig.cmake
+ NAMESPACE RYU::
+ DESTINATION share/ryu
+)
diff --git a/vcpkg/ports/ryu/portfile.cmake b/vcpkg/ports/ryu/portfile.cmake
new file mode 100644
index 0000000..28bb5cb
--- /dev/null
+++ b/vcpkg/ports/ryu/portfile.cmake
@@ -0,0 +1,22 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ulfjack/ryu
+ REF v2.0
+ SHA512 88a0cca74a4889e8e579987abdc75a6ac87c1cdae557e5a15c29dbfd65733f9e591d6569e97a9374444918475099087f8056e696a97c9be24e38eb737e2304c2
+ HEAD_REF master
+)
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS_RELEASE
+ -DINSTALL_HEADERS=ON
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup()
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE-Apache2" "${SOURCE_PATH}/LICENSE-Boost")
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/vcpkg/ports/ryu/usage b/vcpkg/ports/ryu/usage
new file mode 100644
index 0000000..fd4af18
--- /dev/null
+++ b/vcpkg/ports/ryu/usage
@@ -0,0 +1,4 @@
+The package ryu provides CMake targets:
+
+ find_package(ryu CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE RYU::ryu RYU::ryu_printf)
diff --git a/vcpkg/ports/ryu/vcpkg.json b/vcpkg/ports/ryu/vcpkg.json
new file mode 100644
index 0000000..6dfac7d
--- /dev/null
+++ b/vcpkg/ports/ryu/vcpkg.json
@@ -0,0 +1,18 @@
+{
+ "name": "ryu",
+ "version": "2.0",
+ "port-version": 10,
+ "description": "Ryu generates the shortest decimal representation of a floating point number that maintains round-trip safety.",
+ "homepage": "https://github.com/ulfjack/ryu",
+ "license": "Apache-2.0 OR BSL-1.0",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}