Skip to content

fix: link Windows Node addon against node.lib - #15

Merged
gabewillen merged 1 commit into
mainfrom
fix/windows-node-library
Aug 7, 2026
Merged

gabewillen merged 1 commit into
mainfrom
fix/windows-node-library

Conversation

@gabewillen

Copy link
Copy Markdown
Contributor

Fixes the Windows side of the standalone TypeScript N-API prebuild pipeline.

  • Adds a CORTEXT_NODE_LIBRARY FILEPATH override.
  • Resolves node.lib from standard Node prefixes (including x64/lib layouts).
  • Fails clearly when the import library is unavailable.
  • Links it only on WIN32; Unix dynamic lookup/RPATH is unchanged.
  • Documents the override in ffi/README.

A macOS CMake configure for the Node target and git diff --check passed; no Windows runner was available locally.

Copilot AI lite review requested due to automatic review settings August 7, 2026 06:01
@gabewillen
gabewillen merged commit 4d21b9e into main Aug 7, 2026
12 checks passed
@gabewillen
gabewillen deleted the fix/windows-node-library branch August 7, 2026 06:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_LIBRARY as a CMake cache override for the Windows node.lib import library path.
  • Resolves node.lib under the computed Node prefix and links it on WIN32 only, with a clear FATAL_ERROR when 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 thread CMakeLists.txt
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 thread CMakeLists.txt
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."
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants