Skip to content

Commit

Permalink
Merge pull request #82 from tobil4sk/feature/windows-support
Browse files Browse the repository at this point in the history
[make] Add windows support
  • Loading branch information
FourierTransformer authored Jul 23, 2024
2 parents 15ae810 + c5c9f46 commit 1eb85fb
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,27 @@ jobs:
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@v3
- name: Install Lua (${{ matrix.lua }})
run: |
pip install hererocks
hererocks lua_install -r^ --${{ matrix.lua }}
- name: Build lua-simdjson
run: |
.\lua_install\bin\activate
luarocks make
- name: Run tests
run: |
.\lua_install\bin\activate
luarocks install MSVCRT="m" lua-cjson2
luarocks install MSVCRT="m" busted
busted --verbose
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
test/
*.so
*.so
*.dll
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,32 @@ INCLUDE = -I$(LUA_INCDIR)
LIBS = -lpthread
FLAGS = -std=c++11 -Wall $(LIBFLAG) $(CFLAGS)

all: simdjson.so
ifdef LUA_LIBDIR
FLAGS += $(LUA_LIBDIR)/$(LUALIB)
endif

simdjson.so:
$(CXX) $(SRC) $(FLAGS) $(INCLUDE) $(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 = simdjson.$(LIBEXT)

all: $(TARGET)

$(TARGET):
$(CXX) $(SRC) $(FLAGS) $(INCLUDE) $(LIBS_PATH) $(LIBS) -o $@

clean:
rm *.so
rm *.$(LIBEXT)

install: simdjson.so
cp simdjson.so $(INST_LIBDIR)
install: $(TARGET)
cp $(TARGET) $(INST_LIBDIR)
8 changes: 8 additions & 0 deletions lua-simdjson-0.0.2-1.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ build = {
INST_LUADIR="$(LUADIR)",
INST_CONFDIR="$(CONFDIR)",
},
platforms = {
windows = {
build_variables = {
LUA_LIBDIR="$(LUA_LIBDIR)",
LUALIB="$(LUALIB)",
}
}
}
}

0 comments on commit 1eb85fb

Please sign in to comment.