Skip to content

Instantly share code, notes, and snippets.

@xobs
Last active January 7, 2021 11:23
Show Gist options
  • Save xobs/e58715765a958bf4d648c2f578a410ae to your computer and use it in GitHub Desktop.
Save xobs/e58715765a958bf4d648c2f578a410ae to your computer and use it in GitHub Desktop.
Powershell script to build Renode
param (
[Boolean]$submodules = $true,
[switch]$debug = $false,
[switch]$clean = $false
)
$env:PATH += ";C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
# This should be the path to a "bin/" directory of the musl.cc toolchain,
# available for download from https://musl.cc/
$env:PATH += ";D:\Software\musl.cc\x86_64-w64-mingw32-native\bin\"
$target = "ReleaseWindows"
$target_path = "Release"
if ($debug) {
$target = "DebugWindows"
$target_path = "Debug"
}
# We should only do this if "-s" is passed, or if submodules
# are not initialized
if ($submodules) {
git submodule update --init --recursive
}
# It's unclear why this is a separate repository.
git -C lib clone https://github.com/renode/renode-resources.git resources
git -C lib/resources fetch
git -C lib/resources checkout origin/master
# Update references to Xwt
(Get-Content .\lib\termsharp\TermSharp.csproj)|
ForEach-Object {$_ -replace """xwt\\Xwt\\Xwt.csproj", """..\xwt\Xwt\Xwt.csproj"} |
Set-Content .\lib\termsharp\TermSharp.csproj
# Build CCTask, which is used to run subtasks
MSBuild /p:Configuration=Release /p:Platform="Any CPU" .\lib\cctask\CCTask.sln
# Copy the properties file, which contains various build environment settings
if (-not (Test-path output\properties.csproj)) {
Copy-Item src\Infrastructure\src\Emulator\Cores\windows-properties.csproj output\properties.csproj
}
# Run the "clean" task if the user requested
if ($clean) {
MSBuild /p:Configuration=ReleaseWindows /t:Clean Renode.sln
MSBuild /p:Configuration=DebugWindows /t:Clean Renode.sln
return
}
MSBuild /p:Configuration=$target Renode.sln
# copy llvm library
Copy-Item src/Infrastructure/src/Emulator/LLVMDisassembler/bin/$target_path/libLLVM.* output/bin/$target_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment