forked from njs-api/njs-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnjs-api.h
58 lines (46 loc) · 1.77 KB
/
njs-api.h
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// [NJS-API]
// Native JavaScript API for Bindings.
//
// [License]
// Public Domain <http://unlicense.org>
// This is the main header file that tries to auto-detect the target engine
// including integrations. If it fails or you use a single engine within your
// project then it's much easier to just include the specific engine that you
// are using, like "njs-engine-v8".
#ifndef NJS_API_H
#define NJS_API_H
#include "./njs-base.h"
// ============================================================================
// [NJS - Detect the engine and integration]
// ============================================================================
// Node.js native addons define the `BUILDING_NODE_EXTENSION` macro.
#if defined(BUILDING_NODE_EXTENSION)
# define NJS_INTEGRATE_NODE
# define NJS_INTEGRATE_LIBUV
#else
# error "[njs] Couldn't detect the target environment."
#endif // BUILDING_NODE_EXTENSION
#if defined(NJS_INTEGRATE_NODE)
# include <node.h>
# if defined(JS_ENGINE_MOZJS)
# define NJS_ENGINE_SM // jxcore - spidermonkey.
# else
# define NJS_ENGINE_V8 // node/jxcore - v8.
# endif
#endif // NJS_INTEGRATE_NODE
// ============================================================================
// [NJS - Include the detected engine]
// ============================================================================
#if defined(NJS_ENGINE_SM)
# include "./njs-engine-sm.h"
#endif // NJS_ENGINE_SM
#if defined(NJS_ENGINE_V8)
# include "./njs-engine-v8.h"
#endif // NJS_ENGINE_V8
// ============================================================================
// [NJS - Include all detected integrations]
// ============================================================================
#if defined(NJS_INTEGRATE_LIBUV)
# include "./njs-integrate-libuv.h"
#endif // NJS_INTEGRATE_LIBUV
#endif // NJS_API_H