uWebSockets.js/Makefile

39 lines
2.0 KiB
Makefile
Raw Normal View History

2019-01-16 20:31:17 +00:00
# Note: for Windows, run "nmake Windows" in x64 developer terminal
2018-10-28 15:07:21 +00:00
2019-01-16 20:31:17 +00:00
C_SHARED = -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -I uWebSockets/uSockets/src uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/eventing/*.c
CPP_SHARED = -DLIBUS_USE_LIBUV -flto -O3 -c -fPIC -std=c++17 -I uWebSockets/uSockets/src -I uWebSockets/src src/addon.cpp
C_OSX = -mmacosx-version-min=10.7
CPP_OSX = -stdlib=libc++ $(C_OSX)
2018-10-28 15:07:21 +00:00
2019-01-16 20:31:17 +00:00
Unices:
2018-10-28 15:07:21 +00:00
make targets
NODE=targets/node-v10.0.0 ABI=64 make `(uname -s)`
2018-11-03 11:35:42 +00:00
NODE=targets/node-v11.1.0 ABI=67 make `(uname -s)`
2018-10-28 15:07:21 +00:00
for f in dist/*.node; do chmod +x $$f; done
2019-01-16 20:31:17 +00:00
2018-10-28 15:07:21 +00:00
targets:
2019-01-16 20:31:17 +00:00
# Node.js 10
2018-10-28 15:07:21 +00:00
mkdir targets
2019-01-16 20:31:17 +00:00
curl -OJ https://nodejs.org/dist/v10.0.0/node-v10.0.0-headers.tar.gz
tar xzf node-v10.0.0-headers.tar.gz -C targets
curl https://nodejs.org/dist/v10.0.0/win-x64/node.lib > targets/node-v10.0.0/node.lib
# Node.js 11
curl -OJ https://nodejs.org/dist/v11.1.0/node-v11.1.0-headers.tar.gz
tar xzf node-v11.1.0-headers.tar.gz -C targets
curl https://nodejs.org/dist/v11.1.0/win-x64/node.lib > targets/node-v11.1.0/node.lib
2018-10-28 15:07:21 +00:00
Linux:
2018-12-26 12:50:12 +00:00
clang $(C_SHARED) -I $$NODE/include/node
clang++ $(CPP_SHARED) -I $$NODE/include/node
clang++ -flto -O3 *.o -std=c++17 -shared -static-libstdc++ -static-libgcc -s -o dist/uws_linux_$$ABI.node
2019-01-16 20:31:17 +00:00
2018-10-28 15:07:21 +00:00
Darwin:
2019-01-16 20:31:17 +00:00
clang $(C_OSX) $(C_SHARED) -I $$NODE/include/node
clang++ $(CPP_OSX) $(CPP_SHARED) -I $$NODE/include/node
clang++ $(CPP_OSX) -flto -O3 *.o -std=c++17 -shared -undefined dynamic_lookup -o dist/uws_darwin_$$ABI.node
Windows:
nmake targets
cl /D "LIBUS_USE_LIBUV" /std:c++17 /I uWebSockets/uSockets/src uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/eventing/*.c /I targets/node-v10.0.0/include/node /I uWebSockets/src /EHsc /Ox /LD /Fedist/uws_win32_64.node src/addon.cpp targets/node-v10.0.0/node.lib
cl /D "LIBUS_USE_LIBUV" /std:c++17 /I uWebSockets/uSockets/src uWebSockets/uSockets/src/*.c uWebSockets/uSockets/src/eventing/*.c /I targets/node-v11.1.0/include/node /I uWebSockets/src /EHsc /Ox /LD /Fedist/uws_win32_67.node src/addon.cpp targets/node-v11.1.0/node.lib