Giter Club home page Giter Club logo

Comments (5)

langxiong avatar langxiong commented on July 27, 2024 2

@stek69 ,

Installation

CMake.js is a Node.js/io.js native addon build tool which works exactly like node-gyp, but instead of gyp, it is based on CMake build system.

npm install -g cmake-js

To compile a native module that uses only the
plain C N-API calls,
follow the directions for plain node native modules.

npm install --save-dev node-addon-api

To configure project

mkdir -p build_temp/node-api/
cd build_temp/node-api/
cmake-js configure -d ../../ -G "Visual Studio 14 2015" -O ./

To check cmake.js based builds

if(CMAKE_JS_VERSION)
    add_subdirectory(src)
endif(CMAKE_JS_VERSION)

In your addon's CMakeLists.txt

target_include_directories(${PROJECT_NAME} 
    PRIVATE ${CMAKE_SOURCE_DIR}/node_modules/node-addon-api
    PRIVATE ${CMAKE_JS_INC})


target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_JS_LIB})

from node-addon-api.

NickNaso avatar NickNaso commented on July 27, 2024 1

Hi @langxiong,
now cmake-js supports N-API and node-addon-api. See: https://www.npmjs.com/package/cmake-js#n-api-and-node-addon-api
What do you think, should be possible close this issue?

from node-addon-api.

NickNaso avatar NickNaso commented on July 27, 2024 1

I'm closing the issue because now the usage of CMake is well supported and documented in https://www.npmjs.com/package/cmake-js#n-api-and-node-addon-api

from node-addon-api.

langxiong avatar langxiong commented on July 27, 2024

See cmake-js/cmake-js#84

from node-addon-api.

stek69 avatar stek69 commented on July 27, 2024

Hi, I also ran into problems using gyp. Almost all have used libraries CMake.
How to build a project addon using CMake? After all, she's going to the library during the build of my addon.

from node-addon-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.