[node-api|node-addon-api] fix and update (#29599)

* node-api-config-fix

* port-ver

* upd

* hash

* newver

* add-ver

* .

* .

* respect vcpkg_build_type in config

* addver

* Update node-addon-api.json
This commit is contained in:
Leonid Pospelov 2023-02-15 00:27:11 +06:00 committed by GitHub
parent ce8d96a7c3
commit baa9d834e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 65 additions and 47 deletions

View File

@ -1,8 +1,8 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO nodejs/node-addon-api
REF v5.0.0
SHA512 5ee14bc325ce66c6f645c3b638efaf69a7dfc90f0d6514f8568dedf34d5b5460b80c4438c4c12264d80c827edf46a82f0ecceb53b2a370ed5ec2ee640fa1ef7f
REF "v${VERSION}"
SHA512 f7889d676665f053577c4964b56a51d628f2da1bd9ee77b478b088cc11750952037687242e0a24036daae759d27c9b619b9f9db9c2c2839204d91af1603a1d90
HEAD_REF main
)

View File

@ -1,9 +1,11 @@
include(CMakeFindDependencyMacro)
find_dependency(unofficial-node-api CONFIG)
if(NOT TARGET unofficial::node-addon-api::node-addon-api)
include(CMakeFindDependencyMacro)
find_dependency(unofficial-node-api CONFIG)
add_library(unofficial::node-addon-api::node-addon-api IMPORTED INTERFACE)
target_link_libraries(unofficial::node-addon-api::node-addon-api INTERFACE unofficial::node-api::node-api)
add_library(unofficial::node-addon-api::node-addon-api IMPORTED INTERFACE)
target_link_libraries(unofficial::node-addon-api::node-addon-api INTERFACE unofficial::node-api::node-api)
set_target_properties(unofficial::node-addon-api::node-addon-api PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include/"
)
set_target_properties(unofficial::node-addon-api::node-addon-api PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_LIST_DIR}/../../include/"
)
endif()

View File

@ -1,6 +1,6 @@
{
"name": "node-addon-api",
"version": "5.0.0",
"version": "6.0.0",
"description": "Module for using Node-API from C++",
"homepage": "https://github.com/nodejs/node-addon-api",
"license": "MIT",

View File

@ -1,5 +1,3 @@
vcpkg_minimum_required(VERSION 2022-10-12) # for ${VERSION}
set(SHA512 0)
if(VCPKG_TARGET_IS_WINDOWS)
@ -66,7 +64,7 @@ set(source_path "${OUT_SOURCE_PATH}/${suffix}")
file(COPY "${source_path}" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN "*.h")
# we do not take the license from the dist file because for windows it is not included as we download the headers only
set(license_url "https://raw.githubusercontent.com/nodejs/node/v18.12.1/LICENSE")
set(license_url "https://raw.githubusercontent.com/nodejs/node/v${VERSION}/LICENSE")
vcpkg_download_distfile(
out_license
URLS "${license_url}"
@ -75,5 +73,4 @@ vcpkg_download_distfile(
)
file(INSTALL "${out_license}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
# copy ./unofficial-node-api-config.cmake to ${CURRENT_PACKAGES_DIR}/share/node-api
file(COPY "${CMAKE_CURRENT_LIST_DIR}/unofficial-node-api-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}")
configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-node-api-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-${PORT}/unofficial-node-api-config.cmake" @ONLY)

View File

@ -1,29 +0,0 @@
if(WIN32)
add_library(unofficial::node-api::node-api UNKNOWN IMPORTED)
else()
add_library(unofficial::node-api::node-api INTERFACE IMPORTED)
endif()
find_path(node-api_INCLUDE_DIR
NAMES node.h
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../include/node"
NO_DEFAULT_PATH
REQUIRED)
set_target_properties(unofficial::node-api::node-api PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${node-api_INCLUDE_DIR}"
)
if(APPLE)
set_target_properties(unofficial::node-api::node-api PROPERTIES
INTERFACE_LINK_OPTIONS "LINKER:SHELL:-undefined dynamic_lookup"
)
endif()
if(WIN32)
find_library(node-api_LIBRARY_RELEASE NAMES node PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH REQUIRED)
find_library(node-api_LIBRARY_DEBUG NAMES node PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH REQUIRED)
set_target_properties(unofficial::node-api::node-api PROPERTIES
IMPORTED_LOCATION_DEBUG "${node-api_LIBRARY_DEBUG}"
IMPORTED_LOCATION_RELEASE "${node-api_LIBRARY_RELEASE}"
)
endif()

View File

@ -0,0 +1,38 @@
if(NOT TARGET unofficial::node-api::node-api)
if(WIN32)
add_library(unofficial::node-api::node-api UNKNOWN IMPORTED)
else()
add_library(unofficial::node-api::node-api INTERFACE IMPORTED)
endif()
find_path(node-api_INCLUDE_DIR
NAMES node.h
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../include/node"
NO_DEFAULT_PATH
REQUIRED
)
set_target_properties(unofficial::node-api::node-api PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${node-api_INCLUDE_DIR}"
)
if(APPLE)
set_target_properties(unofficial::node-api::node-api PROPERTIES
INTERFACE_LINK_OPTIONS "LINKER:SHELL:-undefined dynamic_lookup"
)
endif()
if(WIN32)
find_library(node-api_LIBRARY_RELEASE NAMES node PATHS "${CMAKE_CURRENT_LIST_DIR}/../../lib" NO_DEFAULT_PATH REQUIRED)
set_target_properties(unofficial::node-api::node-api PROPERTIES
IMPORTED_LOCATION_RELEASE "${node-api_LIBRARY_RELEASE}"
IMPORTED_CONFIGURATIONS RELEASE
)
if("@VCPKG_BUILD_TYPE@" STREQUAL "")
find_library(node-api_LIBRARY_DEBUG NAMES node PATHS "${CMAKE_CURRENT_LIST_DIR}/../../debug/lib" NO_DEFAULT_PATH REQUIRED)
set_target_properties(unofficial::node-api::node-api PROPERTIES
IMPORTED_LOCATION_DEBUG "${node-api_LIBRARY_DEBUG}"
)
set_property(TARGET unofficial::node-api::node-api APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
endif()
endif()
endif()

View File

@ -1,7 +1,7 @@
{
"name": "node-api",
"version-semver": "18.12.1",
"port-version": 1,
"port-version": 2,
"description": "NodeJS API for writing modules in C++",
"homepage": "https://nodejs.org/api/addons.html",
"license": null,

View File

@ -5421,12 +5421,12 @@
"port-version": 3
},
"node-addon-api": {
"baseline": "5.0.0",
"baseline": "6.0.0",
"port-version": 0
},
"node-api": {
"baseline": "18.12.1",
"port-version": 1
"port-version": 2
},
"nonius": {
"baseline": "2019-04-20",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "45cf82eea2cea9f8fa60b8a476f6484f75f81ca5",
"version": "6.0.0",
"port-version": 0
},
{
"git-tree": "b1c42d68e9b5e63b2d63cac93212af32d9e553dc",
"version": "5.0.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "d127d3b83f2702e56542e7c90807893464f3de79",
"version-semver": "18.12.1",
"port-version": 2
},
{
"git-tree": "1b12126f91686d77b2ea46cd9c7e311f000f7bb9",
"version-semver": "18.12.1",