Skip to content

Commit 3a23b9c

Browse files
authored
Merge pull request #50 from gilzoide/bugfix/unity-6-web
Fix support for Unity 6 web builds by letting Unity compile the plugin
2 parents 4f245ca + e7d662a commit 3a23b9c

15 files changed

+63
-65
lines changed

.github/workflows/build.yml

-3
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ jobs:
2121
target: docker-all-linux
2222
- platform: android
2323
target: docker-all-android
24-
- platform: webgl
25-
target: docker-all-webgl
2624
steps:
2725
- uses: actions/checkout@v3
2826
- name: Cache Docker files
@@ -37,7 +35,6 @@ jobs:
3735
with:
3836
name: gilzoide-sqlite-net-${{ matrix.platform }}
3937
path: |
40-
Plugins/lib/${{ matrix.platform }}/**/*.bc
4138
Plugins/lib/${{ matrix.platform }}/**/*.dll
4239
Plugins/lib/${{ matrix.platform }}/**/*.dylib
4340
Plugins/lib/${{ matrix.platform }}/**/*.so

Plugins/Makefile

+2-30
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Android setup
22
ANDROID_NDK_ROOT ?=
3-
# WebGL/Emscripten setup
4-
EMCC ?= emcc
53
# macOS code signing setup
64
CODESIGN ?= codesign
75
MACOS_CODESIGN_SIGNATURE ?=
@@ -20,27 +18,17 @@ BUILD_DIRS = \
2018
lib/windows/x86_64 lib/windows/x86 lib/windows/arm64 \
2119
lib/linux/x86_64 lib/linux/x86 \
2220
lib/macos \
23-
lib/android/arm64 lib/android/arm32 lib/android/x86 lib/android/x86_64 \
24-
lib/webgl
21+
lib/android/arm64 lib/android/arm32 lib/android/x86 lib/android/x86_64
2522

