Skip to content

change node-addon-api build to cmake #422

Closed

Description

@DaAitch

This is not a request to change everything in one day, but a possible improvement/POC of the build.
What are your feelings about a cmake setup?

improvements:

  • get rid of node-gyp one day (like me, what I've read community is not very happy with it)
  • no config-only rigid builds
  • cmake features
    • build is code
    • cross-os compilation
    • actively maintained
    • standard build tool for C/C++ (support ninja/Makefile)

disadvantages:

  • maybe cannot drop node-gyp support for the first time

Other improvements are:

  • I could simplify how tests are compiled/executed: *.test.cc files are compiled, *.test.js files are executed, so simply add files
  • logging/documentation: I love to read code as documentation, so that I can understand how sth. works. With node-gyp it's like "understand node-gyp configuration or die", and with cmake it's easy to understand what happens, maybe not for a beginner to write, but to also to read and understand

Activity

  1. added 2 commits that reference this issue on Dec 29, 2018
  2. gabrielschulhof commented on Dec 29, 2018

    @gabrielschulhof
    Contributor

    @DaAitch we need to ensure that CMake is available on all the machines of https://ci.nodejs.org/job/node-test-node-addon-api/. I'm totally in favour of switching to CMake though.

  3. DaAitch commented on Dec 29, 2018

    @DaAitch
    ContributorAuthor

    @gabrielschulhof: cool, so that should not be a big thing, right :-) ?

  4. gabrielschulhof commented on Dec 29, 2018

    @gabrielschulhof
    Contributor

    Well, it's a modification to the CI infrastructure. We need to see if a switch to CMake is already in work on https://github.com/nodejs/build/.

  5. DaAitch commented on Dec 30, 2018

    @DaAitch
    ContributorAuthor

    what I could found on nodejs and builds is:

    @mhdawson has been involved to some issues. maybe he can help us here?

  6. mhdawson commented on Jan 2, 2019

    @mhdawson
    Member

    There has been some exploratory work to look at using cmake with node core, but its not gotten to the point where there is consensus or a view on when it might/might not happen.

    I think it is interesting it exploring using cmake instead. Is it possible that we could support both at the same time?

  7. DaAitch commented on Jan 2, 2019

    @DaAitch
    ContributorAuthor

    @mhdawson I did some refactoring of the build, but in general if I hadn't remove the gyp files, we could support both the same time. No change of the sources, so: yes.

  8. mhdawson commented on Jan 2, 2019

    @mhdawson
    Member

    Can you share what it looks like with cmake support added? Would be good to look at the changes to better understand.

  9. DaAitch commented on Jan 2, 2019

    @DaAitch
    ContributorAuthor

    sure, it's already attached above: 98cc0c3

  10. mhdawson commented on Jan 2, 2019

    @mhdawson
    Member

    Opened nodejs/TSC#648 to rekindle the discussion for using cmake in node core.

  11. DaAitch commented on Jan 3, 2019

    @DaAitch
    ContributorAuthor

    @mhdawson would a PR makes sense, that touches nothing, but adds an experimental CMakeLists.txt?
    Maybe we can run cmake build on CI as well?

    The commit I did was a mix of many small things I found (maybe I will create a PR for them as well).

  12. mhdawson commented on Jan 4, 2019

    @mhdawson
    Member

    I'm not sure yet. It would be good to have a more complete picture on the suitability of cmake for building addons in general. A distinct PR might make it easier to see the changes that it introduces but I'm not sure we'd be ready to land it.

  13. DaAitch commented on Jan 4, 2019

    @DaAitch
    ContributorAuthor

    @mhdawson okay, so we can retrigger this after nodejs/TSC#648. I'll close this.

  14. refack commented on Jan 20, 2019

    @refack
  15. bkotzz commented on Oct 23, 2019

    @bkotzz

    Can we revive this at all? Would anyone be interested in a PR that simply adds a CMakeList for the library, and a CI job that makes sure it builds, but we keep using gyp for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions