-
-
Notifications
You must be signed in to change notification settings - Fork 79
Building libpng apng
We support the new animated PNG format, but this requires some custom building to get the functionality we need. Specifically, we need to patch an existing release of libpng to add the animated PNG support.
We have an automated script to help you download and build the latest libpng-apng!
Before running this script, make sure you have a compiler installed (GCC/Clang), as well as the zlib development files installed. If you're not sure how, search online for "YOUR_DISTRO_NAME install c compiler" and "YOUR_DISTRO_NAME install zlib dev" for instructions. (We wish we could be more specific, but there are too many distros out there to cover here!)
- Open a terminal and navigate to the CEmu source tree. (e.g.
cd ~/Downloads/CEmu
) - Run:
cd ./gui/qt/capture && ./get_libpng-apng.sh
- Follow any directions needed on the screen - enjoy!
We have an automated script to help you download and build the latest libpng-apng! Note that for this to work, you may need to XCode and/or pkg-config (from brew).
- Open Terminal and navigate to the CEmu source tree. (e.g.
cd ~/Downloads/CEmu
) - Run:
cd ./gui/qt/capture && ./get_libpng-apng.sh
- Follow any directions needed on the screen - enjoy!
There are two ways you can build libpng-apng: either with MinGW/MSYS2, or with MSVC.
If you are using MinGW/MSYS2, follow the steps above for Linux, substituting as necessary.
If you are using MSVC, these are the steps for you!
For all steps requiring downloading and extracting, make sure to download and extract them into the same directory. You can use 7-zip to extract the files necessary for building.
-
Download and extract the latest libpng release from here.
-
Download and extract the patch that matches the version you've downloaded here. Note that if a patch is not available for the version you've selected, you should re-do step #1 with the latest version you see here.
-
Download and extract the latest zlib release from here.
-
Download the patch binaries from here. Extract the entirety to a folder that you know about (e.g.
C:\Users\USER\Downloads
). -
Open a Command Prompt and enter the directory where you have your extracted libpng release. (e.g.
cd C:\libpng-1.6.34
) -
Type in this command, and make sure it completes successfully:
C:\full_path_to\patch.exe -Np1 -i path_to_patch
If this fails, make sure you are within the libpng source tree. -
Now enter your
libpng-x.x.x/projects/vstudio/
directory. Inside there should be azlib.props
file - edit this to point to the correctzlib-x.x.x
folder. (If you put everything into the same folder, this should be easy to edit!) -
Now open
vstudio.sln
. If you're using a newer version of Visual Studio, it will ask you to upgrade. Simply say yes. -
ONLY IF YOU WANT 64-BIT BUILDS: Follow these steps on each project to enable x64 builds. Make sure to follow "To copy Win32 project settings into a 64-bit project configuration" to copy the appropriate settings over.
-
Now you have two choices - you can either build everything directly within the Visual Studio GUI, or you can run it via MSBuild.
-
If you decide to use the GUI, just pick the configuration you want to build and hit Build (play icon). Everything should start building from there.
-
If you decide to use MSBuild, make sure to source the
vcvarsall.bat
script from the MSVC directory. (Alternatively, you can just use the MSBuild Command Prompt, found in your Start Menu.) Once you're in, simply typemsbuild vstudio.sln /p:Configuration="CONFIG"
to get things going. Note that you will need to use the appropriate environment for setting the build architecture, e.g. runningvcvarsall.bat x64
to get 64-bit building support. You may also need/p:Platform="x86"
as well. -
Targets include Release/Debug and Release/Debug Library. Release/Debug will build a DLL, and Release/Debug Library will build a static library. Note that build configurations should match across the whole build process - if you want to build CEmu statically in release mode, you will need a static release of libpng/zlib, as well as a static release of Qt.
-
-
Once you are done building, copy your
*.lib
,*.dll
, and*.pdb
files to a location where you want to store your libpng-apng libraries (e.g.C:\libpng-apng\lib
). Include the zlib files as well - you WILL need these! -
Copy
png.h
,pngconf.h
, andpngpriv.h
to a location where you want to store your libpng-apng includes (e.g.C:\libpng-apng\include
). -
That's it - you're done! For MSVC builds of CEmu, you will need to set the following environment variables for QMake/Qt Creator:
LIBPNG_APNG_LIB
,ZLIB_LIB
, andLIBPNG_APNG_INCLUDE
, pointing to their respective folders.