Skip to content

Commit 6eb32eb

Browse files
authoredAug 13, 2024
Support builds for Electron v32 (WiseLibs#1226)
* use c++20 required by v8 * adjust macro and method signatures * replace SetAccessor with SetNativeDataProperty * use old signatures for older node version * install g++ 10 on ubuntu
1 parent 254b8e9 commit 6eb32eb

File tree

5 files changed

+3221
-3207
lines changed

5 files changed

+3221
-3207
lines changed
 

‎.github/workflows/build.yml

+10
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ jobs:
4848
run: brew install python-setuptools
4949
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
5050
run: python3 -m pip install setuptools
51+
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
52+
run: |
53+
sudo apt update
54+
sudo apt install gcc-10 g++-10 -y
55+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
5156
- run: npm install --ignore-scripts
5257
- run: npm run build-debug
5358
- run: npm test
@@ -101,6 +106,11 @@ jobs:
101106
run: brew install python-setuptools
102107
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
103108
run: python3 -m pip install setuptools
109+
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
110+
run: |
111+
sudo apt update
112+
sudo apt install gcc-10 g++-10 -y
113+
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
104114
- run: npm install --ignore-scripts
105115
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
106116
- run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}

‎binding.gyp

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
'target_name': 'better_sqlite3',
1010
'dependencies': ['deps/sqlite3.gyp:sqlite3'],
1111
'sources': ['src/better_sqlite3.cpp'],
12-
'cflags_cc': ['-std=c++17'],
12+
'cflags_cc': ['-std=c++20'],
1313
'xcode_settings': {
14-
'OTHER_CPLUSPLUSFLAGS': ['-std=c++17', '-stdlib=libc++'],
14+
'OTHER_CPLUSPLUSFLAGS': ['-std=c++20', '-stdlib=libc++'],
1515
},
1616
'msvs_settings': {
1717
'VCCLCompilerTool': {
1818
'AdditionalOptions': [
19-
'/std:c++17',
19+
'/std:c++20',
2020
],
2121
},
2222
},

‎src/better_sqlite3.cpp

+2,165-2,165
Large diffs are not rendered by default.

‎src/better_sqlite3.hpp

+1,036-1,036
Large diffs are not rendered by default.

‎src/util/macros.lzz

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
#define NODE_ARGUMENTS const v8::FunctionCallbackInfo<v8::Value>&
22
#define NODE_ARGUMENTS_POINTER const v8::FunctionCallbackInfo<v8::Value>*
33
#define NODE_METHOD(name) static void name(NODE_ARGUMENTS info)
4+
#if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 121
45
#define NODE_GETTER(name) static void name(v8::Local<v8::String> _, const v8::PropertyCallbackInfo<v8::Value>& info)
6+
#else
7+
#define NODE_GETTER(name) static void name(v8::Local<v8::Name> _, const v8::PropertyCallbackInfo<v8::Value>& info)
8+
#endif
59
#define INIT(name) static v8::Local<v8::Function> name(v8::Isolate* isolate, v8::Local<v8::External> data)
610

711
#define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
@@ -143,7 +147,7 @@ void SetPrototypeGetter(
143147
v8::Local<v8::External> data,
144148
v8::Local<v8::FunctionTemplate> recv,
145149
const char* name,
146-
v8::AccessorGetterCallback func
150+
v8::AccessorNameGetterCallback func
147151
);
148152
#end
149153
#src
@@ -152,7 +156,7 @@ void SetPrototypeGetter(
152156
v8::Local<v8::External> data,
153157
v8::Local<v8::FunctionTemplate> recv,
154158
const char* name,
155-
v8::AccessorGetterCallback func
159+
v8::AccessorNameGetterCallback func
156160
) {
157161
v8::HandleScope scope(isolate);
158162

@@ -166,7 +170,7 @@ void SetPrototypeGetter(
166170
v8::PropertyAttribute::None
167171
);
168172
#else
169-
recv->InstanceTemplate()->SetAccessor(
173+
recv->InstanceTemplate()->SetNativeDataProperty(
170174
InternalizedFromLatin1(isolate, name),
171175
func,
172176
0,

0 commit comments

Comments
 (0)
Please sign in to comment.