Skip to content

Commit

Permalink
enable exceptions the right way (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmomtchev authored Oct 3, 2024
1 parent 86ca17c commit a92a466
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
9 changes: 4 additions & 5 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
'external_python%': 'false',
'binding_dir': '<!(node -e "console.log(path.dirname(require(\'@mapbox/node-pre-gyp\').find(\'package.json\')))")',
},
'target_defaults': {
'includes': [ 'except.gypi' ]
},
'targets': [
{
'target_name': 'pymport',
Expand Down Expand Up @@ -50,7 +53,6 @@
['OS == "win"', {
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': 1,
'AdditionalOptions': [' /std:c++14' ]
},
},
Expand Down Expand Up @@ -93,15 +95,12 @@
}]
],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
'OTHER_CPLUSPLUSFLAGS': [ '-std=c++14' ]
},
'cflags': [ '-fvisibility=hidden '],
'cflags_cc': [ '-std=c++14' ],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'cflags_cc': [ '-std=c++14' ]
}]
]
},
Expand Down
25 changes: 25 additions & 0 deletions except.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
'defines': [ 'NAPI_CPP_EXCEPTIONS' ],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
["OS=='win'", {
"defines": [
"_HAS_EXCEPTIONS=1"
],
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
'EnablePREfast': 'true',
},
},
}],
["OS=='mac'", {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
},
}],
],
}

0 comments on commit a92a466

Please sign in to comment.