Notice
Recent Posts
Recent Comments
Link
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

melius

[Node.js] Addons 본문

Node.js

[Node.js] Addons

melius102 2021. 3. 8. 06:03

https://nodejs.org/dist/latest-v14.x/docs/api/addons.html

https://github.com/nodejs/node

https://github.com/nodejs/node-addon-examples

1. Building

컴파일을 위해서 windows-build-tools와 node-gyp 패키지 설치가 필요하다.

 

1) windows-build-tools

https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md

https://www.npmjs.com/package/windows-build-tools

> npm install --global windows-build-tools
> npm config list

아래의 경로에 Python2와 Visual Studio Build Tools가 설치된다.

 

Python2 >> C:\Users\[user]\.windows-build-tools\python27\python.exe

MSBuild >> C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe

 

* cl.exe도 설치되며, 'Developer Command Prompt for VS 2017'을 실행하면 C++ 코드를 컴파일할 수 있다.

> cl /EHsc hello.cc /Fe: hello.exe
// '/Fe' Renames the executable file.
// '/EH' Exception handling model

 

 

2) node-gyp (option 1)

https://github.com/nodejs/node-gyp#installation

> npm install -g node-gyp

프로젝트 루트에서 아래의 명령 실행

> node-gyp configure  // once
> node-gyp build

 

 

3) cmake.js (option 2)

https://www.npmjs.com/package/cmake-js

 

 

4) etc.

https://github.com/workshopper/goingnative

https://www.youtube.com/watch?v=4OQNsg6xLdk

> where node
> npm root -g
> npm i goingnative

 

 

 

'Node.js' 카테고리의 다른 글

[Node.js] Package manager  (0) 2021.03.20
[Node.js] JavaScript Runtime Environment  (0) 2021.02.27
[Node.js] Worker Threads  (0) 2020.02.04
[Node.js] FormData 객체 전송  (0) 2020.01.29
[Node.js] HTTPS 로컬 서버 구축  (0) 2020.01.29
Comments