mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2024-11-27 05:04:01 +08:00
update these scripts + add support to build deps via --deps
+ simple help page via --help
This commit is contained in:
parent
5def4c4148
commit
86359ea8a9
@ -213,6 +213,7 @@ Open CMD in the repo folder, then run the following
|
|||||||
|
|
||||||
|
|
||||||
This will build a release version of the emu in the folder `build\win\<toolchain>\release`
|
This will build a release version of the emu in the folder `build\win\<toolchain>\release`
|
||||||
|
An example script `build_win_premake.bat` is available, check it out
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
@ -238,7 +239,8 @@ To see all possible build targets
|
|||||||
make help
|
make help
|
||||||
```
|
```
|
||||||
|
|
||||||
This will build a release version of the emu in the folder `build/linux/<toolchain>/release`
|
This will build a release version of the emu in the folder `build/linux/<toolchain>/release`
|
||||||
|
An example script `build_linux_premake.sh` is available, check it out
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -1,19 +1,71 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
chmod +777 third-party/common/win/premake/premake5
|
function help_page () {
|
||||||
./third-party/common/win/premake/premake5 --os=linux genproto
|
echo "./$(basename "$0") [switches]"
|
||||||
|
echo "switches:"
|
||||||
|
echo " --deps: rebuild third-party dependencies"
|
||||||
|
echo " --help: show this page"
|
||||||
|
}
|
||||||
|
|
||||||
# target other than clang?
|
# use 70%
|
||||||
./third-party/common/win/premake/premake5 --os=linux --cc=clang gmake2
|
build_threads="$(( $(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 0) * 70 / 100 ))"
|
||||||
|
[[ $build_threads -lt 2 ]] && build_threads=2
|
||||||
|
|
||||||
|
BUILD_DEPS=0
|
||||||
|
for (( i=1; i<=$#; ++i )); do
|
||||||
|
arg="${!i}"
|
||||||
|
if [[ "$arg" = "--deps" ]]; then
|
||||||
|
BUILD_DEPS=1
|
||||||
|
elif [[ "$arg" = "--help" ]]; then
|
||||||
|
help_page
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "invalid arg $arg" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
premake_exe=./"third-party/common/linux/premake/premake5"
|
||||||
|
if [[ ! -f "$premake_exe" ]]; then
|
||||||
|
echo "preamke wasn't found" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
chmod 777 "$premake_exe"
|
||||||
|
|
||||||
|
# build deps
|
||||||
|
if [[ $BUILD_DEPS = 1 ]]; then
|
||||||
|
export CMAKE_GENERATOR="Unix Makefiles"
|
||||||
|
"$premake_exe" --file="premake5-deps.lua" --all-ext --all-build --64-build --32-build --verbose --clean --os=linux gmake2 || {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$premake_exe" --genproto --os=linux gmake2 || {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pushd ./"build/project/gmake2/linux"
|
||||||
|
|
||||||
# going into build dir
|
|
||||||
cd build/project/gmake2/linux
|
|
||||||
# you can select individual or all
|
# you can select individual or all
|
||||||
|
|
||||||
# make config=debug_x32
|
echo; echo building debug x64
|
||||||
make config=debug_x32
|
make -j $build_threads config=debug_x64 || {
|
||||||
make config=debug_x64
|
exit 1;
|
||||||
make config=release_x32
|
}
|
||||||
make config=release_x64
|
|
||||||
|
|
||||||
cd ..
|
echo; echo building debug x32
|
||||||
|
make -j $build_threads config=debug_x32 || {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo; echo building release x64
|
||||||
|
make -j $build_threads config=release_x64 || {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo; echo building release x32
|
||||||
|
make -j $build_threads config=release_x32 || {
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
popd
|
||||||
|
@ -1,52 +1,120 @@
|
|||||||
@echo off
|
@echo off
|
||||||
call "third-party\common\win\premake\premake5.exe" --os=windows --file="premake5.lua" genproto
|
setlocal
|
||||||
call "third-party\common\win\premake\premake5.exe" --os=windows --file="premake5.lua" vs2022
|
|
||||||
|
:: use 70%
|
||||||
|
set /a build_threads=2
|
||||||
|
if defined NUMBER_OF_PROCESSORS (
|
||||||
|
set /a build_threads=NUMBER_OF_PROCESSORS*70/100
|
||||||
|
)
|
||||||
|
if %build_threads% lss 1 (
|
||||||
|
set /a build_threads=1
|
||||||
|
)
|
||||||
|
|
||||||
|
set /a BUILD_DEPS=0
|
||||||
|
:args_loop
|
||||||
|
if "%~1"=="" (
|
||||||
|
goto :args_loop_end
|
||||||
|
) else if "%~1"=="--deps" (
|
||||||
|
set /a BUILD_DEPS=1
|
||||||
|
) else if "%~1"=="--help" (
|
||||||
|
call :help_page
|
||||||
|
goto :end_script
|
||||||
|
) else (
|
||||||
|
1>&2 echo "invalid arg %~1"
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
shift /1
|
||||||
|
goto :args_loop
|
||||||
|
:args_loop_end
|
||||||
|
|
||||||
|
set "premake_exe=third-party\common\win\premake\premake5.exe"
|
||||||
|
if not exist "%premake_exe%" (
|
||||||
|
1>&2 echo "preamke wasn't found"
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
:: build deps
|
||||||
|
if %BUILD_DEPS%==0 (
|
||||||
|
goto :build_deps_end
|
||||||
|
)
|
||||||
|
set "CMAKE_GENERATOR=Visual Studio 17 2022"
|
||||||
|
call "%premake_exe%" --file="premake5-deps.lua" --all-ext --all-build --64-build --32-build --verbose --clean --os=windows vs2022
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
:build_deps_end
|
||||||
|
|
||||||
:: VS WHERE to get MSBUILD
|
:: VS WHERE to get MSBUILD
|
||||||
set "vswhere_exe=third-party\common\win\vswhere\vswhere.exe"
|
set "vswhere_exe=third-party\common\win\vswhere\vswhere.exe"
|
||||||
if not exist "%vswhere_exe%" (
|
if not exist "%vswhere_exe%" (
|
||||||
echo "vswhere.exe wasn't found"
|
1>&2 echo "vswhere wasn't found"
|
||||||
goto :end_script_with_err
|
goto :end_script_with_err
|
||||||
)
|
)
|
||||||
set "my_vs_path=%vs_static_path%"
|
|
||||||
if "%my_vs_path%"=="" (
|
:: .sln file
|
||||||
for /f "tokens=* delims=" %%A in ('"%vswhere_exe%" -prerelease -latest -nocolor -nologo -property installationPath 2^>nul') do (
|
set "sln_file=build\project\vs2022\win\gbe.sln"
|
||||||
set "my_vs_path=%%~A\MSBuild\Current\Bin\MSBuild.exe"
|
|
||||||
)
|
:: get msbuild path
|
||||||
|
set "my_vs_path="
|
||||||
|
for /f "tokens=* delims=" %%A in ('"%vswhere_exe%" -prerelease -latest -nocolor -nologo -property installationPath 2^>nul') do (
|
||||||
|
set "my_vs_path=%%~A\MSBuild\Current\Bin\MSBuild.exe"
|
||||||
)
|
)
|
||||||
goto :builder
|
if not exist "%my_vs_path%" (
|
||||||
|
1>&2 echo "MSBuild wasn't found"
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
call "%premake_exe%" --file="premake5.lua" --dosstub --winrsrc --winsign --genproto --os=windows vs2022
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
if not exist "%sln_file%" (
|
||||||
|
1>&2 echo "project solution file wasn't found"
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
:: -v:n make it so we can actually see what commands it runs
|
||||||
|
echo: & echo building debug x64
|
||||||
|
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=debug /p:Platform=x64 -v:n /MP%build_threads%
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
echo: & echo building debug x32
|
||||||
|
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=debug /p:Platform=Win32 -v:n /MP%build_threads%
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
echo: & echo building release x64
|
||||||
|
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=release /p:Platform=x64 -v:n /MP%build_threads%
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
echo: & echo building release x32
|
||||||
|
call "%my_vs_path%" /nologo "%sln_file%" /p:Configuration=release /p:Platform=Win32 -v:n /MP%build_threads%
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
goto :end_script_with_err
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
:: if all ok
|
||||||
|
:end_script
|
||||||
|
endlocal
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
|
||||||
:: exit with error
|
:: exit with error
|
||||||
:end_script_with_err
|
:end_script_with_err
|
||||||
popd
|
endlocal
|
||||||
endlocal & (
|
exit /b 1
|
||||||
exit /b 1
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
:builder
|
:help_page
|
||||||
|
echo:
|
||||||
:: -v:n make it so we can actually see what commands it runs
|
echo "%~nx0" [switches]
|
||||||
call %my_vs_path% build\project\vs2022\win\GBE.sln /p:Configuration=debug /p:Platform=x64 -v:n
|
echo switches:
|
||||||
set /a _exit=%errorlevel%
|
echo --deps: rebuild third-party dependencies
|
||||||
if %_exit% equ 1 (
|
echo --help: show this page
|
||||||
goto :end_script_with_err
|
exit /b 0
|
||||||
)
|
|
||||||
|
|
||||||
call %my_vs_path% build\project\vs2022\win\GBE.sln /p:Configuration=debug /p:Platform=Win32 -v:n
|
|
||||||
set /a _exit=%errorlevel%
|
|
||||||
if %_exit% equ 1 (
|
|
||||||
goto :end_script_with_err
|
|
||||||
)
|
|
||||||
|
|
||||||
call %my_vs_path% build\project\vs2022\win\GBE.sln /p:Configuration=release /p:Platform=x64 -v:n
|
|
||||||
set /a _exit=%errorlevel%
|
|
||||||
if %_exit% equ 1 (
|
|
||||||
goto :end_script_with_err
|
|
||||||
)
|
|
||||||
|
|
||||||
call %my_vs_path% build\project\vs2022\win\GBE.sln /p:Configuration=release /p:Platform=Win32 -v:n
|
|
||||||
set /a _exit=%errorlevel%
|
|
||||||
if %_exit% equ 1 (
|
|
||||||
goto :end_script_with_err
|
|
||||||
)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user