Skip to content

Commit

Permalink
Merge branch 'raii' of github.com:renehiemstra/terra into raii
Browse files Browse the repository at this point in the history
  • Loading branch information
hiemstar committed Aug 27, 2024
2 parents 487cf69 + 84ebde2 commit 8109b94
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 53 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,33 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['macos-12', 'windows-2022']
# Note: macOS 12 runs on x86 hardware, and 14 runs on M1 hardware
os: ['macos-12', 'macos-14', 'windows-2022']
llvm: ['11', '12', '13', '14', '15', '16', '17', '18']
cuda: ['0', '1']
lua: ['luajit', 'moonjit']
exclude:
# macOS: exclude cuda
- os: 'macos-12'
cuda: '1'
- os: 'macos-14'
cuda: '1'

# macOS 14: exclude Moonjit (M1 requires LuaJIT)
- os: 'macos-14'
lua: 'moonjit'

# macOS 14: exclude LLVM 11-15
- os: 'macos-14'
llvm: '11'
- os: 'macos-14'
llvm: '12'
- os: 'macos-14'
llvm: '13'
- os: 'macos-14'
llvm: '14'
- os: 'macos-14'
llvm: '15'

# Windows: exclude LLVM 12-18
- os: 'windows-2022'
Expand Down
6 changes: 3 additions & 3 deletions cmake/Modules/GetLuaJIT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ if(TERRA_LUA STREQUAL "luajit")
set(LUAJIT_BASE "luajit")
set(LUAJIT_VERSION_MAJOR 2)
set(LUAJIT_VERSION_MINOR 1)
set(LUAJIT_VERSION_PATCH 1693268511)
set(LUAJIT_VERSION_PATCH 1720049189)
set(LUAJIT_VERSION_EXTRA "")
set(LUAJIT_COMMIT "83954100dba9fc0cf5eeaf122f007df35ec9a604") # 2023-08-28
set(LUAJIT_HASH_SHA256 "99b47959c953200e865f1d55dcbb19f887b1d6fc92b9d73192114115c62a7ac6")
set(LUAJIT_COMMIT "04dca7911ea255f37be799c18d74c305b921c1a6") # 2024-08-07
set(LUAJIT_HASH_SHA256 "346b028d9ba85e04b7e23a43cc51ec076574d2efc0d271d4355141b0145cd6e0")
if(NOT LUAJIT_VERSION_COMMIT STREQUAL "")
set(LUAJIT_URL_PREFIX "https://github.com/LuaJIT/LuaJIT/archive/")
else()
Expand Down
4 changes: 2 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ let
cudaPackages.cuda_cudart
];

