52 lines
1.6 KiB
PowerShell
52 lines
1.6 KiB
PowerShell
# Build configuration
|
|
$configuration = "Release"
|
|
$baseOutputPath = ".\artifacts"
|
|
|
|
# Determine current OS and platform
|
|
$currentPlatform = "win-x64" # Since we're running PowerShell, we're on Windows
|
|
Write-Host "Building for current platform: $currentPlatform"
|
|
|
|
# Create output directories
|
|
$exeOutputPath = "$baseOutputPath\exe"
|
|
$nativeOutputPath = "$baseOutputPath\native"
|
|
New-Item -ItemType Directory -Force -Path $exeOutputPath | Out-Null
|
|
New-Item -ItemType Directory -Force -Path $nativeOutputPath | Out-Null
|
|
|
|
# Build executable
|
|
Write-Host "Building executable..."
|
|
dotnet publish `
|
|
-c $configuration `
|
|
-r $currentPlatform `
|
|
--self-contained true `
|
|
-p:PublishDir=$exeOutputPath
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Executable build failed. Check the error messages above."
|
|
exit 1
|
|
}
|
|
|
|
# Build native shared library
|
|
Write-Host "Building native shared library..."
|
|
dotnet publish `
|
|
-c $configuration `
|
|
-r $currentPlatform `
|
|
--self-contained true `
|
|
-p:BuildType=lib `
|
|
-p:PublishDir=$nativeOutputPath
|
|
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host "Library build failed. Check the error messages above."
|
|
exit 1
|
|
}
|
|
|
|
# Rename the native library to the expected name
|
|
$dllPath = Join-Path $nativeOutputPath "FireflyClient.dll"
|
|
$libDllPath = Join-Path $nativeOutputPath "libFireflyClient.dll"
|
|
if (Test-Path $dllPath) {
|
|
Write-Host "Renaming native library to libFireflyClient.dll..."
|
|
Move-Item -Path $dllPath -Destination $libDllPath -Force
|
|
}
|
|
|
|
Write-Host "Build complete. Outputs available at:"
|
|
Write-Host "Executable: $exeOutputPath"
|
|
Write-Host "Native library: $nativeOutputPath" |