[ryu] Add new port (#10167)

* ryu

* Add tool bazel in OSX

* wip

* wip

* wip

* wip

* wip

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
This commit is contained in:
nicole mazzuca 2020-03-05 14:17:08 -08:00 committed by GitHub
parent bf75bdfe92
commit 4b1444e48d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 0 deletions

4
ports/ryu/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: ryu
Version: 2.0
Homepage: https://github.com/ulfjack/ryu
Description: Ryu generates the shortest decimal representation of a floating point number that maintains round-trip safety.

38
ports/ryu/portfile.cmake Normal file
View File

@ -0,0 +1,38 @@
vcpkg_fail_port_install(ON_TARGET "UWP")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ulfjack/ryu
REF v2.0
SHA512 88a0cca74a4889e8e579987abdc75a6ac87c1cdae557e5a15c29dbfd65733f9e591d6569e97a9374444918475099087f8056e696a97c9be24e38eb737e2304c2
HEAD_REF master
)
vcpkg_find_acquire_program(BAZEL)
get_filename_component(BAZEL_DIR "${BAZEL}" DIRECTORY)
vcpkg_add_to_path(PREPEND ${BAZEL_DIR})
set(ENV{BAZEL_BIN_PATH} "${BAZEL}")
if (CMAKE_HOST_WIN32)
set(ENV{BAZEL_VS} $ENV{VSInstallDir})
set(ENV{BAZEL_VC} $ENV{VCInstallDir})
endif ()
vcpkg_execute_build_process(
COMMAND ${BAZEL} build --verbose_failures //ryu
WORKING_DIRECTORY ${SOURCE_PATH}
LOGNAME build-${TARGET_TRIPLET}-rel
)
if (CMAKE_HOST_WIN32)
file(INSTALL ${SOURCE_PATH}/bazel-bin/ryu/ryu.lib DESTINATION ${CURRENT_PACKAGES_DIR}/lib/)
file(INSTALL ${SOURCE_PATH}/bazel-bin/ryu/ryu.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/)
else()
file(INSTALL ${SOURCE_PATH}/bazel-bin/ryu/libryu.a DESTINATION ${CURRENT_PACKAGES_DIR}/lib/)
file(INSTALL ${SOURCE_PATH}/bazel-bin/ryu/libryu.a DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib/)
endif()
file(INSTALL ${SOURCE_PATH}/LICENSE-Boost DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${SOURCE_PATH}/ryu/ryu.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/ryuConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})

20
ports/ryu/ryuConfig.cmake Normal file
View File

@ -0,0 +1,20 @@
function(set_library_target NAMESPACE LIB_NAME DEBUG_LIB_FILE_NAME RELEASE_LIB_FILE_NAME INCLUDE_DIR)
add_library(${NAMESPACE}::${LIB_NAME} STATIC IMPORTED)
set_target_properties(${NAMESPACE}::${LIB_NAME} PROPERTIES
IMPORTED_CONFIGURATIONS "RELEASE;DEBUG"
IMPORTED_LOCATION_RELEASE "${RELEASE_LIB_FILE_NAME}"
IMPORTED_LOCATION_DEBUG "${DEBUG_LIB_FILE_NAME}"
INTERFACE_INCLUDE_DIRECTORIES "${INCLUDE_DIR}"
)
set(${NAMESPACE}_${LIB_NAME}_FOUND 1)
endfunction()
get_filename_component(ROOT "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(ROOT "${ROOT}" PATH)
get_filename_component(ROOT "${ROOT}" PATH)
if (CMAKE_HOST_WIN32)
set_library_target("RYU" "ryu" "${ROOT}/debug/lib/ryu.lib" "${ROOT}/lib/ryu.lib" "${ROOT}/include/")
else()
set_library_target("RYU" "ryu" "${ROOT}/debug/lib/libryu.a" "${ROOT}/lib/libryu.a" "${ROOT}/include/")
endif()

View File

@ -1549,6 +1549,11 @@ rttr:arm-uwp=fail
rttr:x64-uwp=fail
rxspencer:x64-uwp=fail
rxspencer:arm-uwp=fail
ryu:arm-uwp=fail
ryu:x64-uwp=fail
ryu:x64-windows-static=fail
ryu:x86-windows=fail
ryu::arm64-windows=fail
scintilla:arm-uwp=fail
scintilla:x64-linux=fail
scintilla:x64-osx=fail

View File

@ -281,6 +281,12 @@ function(vcpkg_find_acquire_program VAR)
set(ARCHIVE "bazel-${BAZEL_VERSION}-linux-x86_64")
set(NOEXTRACT ON)
set(HASH db4a583cf2996aeb29fd008261b12fe39a4a5faf0fbf96f7124e6d3ffeccf6d9655d391378e68dd0915bc91c9e146a51fd9661963743857ca25179547feceab1)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
set(_vfa_SUPPORTED ON)
set(URL "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-darwin-x86_64")
set(ARCHIVE "bazel-${BAZEL_VERSION}-darwin-x86_64")
set(NOEXTRACT ON)
set(HASH 420a37081e6ee76441b0d92ff26d1715ce647737ce888877980d0665197b5a619d6afe6102f2e7edfb5062c9b40630a10b2539585e35479b780074ada978d23c)
else()
set(URL "https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-windows-x86_64.zip")
set(ARCHIVE "bazel-${BAZEL_VERSION}-windows-x86_64.zip")