fix: link Windows Node addon against node.lib - #15
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the CMake-based Node addon build to correctly link against Node’s Windows import library (node.lib) as part of the standalone TypeScript N-API prebuild pipeline, and documents the new override knob for Windows.
Changes:
- Adds
CORTEXT_NODE_LIBRARYas a CMake cache override for the Windowsnode.libimport library path. - Resolves
node.libunder the computed Node prefix and links it onWIN32only, with a clearFATAL_ERRORwhen missing. - Documents the Windows override behavior in
ffi/README.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| CMakeLists.txt | Adds a Windows-only node.lib discovery/link step for cortext_node, plus a cache override for the import library path. |
| ffi/README.md | Documents the Windows node.lib lookup behavior and the CORTEXT_NODE_LIBRARY override. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+888
to
+892
| execute_process( | ||
| COMMAND "${CORTEXT_NODE_EXECUTABLE}" -p "require('path').dirname(require('path').dirname(process.execPath))" | ||
| OUTPUT_VARIABLE CORTEXT_NODE_PREFIX | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| COMMAND_ERROR_IS_FATAL ANY |
Comment on lines
+925
to
+941
| find_file(_cortext_node_library | ||
| NAMES node.lib | ||
| PATHS "${CORTEXT_NODE_PREFIX}" | ||
| PATH_SUFFIXES "" x64 lib | ||
| NO_DEFAULT_PATH | ||
| ) | ||
| set(CORTEXT_NODE_LIBRARY "${_cortext_node_library}" CACHE FILEPATH | ||
| "Path to the Node.js import library used for Windows addon builds" | ||
| FORCE | ||
| ) | ||
| endif() | ||
| if(NOT CORTEXT_NODE_LIBRARY OR NOT EXISTS "${CORTEXT_NODE_LIBRARY}") | ||
| message(FATAL_ERROR | ||
| "Node.js import library node.lib was not found under " | ||
| "${CORTEXT_NODE_PREFIX} (searched the prefix, x64, and lib). " | ||
| "Set CORTEXT_NODE_LIBRARY to the node.lib path." | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the Windows side of the standalone TypeScript N-API prebuild pipeline.
A macOS CMake configure for the Node target and git diff --check passed; no Windows runner was available locally.