Skip to content

Commit

Permalink
Update Static Libs for AOT
Browse files Browse the repository at this point in the history
+ Pack the libraries and extract it only if AOT compilation is used
+ Ensure to use Link Target Optimization (LTO) on linker
+ (Hopefully) Fix some missing symbols at MachineIndependent.lib
  • Loading branch information
neon-nyan committed Jan 21, 2025
1 parent 574669c commit 8156a2c
Show file tree
Hide file tree
Showing 22 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
packages/*

CollapseLauncher/Deps/*
CollapseLauncher/StaticLib/*.lib
CollapseLauncher/StaticLib/**/*.lib
CollapseLauncher/Invoker/*
**/Generated Files/**
*.psd
Expand Down
7 changes: 6 additions & 1 deletion CollapseLauncher/CollapseLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
<NativeLibrary Include="StaticLib\Waifu2x\ncnn.lib" />
<NativeLibrary Include="StaticLib\Waifu2x\SPIRV.lib" />
<NativeLibrary Include="StaticLib\Waifu2x\glslang.lib" />
<NativeLibrary Include="StaticLib\Waifu2x\glslang-default-resource-limits.lib" />
<NativeLibrary Include="StaticLib\Waifu2x\OGLCompiler.lib" />
<NativeLibrary Include="StaticLib\Waifu2x\MachineIndependent.lib" />
<NativeLibrary Include="StaticLib\Waifu2x\GenericCodeGen.lib" />
Expand Down Expand Up @@ -347,6 +348,10 @@
<RemoveDir Directories="$(OutDir)Lib\win-x86" Condition="Exists('$(OutDir)Lib\win-x86')" />
</Target>

<Target Name="PreBuild-NativeAOTStaticLib" BeforeTargets="PreBuildEvent" Condition="'$(PublishAot)' == 'true'">
<Exec Command="&quot;$(ProjectDir)StaticLib\7za.exe&quot; x &quot;$(ProjectDir)StaticLib\StaticLib.7z&quot; -o&quot;$(ProjectDir)StaticLib\&quot; -y" />
</Target>

<Target Name="PostBuild" AfterTargets="Publish">
<Exec Command="del /s /q $(PublishDir)av*-58.dll $(PublishDir)av*-60.dll $(PublishDir)avfilter-9.dll $(PublishDir)av*.lib&#xD;&#xA;rd /s /q $(PublishDir)Lib\win-arm64 &amp; exit 0" Condition="$(DefineConstants.Contains('USEFFMPEGFORVIDEOBG'))" />
<Exec Command="copy /Y $(ProjectDir)$(OutDir)Lib\win-x64\Hi3Helper.TaskScheduler.exe $(PublishDir)Lib\win-x64\" />
Expand Down Expand Up @@ -385,7 +390,7 @@
</Target>

<ItemGroup Condition="'$(PublishAot)' == 'true'">
<LinkerArg Include="/DEBUG:NONE /NODEFAULTLIB:MSVCRT" />
<LinkerArg Include="/DEBUG:NONE /NODEFAULTLIB:MSVCRT /LTCG" />
</ItemGroup>

<ItemGroup>
Expand Down
Binary file added CollapseLauncher/StaticLib/7za.exe
Binary file not shown.
Binary file added CollapseLauncher/StaticLib/StaticLib.7z
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/Waifu2x/OGLCompiler.lib
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/Waifu2x/OSDependent.lib
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/Waifu2x/SPIRV.lib
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/Waifu2x/glslang.lib
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/Waifu2x/ncnn.lib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/libomp_msvc-release.lib
Binary file not shown.
Binary file not shown.
Binary file removed CollapseLauncher/StaticLib/libwebp_msvc-release.lib
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion ColorThief

0 comments on commit 8156a2c

Please sign in to comment.