luajitRev = "83954100dba9fc0cf5eeaf122f007df35ec9a604";
luajitRev = "04dca7911ea255f37be799c18d74c305b921c1a6";
luajitBase = "LuaJIT-${luajitRev}";
luajitArchive = "${luajitBase}.tar.gz";
luajitSrc = fetchFromGitHub {
owner = "LuaJIT";
repo = "LuaJIT";
rev = luajitRev;
sha256 = "1m0wpfchljbi0d3x4nzfi1rz8d1viacj6kyqlz034x7nrnazmm1g";
sha256 = "0694z8rmqskx86a375ag7qp2wbdri986l5qdz0zalllp4b1hxy92";
};
llvmMerged = symlinkJoin {
name = "llvmClangMerged";
Expand Down
95 changes: 48 additions & 47 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,59 +28,60 @@ if [[ -n $DOCKER_DISTRO ]]; then
exit 0
fi

arch=$(uname -m | sed -e s/arm64/aarch64/)
if [[ $(uname) = Linux ]]; then
echo "Use Docker for testing build on Linux"
exit 1

elif [[ $(uname) = Darwin ]]; then
if [[ $LLVM_VERSION = 18 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-18.1.7/clang+llvm-18.1.7-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-18.1.7-x86_64-apple-darwin.tar.xz
ln -s clang+llvm-18.1.7-x86_64-apple-darwin/bin/llvm-config llvm-config-17
ln -s clang+llvm-18.1.7-x86_64-apple-darwin/bin/clang clang-17
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-18.1.7-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-18.1.7/clang+llvm-18.1.7-${arch}-apple-darwin.tar.xz
tar xf clang+llvm-18.1.7-${arch}-apple-darwin.tar.xz
ln -s clang+llvm-18.1.7-${arch}-apple-darwin/bin/llvm-config llvm-config-17
ln -s clang+llvm-18.1.7-${arch}-apple-darwin/bin/clang clang-17
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-18.1.7-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 17 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-17.0.5/clang+llvm-17.0.5-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-17.0.5-x86_64-apple-darwin.tar.xz
ln -s clang+llvm-17.0.5-x86_64-apple-darwin/bin/llvm-config llvm-config-17
ln -s clang+llvm-17.0.5-x86_64-apple-darwin/bin/clang clang-17
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-17.0.5-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-17.0.5/clang+llvm-17.0.5-${arch}-apple-darwin.tar.xz
tar xf clang+llvm-17.0.5-${arch}-apple-darwin.tar.xz
ln -s clang+llvm-17.0.5-${arch}-apple-darwin/bin/llvm-config llvm-config-17
ln -s clang+llvm-17.0.5-${arch}-apple-darwin/bin/clang clang-17
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-17.0.5-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 16 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-16.0.3/clang+llvm-16.0.3-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-16.0.3-x86_64-apple-darwin.tar.xz
ln -s clang+llvm-16.0.3-x86_64-apple-darwin/bin/llvm-config llvm-config-16
ln -s clang+llvm-16.0.3-x86_64-apple-darwin/bin/clang clang-16
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-16.0.3-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-16.0.3/clang+llvm-16.0.3-${arch}-apple-darwin.tar.xz
tar xf clang+llvm-16.0.3-${arch}-apple-darwin.tar.xz
ln -s clang+llvm-16.0.3-${arch}-apple-darwin/bin/llvm-config llvm-config-16
ln -s clang+llvm-16.0.3-${arch}-apple-darwin/bin/clang clang-16
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-16.0.3-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 15 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-15.0.2/clang+llvm-15.0.2-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-15.0.2-x86_64-apple-darwin.tar.xz
ln -s clang+llvm-15.0.2-x86_64-apple-darwin/bin/llvm-config llvm-config-15
ln -s clang+llvm-15.0.2-x86_64-apple-darwin/bin/clang clang-15
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-15.0.2-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-15.0.2/clang+llvm-15.0.2-${arch}-apple-darwin.tar.xz
tar xf clang+llvm-15.0.2-${arch}-apple-darwin.tar.xz
ln -s clang+llvm-15.0.2-${arch}-apple-darwin/bin/llvm-config llvm-config-15
ln -s clang+llvm-15.0.2-${arch}-apple-darwin/bin/clang clang-15
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-15.0.2-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 14 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-14.0.6/clang+llvm-14.0.6-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-14.0.6-x86_64-apple-darwin.tar.xz
ln -s clang+llvm-14.0.6-x86_64-apple-darwin/bin/llvm-config llvm-config-14
ln -s clang+llvm-14.0.6-x86_64-apple-darwin/bin/clang clang-14
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-14.0.6-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-14.0.6/clang+llvm-14.0.6-${arch}-apple-darwin.tar.xz
tar xf clang+llvm-14.0.6-${arch}-apple-darwin.tar.xz
ln -s clang+llvm-14.0.6-${arch}-apple-darwin/bin/llvm-config llvm-config-14
ln -s clang+llvm-14.0.6-${arch}-apple-darwin/bin/clang clang-14
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-14.0.6-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 13 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-13.0.1/clang+llvm-13.0.1-x86_64-apple-darwin.tar.xz
tar xf clang+llvm-13.0.1-x86_64-apple-darwin.tar.xz
ln -s clang+llvm-13.0.1-x86_64-apple-darwin/bin/llvm-config llvm-config-13
ln -s clang+llvm-13.0.1-x86_64-apple-darwin/bin/clang clang-13
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-13.0.1-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-13.0.1/clang+llvm-13.0.1-${arch}-apple-darwin.tar.xz
tar xf clang+llvm-13.0.1-${arch}-apple-darwin.tar.xz
ln -s clang+llvm-13.0.1-${arch}-apple-darwin/bin/llvm-config llvm-config-13
ln -s clang+llvm-13.0.1-${arch}-apple-darwin/bin/clang clang-13
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-13.0.1-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 12 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-12.0.1/clang+llvm-12.0.1-x86_64-apple-darwin-macos11.tar.xz
tar xf clang+llvm-12.0.1-x86_64-apple-darwin-macos11.tar.xz
ln -s clang+llvm-12.0.1-x86_64-apple-darwin/bin/llvm-config llvm-config-12
ln -s clang+llvm-12.0.1-x86_64-apple-darwin/bin/clang clang-12
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-12.0.1-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-12.0.1/clang+llvm-12.0.1-${arch}-apple-darwin-macos11.tar.xz
tar xf clang+llvm-12.0.1-${arch}-apple-darwin-macos11.tar.xz
ln -s clang+llvm-12.0.1-${arch}-apple-darwin/bin/llvm-config llvm-config-12
ln -s clang+llvm-12.0.1-${arch}-apple-darwin/bin/clang clang-12
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-12.0.1-${arch}-apple-darwin
elif [[ $LLVM_VERSION = 11 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-11.1.0/clang+llvm-11.1.0-x86_64-apple-darwin-macos11.tar.xz
tar xf clang+llvm-11.1.0-x86_64-apple-darwin-macos11.tar.xz
ln -s clang+llvm-11.1.0-x86_64-apple-darwin/bin/llvm-config llvm-config-11
ln -s clang+llvm-11.1.0-x86_64-apple-darwin/bin/clang clang-11
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-11.1.0-x86_64-apple-darwin
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-11.1.0/clang+llvm-11.1.0-${arch}-apple-darwin-macos11.tar.xz
tar xf clang+llvm-11.1.0-${arch}-apple-darwin-macos11.tar.xz
ln -s clang+llvm-11.1.0-${arch}-apple-darwin/bin/llvm-config llvm-config-11
ln -s clang+llvm-11.1.0-${arch}-apple-darwin/bin/clang clang-11
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-11.1.0-${arch}-apple-darwin
else
echo "Don't know this LLVM version: $LLVM_VERSION"
exit 1
Expand All @@ -95,13 +96,13 @@ elif [[ $(uname) = Darwin ]]; then

elif [[ $(uname) = MINGW* ]]; then
if [[ $LLVM_VERSION = 14 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-14.0.0/clang+llvm-14.0.0-x86_64-windows-msvc17.7z
7z x -y clang+llvm-14.0.0-x86_64-windows-msvc17.7z
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-14.0.0-x86_64-windows-msvc17
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-14.0.0/clang+llvm-14.0.0-${arch}-windows-msvc17.7z
7z x -y clang+llvm-14.0.0-${arch}-windows-msvc17.7z
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-14.0.0-${arch}-windows-msvc17
elif [[ $LLVM_VERSION = 11 ]]; then
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-11.1.0/clang+llvm-11.1.0-x86_64-windows-msvc17.7z
7z x -y clang+llvm-11.1.0-x86_64-windows-msvc17.7z
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-11.1.0-x86_64-windows-msvc17
curl -L -O https://github.com/terralang/llvm-build/releases/download/llvm-11.1.0/clang+llvm-11.1.0-${arch}-windows-msvc17.7z
7z x -y clang+llvm-11.1.0-${arch}-windows-msvc17.7z
export CMAKE_PREFIX_PATH=$PWD/clang+llvm-11.1.0-${arch}-windows-msvc17
fi

if [[ $USE_CUDA -eq 1 ]]; then
Expand Down Expand Up @@ -179,7 +180,7 @@ fi

# Only deploy builds with LLVM 13 (macOS) and 11 (Windows).
if [[ (( $(uname) == Darwin && $LLVM_VERSION = 18 ) || ( $(uname) == MINGW* && $LLVM_VERSION = 11 && $USE_CUDA -eq 1 )) && $SLIB_INCLUDE_LLVM -eq 1 && $TERRA_LUA = luajit ]]; then
RELEASE_NAME=terra-`uname | sed -e s/Darwin/OSX/ | sed -e s/MINGW.*/Windows/`-`uname -m`-`git rev-parse --short HEAD`
RELEASE_NAME=terra-`uname | sed -e s/Darwin/OSX/ | sed -e s/MINGW.*/Windows/`-${arch}-`git rev-parse --short HEAD`
mv install $RELEASE_NAME
if [[ $(uname) = MINGW* ]]; then
7z a -t7z $RELEASE_NAME.7z $RELEASE_NAME
Expand Down

0 comments on commit 8109b94

Please sign in to comment.