With recommendations from: * https://github.com/aseprite/aseprite/pull/2046 * https://github.com/aseprite/aseprite/issues/1910#issuecomment-435145683
12 KiB
Table of contents
- Platforms
- Get the source code
- Dependencies
- Compiling
- Using shared third party libraries
- Building Skia dependency
Platforms
You should be able to compile Aseprite successfully on the following platforms:
- Windows 10 + Visual Studio Community 2019 + Windows 10.0.17763.0 SDK
- macOS 10.14.4 Mojave + Xcode 10.2.1 + macOS 10.14 SDK
- Linux + gcc 4.8 or clang 7.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
git pull
git submodule update --init --recursive
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
- You will need a compiled version of the Skia library. Please check the details about how to build Skia on your platform.
Windows dependencies
First of all, you will need:
- Windows 10 (we don't support cross-compiling and don't know if this would be possible)
- Visual Studio Community 2019
- The Desktop development with C++ item + Windows 10.0.17763.0 SDK from the Visual Studio installer
You will need to compile Skia before and then
continue in the Compiling section. Remember to check the
Windows details section to know how to call
cmake
correctly.
macOS dependencies
On macOS you will need macOS 10.14 SDK and Xcode 10.2.1 (older versions might work).
You must also compile Skia before starting with the compilation.
Linux dependencies
You will need the following dependencies on Ubuntu/Debian:
sudo apt-get install -y g++ cmake ninja-build libx11-dev libxcursor-dev libgl1-mesa-dev libfontconfig1-dev
On Fedora:
sudo yum install -y gcc-c++ cmake ninja-build libX11-devel libXcursor-devel mesa-libGL-devel fontconfig-devel
You must also compile Skia before starting with the compilation.
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 build
In 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 ..
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 aseprite
-
When
ninja
finishes the compilation, you can find the executable insideC:\aseprite\build\bin\aseprite.exe
.
Windows details
After you've compiled Skia,
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
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLAF_OS_BACKEND=skia -DSKIA_DIR=C:\deps\skia -DSKIA_OUT_DIR=C:\deps\skia\out\Release -G Ninja ..
ninja aseprite
In this case, C:\deps\skia
is the directory where Skia was compiled
as described in Skia on Windows section.
macOS details
After compiling Skia, you should run cmake
with
the following parameters and then ninja
:
cd aseprite
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk \
-DLAF_OS_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_OUT_DIR=$HOME/deps/skia/out/Release \
-G Ninja \
..
ninja aseprite
In this case, $HOME/deps/skia
is the directory where Skia was
compiled as described in Skia on macOS section.
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.14.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
First you have to compile Skia, then you should run
cmake
with the following parameters and then ninja
:
cd aseprite
mkdir build
cd build
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLAF_OS_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_OUT_DIR=$HOME/deps/skia/out/Release \
-G Ninja \
..
ninja aseprite
In this case, $HOME/deps/skia
is the directory where Skia was
compiled as described in Skia on Linux section.
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.
Building Skia dependency
When you compile Aseprite with Skia as back-end on Windows or macOS, you need to compile a specific version of Skia. In the following sections you will find straightforward steps to compile Skia.
You can always check the
official Skia instructions and select
the OS you are building for. Aseprite uses the aseprite-m71
Skia
branch from https://github.com/aseprite/skia
.
Skia on Windows
Download
Google depot tools
and uncompress it in some place like C:\deps\depot_tools
.
It's recommended to compile Skia with Clang
to get better performance. So you will need to download Clang,
and install it on a folder like C:\deps\llvm
(a folder without whitespaces).
Open a developer command prompt
or command line (cmd.exe
) and call:
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat" -arch=x64
Then:
set PATH=C:\deps\depot_tools;%PATH%
cd C:\deps\depot_tools
gclient sync
(The gclient
command might print an error like
Error: client not configured; see 'gclient config'
.
Just ignore it.)
cd C:\deps
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
cd skia
set GIT_EXECUTABLE=git.bat
python tools/git-sync-deps
(The tools/git-sync-deps
will take some minutes because it downloads
a lot of packages, please wait and re-run the same command in case it
fails.)
Finally, if you've downloaded Clang, use this command:
set PATH=C:\deps\llvm\bin;%PATH%
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false target_cpu=""x64"" cc=""clang"" cxx=""clang++"" clang_win=""c:\deps\llvm"" win_vc=""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"""
ninja -C out/Release skia
If you haven't installed Clang, and want to compile Skia with MSVC (anyway it's not recommended because the performance penalty is too big), you can use the following commands instead:
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false target_cpu=""x64"" win_vc=""C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC"""
ninja -C out/Release skia
More information about these steps in the official Skia documentation.
Skia on macOS
These steps will create a deps
folder in your home directory with a
couple of subdirectories needed to build Skia (you can change the
$HOME/deps
with other directory). Some of these commands will take
several minutes to finish:
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps
gn gen out/Release --args="is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false extra_cflags_cc=[\"-frtti\"]"
ninja -C out/Release skia
After this you should have all Skia libraries compiled. When you
compile Aseprite, remember to add
-DSKIA_DIR=$HOME/deps/skia
parameter to your cmake
call as
described in the macOS details section.
More information about these steps in the official Skia documentation.
Skia on Linux
These steps will create a deps
folder in your home directory with a
couple of subdirectories needed to build Skia (you can change the
$HOME/deps
with other directory). Some of these commands will take
several minutes to finish:
mkdir $HOME/deps
cd $HOME/deps
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
git clone -b aseprite-m71 https://github.com/aseprite/skia.git
export PATH="${PWD}/depot_tools:${PATH}"
cd skia
python tools/git-sync-deps
gn gen out/Release --args="is_debug=false is_official_build=true skia_use_system_expat=false skia_use_system_icu=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false"
ninja -C out/Release skia
After this you should have all Skia libraries compiled. When you
compile Aseprite, remember to add
-DSKIA_DIR=$HOME/deps/skia
parameter to your cmake
call as
described in the Linux details section.
More information about these steps in the official Skia documentation.