Skip to content

Commit 3864e74

Browse files
author
Apprentice Alchemist
committed
Squash commits
1 parent 3125bef commit 3864e74

File tree

12 files changed

+960
-132
lines changed

12 files changed

+960
-132
lines changed

.github/workflows/main.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build
2+
3+
on: [push]
4+
env:
5+
MACOSX_DEPLOYMENT_TARGET: 10.15
6+
jobs:
7+
build:
8+
if: ${{ !contains(join(github.event.commits.*.message),'[skip ci]') }}
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [windows-latest, macos-latest, ubuntu-latest]
14+
steps:
15+
- name: Install Haxe
16+
uses: krdlab/setup-haxe@master
17+
with:
18+
haxe-version: 4.2.0
19+
- uses: ilammy/msvc-dev-cmd@v1
20+
if: matrix.os == 'windows-latest'
21+
- uses: actions/checkout@v2
22+
with:
23+
submodules: "recursive"
24+
- name: Checkout hashlink
25+
uses: actions/checkout@v2
26+
with:
27+
repository: "HaxeFoundation/hashlink"
28+
path: "hashlink"
29+
- name: Build LuaJIT
30+
if: matrix.os != 'windows-latest'
31+
run: |
32+
cd LuaJIT
33+
make && sudo make install
34+
- name: Build LuaJIT Windows
35+
if: matrix.os == 'windows-latest'
36+
shell: cmd
37+
run: |
38+
cd LuaJIT/src
39+
msvcbuild.bat
40+
cd ../../
41+
mkdir lib/Windows64
42+
copy LuaJIT/src/lua51.dll lib/Windows64
43+
copy LuaJIT/src/lua51.lib lib/Windows64
44+
- name: Build Hashlink
45+
if: matrix.os != 'windows-latest'
46+
run: |
47+
cd hashlink
48+
make libhl
49+
make hl
50+
make ui
51+
sudo make install
52+
- name: Build Hashlink
53+
if: matrix.os == 'windows-latest'
54+
shell: cmd
55+
run: |
56+
cd hashlink
57+
MSBuild libhl.vcxproj /nologo /clp:ErrorsOnly "-p:Configuration=Release;PlatformToolset=v142;WindowsTargetPlatformVersion=10"
58+
MSBuild hl.vcxproj /nologo /clp:ErrorsOnly "-p:Configuration=Release;PlatformToolset=v142;WindowsTargetPlatformVersion=10"
59+
echo %GITHUB_WORKSPACE%\hashlink\x64\Release >> %GITHUB_PATH%
60+
- name: Setup
61+
run: |
62+
haxelib dev hxlua .
63+
haxelib install hxcpp --quiet
64+
cd native
65+
haxelib run hxcpp Build.xml -DHXCPP_M64 -verbose
66+
- name: Test
67+
if: matrix.os == 'windows-latest'
68+
shell: cmd
69+
run: |
70+
copy native\lua.hdll test\lua.hdll
71+
cd test
72+
haxe build.hxml -D HXCPP_M64
73+
out\Main
74+
- name: Test
75+
if: matrix.os == 'macos-latest'
76+
run: |
77+
cp native/lua.hdll test/lua.hdll
78+
cd test
79+
haxe build.hxml -D HXCPP_M64
80+
out/Main
81+
hl out.hl
82+
- name: Test
83+
if: matrix.os == 'ubuntu-latest'
84+
run: |
85+
cp native/lua.hdll test/lua.hdll
86+
cd test
87+
haxe build.hxml -D HXCPP_M64
88+
LD_LIBRARY_PATH=/usr/local/lib out/Main
89+
LD_LIBRARY_PATH=/usr/local/lib hl out.hl
90+
# - name: Upload Artifact
91+
# uses: 'actions/upload-artifact@v2'
92+
# with:
93+
# name: ${{ matrix.os }} ${{ matrix.graphics }}
94+
# path: kinc.hdll

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
out/*
2-
Main.hx
3-
script.lua
2+
**/out/**
3+
.vscode/**
4+
*.hl
5+
native/obj/*
6+
native/lua.hdll
7+
native/lua.hdll.hash

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
11
# hxlua
2+
3+
[![Build](https://github.com/Apprentice-Alchemist/hxlua/actions/workflows/main.yml/badge.svg)](https://github.com/Apprentice-Alchemist/hxlua/actions/workflows/main.yml)
4+
25
Haxe bindings for luaJIT
6+
7+
## Setup
8+
```bash
9+
$ cd path/to/hxlua
10+
$ cd LuaJIT && make && sudo make install # Posix systems
11+
$ cd LuaJIT/src && msvcbuild.bat # Windows, run in an MSVC Command Prompt
12+
$ cd ..
13+
# Regenerate the C side of the hashlink bindings
14+
$ haxe -lib hxlua Lua -D hl_gen -hl out.hl --no-output
15+
# Build the hashlink binary.
16+
$ cd native
17+
# On windows, assumes you have installed hashlink in %HASHLINK%.
18+
# On posix, assumes you have installed hashlink in the default path
19+
# If not, pass -DHASHLINK_BIN=... and -DHASHLINK_INCLUDE=...
20+
# If you intend to use this binary with lime on windows, you'll need to pass
21+
# -DHXCPP_M32 -DHASHLINK_BIN=path/to/lime/templates/bin/hl/windows -DHASHLINK_INCLUDE=path/to/lime/project/include
22+
# And then manually copy lua.hdll to export/hl/bin in your project.
23+
# This may or may not work, I haven't tested it.
24+
$ haxelib run hxcpp Build.xml
25+
$ cp lua.hdll /usr/local/lib # Posix systems
26+
$ copy lua.hdll /path/to/somewhere/in/your/PATH # Windows
27+
```
28+
29+
## Contributing
30+
If you find a bug or want to add a feature, pull requests are always welcome.

Run.hx

Lines changed: 0 additions & 60 deletions
This file was deleted.

lib/Windows64/lua51.dll

0 Bytes
Binary file not shown.

native/Build.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<xml>
2+
<set name="HASHLINK_INCLUDE" value="${HASHLINK}/include" if="HASHLINK windows" unless="HASHLINK_INCLUDE"/>
3+
<set name="HASHLINK_BIN" value="${HASHLINK}" if="HASHLINK windows" unless="HASHLINK_BIN"/>
4+
5+
<set name="HASHLINK_INCLUDE" value="${this_dir}/../hashlink/src" if="GITHUB_WORKSPACE"/>
6+
<set name="HASHLINK_BIN" value="${this_dir}/../hashlink/x64/Release" if="GITHUB_WORKSPACE windows"/>
7+
<set name="HASHLINK_BIN" value="${this_dir}/../hashlink" if="GITHUB_WORKSPACE" unless="HASHLINK_BIN"/>
8+
9+
<files id="lua">
10+
<compilerflag value="-I${HASHLINK_INCLUDE}" if="HASHLINK_INCLUDE"/>
11+
<compilerflag value='-I${this_dir}/../LuaJIT/src'/>
12+
<file name="${this_dir}/lua.c" />
13+
</files>
14+
15+
<target id="default" output="lua" toolid="dll" tool="linker">
16+
<files id="lua"/>
17+
<lib name='${haxelib:hxlua}/lib/${BINDIR}/lua51.lib' if='windows'/>
18+
<lib name='-lluajit-5.1.2.1.0' if='macos'/>
19+
<lib name='-lluajit-5.1' if='linux'/>
20+
<libpath name="${HASHLINK_BIN}" if="windows"/>
21+
<libpath name="/usr/local/lib" if='macos'/>
22+
<lib name="libhl.lib" if="windows"/>
23+
<lib name="-lhl" unless="windows"/>
24+
<ext value=".hdll"/>
25+
</target>
26+
</xml>

0 commit comments

Comments
 (0)