Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for Building on Linux with Dark Haxx™ #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 82 additions & 24 deletions BuildHelper/BuildHelper.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_ML|AnyCPU'">
<TargetFramework>net472</TargetFramework>
<TargetFrameworkIdentifier>.NETCOREAPP</TargetFrameworkIdentifier>
<TargetFrameworkVersion>4.7.2</TargetFrameworkVersion>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
Expand All @@ -20,6 +22,8 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_BIE|AnyCPU'">
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworkIdentifier>.NETCOREAPP</TargetFrameworkIdentifier>
<TargetFrameworkVersion>6.0</TargetFrameworkVersion>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -31,7 +35,22 @@

<Target Name="Buildthing" AfterTargets="Build">
<Message Importance="High" Text="[#0] Cleaning out directory" />
<Exec Command="REM&#xD;&#xA; if exist $(MSBuildProjectDirectory)\..\out\TheArchive.Core.dll del $(MSBuildProjectDirectory)\..\out\TheArchive.Core.dll&#xD;&#xA; if exist $(MSBuildProjectDirectory)\..\out\TheArchive.Core.pdb del $(MSBuildProjectDirectory)\..\out\TheArchive.Core.pdb" />
<Exec Condition="!$([MSBuild]::IsOSUnixLike())"
Command="
REM&#xD;&#xA;
if exist $(MSBuildProjectDirectory)\..\out\TheArchive.Core.dll del $(MSBuildProjectDirectory)\..\out\TheArchive.Core.dll&#xD;&#xA;
if exist $(MSBuildProjectDirectory)\..\out\TheArchive.Core.pdb del $(MSBuildProjectDirectory)\..\out\TheArchive.Core.pdb"
/>
<Exec Condition="$([MSBuild]::IsOSUnixLike())"
Command="
if [ -e '$(MSBuildProjectDirectory)/../out/TheArchive.Core.dll' ]; then
rm '$(MSBuildProjectDirectory)/../out/TheArchive.Core.dll'
fi

if [ -e '$(MSBuildProjectDirectory)/../out/TheArchive.Core.pdb' ]; then
rm '$(MSBuildProjectDirectory)/../out/TheArchive.Core.pdb'
fi
"/>

<Message Importance="High" Text="[#0.1] Building Core Mod" />
<MSBuild Projects="$(MSBuildProjectDirectory)\..\TheArchive.Core\TheArchive.Core.csproj" ContinueOnError="false" BuildInParallel="false" />
Expand Down Expand Up @@ -70,29 +89,68 @@

