Skip to content

Commit 6e2323e

Browse files
authored
Merge pull request #686 from zeromq/fixes [skip ci]
2 parents 591d1f1 + 8f0f4d8 commit 6e2323e

File tree

2 files changed

+37
-6
lines changed

2 files changed

+37
-6
lines changed

CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ macro(set_option_from_env OPTION_NAME)
77
if("$ENV{npm_config_${OPTION_NAME_LOWER}}" STREQUAL "true")
88
set("${OPTION_NAME}"
99
ON
10-
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}")
10+
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}" FORCE)
1111
elseif("$ENV{npm_config_${OPTION_NAME_LOWER}}" STREQUAL "false")
1212
set("${OPTION_NAME}"
1313
OFF
14-
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}")
14+
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}" FORCE)
1515
else()
1616
set("${OPTION_NAME}"
1717
"$ENV{npm_config_${OPTION_NAME_LOWER}}"
18-
CACHE STRING "npm_config_${OPTION_NAME_LOWER}")
18+
CACHE STRING "npm_config_${OPTION_NAME_LOWER}" FORCE)
1919
endif()
2020
endif()
2121

@@ -56,6 +56,13 @@ if(APPLE)
5656
set(CMAKE_OSX_DEPLOYMENT_TARGET ${MACOSX_DEPLOYMENT_TARGET})
5757
endif()
5858

59+
option(ZMQ_ENABLE_SANITIZER_UNDEFINED "Enable undefined behavior sanitizer" OFF)
60+
set_option_from_env(ZMQ_ENABLE_SANITIZER_UNDEFINED)
61+
62+
if(${ZMQ_ENABLE_SANITIZER_UNDEFINED})
63+
set(ENABLE_SANITIZER_UNDEFINED "ENABLE_SANITIZER_UNDEFINED")
64+
endif()
65+
5966
# target system on Windows (for cross-compiling x86) and static linking runtimes
6067
if(WIN32)
6168
if("$ENV{Platform}" STREQUAL "x86")
@@ -107,7 +114,11 @@ run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV
107114
# Name of the project (will be the name of the plugin)
108115
project(addon LANGUAGES C CXX)
109116

110-
project_options(ENABLE_CACHE ENABLE_COMPILE_COMMANDS_SYMLINK)
117+
project_options(
118+
ENABLE_CACHE
119+
ENABLE_COMPILE_COMMANDS_SYMLINK
120+
${ENABLE_SANITIZER_UNDEFINED}
121+
)
111122

112123
file(GLOB_RECURSE SOURCES "./src/*.cc")
113124
add_library(addon SHARED ${SOURCES})

package.json

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
],
9292
"scripts": {
9393
"install": "node ./script/install.js",
94-
"clean": "shx rm -rf ./build ./prebuilds && run-p clean.lib clean.temp",
94+
"clean": "shx rm -rf ./build ./prebuilds ./staging && run-p clean.lib clean.temp",
9595
"clean.lib": "shx rm -rf ./lib/",
9696
"clean.release": "shx rm -rf ./build/Release",
9797
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp",
@@ -100,11 +100,13 @@
100100
"build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-unminified -d docs --jsCompressor terser && shx rm -rf docs-unminified",
101101
"deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"",
102102
"build.native": "cmake-ts nativeonly",
103-
"build.native.debug": "cmake-ts dev-os-only",
103+
"build.native.debug": "cross-env npm_config_zmq_enable_sanitizer_undefined=true cmake-ts dev-os-only",
104104
"build": "run-p build.js build.native",
105105
"build.debug": "run-s build.js build.native.debug",
106106
"test": "run-s test.unit",
107+
"test.debug": "run-s test.unit.debug",
107108
"test.unit": "run-s clean.temp build && mocha ./test/unit/*-test.ts",
109+
"test.unit.debug": "run-s clean.temp build.debug && mocha ./test/unit/*-test.ts",
108110
"test.unit.compat": "run-s clean.temp build && cross-env INCLUDE_COMPAT_TESTS=true mocha ./test/unit/compat/*-test.ts",
109111
"test.unit.nogc": "run-s clean.temp build && cross-env SKIP_GC_TESTS=true mocha",
110112
"test.electron.main": "run-s clean.temp build && electron-mocha ./test/unit/*-test.ts",
@@ -143,6 +145,24 @@
143145
"runtime": "node",
144146
"runtimeVersion": "12.22.12"
145147
},
148+
{
149+
"name": "darwin-arm64-dev",
150+
"dev": true,
151+
"buildType": "Debug",
152+
"os": "darwin",
153+
"arch": "arm64",
154+
"runtime": "node",
155+
"runtimeVersion": "12.22.12"
156+
},
157+
{
158+
"name": "windows-x64-dev",
159+
"dev": true,
160+
"buildType": "Debug",
161+
"os": "win32",
162+
"arch": "x64",
163+
"runtime": "node",
164+
"runtimeVersion": "12.22.12"
165+
},
146166
{
147167
"name": "windows-x64",
148168
"os": "win32",

0 commit comments

Comments
 (0)