From d26a793fe75d26edf03afb9facc2b57dbb78baa0 Mon Sep 17 00:00:00 2001 From: NickNaso Date: Wed, 1 Sep 2021 17:19:20 +0200 Subject: [PATCH 1/2] doc: fixed doc about how to enable C++ exceptions. --- doc/setup.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/doc/setup.md b/doc/setup.md index 5db3452ad..c34a203c6 100644 --- a/doc/setup.md +++ b/doc/setup.md @@ -39,14 +39,25 @@ To use **Node-API** in a native module: ```gyp 'cflags!': [ '-fno-exceptions' ], 'cflags_cc!': [ '-fno-exceptions' ], - 'xcode_settings': { - 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', - 'CLANG_CXX_LIBRARY': 'libc++', - 'MACOSX_DEPLOYMENT_TARGET': '10.7', - }, - 'msvs_settings': { - 'VCCLCompilerTool': { 'ExceptionHandling': 1 }, - }, + 'conditions': [ + ["OS=='win'", { + "defines": [ + "_HAS_EXCEPTIONS=1" + ], + "msvs_settings": { + "VCCLCompilerTool": { + "ExceptionHandling": 1 + }, + }, + }], + ["OS=='mac'", { + 'xcode_settings': { + 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES', + 'CLANG_CXX_LIBRARY': 'libc++', + 'MACOSX_DEPLOYMENT_TARGET': '10.7', + }, + }], + ], ``` Alternatively, disable use of C++ exceptions in Node-API: From 3d16c76776066339e347906bbe8fbfe4ff6417db Mon Sep 17 00:00:00 2001 From: NickNaso Date: Wed, 1 Sep 2021 17:21:57 +0200 Subject: [PATCH 2/2] fixed typo. --- doc/setup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/setup.md b/doc/setup.md index c34a203c6..49e039c8f 100644 --- a/doc/setup.md +++ b/doc/setup.md @@ -44,7 +44,7 @@ To use **Node-API** in a native module: "defines": [ "_HAS_EXCEPTIONS=1" ], - "msvs_settings": { + "msvs_settings": { "VCCLCompilerTool": { "ExceptionHandling": 1 },