2623
SQLITE_SRC = sqlite-amalgamation/sqlite3.c
27-
SQLITE_CFLAGS_SRC = tools~/sqlite-cflags.txt
2824
SQLITE_NET_SRC = $(wildcard sqlite-net~/src/*.cs) sqlite-net~/LICENSE.txt
2925
SQLITE_NET_DEST = ../Runtime/sqlite-net
3026
SQLITE_NET_SED_SCRIPT = tools~/fix-library-path.sed
3127

32-
ifneq ($(findstring 4.,$(MAKE_VERSION)),)
33-
SQLITE_CFLAGS = $(file < $(SQLITE_CFLAGS_SRC))
34-
else
35-
SQLITE_CFLAGS = $(shell cat $(SQLITE_CFLAGS_SRC))
36-
endif
37-
CFLAGS += $(SQLITE_CFLAGS)
38-
3928
$(BUILD_DIRS):
4029
mkdir -p $@
4130

4231
.PRECIOUS: lib/%/sqlite3.o~
43-
lib/%/sqlite3.o~: .EXTRA_PREREQS = $(SQLITE_CFLAGS_SRC)
4432
lib/%/sqlite3.o~: $(SQLITE_SRC) | lib/%
4533
$(CC) -c -o $@ $< $(CFLAGS)
4634

@@ -64,11 +52,6 @@ ifdef MACOS_CODESIGN_SIGNATURE
6452
$(CODESIGN) -s "$(MACOS_CODESIGN_SIGNATURE)" $@
6553
endif
6654

67-
# iOS/tvOS/visionOS compile flags
68-
sqlite-amalgamation/sqlite3.c.meta: .EXTRA_PREREQS = $(SQLITE_CFLAGS_SRC)
69-
sqlite-amalgamation/sqlite3.c.meta:
70-
sed -i '' -E -e 's/(\s*CompileFlags:).*/\1 $(SQLITE_CFLAGS)/' $@
71-
7255
# Android
7356
check-ndk-root:
7457
ifndef ANDROID_NDK_ROOT
@@ -85,10 +68,6 @@ lib/android/arm32/libgilzoide-sqlite-net.so: CC = $(wildcard $(ANDROID_NDK_ROOT)
8568
lib/android/x86_64/libgilzoide-sqlite-net.so: CC = $(wildcard $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/*/bin/x86_64-linux-android21-clang)
8669
lib/android/x86/libgilzoide-sqlite-net.so: CC = $(wildcard $(ANDROID_NDK_ROOT)/toolchains/llvm/prebuilt/*/bin/i686-linux-android21-clang)
8770

88-
# WebGL
89-
lib/webgl/libgilzoide-sqlite-net.bc: .EXTRA_PREREQS = $(SQLITE_CFLAGS_SRC)
90-
lib/webgl/libgilzoide-sqlite-net.bc: $(SQLITE_SRC) | lib/webgl
91-
$(EMCC) -c -emit-llvm -o $@ $< $(CFLAGS)
9271

9372
# Source
9473
$(SQLITE_NET_DEST)/%.cs: sqlite-net~/src/%.cs $(SQLITE_NET_SED_SCRIPT)
@@ -123,14 +102,11 @@ android-arm32: lib/android/arm32/libgilzoide-sqlite-net.so
123102
android-x86_64: lib/android/x86_64/libgilzoide-sqlite-net.so
124103
android-x86: lib/android/x86/libgilzoide-sqlite-net.so
125104

126-
webgl: lib/webgl/libgilzoide-sqlite-net.bc
127-
128105
source: $(SQLITE_NET_DEST)/License.txt $(SQLITE_NET_DEST)/AssemblyInfo.cs $(SQLITE_NET_DEST)/SQLite.cs $(SQLITE_NET_DEST)/SQLiteAsync.cs
129106

130107
all-android: android-arm64 android-arm32 android-x86_64 android-x86
131-
all-apple: macos-universal sqlite-amalgamation/sqlite3.c.meta
108+
all-apple: macos-universal
132109
all-linux: linux-x86_64
133-
all-webgl: webgl
134110
all-windows: windows-x86_64 windows-x86
135111
all-windows-mingw: windows-mingw-x86_64 windows-mingw-x86
136112
all-windows-llvm-mingw: windows-mingw-x86_64 windows-mingw-x86 windows-mingw-arm64
@@ -142,9 +118,6 @@ docker-all-android:
142118
docker-all-linux:
143119
docker build -f tools~/Dockerfile.build.linux --platform=linux/amd64 -t gilzoide-sqlite-net-build-linux:latest $(DOCKER_BUILD_ARGS) .
144120
docker run --rm -v "$(CURDIR)":/src -w /src --platform=linux/amd64 gilzoide-sqlite-net-build-linux:latest make all-linux
145-
docker-all-webgl:
146-
docker build -f tools~/Dockerfile.build.webgl -t gilzoide-sqlite-net-build-webgl:latest $(DOCKER_BUILD_ARGS) .
147-
docker run --rm -v "$(CURDIR)":/src -w /src gilzoide-sqlite-net-build-webgl:latest make all-webgl
148121
docker-all-windows:
149122
docker build -f tools~/Dockerfile.build.windows -t gilzoide-sqlite-net-build-windows:latest $(DOCKER_BUILD_ARGS) .
150123
docker run --rm -v "$(CURDIR)":/src -w /src gilzoide-sqlite-net-build-windows:latest make all-windows-mingw
@@ -159,5 +132,4 @@ download-latest-build:
159132
rsync -r $(TMPDIR)/gilzoide-sqlite-net-linux/* lib/linux/
160133
rsync -r $(TMPDIR)/gilzoide-sqlite-net-android/* lib/android/
161134
rsync -r $(TMPDIR)/gilzoide-sqlite-net-macos/* lib/macos/
162-
rsync -r $(TMPDIR)/gilzoide-sqlite-net-webgl/* lib/webgl/
163135
$(RM) -r $(TMPDIR)

Plugins/lib/webgl.meta

-8
This file was deleted.
-6.96 MB
Binary file not shown.

Plugins/sqlite-amalgamation/sqlite3.c

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "sqlite3_defines.h"
2+
13
/******************************************************************************
24
** This file is an amalgamation of many separate C source files from SQLite
35
** version 3.48.0. By combining all the individual C code files into this

Plugins/sqlite-amalgamation/sqlite3.c.meta

+10-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/sqlite-amalgamation/sqlite3.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "sqlite3_defines.h"
2+
13
/*
24
** 2001-09-15
35
**

Plugins/sqlite-amalgamation/sqlite3.h.meta

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Compile-time definitions used to build SQLite
2+
// This is a separate file so that IL2CPP can use the same flags on all platforms
3+
#define SQLITE_USE_URI 1
4+
#define SQLITE_DQS 0
5+
#define SQLITE_DEFAULT_MEMSTATUS 0
6+
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1
7+
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS 1
8+
#define SQLITE_MAX_EXPR_DEPTH 0
9+
#define SQLITE_OMIT_DECLTYPE 1
10+
#define SQLITE_OMIT_DEPRECATED 1
11+
#define SQLITE_OMIT_PROGRESS_CALLBACK 1
12+
#define SQLITE_OMIT_SHARED_CACHE 1
13+
#define SQLITE_USE_ALLOCA 1
14+
#define SQLITE_ENABLE_RTREE 1
15+
#define SQLITE_ENABLE_MATH_FUNCTIONS 1
16+
#define HAVE_ISNAN 1
17+
#define SQLITE_ENABLE_GEOPOLY 1
18+
#define SQLITE_ENABLE_FTS5 1
19+
#define SQLITE_ENABLE_HIDDEN_COLUMNS 1

Plugins/lib/webgl/libgilzoide-sqlite-net.bc.meta renamed to Plugins/sqlite-amalgamation/sqlite3_defines.h.meta

+13-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/sqlite-amalgamation/sqlite3ext.h

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#include "sqlite3_defines.h"
2+
13
/*
24
** 2006 June 7
35
**

Plugins/sqlite-amalgamation/sqlite3ext.h.meta

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/tools~/Dockerfile.build.webgl

-3
This file was deleted.

Plugins/tools~/sqlite-cflags.txt

-1
This file was deleted.

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ This package provides the excelent [SQLite-net](https://github.com/praeclarum/sq
1111
+ `SQLiteConnection.Deserialize` extension method for deserializing memory (`byte[]`, `NativeArray<byte>` or `ReadOnlySpan<byte>`) into an open database (reference: [SQLite Deserialization](https://www.sqlite.org/c3ref/deserialize.html)).
1212
- [SQLite 3.48.0](https://sqlite.org/releaselog/3_48_0.html)
1313
+ Enabled modules: [R\*Tree](https://sqlite.org/rtree.html), [Geopoly](https://sqlite.org/geopoly.html), [FTS5](https://sqlite.org/fts5.html), [Built-In Math Functions](https://www.sqlite.org/lang_mathfunc.html)
14-
+ Prebuilt for Windows, Linux, macOS, Android and WebGL
15-
+ Built from source in iOS, tvOS and visionOS projects
14+
+ Supports Windows, Linux, macOS, WebGL, Android, iOS, tvOS and visionOS platforms
1615
+ Supports persisting data in WebGL builds by using a [custom VFS backed by Indexed DB](https://github.com/gilzoide/idbvfs).
1716

1817

0 commit comments

Comments
 (0)