引言
本文将根据官方文档介绍Aseprite的编译安装方法。
官方说明文档
Platforms
You should be able to compile Aseprite successfully on the following platforms:
- Windows 10 + Visual Studio Community 2019 + Windows 10.0.18362.0 SDK (we don’t support MinGW)
- macOS 10.15.3 Mojave + Xcode 11.2.1 + macOS 10.15 SDK (older version might work)
- Linux + gcc 9.2 or clang 9.0
Get the source code
You can get the source code downloading a Aseprite-v1.x-Source.zip
file from the latest Aseprite release (in that case please follow the compilation instructions inside the .zip
file):
https://github.com/aseprite/aseprite/releases
Or you can clone the repository and all its submodules using the following command:
git clone --recursive https://github.com/aseprite/aseprite.git |
To update an existing clone you can use the following commands:
cd aseprite |
You can use Git for Windows to clone the repository on Windows.
Dependencies
To compile Aseprite you will need:
- The latest version of CMake (3.14 or greater)
- Ninja build system
- And a compiled version of the
aseprite-m81
branch of the Skia library. There are pre-built packages available. You can get some extra information in the laf dependencies page.
Windows dependencies
- Windows 10 (we don’t support cross-compiling)
- Visual Studio Community 2019 (we don’t support MinGW)
- The Desktop development with C++ item + Windows 10.0.18362.0 SDK from the Visual Studio installer
macOS dependencies
On macOS you will need macOS 10.15 SDK and Xcode 11.2.1 (older versions might work).
Linux dependencies
You will need the following dependencies on Ubuntu/Debian:
sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev |
On Fedora:
sudo dnf install -y gcc-c++ cmake ninja-build libX11-devel libXcursor-devel libXi-devel mesa-libGL-devel fontconfig-devel |
Compiling
Get Aseprite code, put it in a folder like
C:\aseprite
, and create abuild
directory inside to leave all the files that are result of the compilation process (.exe
,.lib
,.obj
,.a
,.o
, etc).cd C:\aseprite
mkdir buildIn this way, if you want to start with a fresh copy of Aseprite source code, you can remove the
build
directory and start again.Enter in the new directory and execute
cmake
:cd C:\aseprite\build
cmake -G Ninja -DLAF_BACKEND=skia ..Here
cmake
needs different options depending on your platform. You must check the details for Windows, macOS, and Linux. Somecmake
options can be modified using tools likeccmake
orcmake-gui
.After you have executed and configured
cmake
, you have to compile the project:cd C:\aseprite\build
ninja asepriteWhen
ninja
finishes the compilation, you can find the executable insideC:\aseprite\build\bin\aseprite.exe
.
Windows details
Open a developer command prompt or in the command line (cmd.exe
) call:
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=x64 |
And then
cd aseprite |
In this case, C:\deps\skia
is the directory where Skia was compiled or uncompressed.
MinGW
We don’t support MinGW compiler and it might bring some problems into the compilation process. If you see that the detected C++ compiler by cmake is C:\MinGW\bin\c++.exe
or something similar, you have to get rid of MinGW path (C:\MinGW\bin
) from the PATH
environment variable and run cmake again from scratch, so the Visual Studio C++ compiler (cl.exe
) is used instead.
You can define the CMAKE_IGNORE_PATH
variable when running cmake for the first time in case that you don’t know or don’t want to modify the PATH
variable, e.g.:
cmake -DCMAKE_IGNORE_PATH=C:\MinGW\bin ... |
More information in issue #2449
macOS details
Run cmake
with the following parameters and then ninja
:
cd aseprite |
In this case, $HOME/deps/skia
is the directory where Skia was compiled or downloaded. Make sure that CMAKE_OSX_SYSROOT
is pointing to the correct SDK directory (in this case /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
), but it could be different in your Mac.
Issues with Retina displays
If you have a Retina display, check the following issue:
https://github.com/aseprite/aseprite/issues/589
Linux details
Run cmake
with the following parameters and then ninja
:
cd aseprite |
In this case, $HOME/deps/skia
is the directory where Skia was compiled or uncompressed.
Using shared third party libraries
If you don’t want to use the embedded code of third party libraries (i.e. to use your installed versions), you can disable static linking configuring each USE_SHARED_
option.
After running cmake -G
, you can edit build/CMakeCache.txt
file, and enable the USE_SHARED_
flag (set its value to ON
) of the library that you want to be linked dynamically.