Add raylib #3
7 changed files with 168 additions and 138 deletions
|
|
@ -109,8 +109,8 @@ done
|
||||||
log "guest up after ~$((i * 2))s: $(ssh_vm 'uname -sr')"
|
log "guest up after ~$((i * 2))s: $(ssh_vm 'uname -sr')"
|
||||||
|
|
||||||
# --- build -------------------------------------------------------------------
|
# --- build -------------------------------------------------------------------
|
||||||
log "installing gmake in guest"
|
log "installing gmake, luajit and the X11/GL prerequisites in guest"
|
||||||
ssh_vm 'set -e; env ASSUME_ALWAYS_YES=yes pkg install -y gmake luajit >/dev/null 2>&1; gmake --version | head -1'
|
ssh_vm 'set -e; env ASSUME_ALWAYS_YES=yes pkg install -y gmake luajit libX11 libXrandr libXinerama libXi libXcursor mesa-libs >/dev/null; gmake --version | head -1'
|
||||||
|
|
||||||
log "transferring source"
|
log "transferring source"
|
||||||
tar czf "$WORK/src.tar.gz" -C "$SRC" \
|
tar czf "$WORK/src.tar.gz" -C "$SRC" \
|
||||||
|
|
|
||||||
|
|
@ -48,18 +48,21 @@ jobs:
|
||||||
- arch: x86_64
|
- arch: x86_64
|
||||||
machine: X86-64
|
machine: X86-64
|
||||||
make_args: ''
|
make_args: ''
|
||||||
packages: ''
|
multiarch: ''
|
||||||
|
packages: 'libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev'
|
||||||
# 32-bit target: leaving HOST_CC unset keeps minilua/buildvm 32-bit
|
# 32-bit target: leaving HOST_CC unset keeps minilua/buildvm 32-bit
|
||||||
# too. Host and target pointer sizes must match -- do not use HOST_CC=gcc.
|
# too. Host and target pointer sizes must match -- do not use HOST_CC=gcc.
|
||||||
- arch: i686
|
- arch: i686
|
||||||
machine: 'Intel 80386'
|
machine: 'Intel 80386'
|
||||||
make_args: 'CC="gcc -m32"'
|
make_args: 'CC="gcc -m32"'
|
||||||
packages: 'gcc-multilib libc6-dev-i386'
|
multiarch: 'i386'
|
||||||
|
packages: 'gcc-multilib libc6-dev-i386 libx11-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libgl-dev:i386'
|
||||||
# 64-bit host -> 64-bit target, so host tools stay native.
|
# 64-bit host -> 64-bit target, so host tools stay native.
|
||||||
- arch: aarch64
|
- arch: aarch64
|
||||||
machine: AArch64
|
machine: AArch64
|
||||||
make_args: 'CC=aarch64-linux-gnu-gcc HOST_CC=gcc'
|
make_args: 'CC=aarch64-linux-gnu-gcc HOST_CC=gcc'
|
||||||
packages: 'gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user-static'
|
multiarch: 'arm64'
|
||||||
|
packages: 'gcc-aarch64-linux-gnu libc6-dev-arm64-cross qemu-user-static libx11-dev:arm64 libxrandr-dev:arm64 libxinerama-dev:arm64 libxcursor-dev:arm64 libxi-dev:arm64 libgl-dev:arm64'
|
||||||
# 32-bit target, so the host tools must be 32-bit too. gcc-multilib
|
# 32-bit target, so the host tools must be 32-bit too. gcc-multilib
|
||||||
# cannot be installed (gcc-12-arm-linux-gnueabihf conflicts with it);
|
# cannot be installed (gcc-12-arm-linux-gnueabihf conflicts with it);
|
||||||
# lib32gcc-12-dev + libc6-dev-i386 replace it, and linux-libc-dev:i386
|
# lib32gcc-12-dev + libc6-dev-i386 replace it, and linux-libc-dev:i386
|
||||||
|
|
@ -67,8 +70,8 @@ jobs:
|
||||||
- arch: armv7
|
- arch: armv7
|
||||||
machine: ARM
|
machine: ARM
|
||||||
make_args: 'CC=arm-linux-gnueabihf-gcc HOST_CC="gcc -m32"'
|
make_args: 'CC=arm-linux-gnueabihf-gcc HOST_CC="gcc -m32"'
|
||||||
packages: 'gcc-arm-linux-gnueabihf libc6-dev-armhf-cross lib32gcc-12-dev libc6-dev-i386 linux-libc-dev:i386 qemu-user-static'
|
multiarch: 'armhf i386'
|
||||||
multiarch_i386: true
|
packages: 'gcc-arm-linux-gnueabihf libc6-dev-armhf-cross lib32gcc-12-dev libc6-dev-i386 linux-libc-dev:i386 qemu-user-static libx11-dev:armhf libxrandr-dev:armhf libxinerama-dev:armhf libxcursor-dev:armhf libxi-dev:armhf libgl-dev:armhf'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://data.forgejo.org/actions/checkout@v4
|
uses: https://data.forgejo.org/actions/checkout@v4
|
||||||
|
|
@ -81,9 +84,16 @@ jobs:
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
# Only armv7: linux-libc-dev:i386 provides its 32-bit asm/ headers.
|
# raylib's GLFW backend needs the X11/GL headers even when only a
|
||||||
if [ '${{ matrix.multiarch_i386 }}' = 'true' ]; then
|
# static archive is produced, and the final link needs the target's
|
||||||
dpkg --add-architecture i386
|
# libX11/libGL stubs. Cross jobs therefore install the *foreign* arch
|
||||||
|
# dev packages; only the native job installs the host's.
|
||||||
|
# armv7 additionally needs linux-libc-dev:i386 for its 32-bit host
|
||||||
|
# tools (gcc -m32), hence two foreign arches there.
|
||||||
|
if [ -n '${{ matrix.multiarch }}' ]; then
|
||||||
|
for arch in ${{ matrix.multiarch }}; do
|
||||||
|
dpkg --add-architecture "$arch"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
apt-get update -qq
|
apt-get update -qq
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
|
|
@ -99,6 +109,12 @@ jobs:
|
||||||
readelf -h ./hate-no-d | grep -F 'Machine:' | grep -F '${{ matrix.machine }}'
|
readelf -h ./hate-no-d | grep -F 'Machine:' | grep -F '${{ matrix.machine }}'
|
||||||
echo "architecture ok: ${{ matrix.machine }}"
|
echo "architecture ok: ${{ matrix.machine }}"
|
||||||
|
|
||||||
|
# The parser tables are generated into build/api from the pinned raylib
|
||||||
|
# headers, so assert they still reproduce the shipped binding byte for
|
||||||
|
# byte before it goes into a release archive.
|
||||||
|
- name: Verify bindings
|
||||||
|
run: make check-bindings
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: sh .forgejo/scripts/make-archive.sh "hate-no-d-linux-${{ matrix.arch }}" tar.gz ./hate-no-d ./hate-no-d.lua
|
run: sh .forgejo/scripts/make-archive.sh "hate-no-d-linux-${{ matrix.arch }}" tar.gz ./hate-no-d ./hate-no-d.lua
|
||||||
|
|
||||||
|
|
@ -270,8 +286,18 @@ jobs:
|
||||||
file "./$bin" | grep -q 'for MS Windows'
|
file "./$bin" | grep -q 'for MS Windows'
|
||||||
deps=$(${{ matrix.arch }}-w64-mingw32-objdump -p "./$bin" | awk '/DLL Name/{print $3}')
|
deps=$(${{ matrix.arch }}-w64-mingw32-objdump -p "./$bin" | awk '/DLL Name/{print $3}')
|
||||||
echo "$deps"
|
echo "$deps"
|
||||||
bad=$(printf '%s\n' "$deps" | grep -v -E '^(KERNEL32|msvcrt)\.dll$' || true)
|
# raylib imports the Win32 system DLLs (gdi32/user32/shell32/winmm)
|
||||||
|
# plus what the mingw link records (advapi32/ole32/...); anything
|
||||||
|
# outside that set is a toolchain DLL leaking into a release. Names
|
||||||
|
# are case-insensitive: mingw writes WINMM.dll, not winmm.dll.
|
||||||
|
# (opengl32 is in the list for the MSVC path, where it does appear.)
|
||||||
|
bad=$(printf '%s\n' "$deps" | grep -viE '^(kernel32|gdi32|user32|shell32|winmm|opengl32|advapi32|ole32|oleaut32|uuid|msvcrt|api-ms-win-[a-z0-9-]+)\.dll$' || true)
|
||||||
[ -z "$bad" ] || { echo "unexpected runtime DLL dependency: $bad" >&2; exit 1; }
|
[ -z "$bad" ] || { echo "unexpected runtime DLL dependency: $bad" >&2; exit 1; }
|
||||||
|
# raylib loads GL through the driver at runtime, so there is no
|
||||||
|
# opengl32 import to assert; what must hold is that ffi.C can resolve
|
||||||
|
# raylib through the exe's export table (PE has no --export-dynamic).
|
||||||
|
${{ matrix.arch }}-w64-mingw32-objdump -p "./$bin" | grep -qw InitWindow \
|
||||||
|
|| { echo "hate-no-d.exe does not export raylib symbols" >&2; exit 1; }
|
||||||
|
|
||||||
- name: Package
|
- name: Package
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -7,6 +7,10 @@ hate-no-d-*/
|
||||||
hate-no-d-*.tar.gz
|
hate-no-d-*.tar.gz
|
||||||
hate-no-d-*.zip
|
hate-no-d-*.zip
|
||||||
|
|
||||||
# Build artifacts.
|
# Build artifacts: objects, the host rlparser, generated parser tables, and
|
||||||
|
# build.bat's CMake trees. The CLI and hate-no-d.lua stay in the root.
|
||||||
|
/build/
|
||||||
|
|
||||||
|
# Stray objects from an out-of-tree compile.
|
||||||
*.o
|
*.o
|
||||||
*.obj
|
*.obj
|
||||||
|
|
|
||||||
127
Makefile
127
Makefile
|
|
@ -1,19 +1,19 @@
|
||||||
# hate-no-d
|
# hate-no-d
|
||||||
#
|
#
|
||||||
# Native platforms are auto-detected from uname. Cross targets are selected explicitly:
|
# Native platforms are auto-detected from uname. Cross targets are explicit:
|
||||||
# make
|
# make
|
||||||
# make PLATFORM=Android ANDROID_NDK=/opt/android-ndk
|
# make PLATFORM=Android ANDROID_NDK=/opt/android-ndk [ANDROID_ABI=... ANDROID_API=...]
|
||||||
# make PLATFORM=Android ANDROID_NDK=... ANDROID_ABI=armeabi-v7a ANDROID_API=21
|
|
||||||
# make PLATFORM=Windows WIN_ARCH=x86_64 (cross build with mingw-w64)
|
# make PLATFORM=Windows WIN_ARCH=x86_64 (cross build with mingw-w64)
|
||||||
#
|
#
|
||||||
# Targets:
|
# Targets:
|
||||||
# make the CLI (hate-no-d or hate-no-d.exe)
|
# make the CLI (hate-no-d or hate-no-d.exe)
|
||||||
# make help every target and option
|
# make help every target and option
|
||||||
#
|
#
|
||||||
# raylib is linked into the CLI.
|
# raylib is linked into the CLI. Objects, rlparser and its generated API tables
|
||||||
|
# go to build/; only the CLI and hate-no-d.lua land in the repository root.
|
||||||
|
# raylib and LuaJIT build in their own trees (both gitignore their output).
|
||||||
|
|
||||||
# luajit requires GNU Make (use `gmake` on FreeBSD/OpenBSD/NetBSD).
|
# luajit requires GNU Make. BSD make fails on .FEATURES before this guard.
|
||||||
# The guard below only runs under GNU make; BSD make fails earlier.
|
|
||||||
ifndef .FEATURES
|
ifndef .FEATURES
|
||||||
$(error This build requires GNU Make -- on BSD use 'gmake')
|
$(error This build requires GNU Make -- on BSD use 'gmake')
|
||||||
endif
|
endif
|
||||||
|
|
@ -26,14 +26,19 @@ LUAJIT_AR := $(LUAJIT_SRC)/libluajit.a
|
||||||
RAYLIB_DIR := submodules/raylib
|
RAYLIB_DIR := submodules/raylib
|
||||||
RAYLIB_SRC := $(RAYLIB_DIR)/src
|
RAYLIB_SRC := $(RAYLIB_DIR)/src
|
||||||
RAYLIB_AR := $(RAYLIB_SRC)/libraylib.a
|
RAYLIB_AR := $(RAYLIB_SRC)/libraylib.a
|
||||||
RAYLIB_API := $(RAYLIB_DIR)/tools/rlparser/output/raylib_api.lua
|
|
||||||
RLPARSER_DIR := $(RAYLIB_DIR)/tools/rlparser
|
RLPARSER_DIR := $(RAYLIB_DIR)/tools/rlparser
|
||||||
RLPARSER := $(RLPARSER_DIR)/rlparser
|
BUILD_DIR := build
|
||||||
API_DIR := $(RLPARSER_DIR)/output
|
API_DIR := $(BUILD_DIR)/api
|
||||||
|
RLPARSER := $(BUILD_DIR)/rlparser
|
||||||
|
RAYLIB_API := $(API_DIR)/raylib_api.lua
|
||||||
BINDING := hate-no-d.lua
|
BINDING := hate-no-d.lua
|
||||||
OBJ := hate-no-d.o
|
OBJ := $(BUILD_DIR)/hate-no-d.o
|
||||||
BIN := hate-no-d
|
BIN := hate-no-d
|
||||||
|
|
||||||
|
GEN_FLAGS := --raylib=$(API_DIR)/raylib_api.lua \
|
||||||
|
--rlgl=$(API_DIR)/rlgl_api.lua \
|
||||||
|
--raymath=$(API_DIR)/raymath_api.lua
|
||||||
|
|
||||||
# Archiver passed to raylib's build. Cross toolchains ship their own.
|
# Archiver passed to raylib's build. Cross toolchains ship their own.
|
||||||
AR ?= ar
|
AR ?= ar
|
||||||
|
|
||||||
|
|
@ -89,13 +94,9 @@ ifeq ($(OS_KIND),bsd)
|
||||||
LINK_TARGET := $(BIN)
|
LINK_TARGET := $(BIN)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Windows (PE, cross-compiled from a POSIX host with mingw-w64)
|
# Windows (PE, cross-compiled from a POSIX host with mingw-w64; native builds use
|
||||||
#
|
# build.bat). i686 needs a 32-bit host compiler, since LuaJIT's buildvm runs
|
||||||
# Native builds use build.bat.
|
# natively and must match the target pointer size:
|
||||||
#
|
|
||||||
# 64-bit targets build on any 64-bit host. i686 also needs a 32-bit host
|
|
||||||
# compiler, because LuaJIT's buildvm runs natively and its pointer size must
|
|
||||||
# match the target:
|
|
||||||
# make PLATFORM=Windows WIN_ARCH=i686 HOST_CC="gcc -m32"
|
# make PLATFORM=Windows WIN_ARCH=i686 HOST_CC="gcc -m32"
|
||||||
ifeq ($(OS_KIND),windows)
|
ifeq ($(OS_KIND),windows)
|
||||||
WIN_ARCH ?= x86_64
|
WIN_ARCH ?= x86_64
|
||||||
|
|
@ -117,17 +118,14 @@ ifeq ($(OS_KIND),windows)
|
||||||
# Export the exe's symbols so ffi.C can resolve raylib on Windows.
|
# Export the exe's symbols so ffi.C can resolve raylib on Windows.
|
||||||
EXPORT_LDFLAGS := -Wl,--export-all-symbols
|
EXPORT_LDFLAGS := -Wl,--export-all-symbols
|
||||||
|
|
||||||
# LuaJIT derives HOST_CC from CC, so label both to the sub-make: otherwise
|
# LuaJIT derives HOST_CC from CC: label both, or the host tools are built with
|
||||||
# the host tools (minilua, buildvm) are compiled with the cross compiler.
|
# the cross compiler.
|
||||||
LUAJIT_EXTRA := "CC=$(CC)" "HOST_CC=$(HOST_CC)" TARGET_SYS=Windows
|
LUAJIT_EXTRA := "CC=$(CC)" "HOST_CC=$(HOST_CC)" TARGET_SYS=Windows
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# macOS (Mach-O)
|
# macOS (Mach-O). ld64 exports main-executable globals by default;
|
||||||
#
|
# -export_dynamic keeps -dead_strip/LTO from discarding the Lua API. JIT under
|
||||||
# ld64 exports main-executable globals by default; -export_dynamic only stops
|
# the hardened runtime needs MAP_JIT, so the deployment target must be >= 11.0.
|
||||||
# -dead_strip / LTO from discarding the Lua API. GC64 is mandatory on arm64.
|
|
||||||
# JIT under the hardened runtime needs MAP_JIT, which is compiled in only when
|
|
||||||
# the deployment target is >= 11.0.
|
|
||||||
ifeq ($(OS_KIND),macos)
|
ifeq ($(OS_KIND),macos)
|
||||||
ifeq ($(origin CC),default)
|
ifeq ($(origin CC),default)
|
||||||
CC := clang
|
CC := clang
|
||||||
|
|
@ -143,8 +141,7 @@ ifeq ($(OS_KIND),macos)
|
||||||
# ld64 has no --whole-archive.
|
# ld64 has no --whole-archive.
|
||||||
RAYLIB_LINK := -Wl,-force_load,$(RAYLIB_AR)
|
RAYLIB_LINK := -Wl,-force_load,$(RAYLIB_AR)
|
||||||
|
|
||||||
# MAP_JIT path: needed for the hardened runtime (and therefore notarization).
|
# MAP_JIT path, needed for the hardened runtime (and thus notarization).
|
||||||
# Requires MACOSX_DEPLOYMENT_TARGET >= 11.0 or LuaJIT compiles it back out.
|
|
||||||
MACOSX_HRT ?= 1
|
MACOSX_HRT ?= 1
|
||||||
ifeq ($(MACOSX_HRT),1)
|
ifeq ($(MACOSX_HRT),1)
|
||||||
LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_OSX_HRT
|
LUAJIT_XCFLAGS += -DLUAJIT_ENABLE_OSX_HRT
|
||||||
|
|
@ -219,15 +216,12 @@ ifndef LINK_TARGET
|
||||||
$(error Unsupported platform '$(PLATFORM)' -- supported: Linux, Android, Darwin, Windows, BSD)
|
$(error Unsupported platform '$(PLATFORM)' -- supported: Linux, Android, Darwin, Windows, BSD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Host compiler for build-time tools (rlparser). The Windows branch above
|
# Host compiler for build-time tools (rlparser); the Windows branch pins gcc.
|
||||||
# already pins gcc; everywhere else 'cc' is the native compiler.
|
|
||||||
HOST_CC ?= cc
|
HOST_CC ?= cc
|
||||||
LUAJIT ?= luajit
|
LUAJIT ?= luajit
|
||||||
|
|
||||||
# raylib's RELEASE desktop build appends -O1. -O2 is a large win for CPU-bound
|
# raylib's RELEASE build appends -O1; -O2 is a big win for CPU-bound code.
|
||||||
# code (measured 0.83s -> 0.47s on image generation here); -O3 adds nothing.
|
# Changing it needs `make clean` -- objects are not flag-aware.
|
||||||
# Override with RAYLIB_OPT=..., then run `make clean` (objects are not
|
|
||||||
# flag-aware, so raylib will not rebuild by itself).
|
|
||||||
RAYLIB_OPT ?= -O2
|
RAYLIB_OPT ?= -O2
|
||||||
RAYLIB_MAKE_ARGS += CUSTOM_CFLAGS="$(RAYLIB_OPT)"
|
RAYLIB_MAKE_ARGS += CUSTOM_CFLAGS="$(RAYLIB_OPT)"
|
||||||
|
|
||||||
|
|
@ -241,8 +235,7 @@ LUAJIT_MAKE_ARGS := BUILDMODE=static XCFLAGS="$(LUAJIT_XCFLAGS)" $(LUAJIT_EXTRA)
|
||||||
$(LUAJIT_AR):
|
$(LUAJIT_AR):
|
||||||
$(MAKE) -C $(LUAJIT_SRC) $(LUAJIT_MAKE_ARGS) "LJCORE_O=ljamalg.o" libluajit.a
|
$(MAKE) -C $(LUAJIT_SRC) $(LUAJIT_MAKE_ARGS) "LJCORE_O=ljamalg.o" libluajit.a
|
||||||
|
|
||||||
# raylib: static archive only; CC/AR are pinned because its Makefile defaults to
|
# raylib: static archive only; CC/AR are pinned, its Makefile defaults to host gcc/ar.
|
||||||
# native gcc/ar.
|
|
||||||
$(RAYLIB_AR):
|
$(RAYLIB_AR):
|
||||||
$(MAKE) -C $(RAYLIB_SRC) $(RAYLIB_MAKE_ARGS) CC="$(CC)" AR="$(AR)"
|
$(MAKE) -C $(RAYLIB_SRC) $(RAYLIB_MAKE_ARGS) CC="$(CC)" AR="$(AR)"
|
||||||
|
|
||||||
|
|
@ -255,7 +248,7 @@ help:
|
||||||
@echo " make bindings regenerate hate-no-d.lua only"
|
@echo " make bindings regenerate hate-no-d.lua only"
|
||||||
@echo " make check-bindings verify hate-no-d.lua is reproducible and loads"
|
@echo " make check-bindings verify hate-no-d.lua is reproducible and loads"
|
||||||
@echo " make print-config resolved configuration for the current target"
|
@echo " make print-config resolved configuration for the current target"
|
||||||
@echo " make clean remove build artifacts, submodules included"
|
@echo " make clean remove build/ and submodule build artifacts"
|
||||||
@echo " make help this text"
|
@echo " make help this text"
|
||||||
@echo ""
|
@echo ""
|
||||||
@echo "Options (pass as VAR=value):"
|
@echo "Options (pass as VAR=value):"
|
||||||
|
|
@ -277,11 +270,17 @@ help:
|
||||||
|
|
||||||
all: $(LINK_TARGET) $(BINDING)
|
all: $(LINK_TARGET) $(BINDING)
|
||||||
|
|
||||||
$(OBJ): hate-no-d.c
|
$(BUILD_DIR):
|
||||||
|
@mkdir -p $@
|
||||||
|
|
||||||
|
$(API_DIR): | $(BUILD_DIR)
|
||||||
|
@mkdir -p $@
|
||||||
|
|
||||||
|
$(OBJ): hate-no-d.c | $(BUILD_DIR)
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ hate-no-d.c
|
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ hate-no-d.c
|
||||||
|
|
||||||
# raylib must be pulled in whole: nothing references it, so the linker would
|
# raylib is pulled in whole: nothing references it, so the linker would drop it
|
||||||
# otherwise drop it and ffi.C would have nothing to resolve.
|
# and ffi.C would have nothing to resolve.
|
||||||
$(BIN): $(OBJ) $(LUAJIT_AR) $(RAYLIB_AR)
|
$(BIN): $(OBJ) $(LUAJIT_AR) $(RAYLIB_AR)
|
||||||
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJ) \
|
$(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(OBJ) \
|
||||||
$(RAYLIB_LINK) $(LUAJIT_AR) $(EXPORT_LDFLAGS) $(LDFLAGS) $(PLAT_LIBS)
|
$(RAYLIB_LINK) $(LUAJIT_AR) $(EXPORT_LDFLAGS) $(LDFLAGS) $(PLAT_LIBS)
|
||||||
|
|
@ -289,44 +288,41 @@ $(BIN): $(OBJ) $(LUAJIT_AR) $(RAYLIB_AR)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Lua bindings (hate-no-d.lua)
|
# Lua bindings (hate-no-d.lua)
|
||||||
#
|
#
|
||||||
# rlparser emits plain Lua tables; gen-hate-no-d.lua turns raylib.h + rlgl.h +
|
# gen-hate-no-d.lua turns the rlparser tables for raylib.h, rlgl.h and raymath.h
|
||||||
# raymath.h into one ffi.cdef block, constants, wrappers and LuaCATS comments.
|
# into one ffi.cdef block plus constants, wrappers and LuaCATS comments.
|
||||||
# The tables live in raylib's own tools output directory, next to the committed
|
|
||||||
# raylib_api.lua; there is no second copy of the parser in this repo.
|
|
||||||
#
|
#
|
||||||
# rlparser is built for the host with HOST_CC, never with the target CC: cross
|
# The tables are generated into build/api from the pinned submodule headers, so
|
||||||
# builds still have to execute it while generating the platform-independent
|
# raylib's tools/rlparser/output (where raylib_api.lua is tracked) stays clean.
|
||||||
# hate-no-d.lua.
|
# rlparser itself is built with HOST_CC, never the target CC: cross builds still
|
||||||
|
# run it to produce the platform-independent binding.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# raylib gitignores this binary; its own Makefile builds it in place when a
|
$(RLPARSER): $(RLPARSER_DIR)/rlparser.c | $(BUILD_DIR)
|
||||||
# fresh checkout does not have one yet. CFLAGS is pinned so a cross/target
|
$(HOST_CC) -O2 -Wall -std=c99 -o $@ $(RLPARSER_DIR)/rlparser.c
|
||||||
# build's command-line flags never leak into the host tool.
|
|
||||||
$(RLPARSER): $(RLPARSER_DIR)/rlparser.c
|
|
||||||
$(MAKE) -C $(RLPARSER_DIR) CC="$(HOST_CC)" CFLAGS="-O2 -Wall -std=c99" rlparser
|
|
||||||
|
|
||||||
$(API_DIR)/rlgl_api.lua: $(RLPARSER) $(RAYLIB_SRC)/rlgl.h
|
$(RAYLIB_API): $(RLPARSER) $(RAYLIB_SRC)/raylib.h | $(API_DIR)
|
||||||
|
$(RLPARSER) -i $(RAYLIB_SRC)/raylib.h -o $@ -f LUA -d RLAPI
|
||||||
|
|
||||||
|
$(API_DIR)/rlgl_api.lua: $(RLPARSER) $(RAYLIB_SRC)/rlgl.h | $(API_DIR)
|
||||||
$(RLPARSER) -i $(RAYLIB_SRC)/rlgl.h -o $@ -f LUA -d RLAPI -t "RLGL IMPLEMENTATION"
|
$(RLPARSER) -i $(RAYLIB_SRC)/rlgl.h -o $@ -f LUA -d RLAPI -t "RLGL IMPLEMENTATION"
|
||||||
|
|
||||||
$(API_DIR)/raymath_api.lua: $(RLPARSER) $(RAYLIB_SRC)/raymath.h
|
$(API_DIR)/raymath_api.lua: $(RLPARSER) $(RAYLIB_SRC)/raymath.h | $(API_DIR)
|
||||||
$(RLPARSER) -i $(RAYLIB_SRC)/raymath.h -o $@ -f LUA -d RMAPI
|
$(RLPARSER) -i $(RAYLIB_SRC)/raymath.h -o $@ -f LUA -d RMAPI
|
||||||
|
|
||||||
$(BINDING): gen-hate-no-d.lua $(API_DIR)/rlgl_api.lua $(API_DIR)/raymath_api.lua $(RAYLIB_API)
|
$(BINDING): gen-hate-no-d.lua $(API_DIR)/rlgl_api.lua $(API_DIR)/raymath_api.lua $(RAYLIB_API)
|
||||||
@command -v $(LUAJIT) >/dev/null 2>&1 || { \
|
@command -v $(LUAJIT) >/dev/null 2>&1 || { \
|
||||||
echo "hate-no-d: cannot run '$(LUAJIT)' -- install LuaJIT or set LUAJIT=..." >&2; exit 1; }
|
echo "hate-no-d: cannot run '$(LUAJIT)' -- install LuaJIT or set LUAJIT=..." >&2; exit 1; }
|
||||||
$(LUAJIT) gen-hate-no-d.lua --out=$@
|
$(LUAJIT) gen-hate-no-d.lua --out=$@ $(GEN_FLAGS)
|
||||||
|
|
||||||
bindings: $(BINDING)
|
bindings: $(BINDING)
|
||||||
|
|
||||||
# Fail if regeneration is not byte-identical or the module does not load; also
|
# Fail if regeneration is not byte-identical or the module does not load.
|
||||||
# checks the three API families are present.
|
|
||||||
check-bindings: $(BINDING)
|
check-bindings: $(BINDING)
|
||||||
$(LUAJIT) gen-hate-no-d.lua --out=hate-no-d.lua.tmp
|
$(LUAJIT) gen-hate-no-d.lua --out=$(BUILD_DIR)/hate-no-d.lua.tmp $(GEN_FLAGS)
|
||||||
cmp $(BINDING) hate-no-d.lua.tmp
|
cmp $(BINDING) $(BUILD_DIR)/hate-no-d.lua.tmp
|
||||||
rm -f hate-no-d.lua.tmp
|
rm -f $(BUILD_DIR)/hate-no-d.lua.tmp
|
||||||
$(LUAJIT) -e 'local M = dofile("$(BINDING)"); assert(type(M) == "table"); assert(type(M.GetMousePosition) == "function", "raylib"); assert(type(M.rlLoadIdentity) == "function", "rlgl"); assert(type(M.Vector2Add) == "function", "raymath"); print("bindings ok")'
|
$(LUAJIT) -e 'local M = dofile("$(BINDING)"); assert(type(M) == "table"); assert(type(M.GetMousePosition) == "function", "raylib"); assert(type(M.rlLoadIdentity) == "function", "rlgl"); assert(type(M.Vector2Add) == "function", "raymath"); print("bindings ok")'
|
||||||
|
|
||||||
# Show the resolved configuration for the current (or selected) platform.
|
# Resolved configuration for the current target; useful before a cross build.
|
||||||
# Useful for checking a cross build before committing to it.
|
|
||||||
print-config:
|
print-config:
|
||||||
@echo "PLATFORM = $(PLATFORM)"
|
@echo "PLATFORM = $(PLATFORM)"
|
||||||
@echo "OS_KIND = $(OS_KIND)"
|
@echo "OS_KIND = $(OS_KIND)"
|
||||||
|
|
@ -340,7 +336,9 @@ print-config:
|
||||||
@echo "OBJ = $(OBJ)"
|
@echo "OBJ = $(OBJ)"
|
||||||
@echo "HOST_CC = $(HOST_CC)"
|
@echo "HOST_CC = $(HOST_CC)"
|
||||||
@echo "LUAJIT = $(LUAJIT)"
|
@echo "LUAJIT = $(LUAJIT)"
|
||||||
|
@echo "BUILD_DIR = $(BUILD_DIR)"
|
||||||
@echo "API_DIR = $(API_DIR)"
|
@echo "API_DIR = $(API_DIR)"
|
||||||
|
@echo "RLPARSER = $(RLPARSER)"
|
||||||
@echo "BINDING = $(BINDING)"
|
@echo "BINDING = $(BINDING)"
|
||||||
@echo "LUAJIT_MAKE_ARGS = $(LUAJIT_MAKE_ARGS)"
|
@echo "LUAJIT_MAKE_ARGS = $(LUAJIT_MAKE_ARGS)"
|
||||||
@echo "RAYLIB_AR = $(RAYLIB_AR)"
|
@echo "RAYLIB_AR = $(RAYLIB_AR)"
|
||||||
|
|
@ -352,8 +350,9 @@ print-config:
|
||||||
clean:
|
clean:
|
||||||
@if [ -f $(LUAJIT_DIR)/Makefile ]; then $(MAKE) -C $(LUAJIT_DIR) clean; fi
|
@if [ -f $(LUAJIT_DIR)/Makefile ]; then $(MAKE) -C $(LUAJIT_DIR) clean; fi
|
||||||
@if [ -f $(RAYLIB_SRC)/Makefile ]; then $(MAKE) -C $(RAYLIB_SRC) clean; fi
|
@if [ -f $(RAYLIB_SRC)/Makefile ]; then $(MAKE) -C $(RAYLIB_SRC) clean; fi
|
||||||
rm -f $(BIN) hate-no-d.exe $(OBJ) libhate-no-d.a libhate-no-d.a.mri $(LUAJIT_AR) $(RAYLIB_AR)
|
rm -rf $(BUILD_DIR)
|
||||||
rm -f $(BINDING) hate-no-d.lua.tmp
|
rm -f $(BIN) hate-no-d.exe libhate-no-d.a libhate-no-d.a.mri $(LUAJIT_AR) $(RAYLIB_AR)
|
||||||
rm -f $(API_DIR)/rlgl_api.lua $(API_DIR)/raymath_api.lua
|
rm -f $(BINDING)
|
||||||
|
rm -f hate-no-d.o # object from builds that predate the move into build/
|
||||||
|
|
||||||
.PHONY: all clean print-config help bindings check-bindings
|
.PHONY: all clean print-config help bindings check-bindings
|
||||||
|
|
|
||||||
84
README.md
84
README.md
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
A [Love2D](https://www.love2d.org/) antagonist.
|
A [Love2D](https://www.love2d.org/) antagonist.
|
||||||
|
|
||||||
A glorified [Makefile](./Makefile), plus a small `build.bat` for MSVC.
|
A glorified [Makefile](./Makefile).
|
||||||
|
|
||||||
Should work on:
|
Should work on:
|
||||||
|
|
||||||
|
|
@ -14,56 +14,52 @@ Should work on:
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
Once you have the binary, save this as `quick-start.lua`:
|
Save this as `quick-start.lua`:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local hnd = require("hate-no-d")
|
local hnd = require("hate-no-d")
|
||||||
|
|
||||||
hnd.InitWindow(1280, 720, "hate-no-d")
|
hnd.InitWindow(1280, 720, "hate-no-d")
|
||||||
|
hnd.SetTargetFPS(60)
|
||||||
|
|
||||||
local text = "Your first hate-no-d application!"
|
local text = "Your first hate-no-d application!"
|
||||||
local fontSize = 48
|
local fontSize = 48
|
||||||
|
|
||||||
local spacing = fontSize / hnd.GetFontDefault().baseSize
|
|
||||||
local textSize = hnd.MeasureTextEx(hnd.GetFontDefault(), text, fontSize, spacing)
|
|
||||||
|
|
||||||
local posX = (hnd.GetRenderWidth() / 2) - (textSize.x / 2)
|
|
||||||
local posY = (hnd.GetRenderHeight() / 2) - (textSize.y / 2)
|
|
||||||
|
|
||||||
while not hnd.WindowShouldClose() do
|
while not hnd.WindowShouldClose() do
|
||||||
|
hnd.BeginDrawing()
|
||||||
hnd.ClearBackground(hnd.SKYBLUE)
|
hnd.ClearBackground(hnd.SKYBLUE)
|
||||||
|
|
||||||
hnd.BeginDrawing()
|
local width = hnd.MeasureText(text, fontSize)
|
||||||
hnd.DrawText(text, posX, posY, fontSize, hnd.DARKBLUE)
|
hnd.DrawText(text, (hnd.GetScreenWidth() - width)/2, (hnd.GetScreenHeight() - fontSize)/2, fontSize, hnd.DARKBLUE)
|
||||||
|
|
||||||
hnd.EndDrawing()
|
hnd.EndDrawing()
|
||||||
end
|
end
|
||||||
|
|
||||||
hnd.CloseWindow()
|
hnd.CloseWindow()
|
||||||
```
|
```
|
||||||
|
|
||||||
Then run it:
|
Run it:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./hate-no-d quick-start.lua
|
./hate-no-d quick-start.lua
|
||||||
```
|
```
|
||||||
|
|
||||||
`hate-no-d.lua` is the generated raylib/rlgl/raymath binding module. Release
|
On Windows:
|
||||||
archives include it next to the binary; when building from source, `make`
|
|
||||||
generates it automatically.
|
|
||||||
|
|
||||||
On Windows, use `cmd` or PowerShell:
|
|
||||||
|
|
||||||
```bat
|
```bat
|
||||||
hate-no-d.exe quick-start.lua
|
hate-no-d.exe quick-start.lua
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`hate-no-d.lua` is the generated raylib/rlgl/raymath binding; release archives
|
||||||
|
ship it next to the binary.
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
|
|
||||||
You can download precompiled builds from the [releases page](https://git.pbento.pt/pedro-bento/hate-no-d/releases).
|
Precompiled builds can be found on the [releases page](https://git.pbento.pt/pedro-bento/hate-no-d/releases).
|
||||||
|
|
||||||
### Linux prerequisites
|
### Linux prerequisites
|
||||||
|
|
||||||
Install a C toolchain, `git` and the OpenGL/X11 development headers:
|
Install a C toolchain, `git`, LuaJIT and the OpenGL/X11 headers.
|
||||||
|
|
||||||
Debian/Ubuntu:
|
Debian/Ubuntu:
|
||||||
|
|
||||||
|
|
@ -97,46 +93,44 @@ sudo emerge --ask sys-devel/gcc dev-build/make dev-vcs/git dev-lang/luajit media
|
||||||
|
|
||||||
### macOS prerequisites
|
### macOS prerequisites
|
||||||
|
|
||||||
Install the Xcode Command Line Tools:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
xcode-select --install
|
xcode-select --install
|
||||||
```
|
|
||||||
|
|
||||||
`make` and `clang` come with them. Install the host LuaJIT used by the binding
|
|
||||||
generator:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
brew install luajit
|
brew install luajit
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The Command Line Tools provide `make` and `clang`; LuaJIT runs the binding
|
||||||
|
generator.
|
||||||
|
|
||||||
### BSD prerequisites
|
### BSD prerequisites
|
||||||
|
|
||||||
Install GNU Make and the X11 development headers. FreeBSD:
|
FreeBSD:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
sudo pkg install gmake luajit libX11 libXrandr libXinerama libXi libXcursor
|
sudo pkg install gmake luajit libX11 libXrandr libXinerama libXi libXcursor mesa-libs
|
||||||
```
|
```
|
||||||
|
|
||||||
On OpenBSD, NetBSD and DragonFly, install `gmake` and `luajit` with the system
|
On OpenBSD, NetBSD and DragonFly install `gmake`, `luajit` (`pkg_add`, `pkgin`
|
||||||
package manager (`pkg_add gmake luajit`, `pkgin install gmake luajit` or
|
or `pkg`) and the X11/GL libraries if they are missing. Use `gmake` instead of
|
||||||
`pkg install gmake luajit`); X11 headers are usually in the base X sets, but
|
`make`.
|
||||||
install the X11 libraries if they are missing. Use `gmake` instead of `make`.
|
|
||||||
|
|
||||||
### Android prerequisites
|
### Android prerequisites
|
||||||
|
|
||||||
Android builds cross-compile from Linux or macOS. Install the Android NDK and
|
Cross-compile from Linux or macOS with the Android NDK, passed as `ANDROID_NDK`
|
||||||
pass its path with `ANDROID_NDK`, or set `ANDROID_NDK_HOME`.
|
or exported as `ANDROID_NDK_HOME`.
|
||||||
|
|
||||||
### Windows prerequisites
|
### Windows prerequisites
|
||||||
|
|
||||||
For MSVC, install Visual Studio 2022 with the "Desktop development with C++" workload. `build.bat` locates it automatically and uses the bundled CMake when available; raylib requires CMake 3.22 or newer, so install CMake if your VS2022 copy bundles an older version.
|
MSVC: install Visual Studio 2022 with the "Desktop development with C++"
|
||||||
|
workload. `build.bat` finds it. raylib needs CMake 3.22+, so install CMake if the
|
||||||
|
bundled copy is older.
|
||||||
|
|
||||||
For MinGW, use MSYS2 with the mingw-w64 toolchain and `make`. A native MSYS2 build is auto-detected; when cross-compiling from another host, pass `PLATFORM=Windows` (and `WIN_ARCH=i686` for 32-bit).
|
MinGW: use MSYS2 with the mingw-w64 toolchain and `make`. A native MSYS2 shell is
|
||||||
|
detected automatically; cross-compiling from elsewhere needs `PLATFORM=Windows`
|
||||||
|
(and `WIN_ARCH=i686` for 32-bit).
|
||||||
|
|
||||||
### Building from source
|
### Building from source
|
||||||
|
|
||||||
To build manually on Linux, macOS or a BSD, run:
|
Linux, macOS and the BSDs:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
|
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
|
||||||
|
|
@ -144,14 +138,10 @@ cd hate-no-d
|
||||||
make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
`make` builds the CLI and regenerates `hate-no-d.lua`; the generator needs a
|
`make` builds the CLI and regenerates `hate-no-d.lua`, which needs a host `luajit`
|
||||||
host `luajit` in `PATH` (override with `make LUAJIT=/path/to/luajit`). On the
|
in `PATH` (override with `make LUAJIT=/path/to/luajit`). On the BSDs use `gmake`.
|
||||||
BSDs, use `gmake` instead of `make`.
|
|
||||||
|
|
||||||
On Windows with MinGW (MSYS2), run `make` in the MSYS2 MINGW shell. To cross-compile
|
Windows with MSVC:
|
||||||
from another host, run `make PLATFORM=Windows` (add `WIN_ARCH=i686` for 32-bit).
|
|
||||||
|
|
||||||
On Windows with MSVC:
|
|
||||||
|
|
||||||
```bat
|
```bat
|
||||||
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
|
git clone --recurse-submodules https://git.pbento.pt/pedro-bento/hate-no-d.git
|
||||||
|
|
@ -159,10 +149,12 @@ cd hate-no-d
|
||||||
build.bat
|
build.bat
|
||||||
```
|
```
|
||||||
|
|
||||||
To build for Android from Linux or macOS, pass your NDK path (or set `ANDROID_NDK_HOME`):
|
Android from Linux or macOS:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
make PLATFORM=Android ANDROID_NDK=/path/to/ndk
|
make PLATFORM=Android ANDROID_NDK=/path/to/ndk
|
||||||
```
|
```
|
||||||
|
|
||||||
`ANDROID_ABI` defaults to `arm64-v8a` and `ANDROID_API` to `21`; see `make help` for the other ABIs. Building `armeabi-v7a` on a 64-bit host also needs `HOST_CC="gcc -m32"`.
|
`ANDROID_ABI` defaults to `arm64-v8a` and `ANDROID_API` to `21`; `make help` lists
|
||||||
|
the other ABIs. Building `armeabi-v7a` on a 64-bit host also needs
|
||||||
|
`HOST_CC="gcc -m32"`.
|
||||||
|
|
|
||||||
14
build.bat
14
build.bat
|
|
@ -106,12 +106,13 @@ if not exist "%RAYLIB_BUILD%\lib\raylib.lib" (
|
||||||
)
|
)
|
||||||
|
|
||||||
echo === Building hate-no-d.exe ===
|
echo === Building hate-no-d.exe ===
|
||||||
if exist hate-no-d.obj del /q hate-no-d.obj
|
if not exist "build" mkdir "build"
|
||||||
|
if exist "build\hate-no-d.obj" del /q "build\hate-no-d.obj"
|
||||||
cl /nologo /c /O2 /W4 /MT /D_CRT_SECURE_NO_WARNINGS ^
|
cl /nologo /c /O2 /W4 /MT /D_CRT_SECURE_NO_WARNINGS ^
|
||||||
/I "submodules\luajit\src" /Fo"hate-no-d.obj" hate-no-d.c
|
/I "submodules\luajit\src" /Fo"build\hate-no-d.obj" hate-no-d.c
|
||||||
if errorlevel 1 goto :fail
|
if errorlevel 1 goto :fail
|
||||||
|
|
||||||
link /nologo /OUT:hate-no-d.exe hate-no-d.obj ^
|
link /nologo /OUT:hate-no-d.exe "build\hate-no-d.obj" ^
|
||||||
"/WHOLEARCHIVE:%CD%\%RAYLIB_BUILD%\lib\raylib.lib" ^
|
"/WHOLEARCHIVE:%CD%\%RAYLIB_BUILD%\lib\raylib.lib" ^
|
||||||
"submodules\luajit\src\lua51.lib" ^
|
"submodules\luajit\src\lua51.lib" ^
|
||||||
opengl32.lib gdi32.lib winmm.lib user32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib advapi32.lib
|
opengl32.lib gdi32.lib winmm.lib user32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib advapi32.lib
|
||||||
|
|
@ -124,7 +125,7 @@ if errorlevel 1 (
|
||||||
goto :fail
|
goto :fail
|
||||||
)
|
)
|
||||||
|
|
||||||
del /q hate-no-d.obj
|
del /q "build\hate-no-d.obj"
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo === Built %CD%\hate-no-d.exe ===
|
echo === Built %CD%\hate-no-d.exe ===
|
||||||
|
|
@ -134,7 +135,10 @@ exit /b 0
|
||||||
|
|
||||||
:clean
|
:clean
|
||||||
echo === Cleaning ===
|
echo === Cleaning ===
|
||||||
for %%f in (hate-no-d.exe hate-no-d.obj) do if exist "%%f" del /q "%%f"
|
rem Every build product lives under build\ or in the submodules' own trees;
|
||||||
|
rem only hate-no-d.exe is left at the root by a build.
|
||||||
|
if exist "hate-no-d.exe" del /q "hate-no-d.exe"
|
||||||
|
if exist "hate-no-d.obj" del /q "hate-no-d.obj"
|
||||||
if exist "submodules\luajit\src" (
|
if exist "submodules\luajit\src" (
|
||||||
pushd "submodules\luajit\src" >nul
|
pushd "submodules\luajit\src" >nul
|
||||||
for %%f in (lua51.lib lua51.dll luajit.exe minilua.exe buildvm.exe) do if exist "%%f" del /q "%%f"
|
for %%f in (lua51.lib lua51.dll luajit.exe minilua.exe buildvm.exe) do if exist "%%f" del /q "%%f"
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,16 @@ The generated file contains:
|
||||||
asset structs (Image*, Mesh*, ...) and callback pinning
|
asset structs (Image*, Mesh*, ...) and callback pinning
|
||||||
* complete LuaCATS annotations (---@class / @field / @param / @return)
|
* complete LuaCATS annotations (---@class / @field / @param / @return)
|
||||||
|
|
||||||
Inputs are plain Lua tables produced by raylib's tools/rlparser:
|
Inputs are plain Lua tables produced by raylib's tools/rlparser. The Makefile
|
||||||
|
generates them into build/api (the parser itself into build/rlparser), so a
|
||||||
|
build never writes into raylib's tools/ tree:
|
||||||
|
|
||||||
rlparser -i raylib.h -o submodules/raylib/tools/rlparser/output/raylib_api.lua -f LUA
|
build/rlparser -i submodules/raylib/src/raylib.h \
|
||||||
rlparser -i rlgl.h -o submodules/raylib/tools/rlparser/output/rlgl_api.lua -f LUA -d RLAPI -t "RLGL IMPLEMENTATION"
|
-o build/api/raylib_api.lua -f LUA -d RLAPI
|
||||||
rlparser -i raymath.h -o submodules/raylib/tools/rlparser/output/raymath_api.lua -f LUA -d RMAPI
|
build/rlparser -i submodules/raylib/src/rlgl.h \
|
||||||
|
-o build/api/rlgl_api.lua -f LUA -d RLAPI -t "RLGL IMPLEMENTATION"
|
||||||
|
build/rlparser -i submodules/raylib/src/raymath.h \
|
||||||
|
-o build/api/raymath_api.lua -f LUA -d RMAPI
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
luajit gen-hate-no-d.lua [--out=hate-no-d.lua] [--no-rlgl] [--no-raymath]
|
luajit gen-hate-no-d.lua [--out=hate-no-d.lua] [--no-rlgl] [--no-raymath]
|
||||||
|
|
@ -27,9 +32,9 @@ with --whole-archive exposes them to ffi.C.
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local CFG = {
|
local CFG = {
|
||||||
raylib = "submodules/raylib/tools/rlparser/output/raylib_api.lua",
|
raylib = "build/api/raylib_api.lua",
|
||||||
rlgl = "submodules/raylib/tools/rlparser/output/rlgl_api.lua",
|
rlgl = "build/api/rlgl_api.lua",
|
||||||
raymath = "submodules/raylib/tools/rlparser/output/raymath_api.lua",
|
raymath = "build/api/raymath_api.lua",
|
||||||
out = "hate-no-d.lua",
|
out = "hate-no-d.lua",
|
||||||
use_rlgl = true,
|
use_rlgl = true,
|
||||||
use_raymath = true,
|
use_raymath = true,
|
||||||
|
|
@ -39,9 +44,9 @@ local USAGE = [[
|
||||||
usage: luajit gen-hate-no-d.lua [options]
|
usage: luajit gen-hate-no-d.lua [options]
|
||||||
|
|
||||||
--out=PATH output file (default: hate-no-d.lua)
|
--out=PATH output file (default: hate-no-d.lua)
|
||||||
--raylib=PATH raylib parser table (default: submodules/.../raylib_api.lua)
|
--raylib=PATH raylib parser table (default: build/api/raylib_api.lua)
|
||||||
--rlgl=PATH rlgl parser table (default: submodules/.../rlgl_api.lua)
|
--rlgl=PATH rlgl parser table (default: build/api/rlgl_api.lua)
|
||||||
--raymath=PATH raymath parser table(default: submodules/.../raymath_api.lua)
|
--raymath=PATH raymath parser table(default: build/api/raymath_api.lua)
|
||||||
--no-rlgl skip rlgl
|
--no-rlgl skip rlgl
|
||||||
--no-raymath skip raymath
|
--no-raymath skip raymath
|
||||||
-h, --help this text
|
-h, --help this text
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue