mirror of
https://github.com/AdvDebug/Brovan
synced 2026-08-09 11:57:17 +00:00
Fix compilation issue for linux
This commit is contained in:
+12
-1
@@ -17,7 +17,18 @@
|
||||
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Target Name="CopyUnicornLinux"
|
||||
AfterTargets="Build"
|
||||
Condition="$([MSBuild]::IsOSPlatform('Linux'))">
|
||||
|
||||
<Copy SourceFiles="$(ProjectDir)Resources/libunicorn.so"
|
||||
DestinationFolder="$(TargetDir)"
|
||||
SkipUnchangedFiles="true"
|
||||
ContinueOnError="true" />
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="$([MSBuild]::IsOSPlatform('Windows'))">
|
||||
<Exec Command="@echo off
:: Detect if this is a Linux target build
set "RID=$(RuntimeIdentifier)"
set "IS_LINUX=0"
if not "%25RID%25"=="" (
 echo %25RID%25 | findstr /i "linux" >nul 2>&1
 if not errorlevel 1 set "IS_LINUX=1"
)

:: Copy the appropriate unicorn library to the target directory
if "%25IS_LINUX%25"=="1" (
 copy /Y "$(ProjectDir)Resources\libunicorn.so" "$(TargetDir)" >nul 2>&1
 if errorlevel 1 (
 echo Warning: Failed to copy libunicorn.so to the target path.
 ) else (
 echo Copied libunicorn.so to the target path successfully.
 )
) else (
 copy /Y "$(ProjectDir)Resources\unicorn.dll" "$(TargetDir)" >nul 2>&1
 if errorlevel 1 (
 echo Warning: Failed to copy unicorn.dll to the target path.
 ) else (
 echo Copied unicorn.dll to the target path successfully.
 )
)

:: Skip editbin entirely for Linux builds
if "%25IS_LINUX%25"=="1" (
 echo Skipping editbin for Linux build.
 exit /b 0
)

:: Get the target path (which is the dll)
set "ORIGINAL_PATH=$(TargetPath)"
:: Replace the target path dll extension with an exe extension to pass it to editbin later.
set "MODIFIED_PATH=%25ORIGINAL_PATH:.dll=.exe%25"
echo Calling VsDevCmd.bat...
call "$(DevEnvDir)..\Tools\VsDevCmd.bat" >nul 2>&1
if errorlevel 1 (
 echo Warning: Couldn't execute visual studio developer command prompt.
 exit /b 0
)
:: Check if editbin.exe is now available
where editbin.exe >nul 2>&1
if errorlevel 1 (
 echo Warning: editbin.exe not found in environment. CFG won't be disabled, Brovan will try to disable it at runtime.
) else (
 :: Disable CFG using editbin.exe
 editbin.exe /GUARD:NO %25MODIFIED_PATH%25 >nul 2>&1
 if errorlevel 1 (
 echo editbin.exe failed to run, CFG won't be disabled so Brovan will try to disable it at runtime.
 ) else (
 echo Disabled CFG using editbin.exe successfully.
 )
)
exit /b 0" />
|
||||
</Target>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user