项目作者: napi-bindings

项目描述 :
Node-API stub
高级语言: C
项目地址: git://github.com/napi-bindings/node-api-stub.git
创建时间: 2019-07-22T17:58:25Z
项目社区:https://github.com/napi-bindings/node-api-stub

开源协议:Apache License 2.0

下载


Node-API Stub

Node-API Build Matrix

Introduction

This repository contains the stub for Node-API used to avoid linker error on
building native addon for Node.js using programming languages different from
C and C++.

Building

The main purpose of this reposistory is to build Node-API static library that
you could include on your project. On release you can find the build for the
following operating systems:

  • Windows
  • Ubuntu 20.04
  • Ubuntu 18.04
  • Ubuntu 16.04
  • macOS

If you want to build the Node-API library on your own the first step is to
clone this repository:

> git clone https://github.com/napi-bindings/node-api-stub.git

Building on Windows

You will need to install GCC for Windows and CMake.

Install GCC compiler

  • Download the right version for your system from this link.
  • Be sure that gcc in in your path of execution.

Install CMake

  • Download the right version for your system from this link.
  • Be sure that cmake is in your path of execution.

Configure and build

Open your shell and execute the commands reported below:

  1. mkdir ./build
  2. cmake \
  3. -DCMAKE_MAKE_PROGRAM=mingw32-make.exe \
  4. -DCMAKE_C_COMPILER=gcc.exe \
  5. -DCMAKE_CXX_COMPILER=g++.exe \
  6. -DCMAKE_BUILD_TYPE=Release \
  7. -G "CodeBlocks - Unix Makefiles" \
  8. -S ./ \
  9. -B ./build
  10. cmake --build ./build

-DCMAKE_BUILD_TYPE could be set with one of the following two values:

  • Release
  • Debug

Building on Unix-like platform

You will need to install C / C++ compiler and CMake.

Prerequisistes to build on Linux

These steps were tested on:

  • Ubuntu 16.04
  • Ubuntu 18.04
  • Ubuntu 20.04

First, you will need to install dependencies:

  1. sudo apt-get update
  2. sudo apt-get install build-essential -y
  3. sudo apt-get install cmake -y

Prerequisites to build on macOS

These steps were tested on macOS Catalina (10.15).

First, you will need to install dependencies:

  • Install Xcode
    • You also need to install the XCode Command Line Tools by running
      xcode-select --install. Alternatively, if you already have the full Xcode
      installed, you can find them under the menu
      Xcode -> Open Developer Tool -> More Developer Tools.... This step will
      install clang, clang++, and make.
  • Install Homebrew
  • Install and cmake running the following command:
    1. brew install cmake

Configure and build

Open your shell and execute the commands reported below:

  1. mkdir ./build
  2. cmake \
  3. -DCMAKE_BUILD_TYPE=Release \
  4. -G "Unix Makefiles" \
  5. -S ./ \
  6. -B ./build
  7. cmake --build ./build

-DCMAKE_BUILD_TYPE could be set with one of the following two values:

  • Release
  • Debug

The Team

Nicola Del Gobbo

https://github.com/NickNaso

https://www.npmjs.com/~nicknaso

https://twitter.com/NickNaso

Acknowledgements

Thank you to all people that encourage me every day.

License

Licensed under Apache license V2