GeezerVison is showing github.com — build: define `NOMINMAX` in common.gypi · nodejs/node@e1bd53c
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: common.gypi +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 458 | 458 | '_HAS_EXCEPTIONS=0', | 459 | 459 | 'BUILDING_V8_SHARED=1', | 460 | 460 | 'BUILDING_UV_SHARED=1', | | 461 | + # Stop <windows.h> from defining macros that conflict with | | 462 | + # std::min() and std::max(). We don't use <windows.h> (much) | | 463 | + # but we still inherit it from uv.h. | | 464 | + 'NOMINMAX', | 461 | 465 | ], | 462 | 466 | }], | 463 | 467 | [ 'OS in "linux freebsd openbsd solaris aix os400"', { | |
Collapse file Copy file name to clipboardExpand all lines: node.gypi -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 63 | 63 | 'FD_SETSIZE=1024', | 64 | 64 | # we need to use node's preferred "win32" rather than gyp's preferred "win" | 65 | 65 | 'NODE_PLATFORM="win32"', | 66 | | - # Stop <windows.h> from defining macros that conflict with | 67 | | - # std::min() and std::max(). We don't use <windows.h> (much) | 68 | | - # but we still inherit it from uv.h. | 69 | | - 'NOMINMAX', | 70 | 66 | '_UNICODE=1', | 71 | 67 | ], | 72 | 68 | 'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h', | |
Collapse file Copy file name to clipboardExpand all lines: test/addons/hello-world/binding.gyp +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 4 | 4 | 'target_name': 'binding', | 5 | 5 | 'sources': [ 'binding.cc' ], | 6 | 6 | 'includes': ['../common.gypi'], | | 7 | + }, | | 8 | + { | | 9 | + 'target_name': 'binding2', | | 10 | + 'sources': [ 'binding2.cc' ], | | 11 | + 'includes': ['../common.gypi'], | 7 | 12 | } | 8 | 13 | ] | 9 | 14 | } |
Collapse file Copy file name to clipboard +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// Include uv.h and v8.h ahead of node.h to verify that node.h doesn't need to | | 2 | +// be included first. Disable clang-format as it will sort the include lists. | | 3 | +// clang-format off | | 4 | +#include <uv.h> | | 5 | +#include <v8.h> | | 6 | +#include <node.h> | | 7 | +// clang-format on | | 8 | + | | 9 | +static void Method(const v8::FunctionCallbackInfo<v8::Value>& args) { | | 10 | + v8::Isolate* isolate = args.GetIsolate(); | | 11 | + args.GetReturnValue().Set( | | 12 | + v8::String::NewFromUtf8(isolate, "world").ToLocalChecked()); | | 13 | +} | | 14 | + | | 15 | +static void InitModule(v8::Local<v8::Object> exports, | | 16 | + v8::Local<v8::Value> module, | | 17 | + v8::Local<v8::Context> context) { | | 18 | + NODE_SET_METHOD(exports, "hello", Method); | | 19 | +} | | 20 | + | | 21 | +NODE_MODULE(NODE_GYP_MODULE_NAME, InitModule) |
Collapse file Copy file name to clipboardExpand all lines: test/addons/hello-world/test.js +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,6 +6,9 @@ const binding = require(bindingPath); | 6 | 6 | assert.strictEqual(binding.hello(), 'world'); | 7 | 7 | console.log('binding.hello() =', binding.hello()); | 8 | 8 |
| | 9 | +const binding2 = require(require.resolve(`./build/${common.buildType}/binding2`)); | | 10 | +assert.strictEqual(binding2.hello(), 'world'); | | 11 | + | 9 | 12 | // Test multiple loading of the same module. | 10 | 13 | delete require.cache[bindingPath]; | 11 | 14 | const rebinding = require(bindingPath); | |
|