Skip to content

Releases: cmake-js/cmake-js

v7.0.0

08 Oct 14:05
110c563
Compare
Choose a tag to compare

This is a breaking change and will likely require some small changes to your cmake config to keep your project building.

Summary

A lot of work has gone into this release, to try and make the general usage of the library smoother. It has better support for building modules with node-api. The on disk footprint of the library is much smaller than before, with various dependencies removed, or updated.

Upgrading

We recommend having the following at the top of your cmake file, before the project(...) definition.

cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0042 NEW)

This will force MSVC to do a MT build, so if you were doing that another way, it should be possible to remove that. If you need to keep it building as MD, you can add set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") in your cmake file.

If you are using node-api, make sure that your package.json has the following, but with the correct NAPI_VERSION filled in. We use this to autodetect that your module is building with node-api.

"binary": {
    "napi_versions": [7]
  },

You should also add the following to the bottom of your cmake file. This lets us avoid downloading the full nodejs headers, and lets us use bundle a much more lightweight copy instead

if(MSVC AND CMAKE_JS_NODELIB_DEF AND CMAKE_JS_NODELIB_TARGET)
  # Generate node.lib
  execute_process(COMMAND ${CMAKE_AR} /def:${CMAKE_JS_NODELIB_DEF} /out:${CMAKE_JS_NODELIB_TARGET} ${CMAKE_STATIC_LINKER_FLAGS})
endif()

If you have something like:

execute_process(COMMAND node -p "require('node-addon-api').include"
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        OUTPUT_VARIABLE NODE_ADDON_API_DIR
        )
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})

in your file, it is no longer needed. We will inject the correct include paths for you, similar to what is done for nan.

That should be everything.
If we missed something in these steps, or if you are having problems getting your module building again, let us know in an issue.

All changes:

  • update dependencies
  • replace some dependencies with modern language features
  • follow node-gyp behaviour for visual-studio version detection and selection
  • automatically locate node-addon-api and add to include paths
  • avoid downloads when building for node-api
  • encourage use of MT builds with MSVC, rather than MD

v6.3.2 - 06/06/22

08 Jun 16:37
2e69605
Compare
Choose a tag to compare
  • fix: if --runtimeVerison must be explicitly specified if building for a different runtime
  • Update baseurl for electron mirror

Full support of Visual Studio 2019 (Gregor Jasny)

27 Feb 08:07
Compare
Choose a tag to compare

v6.0.0

26 Feb 08:54
Compare
Choose a tag to compare

VS detect fixes

21 Aug 10:42
Compare
Choose a tag to compare
v5.3.2

v5.3.2

Electron 4+ compatibility

10 Apr 14:28
Compare
Choose a tag to compare
v5.2.0

5.2.0 ES5 files

v5.1.0

24 Feb 19:46
Compare
Choose a tag to compare
v5.1.0

v5.0.1

24 Jan 20:23
Compare
Choose a tag to compare
line ending fixd

v4.0.0

14 Sep 14:55
Compare
Choose a tag to compare
v4.0.0

Locating NAN and CMake.js fixed

20 May 07:13
Compare
Choose a tag to compare

Bugxfix: Locating NAN and CMake.js fixed