Skip to content

Releases: EmbeddedEnterprises/cmake-ts

v1.0.0

13 Apr 07:35

Choose a tag to compare

cmake-ts re-imagined

New features

Build configs, Cross-compilation, and new CLI

Now, cmake-ts can build the projects with built-in configurations that are selected depending on the arguments and the environment. This includes cross-compilation for different architectures, including Windows arm64, Linux arm64, etc.

cmake-ts build
cmake-ts build --config debug

You can cross-compile by specifying the built-in cross configs

cmake-ts build --config cross-win32-arm64-release

CLI Arguments

build command:

Usage: cmake-ts build [options]

Build the project

Options:
  --config, --configs <configs...>
      Named config(s) to build, which could be from default configs or the ones defined in the config file (package.json)

       If no config is provided, it will build for the current runtime on the current system with the Release build type

      The default configs are combinations of `<Runtime>`, `<BuildType>`, `<Platform>`, and `<Architecture>`.

       - `<Runtime>`: the runtime to use

         e.g.: `node`, `electron`, `iojs`

       - `<BuildType>`: the cmake build type (optimization level)

         e.g.: `debug`, `release`, `relwithdebinfo`, or `minsizerel`

       - `<Platform>`: the target platform

         e.g.: `win32`, `linux`, `darwin`, `aix`, `android`, `freebsd`, `haiku`, `openbsd`, `sunos`, `cygwin`, `netbsd`

       - `<Architecture>`: the target architecture

         e.g.: `x64`, `arm64`, `ia32`, `arm`, `loong64`, `mips`, `mipsel`, `ppc`, `ppc64`, `riscv64`, `s390`, `s390x`

        Any combination of `<BuildType>`, `<Runtime>`, `<Platform>`, and `<Architecture>` is valid. Some examples:

         - `release`
         - `debug`
         - `relwithdebinfo`
         - `node-release`
         - `node-debug`
         - `electron-release`
         - `electron-debug`
         - `win32-x64`
         - `win32-x64-debug`
         - `linux-x64-debug`
         - `linux-x64-node-debug`
         - `linux-x64-electron-release`
         - `darwin-x64-node-release`
         - `darwin-arm64-node-release`
         - `darwin-arm64-electron-relwithdebinfo`

      To explicitly indicate cross-compilation, prefix the config name with \`cross-\`:

       - \`cross-win32-ia32-node-release\`
       - \`cross-linux-arm64-node-release\`
       - \`cross-darwin-x64-electron-relwithdebinfo\`

      You can also define your own configs in the config file (package.json).

       - `<ConfigName>`: the name of the config

         e.g.: `my-config`

       The configs can also be in format of `named-<property>`, which builds the configs that match the property.

         - `named-os`: build all the configs in the config file that have the same OS
         - `named-os-dev`: build all the configs in the config file that have the same OS and `dev` is true
         - `named-all`: build all the configs in the config file


       The configs can be combined with `,` or multiple `--configs` flags. They will be merged together.
   (default: [])
  -h, --help                        display help for command

Runtime Addon Loader

The runtime addon loader allows you to load the addon for the current runtime during runtime.

In ES modules:

import { loadAddon } from 'cmake-ts/build/loader.mjs';
import path from 'path';
import { fileURLToPath } from 'url';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

const addon = loadAddon(path.resolve(__dirname, '..', 'build'));

or in CommonJS:

const { loadAddon } = require('cmake-ts/build/loader.js');

const addon = loadAddon(path.resolve(__dirname, '..', 'build'));

You can pass the types of the addon to the loader to get type safety:

type MyAddon = {
  myFunction: (name: string) => void;
};

const addon = loadAddon<MyAddon>(path.resolve(__dirname, '..', 'build'));

Changelog

  • feat: introduce build configs, triplets, and Cmake config + revamp arg parsing by @aminya in #42
  • test: run the zeromq tests in CI + smoke tests by @aminya in #45
  • fix: improve the logger + add deprecation warnings + update dev-deps by @aminya in #47
  • fix: prevent conflict between binaries by @aminya in #48
  • fix: fix cmake-ts build not working without configs by @aminya in #49
  • feat: support cross-compilation by @aminya in #50
  • feat: set up Windows toolchain variables for cross-compilation by @aminya in #51
  • feat: add the runtime loader module by @aminya in #53
  • fix: prevent test/download/build conflicts in parallel runs by @aminya in #54
  • test: add tests for the utils by @aminya in #55

Full Changelog: v0.6.0...v1.0.0

v0.6.1

07 Apr 09:29

Choose a tag to compare

  • fix: prevent conflict between binaries by @aminya in #48

This changes the parent directory name from abi to libc-abi-buildType to prevent conflicts when all the binaries are copied for a package to the same directory.

BREAKING CHANGE: If a package relies on the numbers only for parent directories, it will fail to load the add-on.

Full Changelog: v0.6.0...v0.6.1

v0.6.0

31 Mar 09:12

Choose a tag to compare

What's Changed

  • feat: create a manifest for the built configurations + include glibc/abi by @aminya in #43
    This adds a manifest.json for the built binaries under built that allows the package to load the correct addon path during runtime. This PR also adds the glibc/abi as information in the key
    The manifest includes the build config serialized as the key to the path of the addon:
{
  "{\"name\":\"\",\"dev\":false,\"os\":\"darwin\",\"arch\":\"arm64\",\"runtime\":\"node\",\"runtimeVersion\":\"23.4.0\",\"toolchainFile\":null,\"CMakeOptions\":[],\"addonSubdirectory\":\"\",\"additionalDefines\":[],\"abi\":131,\"libc\":\"libc\"}": "darwin/arm64/node/131/addon.node"
}
  • chore: add Biome/Prettier for formatting code by @aminya in #39
  • fix: add Biome for linting + fix issues by @aminya in #41

Full Changelog: v0.5.3...v0.6.0

v0.5.3

24 Mar 07:12

Choose a tag to compare

What's Changed

  • fix: fix download issues in the download utils + add tests + remove downloadZip by @aminya in #38

Full Changelog: v0.5.2...v0.5.3

v0.5.2

24 Mar 01:00

Choose a tag to compare

What's Changed

  • 🎉 feat: build cmake-ts using Vite by @aminya in #33
    Now cmake-ts is built using vite, which makes its dependency management independent of the runtime. Two bundles legacy and modern are provided that support Node 12 and Node 20 respectively.
    This allows you to build your package in older runtimes and support older versions of Nodejs.

  • fix: revamp the downloading and extraction utils by @aminya in #34

  • fix: optimize bundle sizes by @aminya in #34

  • fix require usage in ESM bundles by @aminya in #35

  • fix: make bundle paths backwards compatible by @aminya in #36

  • fix: fix linting issues + explicit checks by @aminya in #37

  • test: add tests for building zeromq.js by @aminya in #35

Full Changelog: v0.4.0...v0.5.0
Full Changelog: v0.5.0...v0.5.1
Full Changelog: v0.5.1...v0.5.2

v0.5.1

23 Mar 07:31

Choose a tag to compare

What's Changed

  • 🎉 feat: build cmake-ts using Vite by @aminya in #33
    Now cmake-ts is built using vite, which makes its dependency management independent of the runtime. Two bundles legacy and modern are provided that support Node 12 and Node 20 respectively.
    This allows you to build your package in older runtimes and support older versions of Nodejs.

  • fix: revamp the downloading and extraction utils by @aminya in #34

  • fix: optimize bundle sizes by @aminya in #34

  • fix require usage in ESM bundles by @aminya in #35

  • fix: make bundle paths backwards compatible by @aminya in #36

  • fix: fix linting issues + explicit checks by @aminya in #37

  • test: add tests for building zeromq.js by @aminya in #35

Full Changelog: v0.4.0...v0.5.0
Full Changelog: v0.5.0...v0.5.1

v0.5.0

23 Mar 07:03

Choose a tag to compare

What's Changed

  • 🎉 feat: build cmake-ts using Vite by @aminya in #33
    Now cmake-ts is built using vite, which makes its dependency management independent of the runtime. Two bundles legacy and modern are provided that support Node 12 and Node 20 respectively.
    This allows you to build your package in older runtimes and support older versions of Nodejs.

  • fix: revamp the downloading and extraction utils by @aminya in #34

  • fix: optimize bundle sizes by @aminya in #34

  • fix require usage in ESM bundles by @aminya in #35

  • fix: make bundle paths backwards compatible by @aminya in #36

  • fix: fix linting issues + explicit checks by @aminya in #37

  • test: add tests for building zeromq.js by @aminya in #35

Full Changelog: v0.4.0...v0.5.0

v0.4.0

21 Mar 10:41

Choose a tag to compare

What's Changed

  • feat: allow installation via npm + update dependencies by @aminya in #27
  • fix: update Electron mirror to artifacts.electronjs.org by @robinchrist in #26
  • Fix: VS CMake Generator Finder can Now Find MSVS 2019+ Automatically by @diefbell-grabcad in #32

New Contributors

Full Changelog: v0.3.0...v0.4.0

v0.3.0

21 Mar 10:41
acaca0e

Choose a tag to compare

What's Changed

  • Multiple enhancements from real world experiences (v1.x?) by @robinchrist in #22

Full Changelog: v0.2.1...v0.3.0

v0.2.1

21 Mar 10:41
07f0cba

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.0...v0.2.1