Skip to content

Commit e8120bb

Browse files
Merge in changes from lua-simdjson 0.0.7 (#2)
* Update simdjson to 3.11.3 (FourierTransformer#95) * Removed old rockspec (FourierTransformer#96) * Add scm rockspec for installing from master (FourierTransformer#98) * Add support for windows with MSVC toolchain (FourierTransformer#97) * Add nmake file for building with windows MSVC * Fix function export for msvc build * Add MSVC target to test matrix * [ci] Use patched luarocks to fix msvc setup * [ci] Add workaround for missing compat53 * [ci] Use patched luarocks to avoid compat53 issue * [ci] Update to upstream version of luarocks The patch for the lua compat53 issue has been merged now * Fix missing LD flag for msvc makefile (FourierTransformer#99) * Update simdjson to 3.12.3 (FourierTransformer#101) * nmake: Fix file names for hxsimdjson --------- Co-authored-by: FourierTransformer <[email protected]>
1 parent 66db439 commit e8120bb

File tree

9 files changed

+15834
-10404
lines changed

9 files changed

+15834
-10404
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ jobs:
4646
fail-fast: false
4747
matrix:
4848
lua: [lua=5.1, lua=5.2, lua=5.3, lua=5.4, luajit=2.0, luajit=2.1]
49+
target: [mingw,vs]
4950
runs-on: windows-2022
5051
steps:
5152
# Checks-out the repository under $GITHUB_WORKSPACE.
5253
- uses: actions/checkout@v4
5354
- name: Install Lua (${{ matrix.lua }})
5455
run: |
5556
pip install hererocks
56-
hererocks lua_install -r@3a142ce --${{ matrix.lua }}
57+
hererocks lua_install -r@28f9d98 --${{ matrix.lua }} --target ${{ matrix.target }}
5758
- name: Build lua-simdjson
5859
run: |
5960
.\lua_install\bin\activate

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,8 @@ test/
44
*.o
55
*.d
66
*.src.rock
7+
8+
# msvc
9+
*.obj
10+
*.lib
11+
*.exp

Makefile.win

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
OBJ = src/hxluasimdjson.obj src/simdjson.obj
2+
CPPFLAGS = -I$(LUA_INCDIR)
3+
CXXFLAGS = -EHsc -std:c++17 $(CFLAGS)
4+
LDFLAGS = $(LIBFLAG)
5+
6+
!ifdef LUA_LIBDIR
7+
LDLIBS = $(LUA_LIBDIR)/$(LUALIB)
8+
!endif
9+
10+
TARGET = hxsimdjson.dll
11+
12+
all: $(TARGET)
13+
14+
src/hxluasimdjson.obj: src/hxluasimdjson.h src/simdjson.h
15+
src/simdjson.obj: src/simdjson.h
16+
17+
.cpp.obj::
18+
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -Fo:"src\\"
19+
20+
$(TARGET): $(OBJ)
21+
$(LD) $(LDFLAGS) $** -out:$@ $(LDLIBS)
22+
23+
clean:
24+
del *.dll src\*.obj *.lib *.exp 2>nul
25+
26+
install: $(TARGET)
27+
copy $(TARGET) $(INST_LIBDIR)

hx-lua-simdjson-0.0.5-1.rockspec renamed to hx-lua-simdjson-0.0.7-1.rockspec

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package="hx-lua-simdjson"
2-
version="0.0.5-1"
2+
version="0.0.7-1"
33
source = {
44
url = "git://github.com/HaxeFoundation/hx-lua-simdjson",
5-
tag = "0.0.5"
5+
tag = "0.0.7"
66
}
77
description = {
88
summary = "This is a simple Haxe-specific Lua binding for simdjson",
@@ -36,6 +36,7 @@ build = {
3636
build_variables = {
3737
LUA_LIBDIR="$(LUA_LIBDIR)",
3838
LUALIB="$(LUALIB)",
39+
LD="$(LD)",
3940
}
4041
}
4142
}

hx-lua-simdjson-scm-0.rockspec renamed to hx-lua-simdjson-scm-1.rockspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package="hx-lua-simdjson"
2-
version="scm-0"
2+
version="scm-1"
33
source = {
44
url = "git://github.com/HaxeFoudnation/hx-lua-simdjson",
5-
tag = "0.0.0"
65
}
76
description = {
87
summary = "This is a simple Haxe-specific Lua binding for simdjson",
@@ -36,6 +35,7 @@ build = {
3635
build_variables = {
3736
LUA_LIBDIR="$(LUA_LIBDIR)",
3837
LUALIB="$(LUALIB)",
38+
LD="$(LD)",
3939
}
4040
}
4141
}

src/hxluasimdjson.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "hxluasimdjson.h"
1616

1717
#define LUA_SIMDJSON_NAME "hxsimdjson"
18-
#define LUA_SIMDJSON_VERSION "0.0.5"
18+
#define LUA_SIMDJSON_VERSION "0.0.7"
1919

2020
using namespace simdjson;
2121

@@ -136,9 +136,6 @@ void convert_ondemand_element_to_table(lua_State *L, T& element) {
136136
// calling is_null().value() will trigger an exception if the value is invalid
137137
if (element.is_null().value()) {
138138
lua_pushnil(L);
139-
} else {
140-
// workaround for simdjson 3.10.1
141-
throw simdjson_error(INCORRECT_TYPE);
142139
}
143140
break;
144141
}

src/hxluasimdjson.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#include <lua.hpp>
2+
3+
#ifdef _MSC_VER
4+
#define LUASIMDJSON_EXPORT __declspec(dllexport)
5+
#else
6+
#define LUASIMDJSON_EXPORT extern
7+
#endif
8+
29
extern "C" {
310
static int parse(lua_State*);
411
static int parse_file(lua_State*);
512
static int active_implementation(lua_State*);
613
static int ParsedObject_open(lua_State*);
714
static int ParsedObject_open_file(lua_State*);
815

9-
1016
static const struct luaL_Reg hxluasimdjson[] = {
1117
{"parse", parse},
1218
{"parseFile", parse_file},
@@ -16,5 +22,5 @@ extern "C" {
1622

1723
{NULL, NULL},
1824
};
19-
int luaopen_hxsimdjson (lua_State*);
25+
LUASIMDJSON_EXPORT int luaopen_hxsimdjson(lua_State*);
2026
}

0 commit comments

Comments
 (0)