Skip to content

Commit

Permalink
Merge pull request #90 from ahoefling/libde265
Browse files Browse the repository at this point in the history
Added libde265 as third-party Compilation Instead of Using vcpkg
  • Loading branch information
SkyeHoefling authored Feb 2, 2022
2 parents e9eba24 + da66998 commit 8a49d06
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
2 changes: 1 addition & 1 deletion BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ C:\Program Files\Meson
*In our environment `nasm` was not automatically added to the path, but the other dependencies were*

## Compile
First time compilation takes a very long time, after you start the build go grab a cup of ☕ or 🍵. Our build agent runs the entire clean build in about 25-35 minutes, your build times may vary. Future builds won't take as long even if you do a clean and rebuild as vcpkg will cache binaries in your user directory.
First time compilation takes a very long time, after you start the build go grab a cup of ☕ or 🍵. Our build agent runs the entire clean build in about 25-35 minutes, your build times may vary.

By compiling the main project `FileOnQ.Imaging.Heif` you will be compiling all native dependencies including the C++ encoding library `FileOnQ.Imaging.Heif.Encoders`. No need to run any additional compilation instructions.

Expand Down
8 changes: 8 additions & 0 deletions build/libde265.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@echo off
title Building libde265
set arch=%1
set config=%2
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %arch%
cd ../third-party/libde265-%arch%
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=%config% .
nmake
4 changes: 2 additions & 2 deletions build/libheif.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cmake -G"NMake Makefiles"^
-DJPEG_INCLUDE_DIR:PATH=%thirdPartyPath%\libjpeg-turbo-%arch%^
-DJPEG_LIBRARY_DEBUG:FILEPATH=%thirdPartyPath%\libjpeg-turbo-%arch%\jpeg.lib^
-DJPEG_LIBRARY_RELEASE:FILEPATH=%thirdPartyPath%\libjpeg-turbo-%arch%\jpeg.lib^
-DLIBDE265_INCLUDE_DIR:PATH=%thirdPartyPath%\vcpkg\installed\%arch%-windows\include^
-DLIBDE265_LIBRARY:FILEPATH=%thirdPartyPath%\vcpkg\installed\%arch%-windows\lib\libde265.lib^
-DLIBDE265_INCLUDE_DIR:PATH=%thirdPartyPath%\libde265-%arch%^
-DLIBDE265_LIBRARY:FILEPATH=%thirdPartyPath%\libde265-%arch%\libde265\libde265.lib^
..

nmake
28 changes: 28 additions & 0 deletions src/FileOnQ.Imaging.Heif/Build/libde265.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="15.0">

<Target Name="libde265-clone-x86" Condition="!Exists('$(ThirdPartyDir)/libde265-x86/README.md')">
<Exec Command="git clone https://github.com/strukturag/libde265.git libde265-x86" WorkingDirectory="$(ThirdPartyDir)" />
<Exec Command="git checkout v1.0.8" WorkingDirectory="$(ThirdPartyDir)/libde265-x86" />
</Target>

<Target Name="libde265-clone-x64" Condition="!Exists('$(ThirdPartyDir)/libde265-x64/README.md')">
<Exec Command="git clone https://github.com/strukturag/libde265.git libde265-x64" WorkingDirectory="$(ThirdPartyDir)" />
<Exec Command="git checkout v1.0.8" WorkingDirectory="$(ThirdPartyDir)/libde265-x64" />
</Target>

<Target Name="libde265" DependsOnTargets="libde265-clone-x64;libde265-clone-x86" Condition="!Exists('runtimes/win-x64/native/libde265.dll') and !Exists('runtimes/win-x86/native/libde265.dll')">
<Exec Command="libde265.bat x86 $(Configuration)" WorkingDirectory="$(ThirdPartyDir)/../build" />
<Exec Command="libde265.bat x64 $(Configuration)" WorkingDirectory="$(ThirdPartyDir)/../build" />

<Copy SourceFiles="$(ThirdPartyDir)/libde265-x86/libde265/libde265.dll" DestinationFolder="runtimes/win-x86/native" />
<Copy SourceFiles="$(ThirdPartyDir)/libde265-x64/libde265/libde265.dll" DestinationFolder="runtimes/win-x64/native" />
</Target>

