See cmake-js/cmake-js#84
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.
@stek69 ,
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})
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?
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