Created
March 25, 2018 01:00
-
-
Save Lunchbox4K/647b97461a3d375bab876bd4c40bc3d7 to your computer and use it in GitHub Desktop.
UE4.19 Steamworks 1.42 Ubuntu 16.04 Setup Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
# The MIT License | |
# | |
# Copyright (c) 2018 Mitchell Pell. https://mpworks.net | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in | |
# all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
# THE SOFTWARE. | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
# UE4 Engine Setup Script w/ Steamworks. | |
# | |
# Author: Mitchell Pell | |
# Email: [email protected] | |
# Website: https://blog.mpworks.net/ue4-steamworks-ubuntu-setup-script/ | |
# Date: 2018/03/24 | |
# Version: 0.2 | |
# | |
# Developed and Tested on: | |
# - Operating System: Xubuntu 16.04 (4.13*) x64 | |
# - Unreal Engine: 4.19.0s | |
# - Steamworks: 1.42 | |
# | |
# Revisions: | |
# | |
# - 0.2 - mp - 18.03.24 - Fixed ./Setup.sh being called instead of echoing | |
# when using the cmd with -D flag. | |
# - 0.1 - mp - 18.03.23 - Initial Script. | |
# | |
# Note(s): | |
# | |
# + I'm not an expert. I am learning UE4 on my free time and have little | |
# shell script experience outside this file. So read over carefully if | |
# you plan on using this. | |
# | |
# + Made script for UE_4.19.0 and Steamworks 1.42, but everything is defined | |
# in settings, thus other versions may work with a few tweaks to the script. | |
# | |
# + Steamworks SDK requires login and thus the Steamworks SDK zip file | |
# needs to be downloaded and its location updated in the settings below. | |
# | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
# Settings | |
#=================================================================================================================== | |
STEAM_ROOT="$HOME/.steam" # Location of Steam client install. | |
# todo: Replace with apt-get install location. | |
# and add steam to this scripts apt-get install. | |
SW_ZIP_PARENT_DIR="$HOME/Downloads" # Download location of Steamworks zip | |
SW_VER='1.42' # Steamworks version | |
SW_PREV_VER='1.39' # Steamworks version being replaced in engine files. | |
SW_VER_INT="142" | |
SW_PREV_VER_INT="139" # Steamworks version being replaced in engine files. | |
# todo: Fix the macro that removes '.' from "a.b" | |
# and move back to generated variables. | |
ENG_VER="4.19.0" # Engine version | |
ENG_GIT_BRANCH="4.19" # Engine version used with git clone '-b' flag. | |
ENG_GIT_CLONE_BY_TAG=false # todo: add clone by tag option. | |
ENG_GIT_TAG="4.19.0-release" | |
ENG_PARENT_DIR="/mnt/zed/ue4" # Location of Engine | |
INSTALL_CLANG_5=true # Flag: Install Clang 5.0 | |
ENG_GIT_URL="https://github.com/EpicGames/UnrealEngine.git" | |
# Launch Commgfdands | |
# Thanks: https://stackoverflow.com/questions/7069682/how-to-get-arguments-with-flags-in-bash-script | |
#=================================================================================================================== | |
# Launch command variables | |
#--------------------- | |
ENG_CLEAN_BUILD=false | |
SKIP_PROMPTS=false | |
DEBUG_ECHO=false | |
UPDATE=false | |
FORCE=false | |
NO_LAUNCH=false | |
while test $# -gt 0; do | |
case "$1" in | |
-[Yy]*|--yes*) #Skip Prompts | |
SKIP_PROMPTS=true | |
shift | |
;; | |
-[Uu]*|--update*) #Update Engine (Skip: git clone; apt-get install ...; copy steamworks) | |
UPDATE=true | |
shift | |
;; | |
-[Cc]*|--clean*) #Clean engine build | |
ENG_CLEAN_BUILD=true | |
shift | |
;; | |
-[Ff]*|--force*) #Force delete and re-download | |
FORCE=true | |
UPDATE=false | |
shift | |
;; | |
-[Dd]*|--debug*) #Debug mode | |
DEBUG_ECHO=true | |
shift | |
;; | |
-[Nn]*|--no-launch*) #Don't launch editor. For use with -y | |
NO_LAUNCH=true | |
shift | |
;; | |
*) | |
break | |
;; | |
esac | |
done | |
# Generated Variables | |
#------------------------- | |
#=================================================================================================================== | |
SW_FILE="steamworks_sdk_$SW_VER_INT.zip" # ( e.g. steamworks_sdk_142.zip ) | |
#Add extra definition to engine folder name when cloned from a tag instead of a branch. | |
if [ "$ENG_GIT_CLONE_BY_TAG" = true ]; then | |
ENG_DIR_NAME="UE_$ENG_VER" | |
else | |
ENG_DIR_NAME="UE_$ENG_GIT_BRANCH" | |
fi | |
ENG_ROOT="$ENG_PARENT_DIR/$ENG_DIR_NAME" # Location of Engine | |
pre_cmd=; | |
if [ "$DEBUG_ECHO" = true ]; then | |
pre_cmd=echo | |
fi | |
choice_yes=false #True/False on Y/N questions. True on y. | |
uprintf="/usr/bin/printf" #used to print check-marks and exes. | |
CHECKMARK="\u2714" | |
EXMARK="\u274c" | |
echo "+--========================================------------------ >>" | |
echo "| Mitchell's Unreal Engine (4.19.0) w/ Steamworks Setup Script" | |
echo "+--========================================------------------ >>" | |
echo "\ " | |
echo " ------------------------------------------------------------ >>" | |
echo "" | |
echo "[0/6] Initial Checks " | |
echo "----------------------------------------" | |
echo "" | |
#=================================================================================================================== | |
if [ "$DEBUG_ECHO" = true ] ; then | |
$uprintf "[D] Debug mode. All commands will be outputted with echo. \n" | |
fi | |
# Check for Steamworks SDK zip file. | |
if [ ! -e "$SW_ZIP_PARENT_DIR/$SW_FILE" ]; then | |
$uprintf "[$EXMARK] Could not locate the Steamworks SDK Zip at $SW_ZIP_PARENT_DIR/$SW_FILE. \n" | |
exit 1 | |
fi | |
# No root | |
if [ `whoami` = 'root' ]; then | |
$uprintf "[$EXMARK] Please do not run this script as root. \n" | |
exit 1 | |
fi | |
# Eval. Sudo | |
echo "[!] sudo required for script:" | |
sucheck="$(sudo whoami)"; | |
if [ "$sucheck" = 'root' ]; then | |
$uprintf "[$CHECKMARK] Sudo access granted. \n" | |
else | |
$uprintf "[$EXMARK] Sudo access failed! \n" | |
exit 1 | |
fi | |
#Check if folder exists at the designated engine path. | |
if [ -d "$ENG_ROOT" ]; then | |
$uprintf "[!] Engine folder already exists at $ENG_ROOT. \n" | |
#If -f | |
if [ "$SKIP_PROMPTS" = true ]; then | |
if [ "$FORCE" = true ]; then | |
echo " [--force] Force delete flag set." | |
choice="y" | |
else | |
choice="n" | |
fi | |
#if -u #ds a | |
elif [ "$UPDATE" = true ]; then | |
choice='n' | |
else | |
read -p "[?] Delete existing engine and continue (N/y)?" choice | |
fi | |
case "$choice" in | |
y|Y ) echo "\t[y] Deleted the Engine."; $pre_cmd rm -f -r $ENG_ROOT;; | |
n|N ) echo "\t[n] Saving the Engine." ;; | |
* ) echo "\t[n] Saving the Engine.";; | |
esac | |
fi | |
echo "" | |
echo "[1/6] Updating and Installing Prerequisites " | |
echo "----------------------------------------" | |
echo "" | |
#=================================================================================================================== | |
if [ "$UPDATE" = true ] ; then | |
if [ \( "$SKIP_PROMPTS" = true \) ] ; then | |
$pre_cmd sudo apt-get update && $pre_cmd sudo apt-get -y upgrade | |
else | |
$pre_cmd sudo apt-get update && $pre_cmd sudo apt-get upgrade | |
fi | |
else | |
if [ \( "$SKIP_PROMPTS" = true \) ] ; then | |
$pre_cmd sudo apt-get update && $pre_cmd sudo apt-get -y upgrade | |
$pre_cmd sudo apt-get -y install \ | |
unzip git \ | |
build-essential mono-mcs mono-devel mono-xbuild mono-dmcs \ | |
mono-reference-assemblies-4.0 libmono-system-data-datasetextensions4.0-cil \ | |
libmono-system-web-extensions4.0-cil libmono-system-management4.0-cil \ | |
libmono-system-xml-linq4.0-cil cmake dos2unix clang-3.5 clang-3.8 \ | |
libfreetype6-dev libgtk-3-dev libmono-microsoft-build-tasks-v4.0-4.0-cil xdg-user-dirs | |
else | |
$pre_cmd sudo apt-get update && $pre_cmd sudo apt-get upgrade | |
$pre_cmd sudo apt-get install \ | |
unzip git \ | |
build-essential mono-mcs mono-devel mono-xbuild mono-dmcs \ | |
mono-reference-assemblies-4.0 libmono-system-data-datasetextensions4.0-cil \ | |
libmono-system-web-extensions4.0-cil libmono-system-management4.0-cil \ | |
libmono-system-xml-linq4.0-cil cmake dos2unix clang-3.5 clang-3.8 \ | |
libfreetype6-dev libgtk-3-dev libmono-microsoft-build-tasks-v4.0-4.0-cil xdg-user-dirs | |
fi | |
# Clang 5.0 | |
if [ "$INSTALL_CLANG_5" = true ] ; then | |
if [ "$SKIP_PROMPTS" = true ] ; then | |
$pre_cmd sudo apt-get -y install clang-5.0 | |
else | |
echo "" | |
$uprintf "[$CHECKMARK] UE 4.19+ supports Clang 5.0. \n" | |
$pre_cmd sudo apt-get install clang-5.0 | |
fi | |
fi | |
fi | |
echo "" | |
echo "[2/6] Downloading the Unreal Engine " | |
echo "----------------------------------------" | |
echo "" | |
#=================================================================================================================== | |
if [ ! -d "$ENG_ROOT" ]; then | |
$uprintf "[!] Cloning Engine from GitHub \n" | |
$pre_cmd git clone -b $ENG_GIT_BRANCH $ENG_GIT_URL $ENG_ROOT | |
elif [ "$DEBUG_ECHO" = true ]; then | |
#This is only called with $DEBUG_ECHO | |
echo git clone -b $ENG_GIT_BRANCH $ENG_GIT_URL $ENG_ROOT | |
else | |
$uprintf "[$CHECKMARK] Engine Detected, and will not be remade. \n" | |
fi | |
echo "" | |
echo "[3/6] Copying Steamworks Files" | |
echo "----------------------------------------" | |
echo "" | |
#=================================================================================================================== | |
#Check if allowed to copy/replace Steamworks files. | |
if [ -d "$ENG_ROOT/Engine/Source/ThirdParty/Steamworks/Steamv142/sdk" ]; then | |
if [ "$UPDATE" = true ]; then | |
choice='n' | |
elif [ "$SKIP_PROMPTS" = true ]; then | |
choice='y' | |
else | |
echo "Steamworks SDK folder already exists in the Engine." | |
read -p "Copy and replace Steamworks files in Engine(y/n)?" choice | |
fi | |
case "$choice" in | |
y|Y ) choice_yes=true ;; | |
n|N ) choice_yes=false ;; | |
* ) choice_yes=false; ;; | |
esac | |
else | |
choice_yes=true | |
fi | |
#Copy passed above check. | |
if [ "$choice_yes" = true ] ; then | |
# Extract SDK and prepare needed directories. | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
$pre_cmd unzip -d "$SW_ZIP_PARENT_DIR/steamworks" "$SW_ZIP_PARENT_DIR/$SW_FILE" | |
$pre_cmd rm -r -f "$ENG_ROOT/Engine/Source/ThirdParty/Steamworks/Steamv142" | |
$pre_cmd mkdir -p "$ENG_ROOT/Engine/Source/ThirdParty/Steamworks/Steamv142" | |
$pre_cmd rm -r -f "$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/Linux" | |
$pre_cmd mkdir -p "$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/Linux" | |
$pre_cmd rm -r -f "$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/x86_64-unknown-linux-gnu" | |
$pre_cmd mkdir -p "$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/x86_64-unknown-linux-gnu" | |
# Copy SDK to Engine Source | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
$pre_cmd cp -R -f "$SW_ZIP_PARENT_DIR/steamworks/sdk" \ | |
"$ENG_ROOT/Engine/Source/ThirdParty/Steamworks/Steamv142/sdk" | |
#Copy SDK Binaries to Engine Binaries | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# Engine > Binaries > ThirdParty > Steamworks > Steamv142 > linux64 | |
$pre_cmd cp -f "$SW_ZIP_PARENT_DIR/steamworks/sdk/redistributable_bin/linux64/libsteam_api.so" \ | |
"$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/Linux/libsteam_api.so" | |
$pre_cmd cp -f "$SW_ZIP_PARENT_DIR/steamworks/sdk/redistributable_bin/steam_api.lib" \ | |
"$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/Linux/steam_api.lib" | |
# Engine > Binaries > Linux | |
$pre_cmd cp -f "$SW_ZIP_PARENT_DIR/steamworks/sdk/redistributable_bin/linux64/libsteam_api.so" \ | |
"$ENG_ROOT/Engine/Binaries/Linux/libsteam_api.so" | |
$pre_cmd cp -f "$SW_ZIP_PARENT_DIR/steamworks/sdk/redistributable_bin/steam_api.lib" \ | |
"$ENG_ROOT/Engine/Binaries/Linux/steam_api.lib" | |
# Engine > Binaries > ThirdParty > Steamworks > Steamv142 > x86_64-unknown-linux-gnu | |
# Note: Needed due to error locating files while packaging. | |
$pre_cmd cp -f "$SW_ZIP_PARENT_DIR/steamworks/sdk/redistributable_bin/linux64/libsteam_api.so" \ | |
"$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/x86_64-unknown-linux-gnu/libsteam_api.so" | |
$pre_cmd cp -f "$SW_ZIP_PARENT_DIR/steamworks/sdk/redistributable_bin/steam_api.lib" \ | |
"$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/x86_64-unknown-linux-gnu/steam_api.lib" | |
# Copy Steam Binaries to Engine Binaries | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
$pre_cmd cp -f "$STEAM_ROOT/linux64/steamclient.so" \ | |
"$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/Linux/steamclient.so" | |
#cp "$STEAM_ROOT/linux64/steamclient.so" \ | |
# "$ENG_ROOT/Engine/Binaries/ThirdParty/Steamworks/Steamv142/x86_64-unknown-linux-gnu/steamclient.so" | |
# Cleanup extracted Steamworks SDK. | |
$pre_cmd rm -r -f "$SW_ZIP_PARENT_DIR/steamworks" | |
# Update Engine files to use new Steamworks version. | |
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | |
# Replace 1.39 with 1.42 throughout Steamworks.build.cs | |
$pre_cmd sed -i "s/$SW_PREV_VER/$SW_VER/g" \ | |
"$ENG_ROOT/Engine/Source/ThirdParty/Steamworks/Steamworks.build.cs" | |
# Replace 139 with 142 throughout Steamworks.build.cs | |
$pre_cmd sed -i "s/$SW_PREV_VER_INT/$SW_VER_INT/g" \ | |
"$ENG_ROOT/Engine/Source/ThirdParty/Steamworks/Steamworks.build.cs" | |
$pre_cmd sed -i "s/$SW_PREV_VER_INT/$SW_VER_INT/g" \ | |
"$ENG_ROOT/Engine/Plugins/Runtime/Steam/SteamController/Source/SteamController/SteamController.Build.cs" | |
$pre_cmd sed -i "s/$SW_P4REV_VER_INT/$SW_VER_INT/g" \ | |
"$ENG_ROOT/Engine/Plugins/Online/OnlineSubsystemSteam/Source//OnlineSubsystemSteam.Build.cs" | |
fi | |
echo "" | |
echo "[4/6] Setting Additional Engine Tweaks" | |
echo "----------------------------------------" | |
echo "" | |
#=================================================================================================================== | |
# Apply linux steam compilation fix ( ARRAY_COUNT Macro redefinition ) | |
# Fix: Remove -Werror flag. | |
# Source: https://answers.unrealengine.com/questions/473718/error-while-using-steam-apih-on-linuxosx.html | |
$uprintf "[!] Removing -Werror flag from Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs using: \n\t" | |
echo sed -i "s/-Werror//g" "$ENG_ROOT/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs" | |
$pre_cmd sed -i "s/-Werror//g" "$ENG_ROOT/Engine/Source/Programs/UnrealBuildTool/Platform/Linux/LinuxToolChain.cs" | |
echo "" | |
echo "[5/6] Setting up and Generating Engine Project Files" | |
echo "----------------------------------------" | |
#=================================================================================================================== | |
if [ "$SKIP_PROMPTS" = true ]; then | |
# 0.2 - Fixed calling command with -D flag. Since $pre_cmd was not preventing | |
# the Setup.sh call due to the pipe. | |
if [ "$DEBUG_ECHO" = false ]; then | |
$pre_cmd echo "y" | $ENG_ROOT/Setup.sh # --force # todo: Figure out | |
else | |
$pre_cmd $ENG_ROOT/Setup.sh | |
fi | |
else | |
$pre_cmd $ENG_ROOT/Setup.sh | |
fi | |
$pre_cmd $ENG_ROOT/GenerateProjectFiles.sh | |
if [ "$SKIP_PROMPTS" = true ]; then | |
choice='y' | |
else | |
echo "Setup complete. Would you like to compile the engine now?" | |
read -p "Compile using make (N/y)?" choice | |
fi | |
case $choice in | |
y|Y ) choice_yes=true;; | |
n|N ) choice_yes=false;; | |
* ) choice_yes=false ;; | |
esac | |
if [ "$choice_yes" = true ]; then | |
echo "" | |
echo "[6/6] Compiling the Engine" | |
echo "----------------------------------------" | |
echo "" | |
if [ "$ENG_CLEAN_BUILD" = true ]; then | |
$pre_cmd make -C $ENG_ROOT | |
else | |
$pre_cmd make -C $ENG_ROOT | |
fi | |
else | |
echo "You can compile the engine later using:\n make -C $ENG_ROOT " | |
fi | |
# Launch Engine | |
#=================================================================================================================== | |
if [ "$NO_LAUNCH" = false ]; then | |
if [ -e "$ENG_ROOT/Engine/Binaries/Linux/UE4Editor" ] ; then | |
if [ "$SKIP_PROMPTS" = true ]; then | |
choice='y' | |
else | |
echo "Build completed using make. Would you like to run the engine editor now?" | |
read -p "Start UE4 Editor (N/y)?" choice | |
fi | |
case "$choice" in | |
y|Y ) choice_yes=true;; | |
n|N ) choice_yes=false;; | |
* ) choice_yes=false;; | |
esac | |
if [ "$choice_yes" = true ]; then | |
echo "" | |
echo "[-->] Launching the Engine Editor" | |
echo "----------------------------------------" | |
$pre_cmd "$ENG_ROOT/Engine/Binaries/Linux/UE4Editor" | |
else | |
echo "" | |
fi | |
else | |
echo "Error building Engine. Unable to locate $ENG_ROOT/Engine/Binaries/Linux/UE4Editor."; | |
fi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
# The MIT License | |
# | |
# Copyright (c) 2018 Mitchell Pell. https://mpworks.net | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in | |
# all copies or substantial portions of the Software. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
# THE SOFTWARE. | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
# UE4 Game Project Setup Script w/ Steamworks. | |
# | |
# Developed and Tested on: | |
# - Operating System: Xubuntu 16.04 (4.13*) x64 | |
# - Unreal Engine: 4.19.0 | |
# - Steamworks: 1.42 | |
# | |
# Mitchell Pell | |
# 2018/03/23 | |
# v0.1 | |
# | |
# See: | |
# + SetupEngine.sh - Called with --update-engine to update the engine. | |
# | |
# Note(s): | |
# | |
# + I'm not an expert. I am learning UE4 on my free time and have little | |
# shell script experience outside this file. So read over carefully if | |
# you plan on using this. | |
# | |
# + Made script for UE_4.19.0 and Steamworks 1.42, but everyting is defined | |
# in settings, thus other versions may work with a few tweeks to the script. | |
# | |
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
PROJECT_DIR=$(dirname $0) #Same as script file location in my case. | |
PROJECT="{Project Path}.uproject" | |
PROJECT_PACKAGED="{Packaged Location}" | |
STEAM_ROOT="$HOME/.steam" | |
ENG_VER="4.19" | |
ENG_PARENT_DIR="/mnt/zed/ue4" | |
ENG_DIR_NAME="UE_$ENG_VER" | |
ENG_ROOT="$ENG_PARENT_DIR/$ENG_DIR_NAME" | |
#Launch Flags | |
UPDATE_ENGINE=false # Update Engine and Build | |
PLAY_PACKAGED=false # Play packaged game | |
# Thanks: https://stackoverflow.com/questions/7069682/how-to-get-arguments-with-flags-in-bash-script | |
#=================================================================================================================== | |
while test $# -gt 0; do | |
case "$1" in | |
-[Ee]*|--update-engine*) | |
UPDATE_ENGINE=true | |
shift | |
;; | |
-[Pp]*|--*) | |
PLAY_PACKAGED=true | |
shift | |
;; | |
*) | |
break | |
;; | |
esac | |
done | |
# Start Steam | |
echo "" | |
echo "[ Starting Steam ]" | |
steam > /dev/null & | |
#Update Engine | |
if [ "$UPDATE_ENGINE" = true ]; then | |
echo "" | |
printf "[ Updating Engine ] " | |
chmod +x $PROJECT_DIR/SetupEngine.sh | |
echo $PROJECT_DIR/SetupEngine.sh -u -y -N # Update; Yes to all prompts; don't launch engine | |
$PROJECT_DIR/SetupEngine.sh -u -y -N # Update; Yes to all prompts; don't launch engine | |
fi | |
#Update Project Files | |
$ENG_ROOT/GenerateProjectFiles.sh -project="$PROJECT" -game -engine -vscode | |
#Start Packaged game | |
if [ "$PLAY_PACKAGED" = true ]; then | |
# Apply Steam overlay fix ( Environment variable ) | |
# Thanks: https://answers.unrealengine.com/questions/710572/linux-dev-build-no-steam-overlay.html | |
export LD_PRELOAD="$STEAM_ROOT/ubuntu12_64/gameoverlayrenderer.so" | |
$PROJECT_PACKAGED/MagesFury.sh | |
#Launch Editor | |
else | |
$ENG_ROOT/Engine/Binaries/Linux/UE4Editor "$PROJECT" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment