Skip to content

Commit

Permalink
chore: parametrize sanitizer build
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Apr 17, 2021
1 parent be3eff2 commit 740b4df
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 20 deletions.
57 changes: 37 additions & 20 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -113,29 +113,46 @@

['OS == "win"', {
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': 2, # /EHsc
# 0 - MultiThreaded (/MT)
# 1 - MultiThreadedDebug (/MTd)
# 2 - MultiThreadedDLL (/MD)
# 3 - MultiThreadedDebugDLL (/MDd)
'RuntimeLibrary': 3,
'AdditionalOptions': [
'-std:c++17',
"/DEBUG",

# Uncomment to enable address sanitizer
'conditions': [
['"<@(sanitizers)" != "true"', {
# without sanitizer
'VCCLCompilerTool': {
'ExceptionHandling': 2, # /EHsc
# 0 - MultiThreaded (/MT)
# 1 - MultiThreadedDebug (/MTd)
# 2 - MultiThreadedDLL (/MD)
# 3 - MultiThreadedDebugDLL (/MDd)
'RuntimeLibrary': 3,
'AdditionalOptions': [
'-std:c++17',
"/DEBUG",
],
},
'VCLinkerTool': {
'BasicRuntimeChecks': 3, # /RTC1
},
}, {
# with sanitizer
# Build with `node-gyp rebuild --debug --sanitizers='true'`
# Make sure to add the followings (or what your MSVC use) to the PATH and run `refreshenv`.
# # C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.29917/lib/x64/
# # C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/VC/Tools/MSVC/14.29.29917/bin/Hostx64/x64/
# "/fsanitize=address",
# "/Zi",
# "/INCREMENTAL:NO",
],
},
'VCLinkerTool': {
'BasicRuntimeChecks': 3, # /RTC1
},
'VCCLCompilerTool': {
'ExceptionHandling': 2, # /EHsc
'RuntimeLibrary': 3,
"DebugInformationFormat": "ProgramDatabase", # /Zi
'AdditionalOptions': [
'-std:c++17',
"/DEBUG",
"/fsanitize=address",
],
},
'VCLinkerTool': {
'BasicRuntimeChecks': 0, # not supported with fsanitize
"LinkIncremental": "NO", # /INCREMENTAL:NO
},
}],
],
},
}],
],
Expand Down
4 changes: 4 additions & 0 deletions script/ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ if [ -n "${ZMQ_NO_SYNC_RESOLVE}" ]; then
export npm_config_zmq_no_sync_resolve=true
fi

if [ -n "${ZMQ_SANITIZERS}" ]; then
export npm_config_sanitizers=true
fi

export npm_config_build_from_source=true

# Installing node-gyp globally facilitates calling it in various ways, not just
Expand Down

0 comments on commit 740b4df

Please sign in to comment.