Skip to content

Commit

Permalink
Merge pull request #1 from tobil4sk/update
Browse files Browse the repository at this point in the history
Update with latest lua-simdjson changes
  • Loading branch information
Simn authored Oct 8, 2024
2 parents 5033f01 + 70879f5 commit 66db439
Show file tree
Hide file tree
Showing 19 changed files with 167,762 additions and 16,555 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: CI

on: [push, pull_request]

jobs:
lua:
strategy:
fail-fast: false
matrix:
os: [linux, macos, macos-arm64]
lua: [lua=5.1, lua=5.2, lua=5.3, lua=5.4, luajit=2.0, luajit=2.1]
include:
- os: linux
runner: ubuntu-22.04
- os: macos
runner: macos-13
- os: macos-arm64
runner: macos-14
exclude:
- os: macos-arm64
lua: luajit=2.0
name: ${{ matrix.os }} (${{ matrix.lua }})
runs-on: ${{ matrix.runner }}
steps:
# Checks-out the repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v4
- name: Install Lua (${{ matrix.lua }})
run: |
pip install hererocks
hererocks lua_install -r^ --${{ matrix.lua }}
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
- name: Build lua-simdjson
run: |
source lua_install/bin/activate
luarocks make
# - name: Run tests
# run: |
# source lua_install/bin/activate
# luarocks install lua-cjson2
# luarocks install busted
# busted --verbose

windows:
strategy:
fail-fast: false
matrix:
lua: [lua=5.1, lua=5.2, lua=5.3, lua=5.4, luajit=2.0, luajit=2.1]
runs-on: windows-2022
steps:
# Checks-out the repository under $GITHUB_WORKSPACE.
- uses: actions/checkout@v4
- name: Install Lua (${{ matrix.lua }})
run: |
pip install hererocks
hererocks lua_install -r@3a142ce --${{ matrix.lua }}
- name: Build lua-simdjson
run: |
.\lua_install\bin\activate
luarocks make
# - name: Run tests
# run: |
# .\lua_install\bin\activate
# luarocks install lua-cjson2
# luarocks install busted
# busted --verbose
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
test/
*.so
*.dll
*.o
*.d
*.src.rock
47 changes: 36 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
SRC = src/hxluasimdjson.cpp src/simdjson.cpp
INCLUDE = -I$(LUA_INCDIR)
LIBS_PATH = -L$(LUA_LIBDIR)
LIBS = -lpthread
FLAGS = -std=c++11 -Wall $(LIBFLAG) $(CFLAGS)
OBJ = src/hxluasimdjson.o src/simdjson.o
CPPFLAGS = -I$(LUA_INCDIR)
CXXFLAGS = -std=c++11 -Wall $(CFLAGS)
LDFLAGS = $(LIBFLAG)
LDLIBS = -lpthread

all: hxsimdjson.so
ifdef LUA_LIBDIR
LDLIBS += $(LUA_LIBDIR)/$(LUALIB)
endif

hxsimdjson.so:
$(CXX) $(SRC) $(FLAGS) $(INCLUDE) $(LIBS_PATH) $(LIBS) -o $@
ifeq ($(OS),Windows_NT)
LIBEXT = dll
else
UNAME := $(shell uname -s)
ifeq ($(findstring MINGW,$(UNAME)),MINGW)
LIBEXT = dll
else ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
LIBEXT = dll
else
LIBEXT = so
endif
endif

TARGET = hxsimdjson.$(LIBEXT)

all: $(TARGET)

DEP_FILES = $(OBJ:.o=.d)
-include $(DEP_FILES)

%.o: %.cpp
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MMD -MP -c $< -o $@

$(TARGET): $(OBJ)
$(CXX) $(LDFLAGS) $^ -o $@ $(LDLIBS)

