Skip to content

Commit 59bea2c

Browse files
authored
Merge pull request #44 from lgeiger/windows
Windows prebuilts
2 parents dc8bf6d + 841deea commit 59bea2c

File tree

10 files changed

+141
-229
lines changed

10 files changed

+141
-229
lines changed

binding.cc

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,7 @@
3838
#include "nan.h"
3939

4040
#ifdef _WIN32
41-
# include <delayimp.h>
4241
# define snprintf _snprintf_s
43-
typedef BOOL (WINAPI* SetDllDirectoryFunc)(wchar_t *lpPathName);
44-
class SetDllDirectoryCaller {
45-
public:
46-
explicit SetDllDirectoryCaller() : func_(NULL) { }
47-
~SetDllDirectoryCaller() {
48-
if (func_)
49-
func_(NULL);
50-
}
51-
// Sets the SetDllDirectory function pointer to activates this object.
52-
void set_func(SetDllDirectoryFunc func) { func_ = func; }
53-
private:
54-
SetDllDirectoryFunc func_;
55-
};
5642
#endif
5743

5844
#define ZMQ_CAN_DISCONNECT (ZMQ_VERSION_MAJOR == 3 && ZMQ_VERSION_MINOR >= 2) || ZMQ_VERSION_MAJOR > 3
@@ -1586,36 +1572,6 @@ namespace zmq {
15861572
// module
15871573

15881574
extern "C" NAN_MODULE_INIT(init) {
1589-
#ifdef _MSC_VER
1590-
// On Windows, inject the windows/lib folder into the DLL search path so that
1591-
// it will pick up our bundled DLL in case we do not have zmq installed on
1592-
// this system.
1593-
HMODULE kernel32_dll = GetModuleHandleW(L"kernel32.dll");
1594-
SetDllDirectoryCaller caller;
1595-
SetDllDirectoryFunc set_dll_directory;
1596-
wchar_t path[MAX_PATH] = L"";
1597-
wchar_t pathDir[MAX_PATH] = L"";
1598-
if (kernel32_dll != NULL) {
1599-
set_dll_directory =
1600-
reinterpret_cast<SetDllDirectoryFunc>(GetProcAddress(kernel32_dll, "SetDllDirectoryW"));
1601-
if (set_dll_directory) {
1602-
GetModuleFileNameW(GetModuleHandleW(L"zmq.node"), path, MAX_PATH - 1);
1603-
wcsncpy(pathDir, path, wcsrchr(path, '\\') - path);
1604-
path[0] = '\0';
1605-
pathDir[wcslen(pathDir)] = '\0';
1606-
# ifdef _WIN64
1607-
wcscat(pathDir, L"\\..\\..\\windows\\lib\\x64");
1608-
# else
1609-
wcscat(pathDir, L"\\..\\..\\windows\\lib\\x86");
1610-
# endif
1611-
_wfullpath(path, pathDir, MAX_PATH);
1612-
set_dll_directory(path);
1613-
caller.set_func(set_dll_directory);
1614-
assert (!FAILED(__HrLoadAllImportsForDll("libzmq-v100-mt-4_0_4.dll")) &&
1615-
"delayload error");
1616-
}
1617-
}
1618-
#endif
16191575
zmq::Initialize(target);
16201576
}
16211577

binding.gyp

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,51 +3,41 @@
33
{
44
'target_name': 'zmq',
55
'sources': [ 'binding.cc' ],
6-
'include_dirs' : [
7-
"<!(node -e \"require('nan')\")"
8-
],
6+
'include_dirs' : ["<!(node -e \"require('nan')\")"],
7+
'cflags!': ['-fno-exceptions'],
8+
'cflags_cc!': ['-fno-exceptions'],
99
'conditions': [
1010
['OS=="win"', {
11-
'win_delay_load_hook': 'true',
11+
'msbuild_toolset': 'v120',
12+
'defines': ['ZMQ_STATIC'],
1213
'include_dirs': ['windows/include'],
13-
'link_settings': {
14-
'libraries': [
15-
'Delayimp.lib',
16-
],
17-
'conditions': [
18-
['target_arch=="ia32"', {
19-
'libraries': [
20-
'<(PRODUCT_DIR)/../../windows/lib/x86/libzmq-v100-mt-4_0_4.lib',
21-
]
22-
},{
23-
'libraries': [
24-
'<(PRODUCT_DIR)/../../windows/lib/x64/libzmq-v100-mt-4_0_4.lib',
25-
]
26-
}]
27-
],
28-
},
29-
'msvs_settings': {
30-
'VCLinkerTool': {
31-
'DelayLoadDLLs': ['libzmq-v100-mt-4_0_4.dll']
32-
}
33-
},
34-
}, {
35-
'libraries': [ '<(PRODUCT_DIR)/../../zmq/lib/libzmq.a' ],
36-
'include_dirs': [ '<(PRODUCT_DIR)/../../zmq/include' ],
37-
'cflags!': ['-fno-exceptions'],
38-
'cflags_cc!': ['-fno-exceptions'],
14+
'conditions': [
15+
['target_arch=="ia32"', {
16+
'libraries': [
17+
'<(PRODUCT_DIR)/../../windows/lib/Win32/libzmq',
18+
'ws2_32.lib',
19+
]
20+
},{
21+
'libraries': [
22+
'<(PRODUCT_DIR)/../../windows/lib/x64/libzmq',
23+
'ws2_32.lib',
24+
]
25+
}]
26+
],
3927
}],
4028
['OS=="mac" or OS=="solaris"', {
4129
'xcode_settings': {
4230
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
4331
'MACOSX_DEPLOYMENT_TARGET': '10.6',
4432
},
4533
'libraries': [ '<(PRODUCT_DIR)/../../zmq/lib/libzmq.a' ],
34+
'include_dirs': [ '<(PRODUCT_DIR)/../../zmq/include' ],
4635
}],
4736
['OS=="openbsd" or OS=="freebsd"', {
4837
}],
4938
['OS=="linux"', {
5039
'libraries': [ '<(PRODUCT_DIR)/../../zmq/lib/libzmq.a' ],
40+
'include_dirs': [ '<(PRODUCT_DIR)/../../zmq/include' ],
5141
}],
5242
]
5343
}

0 commit comments

Comments
 (0)