Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

analysis: add cmake toolchain analysis #9

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions toolchain-analysis/cmake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# CMake toolchain analysis

[CMake](https://cmake.org) is an open-source, cross-platform family of tools
designed to build, test and package software. CMake is used to control the
software compilation process using simple platform and compiler independent
configuration files, and generate native makefiles and workspaces that can be
used in the compiler environment of your choice.

## Supported platforms

TODO: test cmake against currently Node.js supported platforms and toolchains
(see [BUILDING.MD](https://github.com/nodejs/node/edit/master/BUILDING.md)).

### Unsupported platforms

TODO: see above

## Pros

* Widely used by C++ projects (probably the most used toolchain besides of
`make` and `autotools`).
* Easier to upgrade all our dependencies (except V8) and easier to add new
dependencies that use or are compatible with CMake (which is likely based on
previous point)
* It's been around for over two decades
* Due to its popularity, it's the most likely toolchain to support all of our
platforms within our minimum version constraints

## Cons

* CMake is not on V8 tree, therefore, V8 upgrades would be just as hard as today
with gyp


## Known ports

* No open source known ports [1^]

[1^]: It's not a full Node.js port, but
[bnoordhuis/v8-cmake](https://github.com/bnoordhuis/v8-cmake) adds cmake
support to V8

## Need more info

* Would cmake build affect Electron ability to build Node.js with GN in any way?

## Observations

* There seems to be positive reception at the idea of cmake for native modules,
having the same build system for building Node.js and its native modules
mmarchini marked this conversation as resolved.
Show resolved Hide resolved
* It is already possible to build node-addon-api based native modules with cmake.
Copy link

Choose a reason for hiding this comment

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

This is true for every build toolchain and also API (not just node-addon-api) so how valuable is this observation as a comparison to other toolchains?

Copy link
Member

Choose a reason for hiding this comment

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

It is one that I know people have already been using and has been tested out/validated.

* There is the possibility of using cmake to build everything except V8, using
GN to build V8 and then linking it statically to Node.js