clean:
rm *.so
rm -f *.$(LIBEXT) src/*.{o,d}

install: hxsimdjson.so
cp hxsimdjson.so $(INST_LIBDIR)
install: $(TARGET)
cp $(TARGET) $(INST_LIBDIR)
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# hx-lua-simdjson (WIP)
# hx-lua-simdjson

[![Build Status](https://github.com/FourierTransformer/lua-simdjson/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/FourierTransformer/lua-simdjson/actions?query=branch%3Amaster)

A basic haxe-specific lua binding to [simdjson](https://simdjson.org). This
library is intended to be used only via the Haxe compiler.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package="hx-lua-simdjson"
version="0.0.1-0"
version="0.0.5-1"
source = {
url = "git://github.com/jdonaldson/hx-lua-simdjson",
tag = "0.0.2"
url = "git://github.com/HaxeFoundation/hx-lua-simdjson",
tag = "0.0.5"
}
description = {
summary = "This is a simple Haxe-specific Lua binding for simdjson",
detailed = [[
This is a Haxe-specific c++ binding to simdjson for parsing JSON very quickly.
]],
homepage = "https://github.com/jdonaldson/hx-lua-simdjson",
homepage = "https://github.com/HaxeFoundation/hx-lua-simdjson",
license = "Apache-2.0"
}
dependencies = {
Expand All @@ -20,7 +20,6 @@ build = {
build_variables = {
CFLAGS="$(CFLAGS)",
LIBFLAG="$(LIBFLAG)",
LUA_LIBDIR="$(LUA_LIBDIR)",
LUA_BINDIR="$(LUA_BINDIR)",
LUA_INCDIR="$(LUA_INCDIR)",
LUA="$(LUA)",
Expand All @@ -32,4 +31,12 @@ build = {
INST_LUADIR="$(LUADIR)",
INST_CONFDIR="$(CONFDIR)",
},
platforms = {
windows = {
build_variables = {
LUA_LIBDIR="$(LUA_LIBDIR)",
LUALIB="$(LUALIB)",
}
}
}
}
13 changes: 10 additions & 3 deletions hx-lua-simdjson-scm-0.rockspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package="hx-lua-simdjson"
version="scm-0"
source = {
url = "git://github.com/jdonaldson/hx-lua-simdjson",
url = "git://github.com/HaxeFoudnation/hx-lua-simdjson",
tag = "0.0.0"
}
description = {
summary = "This is a simple Haxe-specific Lua binding for simdjson",
detailed = [[
This is a Haxe-specific c++ binding to simdjson for parsing JSON very quickly.
]],
homepage = "https://github.com/jdonaldson/hx-lua-simdjson",
homepage = "https://github.com/HaxeFoundation/hx-lua-simdjson",
license = "Apache-2.0"
}
dependencies = {
Expand All @@ -20,7 +20,6 @@ build = {
build_variables = {
CFLAGS="$(CFLAGS)",
LIBFLAG="$(LIBFLAG)",
LUA_LIBDIR="$(LUA_LIBDIR)",
LUA_BINDIR="$(LUA_BINDIR)",
LUA_INCDIR="$(LUA_INCDIR)",
LUA="$(LUA)",
Expand All @@ -32,4 +31,12 @@ build = {
INST_LUADIR="$(LUADIR)",
INST_CONFDIR="$(CONFDIR)",
},
platforms = {
windows = {
build_variables = {
LUA_LIBDIR="$(LUA_LIBDIR)",
LUALIB="$(LUALIB)",
}
}
}
}
1 change: 1 addition & 0 deletions jsonexamples/invalid/bool_trailing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
true trailing
1 change: 1 addition & 0 deletions jsonexamples/invalid/nil_token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[nil]
1 change: 1 addition & 0 deletions jsonexamples/invalid/nil_token_scalar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nil
1 change: 1 addition & 0 deletions jsonexamples/invalid/nully_token.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[nully]
1 change: 1 addition & 0 deletions jsonexamples/invalid/nully_token_scalar.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nully
1 change: 1 addition & 0 deletions jsonexamples/invalid/nully_trailing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nully trailing
1 change: 1 addition & 0 deletions jsonexamples/scalars/bool.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
true
1 change: 1 addition & 0 deletions jsonexamples/scalars/null.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
null
1 change: 1 addition & 0 deletions jsonexamples/scalars/number.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
1 change: 1 addition & 0 deletions jsonexamples/scalars/string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"hello world"
Loading

0 comments on commit 66db439

Please sign in to comment.