Skip to content

Commit

Permalink
Add node-api-stub
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Dec 19, 2024
1 parent 590f874 commit b410ec9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/n/node-api-stub/patches/cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
--- a/CMakeLists.txt 2024-12-18 21:07:24.460618593 +0800
+++ b/CMakeLists.txt 2024-12-18 21:07:05.907811865 +0800
@@ -3,3 +3,4 @@
project(libnode_api LANGUAGES C)

add_library(node_api STATIC node_api.c)
+install(TARGETS node_api RUNTIME)
27 changes: 27 additions & 0 deletions packages/n/node-api-stub/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package("node-api-stub")

set_homepage("https://github.com/napi-bindings/node-api-stub")
set_description("Node-API stub")
set_license("MIT")

add_urls("https://github.com/napi-bindings/node-api-stub.git")
add_urls("https://github.com/napi-bindings/node-api-stub/archive/refs/tags/$(version).tar.gz")
add_versions("8.0.0", "7fdf725a3122f4d86443e707227a30c663c7163c6d1b9f883cb2305f18e01740")
add_patches("8.0.0", path.join(os.scriptdir(), "patches", "cmake.patch"), "ed3edac79b7efa682553e6dc85b5479f111445fc4df2e1b9674c5d7583cfb945")

add_deps("cmake")
add_links("node_api")

on_install("windows", "macosx", "linux", function (package)
import("package.tools.cmake").install(package)
end)

on_test(function (package)
assert(package:check_csnippets({test = [[
void test() {
napi_env env;
napi_value result;
napi_get_undefined(env, &result);
}
]]}, {configs = {languages = "c99"}}))
end)

0 comments on commit b410ec9

Please sign in to comment.