{"id":13669717,"url":"https://github.com/kjhe11e/NodeJsAddons","last_synced_at":"2025-04-27T08:32:53.705Z","repository":{"id":89162398,"uuid":"85355443","full_name":"kjhe11e/NodeJsAddons","owner":"kjhe11e","description":"Writing C/C++ addons for use with NodeJs","archived":false,"fork":false,"pushed_at":"2019-10-03T03:45:53.000Z","size":4330,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-11T07:38:40.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kjhe11e.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-03-17T21:17:42.000Z","updated_at":"2023-07-06T06:42:46.000Z","dependencies_parsed_at":"2023-06-14T05:30:35.188Z","dependency_job_id":null,"html_url":"https://github.com/kjhe11e/NodeJsAddons","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjhe11e%2FNodeJsAddons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjhe11e%2FNodeJsAddons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjhe11e%2FNodeJsAddons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kjhe11e%2FNodeJsAddons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kjhe11e","download_url":"https://codeload.github.com/kjhe11e/NodeJsAddons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251112600,"owners_count":21538162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:00:20.575Z","updated_at":"2025-04-27T08:32:48.683Z","avatar_url":"https://github.com/kjhe11e.png","language":"C++","readme":"A cumulative learning of building NodeJs addons written in C/C++.\n\n#### Note: Node has deprecated `Nan` in favor of `N-API` -- [relevant docs](https://nodejs.org/api/addons.html)\n\n========= *Using node-gyp* ==========\n\nTo run an application:\n\n1) cd to the program's directory (e.g. MathAddon)\n\n2) Run `node-gyp configure`\n\n3) Run `node-gyp build`\n\n4) Run `node __main.js_file__` to execute the program, e.g. `node index.js`\n\n\n========== *Using Nan and CMake* ==========\n\nCMake and Nan is a viable combination for creating NodeJs addons. IntelliJ's CLion IDE supports CMake.\n\n\n-- Install cmake-js:\n```\n npm install cmake-js\n```\n\n-- Basic project structure:\n\nWhen creating a project in IntelliJ's CLion, a CMakeLists.txt file will be automatically generated.\n\nThe CMakeLists.txt file is CMake's version of node-gyp's binding.gyp file.\n\nAn example CMakeLists.txt file: \n\n```\ncmake_minimum_required(VERSION 3.5)\n\n# name of project, will be name of plugin\nproject(Peripherals)\n\n# build shared library named after the project from files in 'src/' dir\nfile(GLOB SOURCE_FILES \"src/*.cpp\" \"src/*.h\")\nadd_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})\n\n# needed to resolve nan.h library\ninclude_directories(${CMAKE_JS_INC} ../nan)\n\n# give library file a .node extension without any \"lib\" prefix\nset_target_properties(${PROJECT_NAME} PROPERTIES PREFIX \"\" SUFFIX \".node\")\n\n# essential include files to build a node addon,\n# should add this line in every CMake.js based project\ntarget_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_JS_INC})\n\n# essential library files to link to a node addon\n# add this line to every CMake.js based project\ntarget_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB}) ```\n\n\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjhe11e%2FNodeJsAddons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkjhe11e%2FNodeJsAddons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkjhe11e%2FNodeJsAddons/lists"}