You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+18-6
Original file line number
Diff line number
Diff line change
@@ -12,16 +12,25 @@ Configuration is done entirely via `package.json`. You can specify multiple buil
12
12
13
13
```js
14
14
"cmake-ts": {
15
-
"nodeAPI":"node-addon-api"// Specify the node API package such as `node-addon-api`, `nan`, or the path to a directory that has the nodeAPI header. By default `nan` is considered.
15
+
"nodeAPI":"node-addon-api"// Specify the node API package such as `node-addon-api`, `nan`, or the path to a directory that has the nodeAPI header. Default is `node-addon-api`, a warning is emitted if nan is used
16
16
"configurations": [
17
17
{
18
+
"name":"win-x64", // name for named-configs mode
18
19
"os":"win32", // win32, linux and darwin are supported
19
20
"arch":"x64", // x64, x86 should work
20
21
"runtime":"electron", // node or electron
21
22
"runtimeVersion":"4.0.1", // Version of the runtime which it is built
22
-
"toolchainFile":"/windows.cmake"// CMake Toolchain file to use for crosscompiling
23
+
"toolchainFile":"/windows.cmake", // CMake Toolchain file to use for crosscompiling
24
+
"CMakeOptions": [ //Same syntax as for the globalCMakeOptions
25
+
{
26
+
"name":"MY_CMAKE_OPTION",
27
+
"value":"my_value",
28
+
}
29
+
],
30
+
"addonSubdirectory":"avx2-generic"// if you build addons for multiple architectures in high performance scenarios, you can put the addon inside another subdirectory
23
31
}, // more build configurations...
24
32
{
33
+
"dev":true, // whether this configuration is eligible to be used in a dev test build
25
34
"os":"linux", // win32, linux and darwin are supported
26
35
"arch":"x64", // x64, x86 should work
27
36
"runtime":"node", // node or electron
@@ -46,15 +55,18 @@ Configuration is done entirely via `package.json`. You can specify multiple buil
46
55
47
56
## Workflow
48
57
49
-
While it is desirable to perform a full build (all configurations) within a CI environment, long build times hinder local package development. Therefore cmake-ts knows not only the `build` target but also two other targets:
58
+
While it is desirable to perform a full build (all configurations) within a CI environment, long build times hinder local package development. Therefore cmake-ts knows multiple build modes:
50
59
51
-
-`nativeonly` -> Builds the native code **only** for the runtime cmake-ts is currently running on, ignoring all previously specified configurations. This is useful if you'd like to run some unit tests against the compiled code. When running `cmake-ts nativeonly`, cmake-ts will determine the runtime, ABI, and platform from the environment, and build only the configuration required to run on this platform.
60
+
-**TODO**`nativeonly` -> Builds the native code **only** for the runtime cmake-ts is currently running on, ignoring all previously specified configurations. This is useful if you'd like to run some unit tests against the compiled code. When running `cmake-ts nativeonly`, cmake-ts will determine the runtime, ABI, and platform from the environment, and build only the configuration required to run on this platform.
52
61
-*Example using the configuration above*
53
62
- You run `cmake-ts nativeonly` on **NodeJS 11.7 on MacOS**, `cmake-ts` will **ignore** all specified configurations above and build the native addon for **NodeJS 11.7 on MacOS**
54
-
-`osonly` -> Builds the native code for all configurations which match the current operating system. This is useful for those developing for example an electron addon and want to test their code in electron. In such a case, you would specify electron and NodeJS runtimes for several platforms in your configuration and you can use `cmake-ts osonly` to build a local package you can install in your application.
63
+
-**TODO**`osonly` -> Builds the native code for all configurations which match the current operating system. This is useful for those developing for example an electron addon and want to test their code in electron. In such a case, you would specify electron and NodeJS runtimes for several platforms in your configuration and you can use `cmake-ts osonly` to build a local package you can install in your application.
55
64
-*Example using the configuration above*
56
65
- You run `cmake-ts osonly` on **NodeJS 11.7 on Linux**, `cmake-ts` will **ignore** all configurations above where `os != linux` and build the native addon for **all** remaining configurations, in this case it will build for **NodeJS 10.3 on Linux**.
57
-
-**HINT**: For both `osonly` and `nativeonly`, the specified CMake Toolchain files are ignored since I assume you got your toolchain set up correctly for your **own** operating system.
66
+
-**TODO****HINT**: For both `osonly` and `nativeonly`, the specified CMake Toolchain files are ignored since I assume you got your toolchain set up correctly for your **own** operating system.
67
+
- None / Omitted: Builds all configs
68
+
-`dev-os-only` builds the first config that has `dev == true` and `os` matches the current OS
69
+
-`named-configs arg1 arg2 ...` builds all configs for which `name` is one of the args
console.warn(`WARNING: specified nodeAPI ${this.options.nodeAPI} seems to be nan - The usage of nan is discouraged due to subtle and hard-to-fix ABI issues! Consider using node-addon-api / N-API instead!`)
69
+
}
70
+
if(!this.options.nodeAPI){
71
+
console.warn('WARNING: nodeAPI was not specified. The default changed from "nan" to "node-addon-api" in v0.3.0! Please make sure this is intended.');
0 commit comments