forked from 0ad/0ad
Add a script to build spir-v shaders for the bundle.
Fixes: #6636 Refs: #6718 Discussed with: @vladislavbelov Differential Revision: https://code.wildfiregames.com/D4988 This was SVN commit r27633.
This commit is contained in:
parent
7cd980f2e1
commit
d8b1935493
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -24,12 +24,13 @@ pipeline {
|
||||
}
|
||||
|
||||
parameters {
|
||||
string(name: 'BUNDLE_VERSION', defaultValue: '0.0.26dev', description: 'Bundle Version')
|
||||
string(name: 'SVN_REV', defaultValue: 'HEAD', description: 'For instance 21000')
|
||||
string(name: 'BUNDLE_VERSION', defaultValue: '0.0.27dev', description: 'Bundle Version')
|
||||
string(name: 'ENGINE_VERSION', defaultValue: '0.0.27', description: 'Engine Version')
|
||||
booleanParam(name: 'ONLY_MOD', defaultValue: true, description: 'Only archive the mod mod.')
|
||||
booleanParam(name: 'DO_GZIP', defaultValue: true, description: 'Create .gz unix tarballs as well as .xz')
|
||||
booleanParam(name: 'FULL_REBUILD', defaultValue: true, description: 'Do a full rebuild (safer for release, slower).')
|
||||
booleanParam(name: 'WINDOWS_UNIX', defaultValue: true, description: 'Build windows and unix bundles.')
|
||||
booleanParam(name: 'BUILD_SHADERS', defaultValue: true, description: 'Build the spir-v shaders (very slow).')
|
||||
}
|
||||
|
||||
stages {
|
||||
@ -65,7 +66,7 @@ pipeline {
|
||||
}
|
||||
stage("Create archive data") {
|
||||
steps {
|
||||
sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" ONLY_MOD=${params.ONLY_MOD} source/tools/dist/build-archives.sh"
|
||||
sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" ONLY_MOD=${params.ONLY_MOD} BUILD_SHADERS=${params.BUILD_SHADERS} ENGINE_VERSION=${params.ENGINE_VERSION} source/tools/dist/build-archives.sh"
|
||||
}
|
||||
}
|
||||
stage("Create Mac Bundle") {
|
||||
@ -76,25 +77,25 @@ pipeline {
|
||||
stage("Create Windows installer & *nix files") {
|
||||
steps {
|
||||
script {
|
||||
if(params.WINDOWS_UNIX)
|
||||
{
|
||||
// The files created by the mac compilation need to be deleted
|
||||
sh "svn st {binaries/,build/} --no-ignore | cut -c 9- | xargs rm -rfv"
|
||||
// Hide the libraries folder.
|
||||
sh "mv libraries/ temp_libraries/"
|
||||
sh "svn revert libraries/ -R"
|
||||
// The generated tests use hardcoded paths so they must be deleted as well.
|
||||
sh 'python3 -c \"import glob; print(\\\" \\\".join(glob.glob(\\\"source/**/tests/**.cpp\\\", recursive=True)));\" | xargs rm -v'
|
||||
sh "svn revert build/ -R"
|
||||
try {
|
||||
// Then run the core object.
|
||||
sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" BUNDLE_VERSION=${params.BUNDLE_VERSION} DO_GZIP=${params.DO_GZIP} source/tools/dist/build-unix-win32.sh"
|
||||
} finally {
|
||||
// Un-hide the libraries.
|
||||
sh "rm -rfv libraries/"
|
||||
sh "mv temp_libraries/ libraries/"
|
||||
}
|
||||
}
|
||||
if(params.WINDOWS_UNIX)
|
||||
{
|
||||
// The files created by the mac compilation need to be deleted
|
||||
sh "svn st {binaries/,build/} --no-ignore | cut -c 9- | xargs rm -rfv"
|
||||
// Hide the libraries folder.
|
||||
sh "mv libraries/ temp_libraries/"
|
||||
sh "svn revert libraries/ -R"
|
||||
// The generated tests use hardcoded paths so they must be deleted as well.
|
||||
sh 'python3 -c \"import glob; print(\\\" \\\".join(glob.glob(\\\"source/**/tests/**.cpp\\\", recursive=True)));\" | xargs rm -v'
|
||||
sh "svn revert build/ -R"
|
||||
try {
|
||||
// Then run the core object.
|
||||
sh "JOBS=\"-j\$(sysctl -n hw.ncpu)\" BUNDLE_VERSION=${params.BUNDLE_VERSION} DO_GZIP=${params.DO_GZIP} source/tools/dist/build-unix-win32.sh"
|
||||
} finally {
|
||||
// Un-hide the libraries.
|
||||
sh "rm -rfv libraries/"
|
||||
sh "mv temp_libraries/ libraries/"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
source/tools/dist/build-archives.sh
vendored
39
source/tools/dist/build-archives.sh
vendored
@ -38,9 +38,46 @@ else
|
||||
fi
|
||||
popd > /dev/null
|
||||
|
||||
BUILD_SHADERS="${BUILD_SHADERS:=true}"
|
||||
if [ "${BUILD_SHADERS}" = true ]; then
|
||||
PYTHON=${PYTHON:=$(command -v python3 || command -v python)}
|
||||
GLSLC=${GLSLC:=$(command -v glslc)}
|
||||
SPIRV_REFLECT=${SPIRV_REFLECT:=$(command -v spirv-reflect)}
|
||||
|
||||
[ -n "${PYTHON}" ] || die "Error: python is not available. Install it before proceeding."
|
||||
[ -n "${GLSLC}" ] || die "Error: glslc is not available. Install it with the Vulkan SDK before proceeding."
|
||||
[ -n "${SPIRV_REFLECT}" ] || die "Error: spirv-reflect is not available. Install it with the Vulkan SDK before proceeding."
|
||||
|
||||
pushd "source/tools/spirv" > /dev/null
|
||||
|
||||
ENGINE_VERSION=${ENGINE_VERSION:="0.0.xx"}
|
||||
rulesFile="rules.${ENGINE_VERSION}.json"
|
||||
|
||||
if [ ! -e "$rulesFile" ]
|
||||
then
|
||||
# The rules.json file should be present in release tarballs, for
|
||||
# some Linux CIs don't have access to the internet.
|
||||
download="$(command -v wget || echo "curl -sLo ""${rulesFile}""")"
|
||||
$download "https://releases.wildfiregames.com/spir-v/$rulesFile"
|
||||
fi
|
||||
|
||||
for modname in $archives
|
||||
do
|
||||
modLocation="../../../binaries/data/mods/${modname}"
|
||||
if [ -e "${modLocation}/shaders/spirv/" ]
|
||||
then
|
||||
echo "Removing existing spirv shaders for '${modname}'..."
|
||||
rm -rf "${modLocation}/shaders/spirv"
|
||||
fi
|
||||
echo "Building shader for '${modname}'..."
|
||||
$PYTHON compile.py "$modLocation" "$rulesFile" "$modLocation" --dependency "../../../binaries/data/mods/mod/"
|
||||
done
|
||||
popd > /dev/null
|
||||
fi
|
||||
|
||||
for modname in $archives
|
||||
do
|
||||
echo "\nBuilding archive for '${modname}'\n"
|
||||
echo "Building archive for '${modname}'..."
|
||||
ARCHIVEBUILD_INPUT="binaries/data/mods/${modname}"
|
||||
ARCHIVEBUILD_OUTPUT="archives/${modname}"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user