Skip to content

Commit 1eb85fb

Browse files
Merge pull request #82 from tobil4sk/feature/windows-support
[make] Add windows support
2 parents 15ae810 + c5c9f46 commit 1eb85fb

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

.github/workflows/ci.yml

+24
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,27 @@ jobs:
3535
luarocks install lua-cjson2
3636
luarocks install busted
3737
busted --verbose
38+
39+
windows:
40+
strategy:
41+
fail-fast: false
42+
matrix:
43+
lua: [lua=5.1, lua=5.2, lua=5.3, lua=5.4, luajit=2.0, luajit=2.1]
44+
runs-on: windows-2022
45+
steps:
46+
# Checks-out the repository under $GITHUB_WORKSPACE.
47+
- uses: actions/checkout@v3
48+
- name: Install Lua (${{ matrix.lua }})
49+
run: |
50+
pip install hererocks
51+
hererocks lua_install -r^ --${{ matrix.lua }}
52+
- name: Build lua-simdjson
53+
run: |
54+
.\lua_install\bin\activate
55+
luarocks make
56+
- name: Run tests
57+
run: |
58+
.\lua_install\bin\activate
59+
luarocks install MSVCRT="m" lua-cjson2
60+
luarocks install MSVCRT="m" busted
61+
busted --verbose

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
test/
2-
*.so
2+
*.so
3+
*.dll

Makefile

+25-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,32 @@ INCLUDE = -I$(LUA_INCDIR)
33
LIBS = -lpthread
44
FLAGS = -std=c++11 -Wall $(LIBFLAG) $(CFLAGS)
55

6-
all: simdjson.so
6+
ifdef LUA_LIBDIR
7+
FLAGS += $(LUA_LIBDIR)/$(LUALIB)
8+
endif
79

8-
simdjson.so:
9-
$(CXX) $(SRC) $(FLAGS) $(INCLUDE) $(LIBS) -o $@
10+
ifeq ($(OS),Windows_NT)
11+
LIBEXT = dll
12+
else
13+
UNAME := $(shell uname -s)
14+
ifeq ($(findstring MINGW,$(UNAME)),MINGW)
15+
LIBEXT = dll
16+
else ifeq ($(findstring CYGWIN,$(UNAME)),CYGWIN)
17+
LIBEXT = dll
18+
else
19+
LIBEXT = so
20+
endif
21+
endif
22+
23+
TARGET = simdjson.$(LIBEXT)
24+
25+
all: $(TARGET)
26+
27+
$(TARGET):
28+
$(CXX) $(SRC) $(FLAGS) $(INCLUDE) $(LIBS_PATH) $(LIBS) -o $@
1029

1130
clean:
12-
rm *.so
31+
rm *.$(LIBEXT)
1332

14-
install: simdjson.so
15-
cp simdjson.so $(INST_LIBDIR)
33+
install: $(TARGET)
34+
cp $(TARGET) $(INST_LIBDIR)

lua-simdjson-0.0.2-1.rockspec

+8
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@ build = {
3131
INST_LUADIR="$(LUADIR)",
3232
INST_CONFDIR="$(CONFDIR)",
3333
},
34+
platforms = {
35+
windows = {
36+
build_variables = {
37+
LUA_LIBDIR="$(LUA_LIBDIR)",
38+
LUALIB="$(LUALIB)",
39+
}
40+
}
41+
}
3442
}

0 commit comments

Comments
 (0)