Skip to content

Commit be58c58

Browse files
committed
Wrapper, JS: make it windows comaptible:
- add the NOMINMAX hack (I hate windows.h xD) - fix building with many hacks in the bindings.py - fix compilation in CI, since we have to use static stdlib
1 parent 74df770 commit be58c58

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

binding.gyp

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,50 @@
2121
[
2222
'OS == "mac"',
2323
{"cflags_cc!": ["-std=c++23"], "cflags_cc+": ["-std=c++20"]},
24-
]
24+
],
25+
[
26+
'OS != "win"',
27+
{
28+
"libraries": [
29+
"<!@(pkg-config oopetris-recordings --libs-only-l)",
30+
],
31+
},
32+
],
33+
[
34+
'OS == "win"',
35+
{
36+
"include_dirs+": [
37+
"<!@(node -e \"console.log(require('path').join(require.resolve('nan'),'..').replaceAll('\\\\','/'))\")",
38+
]
39+
},
40+
],
2541
],
2642
"defines": ["V8_DEPRECATION_WARNINGS=1"],
2743
"sources": ["src/cpp/wrapper.cpp"],
2844
"include_dirs": [
2945
"<!@(node -e \"require('nan')\")",
3046
"<!@(pkg-config oopetris-recordings --cflags-only-I | sed s/-I//g)",
3147
],
32-
"libraries": [
33-
"<!@(pkg-config oopetris-recordings --libs-only-l)",
34-
],
3548
"library_dirs": [
3649
"<!@(pkg-config oopetris-recordings --libs-only-L | sed s/-L//g)",
3750
],
51+
"msvs_settings": { ## settinsg cflags_cc doesn't really work onw windows, so using this
52+
"VCCLCompilerTool": {
53+
"AdditionalOptions": [
54+
"/std:c++latest",
55+
"/W4",
56+
"/EHsc",
57+
"/O2",
58+
"/wd4100", # since nan.h -> node.h has some warnings regarding that
59+
"<!@(pkg-config oopetris-recordings --cflags)",
60+
]
61+
},
62+
"VCLinkerTool": {
63+
"AdditionalDependencies": [
64+
"<!@(pkg-config oopetris-recordings --libs-only-l | sed s/-l/lib/g |sed 's/\s/.a /g')", # adjust to the default setting, namely lib<name>.a via some sed magic
65+
],
66+
},
67+
},
3868
}
3969
],
4070
}

src/cpp/wrapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#ifdef _WIN32
2+
#ifndef NOMINMAX
3+
#define NOMINMAX
4+
#endif
5+
#endif
6+
17
#include <nan.h>
28

39
#include <core/core.hpp>

0 commit comments

Comments
 (0)