Skip to content

Commit

Permalink
Merge pull request #686 from zeromq/fixes [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored Dec 30, 2024
2 parents 591d1f1 + 8f0f4d8 commit 6e2323e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ macro(set_option_from_env OPTION_NAME)
if("$ENV{npm_config_${OPTION_NAME_LOWER}}" STREQUAL "true")
set("${OPTION_NAME}"
ON
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}")
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}" FORCE)
elseif("$ENV{npm_config_${OPTION_NAME_LOWER}}" STREQUAL "false")
set("${OPTION_NAME}"
OFF
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}")
CACHE BOOL "npm_config_${OPTION_NAME_LOWER}" FORCE)
else()
set("${OPTION_NAME}"
"$ENV{npm_config_${OPTION_NAME_LOWER}}"
CACHE STRING "npm_config_${OPTION_NAME_LOWER}")
CACHE STRING "npm_config_${OPTION_NAME_LOWER}" FORCE)
endif()
endif()

Expand Down Expand Up @@ -56,6 +56,13 @@ if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET ${MACOSX_DEPLOYMENT_TARGET})
endif()

option(ZMQ_ENABLE_SANITIZER_UNDEFINED "Enable undefined behavior sanitizer" OFF)
set_option_from_env(ZMQ_ENABLE_SANITIZER_UNDEFINED)

if(${ZMQ_ENABLE_SANITIZER_UNDEFINED})
set(ENABLE_SANITIZER_UNDEFINED "ENABLE_SANITIZER_UNDEFINED")
endif()

# target system on Windows (for cross-compiling x86) and static linking runtimes
if(WIN32)
if("$ENV{Platform}" STREQUAL "x86")
Expand Down Expand Up @@ -107,7 +114,11 @@ run_vcpkg(VCPKG_URL "https://github.com/microsoft/vcpkg.git" VCPKG_REV
# Name of the project (will be the name of the plugin)
project(addon LANGUAGES C CXX)

project_options(ENABLE_CACHE ENABLE_COMPILE_COMMANDS_SYMLINK)
project_options(
ENABLE_CACHE
ENABLE_COMPILE_COMMANDS_SYMLINK
${ENABLE_SANITIZER_UNDEFINED}
)

file(GLOB_RECURSE SOURCES "./src/*.cc")
add_library(addon SHARED ${SOURCES})
Expand Down
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
],
"scripts": {
"install": "node ./script/install.js",
"clean": "shx rm -rf ./build ./prebuilds && run-p clean.lib clean.temp",
"clean": "shx rm -rf ./build ./prebuilds ./staging && run-p clean.lib clean.temp",
"clean.lib": "shx rm -rf ./lib/",
"clean.release": "shx rm -rf ./build/Release",
"clean.temp": "shx rm -rf ./tmp && shx mkdir -p ./tmp",
Expand All @@ -100,11 +100,13 @@
"build.doc": "typedoc --options ./typedoc.json && minify-all -s docs-unminified -d docs --jsCompressor terser && shx rm -rf docs-unminified",
"deploy.doc": "run-s build.doc && gh-pages --dist \"./docs\"",
"build.native": "cmake-ts nativeonly",
"build.native.debug": "cmake-ts dev-os-only",
"build.native.debug": "cross-env npm_config_zmq_enable_sanitizer_undefined=true cmake-ts dev-os-only",
"build": "run-p build.js build.native",
"build.debug": "run-s build.js build.native.debug",
"test": "run-s test.unit",
"test.debug": "run-s test.unit.debug",
"test.unit": "run-s clean.temp build && mocha ./test/unit/*-test.ts",
"test.unit.debug": "run-s clean.temp build.debug && mocha ./test/unit/*-test.ts",
"test.unit.compat": "run-s clean.temp build && cross-env INCLUDE_COMPAT_TESTS=true mocha ./test/unit/compat/*-test.ts",
"test.unit.nogc": "run-s clean.temp build && cross-env SKIP_GC_TESTS=true mocha",
"test.electron.main": "run-s clean.temp build && electron-mocha ./test/unit/*-test.ts",
Expand Down Expand Up @@ -143,6 +145,24 @@
"runtime": "node",
"runtimeVersion": "12.22.12"
},
{
"name": "darwin-arm64-dev",
"dev": true,
"buildType": "Debug",
"os": "darwin",
"arch": "arm64",
"runtime": "node",
"runtimeVersion": "12.22.12"
},
{
"name": "windows-x64-dev",
"dev": true,
"buildType": "Debug",
"os": "win32",
"arch": "x64",
"runtime": "node",
"runtimeVersion": "12.22.12"
},
{
"name": "windows-x64",
"os": "win32",
Expand Down

0 comments on commit 6e2323e

Please sign in to comment.