<!-- Frankenstein build smh -->
<Target Name="BuildLastSteps" AfterTargets="Buildthing" >
<Exec Command="ECHO [#2] Building IL2CPP/MONO Support-Modules ...
cd $(MSBuildProjectDirectory)\..\TheArchive.IL2CPP\
ECHO [#2.1] Building IL2CPP Support-Module ...
dotnet clean -f $(TargetFramework) -c $(Configuration)
dotnet build -f $(TargetFramework) -c $(Configuration)

cd $(MSBuildProjectDirectory)\..\TheArchive.MONO\
if '$(Configuration)' == 'R_ML' (
ECHO [#2.2] Building MONO Support-Module ...
dotnet build -f $(TargetFramework) -c $(Configuration)
) ELSE (
if exist $(MSBuildProjectDirectory)\..\TheArchive.Core\Resources\TheArchive.MONO.dll del /F $(MSBuildProjectDirectory)\..\TheArchive.Core\Resources\TheArchive.MONO.dll
ECHO DUMMY > $(MSBuildProjectDirectory)\..\TheArchive.Core\Resources\TheArchive.MONO.dll
)
ECHO [#3] Building Core Mod
cd $(MSBuildProjectDirectory)\..\TheArchive.Core\
dotnet clean -f $(TargetFramework) -c $(Configuration)
dotnet build -f $(TargetFramework) -c $(Configuration)

ECHO [#4] Copying $(Configuration) TheArchive.Core.dll to out directory.
if exist &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.dll&quot; copy /y &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.dll&quot; &quot;$(SolutionDir)out\&quot;
if exist &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.pdb&quot; copy /y &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.pdb&quot; &quot;$(SolutionDir)out\&quot;" />

<Exec Condition="!$([MSBuild]::IsOSUnixLike())"
Command="
ECHO [#2] Building IL2CPP/MONO Support-Modules ...
cd $(MSBuildProjectDirectory)\..\TheArchive.IL2CPP\
ECHO [#2.1] Building IL2CPP Support-Module ...
dotnet clean -f $(TargetFramework) -c $(Configuration)
dotnet build -f $(TargetFramework) -c $(Configuration)

cd $(MSBuildProjectDirectory)\..\TheArchive.MONO\
if '$(Configuration)' == 'R_ML' (
ECHO [#2.2] Building MONO Support-Module ...
dotnet build -f $(TargetFramework) -c $(Configuration)
) ELSE (
if exist $(MSBuildProjectDirectory)\..\TheArchive.Core\Resources\TheArchive.MONO.dll del /F $(MSBuildProjectDirectory)\..\TheArchive.Core\Resources\TheArchive.MONO.dll
ECHO DUMMY > $(MSBuildProjectDirectory)\..\TheArchive.Core\Resources\TheArchive.MONO.dll
)
ECHO [#3] Building Core Mod
cd $(MSBuildProjectDirectory)\..\TheArchive.Core\
dotnet clean -f $(TargetFramework) -c $(Configuration)
dotnet build -f $(TargetFramework) -c $(Configuration)

ECHO [#4] Copying $(Configuration) TheArchive.Core.dll to out directory.
if exist &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.dll&quot; copy /y &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.dll&quot; &quot;$(SolutionDir)out\&quot;
if exist &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.pdb&quot; copy /y &quot;$(MSBuildProjectDirectory)\..\TheArchive.Core\bin\$(Configuration)\TheArchive.Core.pdb&quot; &quot;$(SolutionDir)out\&quot;"
/>
<Exec Condition="$([MSBuild]::IsOSUnixLike())"
Command="
echo '[#2] Building IL2CPP/MONO Support-Modules ...'
cd '$(MSBuildProjectDirectory)/../TheArchive.IL2CPP/'

echo '[#2.1] Building IL2CPP Support-Module ...'
dotnet clean -f $(TargetFramework) -c $(Configuration)
dotnet build -f $(TargetFramework) -c $(Configuration)
cd '$(MSBuildProjectDirectory)/../TheArchive.MONO/'
if [ '$(Configuration)' == 'R_ML' ]; then
echo '[#2.2] Building MONO Support-Module ...'
dotnet build -f $(TargetFramework) -c $(Configuration)
else
if [ -e '$(MSBuildProjectDirectory)/../TheArchive.Core/Resources/TheArchive.MONO.dll' ]; then
rm -f '$(MSBuildProjectDirectory)/../TheArchive.Core/Resources/TheArchive.MONO.dll'
fi
echo 'DUMMY' > '$(MSBuildProjectDirectory)/../TheArchive.Core/Resources/TheArchive.MONO.dll'
fi

echo '[#3] Building Core Mod'
cd '$(MSBuildProjectDirectory)/../TheArchive.Core/'
dotnet clean -f $(TargetFramework) -c $(Configuration)
dotnet build -f $(TargetFramework) -c $(Configuration)

echo '[#4] Copying $(Configuration) TheArchive.Core.dll to out/Localization directory.'
if [ -e '$(MSBuildProjectDirectory)/../TheArchive.Core/bin/$(Configuration)/TheArchive.Core.dll' ]; then
cp '$(MSBuildProjectDirectory)/../TheArchive.Core/bin/$(Configuration)/TheArchive.Core.dll' '$(SolutionDir)out/'
fi
if [ -e '$(MSBuildProjectDirectory)/../TheArchive.Core/bin/$(Configuration)/TheArchive.Core.pdb' ]; then
cp '$(MSBuildProjectDirectory)/../TheArchive.Core/bin/$(Configuration)/TheArchive.Core.pdb' '$(SolutionDir)out/'
fi

echo '[#5] Copying Localizations to out directory.'
if [ -d '$(MSBuildProjectDirectory)/../TheArchive.Core/Localization' ]; then
cp -r '$(MSBuildProjectDirectory)/../TheArchive.Core/Localization/' '$(SolutionDir)out/Localization/'
fi
"/>
</Target>

<PropertyGroup>
Expand Down
23 changes: 20 additions & 3 deletions TheArchive.Core/TheArchive.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</NuGetPackageImportStamp>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_ML|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)' == 'R_ML'">
<TargetFramework>net472</TargetFramework>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -23,7 +23,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_BIE|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)' == 'R_BIE'">
<TargetFramework>net6.0</TargetFramework>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -63,7 +63,7 @@
<None Include="packages.config" />
</ItemGroup>

<PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<PreBuildEvent>
cd $(MSBuildProjectDirectory)\Resources\
if exist TheArchive.IL2CPP.dll (
Expand All @@ -80,6 +80,23 @@
)
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<PreBuildEvent>
cd "$(MSBuildProjectDirectory)/Resources"
if [ -f "TheArchive.IL2CPP.dll" ]; then
echo "Not generating IL2CPP dummy dll"
else
echo "Generating IL2CPP dummy dll ..."
echo "DUMMY" > TheArchive.IL2CPP.dll
fi
if [ -f "TheArchive.MONO.dll" ]; then
echo "Not generating MONO dummy dll"
else
echo "Generating MONO dummy dll ..."
echo "DUMMY" > TheArchive.MONO.dll
fi
</PreBuildEvent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="GitInfo" Version="2.2.0" />
</ItemGroup>
Expand Down
12 changes: 9 additions & 3 deletions TheArchive.IL2CPP/TheArchive.IL2CPP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_ML|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)' == 'R_ML'">
<TargetFramework>net472</TargetFramework>
<DefineConstants>TRACE;IL2CPP</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand All @@ -23,7 +23,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_BIE|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)' == 'R_BIE'">
<TargetFramework>net6.0</TargetFramework>
<DefineConstants>TRACE;IL2CPP</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
Expand Down Expand Up @@ -171,10 +171,16 @@
<Folder Include="Properties\" />
</ItemGroup>

<PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<PostBuildEvent>
cd $(MSBuildProjectDirectory)
copy /y bin\$(Configuration)\TheArchive.IL2CPP.dll ..\TheArchive.Core\Resources\TheArchive.IL2CPP.dll
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<PostBuildEvent>
cd $(MSBuildProjectDirectory)
cp bin/$(Configuration)/TheArchive.IL2CPP.dll ../TheArchive.Core/Resources/TheArchive.IL2CPP.dll
</PostBuildEvent>
</PropertyGroup>
</Project>
12 changes: 9 additions & 3 deletions TheArchive.MONO/TheArchive.MONO.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<Deterministic>true</Deterministic>
<Configurations>R_ML;R_BIE</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'R_ML|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)' == 'R_ML'">
<TargetFramework>net472</TargetFramework>
<OutputPath>bin\R_ML\</OutputPath>
<DefineConstants>TRACE;MONO</DefineConstants>
Expand All @@ -22,7 +22,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='R_BIE|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)'=='R_BIE'">
<TargetFramework>net6.0</TargetFramework>
<OutputPath>bin\R_BIE\</OutputPath>
<DefineConstants>TRACE;MONO</DefineConstants>
Expand Down Expand Up @@ -311,10 +311,16 @@
<Reference Include="System.Net.Http" />
</ItemGroup>

<PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<PostBuildEvent>
cd $(MSBuildProjectDirectory)
copy /y bin\$(Configuration)\TheArchive.MONO.dll ..\TheArchive.Core\Resources\TheArchive.MONO.dll
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<PostBuildEvent>
cd $(MSBuildProjectDirectory)
cp bin/$(Configuration)/TheArchive.MONO.dll ../TheArchive.Core/Resources/TheArchive.MONO.dll
</PostBuildEvent>
</PropertyGroup>
</Project>