|
| 1 | +@echo off |
| 2 | + |
| 3 | +:: Useful for printing all variables |
| 4 | +:: set |
| 5 | + |
| 6 | +:: ########################################### EDIT VARIABLES ########################################### |
| 7 | + |
| 8 | +:: Replace with your steamworks sdk path (download from here: https://partner.steamgames.com/doc/sdk) |
| 9 | +set STEAM_SDK_PATH=%~dp0..\steamworks_sdk |
| 10 | +if "%USERNAME%" == "user" ( |
| 11 | + set STEAM_SDK_PATH=D:\SDK\SteamworksLatest |
| 12 | +) |
| 13 | + |
| 14 | +:: ###################################################################################################### |
| 15 | + |
| 16 | +:: Ensure the path ends with a backslash |
| 17 | +if not %STEAM_SDK_PATH:~-1% == \ ( |
| 18 | + set SDK_PATH=%STEAM_SDK_PATH%\ |
| 19 | +) else ( |
| 20 | + set SDK_PATH=%STEAM_SDK_PATH% |
| 21 | +) |
| 22 | + |
| 23 | +:: Ensure the directory exists |
| 24 | +if not exist "%SDK_PATH%" goto error_incorrect_STEAMWORKS_path |
| 25 | + |
| 26 | +:: Ensure we are on the output path |
| 27 | +pushd "%YYoutputFolder%" |
| 28 | + |
| 29 | +:: Call setup method depending on the platform |
| 30 | +:: NOTE: the setup method can be (:Windows_copy_dependencies, :MacOS_copy_dependencies or :Ubuntu_copy_dependencies) |
| 31 | +call :%YYPLATFORM_name%_copy_dependencies |
| 32 | +if ERRORLEVEL 1 ( |
| 33 | + echo "" |
| 34 | + echo "#################################### INFORMATION #####################################" |
| 35 | + echo "Steam Extension is not available in this target: %YYPLATFORM_name% (no setup required)" |
| 36 | + echo "######################################################################################" |
| 37 | + echo "" |
| 38 | +) |
| 39 | +popd |
| 40 | + |
| 41 | +:exit |
| 42 | +exit /b 0 |
| 43 | + |
| 44 | +:: ---------------------------------------------------------------------------------------------------- |
| 45 | +:Windows_copy_dependencies |
| 46 | + if "%YYPLATFORM_option_windows_use_x64%" == "True" ( |
| 47 | + echo "Copying Windows (64 bit) dependencies" |
| 48 | + if not exist "steam_api64.dll" copy "%SDK_PATH%redistributable_bin\win64\steam_api64.dll" "steam_api64.dll" |
| 49 | + ) else ( |
| 50 | + echo "Copying Windows (32 bit) dependencies" |
| 51 | + if not exist "steam_api.dll" copy "%SDK_PATH%redistributable_bin\steam_api.dll" "steam_api.dll" |
| 52 | + ) |
| 53 | + if ERRORLEVEL 1 call :exitError |
| 54 | +goto :eof |
| 55 | + |
| 56 | +:: ---------------------------------------------------------------------------------------------------- |
| 57 | +:macOS_copy_dependencies |
| 58 | + echo "Copying macOS (64 bit) dependencies" |
| 59 | + if "%YYTARGET_runtime%" == "VM" ( |
| 60 | + |
| 61 | + :: This is used for VM |
| 62 | + powershell Expand-Archive '%YYprojectName%.zip' _temp\ |
| 63 | + copy /y "%SDK_PATH%redistributable_bin\osx\libsteam_api.dylib" "_temp\assets\libsteam_api.dylib" |
| 64 | + powershell Compress-Archive -Force _temp\* '%YYprojectName%.zip' |
| 65 | + rmdir /s /q _temp |
| 66 | + |
| 67 | + ) else ( |
| 68 | + |
| 69 | + :: This is used from YYC compilation |
| 70 | + copy "%SDK_PATH%redistributable_bin\osx\libsteam_api.dylib" "%YYprojectName%\%YYprojectName%\Supporting Files\libsteam_api.dylib" |
| 71 | + ) |
| 72 | + if ERRORLEVEL 1 call :exitError |
| 73 | +goto :eof |
| 74 | + |
| 75 | +:: ---------------------------------------------------------------------------------------------------- |
| 76 | +:Linux_copy_dependencies |
| 77 | + echo "Copying Linux (64 bit) dependencies" |
| 78 | + powershell Expand-Archive '%YYprojectName%.zip' _temp\ |
| 79 | + |
| 80 | + if not exist "assets/libsteam_api.so" ( |
| 81 | + copy "%SDK_PATH%redistributable_bin\linux64\libsteam_api.so" "_temp\assets\libsteam_api.so" |
| 82 | + powershell Compress-Archive -Force _temp\* '%YYprojectName%.zip' |
| 83 | + ) |
| 84 | + rmdir /s /q _temp |
| 85 | + if ERRORLEVEL 1 call :exitError |
| 86 | +goto :eof |
| 87 | + |
| 88 | +:: ---------------------------------------------------------------------------------------------------- |
| 89 | +:exitError |
| 90 | + echo "" |
| 91 | + echo "######################################################## ERROR #########################################################" |
| 92 | + echo "The setup script was unable to copy dependencies" |
| 93 | + echo "########################################################################################################################" |
| 94 | + echo "" |
| 95 | +exit 1 |
| 96 | + |
| 97 | +:: ---------------------------------------------------------------------------------------------------- |
| 98 | +:: If the steamworks SDK path doesn't exit ask the user to edit this file |
| 99 | +:error_incorrect_STEAMWORKS_path |
| 100 | + echo "" |
| 101 | + echo "######################################################## ERROR #########################################################" |
| 102 | + echo "The specified steamworks SDK path doesn't exist please edit the file 'post_build_step.bat' in your project's root folder" |
| 103 | + echo "########################################################################################################################" |
| 104 | + echo "" |
| 105 | +exit 1 |
0 commit comments