Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node.js Windows Build #2103

Merged
merged 17 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,31 @@ jobs:
- name: Node 15
run: ./scripts/node_build.sh 15

win-nodejs:
name: node.js Windows
runs-on: windows-latest
needs: linux-debug

strategy:
matrix:
node: [ '10', '12', '14', '15' ]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- name: Node Version
run: ./scripts/node_version.sh

- name: Node
run: ./scripts/node_build_win.sh

linux-wasm-release:
name: WebAssembly Release
runs-on: ubuntu-20.04
Expand Down
20 changes: 20 additions & 0 deletions scripts/node_build_win.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash

set -e

node --version
npm --version
which node

cd tools/nodejs
make clean
./configure

npm install --build-from-source
npm test
npx node-pre-gyp package testpackage testbinary

if [[ "$GITHUB_REF" =~ ^(refs/heads/master|refs/tags/v.+)$ ]] ; then
npx node-pre-gyp publish
npx node-pre-gyp info
fi
7 changes: 7 additions & 0 deletions src/execution/operator/helper/physical_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,18 @@
#ifndef _WIN32
#include <dlfcn.h>
#else
#ifndef NOMINMAX
Mytherin marked this conversation as resolved.
Show resolved Hide resolved
#define NOMINMAX
#endif
#include <windows.h>

#define RTLD_LAZY 0
#define RTLD_LOCAL 0

#undef CreateDirectory
#undef MoveFile
#undef RemoveDirectory

#endif

namespace duckdb {
Expand Down
73 changes: 43 additions & 30 deletions tools/nodejs/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
{
"target_name": "<(module_name)",
"sources": [
"src/duckdb_node.cpp",
"src/database.cpp",
"src/connection.cpp",
"src/statement.cpp",
"src/utils.cpp",
"src/duckdb.cpp" # comment this out to build against existing lib
"src/duckdb_node.cpp",
"src/database.cpp",
"src/connection.cpp",
"src/statement.cpp",
"src/utils.cpp",
"src/duckdb.cpp" # comment this out to build against existing lib
],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")"
],
'defines': [
'NAPI_DISABLE_CPP_EXCEPTIONS=1',
"NAPI_VERSION=5"],
'NAPI_DISABLE_CPP_EXCEPTIONS=1',
"NAPI_VERSION=5"
],
"cflags_cc": [
"-frtti",
"-fexceptions"
Expand Down Expand Up @@ -43,31 +44,43 @@
},
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1
"ExceptionHandling": 1,
"AdditionalOptions": [
"/bigobj"
]
}
},
# uncomment this to build against existing lib
# "libraries": [
# "/Users/hannes/source/duckdb/build/release/src/libduckdb_static.a",
# "/Users/hannes/source/duckdb/build/release/third_party/fmt/libfmt.a",
# "/Users/hannes/source/duckdb/build/release/third_party/libpg_query/libpg_query.a",
# "/Users/hannes/source/duckdb/build/release/third_party/utf8proc/libutf8proc.a",
# "/Users/hannes/source/duckdb/build/release/third_party/re2/libduckdb_re2.a"
#
# ]
"conditions": [
[
'OS=="win"',
{
"defines": [
"DUCKDB_BUILD_LIBRARY"
]
},
], # OS=="win"
], # conditions
# uncomment this to build against existing lib
# "libraries": [
# "/Users/hannes/source/duckdb/build/release/src/libduckdb_static.a",
# "/Users/hannes/source/duckdb/build/release/third_party/fmt/libfmt.a",
# "/Users/hannes/source/duckdb/build/release/third_party/libpg_query/libpg_query.a",
# "/Users/hannes/source/duckdb/build/release/third_party/utf8proc/libutf8proc.a",
# "/Users/hannes/source/duckdb/build/release/third_party/re2/libduckdb_re2.a"
# ]
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [
"<!(node -p \"require('node-addon-api').gyp\")"
],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
"target_name": "action_after_build",
"type": "none",
"dependencies": [
"<(module_name)"
],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
]
}