<Target Name="libde265-clean" BeforeTargets="Clean">
<Exec Command="rmdir /s /q libde265-x86" WorkingDirectory="$(ThirdPartyDir)" Condition="Exists('$(ThirdPartyDir)/libde265-x86/README.md')" />
<Exec Command="rmdir /s /q libde265-x64" WorkingDirectory="$(ThirdPartyDir)" Condition="Exists('$(ThirdPartyDir)/libde265-x64/README.md')" />
<Delete Files="runtimes/win-x86/native/libde265.dll" />
<Delete Files="runtimes/win-x64/native/libde265.dll" />
</Target>
</Project>
15 changes: 1 addition & 14 deletions src/FileOnQ.Imaging.Heif/Build/libheif.targets
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
<Copy SourceFiles="@(IncludeFiles_x64)" DestinationFiles="@(IncludeFiles_x64->'$(ThirdPartyDir)/libheif-x64/libheif/%(RecursiveDir)%(Filename)%(Extension)')" />
</Target>

<Target Name="LibHeif-Dependencies" DependsOnTargets="Vcpkg;libjpeg-turbo;dav1d" Condition="!Exists('dav1d.dll') and !Exists('libde265.dll')">
<Exec Command="vcpkg.exe install libde265:x64-windows" WorkingDirectory="$(ThirdPartyDir)/vcpkg" />
<Copy SourceFiles="$(ThirdPartyDir)/vcpkg/installed/x64-windows/bin/libde265.dll" DestinationFolder="runtimes/win-x64/native" />
<Exec Command="vcpkg.exe install libde265:x86-windows" WorkingDirectory="$(ThirdPartyDir)/vcpkg" />
<Copy SourceFiles="$(ThirdPartyDir)/vcpkg/installed/x86-windows/bin/libde265.dll" DestinationFolder="runtimes/win-x86/native" />
<Target Name="LibHeif-Dependencies" DependsOnTargets="libde265;libjpeg-turbo;dav1d" Condition="!Exists('dav1d.dll') and !Exists('libde265.dll')">
</Target>

<Target Name="LibHeif-Clone-x86" Condition="!Exists('$(ThirdPartyDir)/libheif-x86/README.md')">
Expand All @@ -40,20 +36,11 @@
<Exec Command="git checkout v1.12.0" WorkingDirectory="$(ThirdPartyDir)/libheif-x64" />
</Target>

<Target Name="Vcpkg" Condition="!Exists('$(ThirdPartyDir)/vcpkg/vcpkg.exe')">
<Exec Command="git clone https://github.com/microsoft/vcpkg" WorkingDirectory="$(ThirdPartyDir)" />
<Exec Command="bootstrap-vcpkg.bat" WorkingDirectory="$(ThirdPartyDir)/vcpkg" />
</Target>

<Target Name="LibHeif-Clean" BeforeTargets="Clean" >
<Exec Command="rmdir /s /q libheif-x86" WorkingDirectory="$(ThirdPartyDir)" Condition="Exists('$(ThirdPartyDir)/libheif-x86/README.md')" />
<Exec Command="rmdir /s /q libheif-x64" WorkingDirectory="$(ThirdPartyDir)" Condition="Exists('$(ThirdPartyDir)/libheif-x64/README.md')" />
</Target>

<Target Name="vcpkg-clean" BeforeTargets="Clean" Condition="Exists('$(ThirdPartyDir)/vcpkg/vcpkg.exe')">
<Exec Command="rmdir /s /q vcpkg" WorkingDirectory="$(ThirdPartyDir)" />
</Target>

<Target Name="CleanLibHeif" BeforeTargets="Clean">
<Delete Files="runtimes/win-x86/native/dav1d.dll" />
<Delete Files="runtimes/win-x86/native/heif.dll" />
Expand Down
3 changes: 2 additions & 1 deletion src/FileOnQ.Imaging.Heif/FileOnQ.Imaging.Heif.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
<Import Project="Build\build-properties.props" />
<Import Project="Build\dav1d.targets" />
<Import Project="Build\encoders.targets" />
<Import Project="Build\libheif.targets" />
<Import Project="Build\libde265.targets" />
<Import Project="Build\libjpeg-turbo.targets" />
<Import Project="Build\libheif.targets" />

</Project>

0 comments on commit 8a49d06

Please # to comment.