Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .github/workflows/cjson.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CJSON-Main

on:
workflow_dispatch:
push:
branches:
- 'master'
pull_request:
branches: [ master ]

jobs:
CJSON_MASTER:
strategy:
matrix:
build_type: [Release, RelWithDebInfo, MinSizeRel, Debug]
target_system: [ ubuntu-22.04, windows-2022, macos-11 ]
runs-on: ${{ matrix.target_system }}
env:
BUILD_EXT: ${{ matrix.target_system == 'windows-2022' && '.dll' || '.so' }}
BUILD_DIR: ${{ matrix.target_system == 'windows-2022' && 'D:/a/lua-cjson/lua-cjson' || '/home/runner/work/lua-cjson/lua-cjson' }}

steps:
- uses: actions/checkout@v4

- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows'
with:
msystem: UCRT64
update: true
install: git mingw-w64-ucrt-x86_64-gcc

- name: Prime ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.target_system }}-${{ matrix.build_type }}
max-size: 1000M

- name: Cache LuaJIT
id: cache-Lua
uses: actions/cache@v3
with:
path: |
LuaJIT
key: ${{ runner.os }}-Lua

- name: Get Deps (LuaJIT)
shell: bash
if: steps.cache-Lua.outputs.cache-hit != 'true'
run: |
curl -o LuaJIT.7z -L https://github.com/DreamWeave-MP/LuaJIT/releases/download/Stable-CI/LuaJIT-${{ runner.os }}.7z
7z x -y LuaJIT.7z -oLuaJIT/

- name: Configure
if: runner.os != 'Windows'
shell: bash
run: |
LUA_DIR=LuaJIT/ cmake .

- name: Configure
if: runner.os == 'Windows'
shell: bash
run: |
LUA_DIR=LuaJIT/ CC=$(which gcc) cmake . -G 'MinGW Makefiles'

- name: Build
run: |
cmake --build . --config ${{ matrix.build_type }}

- name: Prep Release
run: |
mv cjson${{ env.BUILD_EXT }} cjson-${{ matrix.build_type }}-${{ runner.os }}${{ env.BUILD_EXT }}

- name: Upload Release
if: github.event_name != 'pull_request'
uses: softprops/action-gh-release@v1
with:
tag_name: Stable-CI
files: cjson-${{ matrix.build_type }}-${{ runner.os }}${{ env.BUILD_EXT }}
body: |
CI Build for Dreamweave IO2 fork

- name: Upload Artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v3
with:
name: cjson-${{ matrix.build_type }}-${{ runner.os }}
path: cjson-${{ matrix.build_type }}-${{ runner.os }}${{ env.BUILD_EXT }}
36 changes: 36 additions & 0 deletions CI/get_luajit.Linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

set -euo pipefail

print_help() {
echo "usage: $0 [group]..."
echo
echo " available groups: "${!GROUPED_DEPS[@]}""
}

declare -rA GROUPED_DEPS=(
# Common dependencies for building OpenMW.
[openmw-deps]="
libluajit-5.1-dev
"
)

if [[ $# -eq 0 ]]; then
>&2 print_help
exit 1
fi

deps=()
for group in "$@"; do
if [[ ! -v GROUPED_DEPS[$group] ]]; then
>&2 echo "error: unknown group ${group}"
exit 1
fi
deps+=(${GROUPED_DEPS[$group]})
done

export APT_CACHE_DIR="${PWD}/apt-cache"
set -x
mkdir -pv "$APT_CACHE_DIR"
apt-get update -yq
apt-get -q -o dir::cache::archives="$APT_CACHE_DIR" install -y --no-install-recommends "${deps[@]}"
52 changes: 52 additions & 0 deletions CI/get_luajit.windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
set -e

download() {
if [ $# -lt 3 ]; then
echo "Invalid parameters to download."
return 1
fi

NAME=$1
shift

echo "$NAME..."

while [ $# -gt 1 ]; do
URL=$1
FILE=$2
shift
shift

if ! [ -f $FILE ]; then
printf " Downloading $FILE... "

if [ -z $VERBOSE ]; then
RET=0
curl --silent --fail --retry 10 -Ly 5 -o $FILE $URL || RET=$?
else
RET=0
curl --fail --retry 10 -Ly 5 -o $FILE $URL || RET=$?
fi

if [ $RET -ne 0 ]; then
echo "Failed!"
wrappedExit $RET
else
echo "Done."
fi
else
echo " $FILE exists, skipping."
fi
done

if [ $# -ne 0 ]; then
echo "Missing parameter."
fi
}

download "LuaJIT v2.1.0-beta3-452-g7a0cf5fd" \
"https://gitlab.com/OpenMW/openmw-deps/-/raw/main/windows/LuaJIT-v2.1.0-beta3-452-g7a0cf5fd-msvc2019-win64.7z" \
"LuaJIT-v2.1.0-beta3-452-g7a0cf5fd-msvc2019-win64.7z"

echo "Extracting LuaJIT . . ."
eval 7z x -y LuaJIT-v2.1.0-beta3-452-g7a0cf5fd-msvc2019-win64.7z -o./LuaJIT
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

find_package(Lua51 REQUIRED)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/)

find_package(LuaJit REQUIRED)
include_directories(${LUA_INCLUDE_DIR})

if(NOT USE_INTERNAL_FPCONV)
Expand Down
16 changes: 16 additions & 0 deletions cmake/FindLuaJit.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include(LibFindMacros)

libfind_pkg_detect(LuaJit luajit
FIND_PATH luajit.h
HINTS $ENV{LUA_DIR}
PATH_SUFFIXES include include/luajit-2.1
FIND_LIBRARY luajit-5.1 luajit lua51
HINTS $ENV{LUA_DIR}
PATH_SUFFIXES lib
)


libfind_process(LuaJit)

set(LUA_LIBRARY ${LuaJit_LIBRARY})
set(LUA_INCLUDE_DIR ${LuaJit_INCLUDE_DIR})
Loading