Update build instructions for Skia m96 & Apple Silicon (#2451)

This commit is contained in:
David Capello 2021-11-16 21:20:00 -03:00
parent f93b33f248
commit 82d93a8697
3 changed files with 42 additions and 14 deletions

View File

@ -31,8 +31,9 @@ set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/laf/cmake/cxx
project(aseprite C CXX)
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
# As we compile with CMAKE_OSX_DEPLOYMENT_TARGET=10.7, we have to
# explicitly say that we want to use libc++ instead of the GNU libstdc++
# As we compile with CMAKE_OSX_DEPLOYMENT_TARGET=10.9, we have to
# explicitly say that we want to use libc++ instead of the GNU
# libstdc++
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
@ -277,15 +278,7 @@ include_directories(${FREETYPE_INCLUDE_DIRS})
if(USE_SHARED_HARFBUZZ)
find_package(HarfBuzz)
else()
if(LAF_BACKEND STREQUAL "skia")
# Use the Skia harfbuzz (it's a modified version with C++11
# mutexes).
add_definitions(-DHAVE_CONFIG_OVERRIDE_H=1)
set(HARFBUZZ_LIBRARIES ${SKIA_HARFBUZZ_LIBRARY})
set(HARFBUZZ_INCLUDE_DIRS
${SKIA_DIR}/third_party/harfbuzz
${SKIA_DIR}/third_party/externals/harfbuzz/src)
else()
if(NOT LAF_BACKEND STREQUAL "skia")
set(HARFBUZZ_LIBRARIES harfbuzz)
set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_DIR}/src)
endif()
@ -348,6 +341,16 @@ set(LAF_WITH_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable LAF tests")
set(UNDO_TESTS ${ENABLE_TESTS} CACHE BOOL "Enable undo tests")
add_subdirectory(laf)
# Use the Skia harfbuzz (it's a modified version with C++11 mutexes).
if(LAF_BACKEND STREQUAL "skia")
add_definitions(-DHAVE_CONFIG_OVERRIDE_H=1)
set(HARFBUZZ_LIBRARIES ${SKIA_HARFBUZZ_LIBRARY})
set(HARFBUZZ_INCLUDE_DIRS
${SKIA_DIR}/third_party/harfbuzz
${SKIA_DIR}/third_party/externals/harfbuzz/src)
endif()
add_subdirectory(src)
######################################################################

View File

@ -163,7 +163,7 @@ Run `cmake` with the following parameters and then `ninja`:
-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.15.sdk \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
-DLAF_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-x64 \
@ -175,9 +175,28 @@ Run `cmake` with the following parameters and then `ninja`:
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`),
`/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`),
but it could be different in your Mac.
### Apple Silicon
If you running macOS on an ARM64/AArch64/Apple Silicon Mac (e.g. M1),
you can compile a native ARM64 version of Aseprite following the same
steps as above but when we call `cmake`, we have some differences:
cmake \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
-DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk \
-DLAF_BACKEND=skia \
-DSKIA_DIR=$HOME/deps/skia \
-DSKIA_LIBRARY_DIR=$HOME/deps/skia/out/Release-arm64 \
-DSKIA_LIBRARY=$HOME/deps/skia/out/Release-arm64/libskia.a \
-DPNG_ARM_NEON:STRING=on \
-G Ninja \
..
### Issues with Retina displays
If you have a Retina display, check the following issue:
@ -204,6 +223,12 @@ Run `cmake` with the following parameters and then `ninja`:
In this case, `$HOME/deps/skia` is the directory where Skia was
compiled or uncompressed.
### GCC compiler
In case that you are using the pre-compiled Skia version, you will
need to use the Clang compiler to compile Aseprite. Only if you
compile Skia with GCC, you will be able to compile Aseprite with GCC.
# Using shared third party libraries
If you don't want to use the embedded code of third party libraries

View File

@ -90,7 +90,7 @@ if(NOT USE_SHARED_FREETYPE)
endif()
endif()
if(NOT USE_SHARED_HARFBUZZ)
if(NOT USE_SHARED_HARFBUZZ AND NOT LAF_BACKEND STREQUAL "skia")
if(NOT USE_SHARED_FREETYPE)
set(ENV{FREETYPE_DIR} ${FREETYPE_DIR})
endif()