mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-21 18:17:10 +01:00
[harfbuzz,skia] Update and replace Skia dependencies with vcpkg (#11416)
This commit is contained in:
parent
edfc5ac1c3
commit
ec2b59b93e
@ -1,13 +1,13 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 019e205..8a464a5 100644
|
||||
index 71830b6f5..a25cb09dd 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -795,7 +795,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
||||
@@ -712,7 +712,7 @@ if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
|
||||
)
|
||||
install(EXPORT harfbuzzConfig
|
||||
NAMESPACE harfbuzz::
|
||||
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/harfbuzz
|
||||
+ DESTINATION share/harfbuzz
|
||||
)
|
||||
if (HB_BUILD_UTILS)
|
||||
if (WIN32 AND BUILD_SHARED_LIBS)
|
||||
if (HB_HAVE_ICU)
|
||||
install(TARGETS harfbuzz-icu
|
||||
|
@ -1,9 +1,8 @@
|
||||
Source: harfbuzz
|
||||
Version: 2.5.3-1
|
||||
Version: 2.6.6
|
||||
Description: HarfBuzz OpenType text shaping engine
|
||||
Homepage: https://github.com/behdad/harfbuzz
|
||||
Build-Depends: freetype[core], ragel, gettext (osx)
|
||||
Default-Features: ucdn
|
||||
|
||||
Feature: graphite2
|
||||
Build-Depends: graphite2
|
||||
@ -13,9 +12,6 @@ Feature: icu
|
||||
Build-Depends: icu
|
||||
Description: icu support for harfbuzz
|
||||
|
||||
Feature: ucdn
|
||||
Description: Builtin (UCDN) Unicode callbacks support
|
||||
|
||||
Feature: glib
|
||||
Build-Depends: glib
|
||||
Description: Glib Unicode callbacks support
|
||||
|
@ -1,11 +1,11 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2d6e77e8..36e4b4e6 100644
|
||||
index 9b21bef2c..ae741ef63 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -306,22 +306,14 @@ endif ()
|
||||
@@ -213,21 +213,13 @@ endif ()
|
||||
if (HB_HAVE_GLIB)
|
||||
add_definitions(-DHAVE_GLIB)
|
||||
|
||||
|
||||
- # https://github.com/WebKit/webkit/blob/master/Source/cmake/FindGLIB.cmake
|
||||
- find_package(PkgConfig)
|
||||
- pkg_check_modules(PC_GLIB QUIET glib-2.0)
|
||||
@ -18,14 +18,13 @@ index 2d6e77e8..36e4b4e6 100644
|
||||
+ find_package(Threads REQUIRED)
|
||||
+ find_package(unofficial-iconv REQUIRED)
|
||||
+ find_package(unofficial-glib CONFIG REQUIRED)
|
||||
|
||||
list(APPEND project_sources ${PROJECT_SOURCE_DIR}/src/hb-glib.cc)
|
||||
|
||||
list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-glib.h)
|
||||
|
||||
|
||||
- list(APPEND THIRD_PARTY_LIBS ${GLIB_LIBRARIES})
|
||||
-
|
||||
- mark_as_advanced(GLIB_LIBRARIES GLIBCONFIG_INCLUDE_DIR GLIB_INCLUDE_DIR)
|
||||
+ list(APPEND THIRD_PARTY_LIBS unofficial::glib::glib)
|
||||
endif ()
|
||||
|
||||
|
||||
if (HB_HAVE_ICU)
|
||||
|
@ -1,10 +1,8 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO harfbuzz/harfbuzz
|
||||
REF 2.5.3
|
||||
SHA512 d541463b3647fc2c7ddaa29aedcea1c3bde5e26e0d529384d66d630af3aaf2a4befb3c4d47c93833f099339a0f951fb132011a02c57fc00ba543bd1b17026ffa
|
||||
REF 2.6.6
|
||||
SHA512 3ddf3e6eccf28ca1441544f0b67e243c6a85a32122bfc0f8092b3cc465b20a25aa3cb72404070d2627b9e204f86412c3bfb9aaca272c5492d8448facc1971a7d
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
0001-fix-cmake-export.patch
|
||||
@ -26,44 +24,17 @@ if("${_contents}" MATCHES "find_library\\(GLIB_LIBRARIES")
|
||||
message(FATAL_ERROR "Harfbuzz's cmake must not directly find_library() glib.")
|
||||
endif()
|
||||
|
||||
SET(HB_HAVE_ICU "OFF")
|
||||
if("icu" IN_LIST FEATURES)
|
||||
SET(HB_HAVE_ICU "ON")
|
||||
endif()
|
||||
|
||||
SET(HB_HAVE_GRAPHITE2 "OFF")
|
||||
if("graphite2" IN_LIST FEATURES)
|
||||
SET(HB_HAVE_GRAPHITE2 "ON")
|
||||
endif()
|
||||
|
||||
## Unicode callbacks
|
||||
|
||||
# Builtin (UCDN)
|
||||
set(BUILTIN_UCDN OFF)
|
||||
if("ucdn" IN_LIST FEATURES)
|
||||
set(BUILTIN_UCDN ON)
|
||||
endif()
|
||||
|
||||
# Glib
|
||||
set(HAVE_GLIB OFF)
|
||||
if("glib" IN_LIST FEATURES)
|
||||
set(HAVE_GLIB ON)
|
||||
endif()
|
||||
|
||||
# At least one Unicode callback must be specified, or harfbuzz compilation fails
|
||||
if(NOT (BUILTIN_UCDN OR HAVE_GLIB))
|
||||
message(FATAL_ERROR "Error: At least one Unicode callback must be specified (ucdn, glib).")
|
||||
endif()
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
icu HB_HAVE_ICU
|
||||
graphite2 HB_HAVE_GRAPHITE2
|
||||
glib HB_HAVE_GLIB
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
OPTIONS ${FEATURE_OPTIONS}
|
||||
-DHB_HAVE_FREETYPE=ON
|
||||
-DHB_BUILTIN_UCDN=${BUILTIN_UCDN}
|
||||
-DHB_HAVE_ICU=${HB_HAVE_ICU}
|
||||
-DHB_HAVE_GLIB=${HAVE_GLIB}
|
||||
-DHB_HAVE_GRAPHITE2=${HB_HAVE_GRAPHITE2}
|
||||
-DHB_BUILD_TESTS=OFF
|
||||
OPTIONS_DEBUG
|
||||
-DSKIP_INSTALL_HEADERS=ON
|
||||
@ -74,7 +45,7 @@ vcpkg_fixup_cmake_targets()
|
||||
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
if (HAVE_GLIB)
|
||||
if ("glib" IN_LIST FEATURES)
|
||||
# Propagate dependency on glib downstream
|
||||
file(READ "${CURRENT_PACKAGES_DIR}/share/harfbuzz/harfbuzzConfig.cmake" _contents)
|
||||
file(WRITE "${CURRENT_PACKAGES_DIR}/share/harfbuzz/harfbuzzConfig.cmake" "
|
||||
@ -86,6 +57,4 @@ ${_contents}
|
||||
endif()
|
||||
|
||||
# Handle copyright
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/harfbuzz RENAME copyright)
|
||||
|
||||
vcpkg_test_cmake(PACKAGE_NAME harfbuzz)
|
||||
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
@ -162,12 +162,24 @@ find_library(SSL_DEBUG ssl ssleay32 ssld ssleay32d PATHS "${CURRENT_INSTALLED_DI
|
||||
find_library(EAY_RELEASE libeay32 crypto libcrypto PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(EAY_DEBUG libeay32 crypto libcrypto libeay32d cryptod libcryptod PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
|
||||
set(FREETYPE_RELEASE_ALL "${FREETYPE_RELEASE} ${BZ2_RELEASE} ${LIBPNG_RELEASE} ${ZLIB_RELEASE}")
|
||||
set(FREETYPE_DEBUG_ALL "${FREETYPE_DEBUG} ${BZ2_DEBUG} ${LIBPNG_DEBUG} ${ZLIB_DEBUG}")
|
||||
|
||||
# If HarfBuzz is built with GLib enabled, it must be statically link
|
||||
set(GLIB_LIB_VERSION 2.0)
|
||||
find_library(GLIB_RELEASE NAMES glib-${GLIB_LIB_VERSION} PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATH)
|
||||
find_library(GLIB_DEBUG NAMES glib-${GLIB_LIB_VERSION} PATHS "${CURRENT_INSTALLED_DIR}/debug/lib" NO_DEFAULT_PATH)
|
||||
if(GLIB_RELEASE MATCHES "-NOTFOUND" OR GLIB_DEBUG MATCHES "-NOTFOUND")
|
||||
set(GLIB_RELEASE "")
|
||||
set(GLIB_DEBUG "")
|
||||
endif()
|
||||
|
||||
set(RELEASE_OPTIONS
|
||||
"LIBJPEG_LIBS=${JPEG_RELEASE}"
|
||||
"ZLIB_LIBS=${ZLIB_RELEASE}"
|
||||
"LIBPNG_LIBS=${LIBPNG_RELEASE} ${ZLIB_RELEASE}"
|
||||
"PCRE2_LIBS=${PCRE2_RELEASE}"
|
||||
"FREETYPE_LIBS=${FREETYPE_RELEASE} ${BZ2_RELEASE} ${LIBPNG_RELEASE} ${ZLIB_RELEASE}"
|
||||
"FREETYPE_LIBS=${FREETYPE_RELEASE_ALL}"
|
||||
"ICU_LIBS=${ICU_RELEASE}"
|
||||
"QMAKE_LIBS_PRIVATE+=${BZ2_RELEASE}"
|
||||
"QMAKE_LIBS_PRIVATE+=${LIBPNG_RELEASE}"
|
||||
@ -177,7 +189,7 @@ set(DEBUG_OPTIONS
|
||||
"ZLIB_LIBS=${ZLIB_DEBUG}"
|
||||
"LIBPNG_LIBS=${LIBPNG_DEBUG} ${ZLIB_DEBUG}"
|
||||
"PCRE2_LIBS=${PCRE2_DEBUG}"
|
||||
"FREETYPE_LIBS=${FREETYPE_DEBUG} ${BZ2_DEBUG} ${LIBPNG_DEBUG} ${ZLIB_DEBUG}"
|
||||
"FREETYPE_LIBS=${FREETYPE_DEBUG_ALL}"
|
||||
"ICU_LIBS=${ICU_DEBUG}"
|
||||
"QMAKE_LIBS_PRIVATE+=${BZ2_DEBUG}"
|
||||
"QMAKE_LIBS_PRIVATE+=${LIBPNG_DEBUG}"
|
||||
@ -196,14 +208,14 @@ if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(APPEND RELEASE_OPTIONS
|
||||
"PSQL_LIBS=${PSQL_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
|
||||
"SQLITE_LIBS=${SQLITE_RELEASE}"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE}"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL}"
|
||||
"OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
|
||||
)
|
||||
|
||||
list(APPEND DEBUG_OPTIONS
|
||||
"PSQL_LIBS=${PSQL_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
|
||||
"SQLITE_LIBS=${SQLITE_DEBUG}"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG}"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL}"
|
||||
"OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} ws2_32.lib secur32.lib advapi32.lib shell32.lib crypt32.lib user32.lib gdi32.lib"
|
||||
)
|
||||
elseif(VCPKG_TARGET_IS_LINUX)
|
||||
@ -214,14 +226,14 @@ elseif(VCPKG_TARGET_IS_LINUX)
|
||||
list(APPEND RELEASE_OPTIONS
|
||||
"PSQL_LIBS=${PSQL_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread"
|
||||
"SQLITE_LIBS=${SQLITE_RELEASE} -ldl -lpthread"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE}"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL} ${GLIB_RELEASE} -lpthread"
|
||||
"OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread"
|
||||
"FONTCONFIG_LIBS=${FONTCONFIG_RELEASE} ${FREETYPE_RELEASE} ${EXPAT_RELEASE}"
|
||||
)
|
||||
list(APPEND DEBUG_OPTIONS
|
||||
"PSQL_LIBS=${PSQL_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread"
|
||||
"SQLITE_LIBS=${SQLITE_DEBUG} -ldl -lpthread"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG}"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL} ${GLIB_DEBUG} -lpthread"
|
||||
"OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread"
|
||||
"FONTCONFIG_LIBS=${FONTCONFIG_DEBUG} ${FREETYPE_DEBUG} ${EXPAT_DEBUG}"
|
||||
)
|
||||
@ -252,14 +264,14 @@ elseif(VCPKG_TARGET_IS_OSX)
|
||||
list(APPEND RELEASE_OPTIONS
|
||||
"PSQL_LIBS=${PSQL_RELEASE} ${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread"
|
||||
"SQLITE_LIBS=${SQLITE_RELEASE} -ldl -lpthread"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} -framework ApplicationServices"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_RELEASE} ${FREETYPE_RELEASE_ALL} -framework ApplicationServices"
|
||||
"OPENSSL_LIBS=${SSL_RELEASE} ${EAY_RELEASE} -ldl -lpthread"
|
||||
"FONTCONFIG_LIBS=${FONTCONFIG_RELEASE} ${FREETYPE_RELEASE} ${EXPAT_RELEASE} -liconv"
|
||||
)
|
||||
list(APPEND DEBUG_OPTIONS
|
||||
"PSQL_LIBS=${PSQL_DEBUG} ${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread"
|
||||
"SQLITE_LIBS=${SQLITE_DEBUG} -ldl -lpthread"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} -framework ApplicationServices"
|
||||
"HARFBUZZ_LIBS=${HARFBUZZ_DEBUG} ${FREETYPE_DEBUG_ALL} -framework ApplicationServices"
|
||||
"OPENSSL_LIBS=${SSL_DEBUG} ${EAY_DEBUG} -ldl -lpthread"
|
||||
"FONTCONFIG_LIBS=${FONTCONFIG_DEBUG} ${FREETYPE_DEBUG} ${EXPAT_DEBUG} -liconv"
|
||||
)
|
||||
|
@ -1,10 +1,11 @@
|
||||
Source: skia
|
||||
Version: 2020-02-15-1
|
||||
Version: 2020-05-18-1
|
||||
Homepage: https://skia.org
|
||||
Description: Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and software platforms.
|
||||
It serves as the graphics engine for Google Chrome and Chrome OS, Android, Mozilla Firefox and Firefox OS, and many other products.
|
||||
Skia is sponsored and managed by Google, but is available for use by anyone under the BSD Free Software License. While engineering of the core components is done by the Skia development team, we consider contributions from any source.
|
||||
Supports: x64 & (osx | windows)
|
||||
Build-Depends: expat, freetype[core], icu, harfbuzz[icu], libjpeg-turbo, libpng, libwebp, zlib
|
||||
|
||||
Feature: metal
|
||||
Description: metal support for skia
|
||||
|
10
ports/skia/expat.gn
Normal file
10
ports/skia/expat.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("expat") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
10
ports/skia/freetype2.gn
Normal file
10
ports/skia/freetype2.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("freetype2") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
10
ports/skia/harfbuzz.gn
Normal file
10
ports/skia/harfbuzz.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("harfbuzz") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
11
ports/skia/icu.gn
Normal file
11
ports/skia/icu.gn
Normal file
@ -0,0 +1,11 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("icu") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
defines = @_DEFINITIONS@
|
||||
}
|
10
ports/skia/libjpeg-turbo.gn
Normal file
10
ports/skia/libjpeg-turbo.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("libjpeg") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
10
ports/skia/libpng.gn
Normal file
10
ports/skia/libpng.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("libpng") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
10
ports/skia/libwebp.gn
Normal file
10
ports/skia/libwebp.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("libwebp") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
10
ports/skia/piex.gn
Normal file
10
ports/skia/piex.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("piex") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
@ -5,34 +5,111 @@ vcpkg_fail_port_install(
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
URL https://skia.googlesource.com/skia.git
|
||||
REF 05676f7bc238f667de848dfd37b4aa3c01b69efb
|
||||
REF fb0b35fed5580d49392df7ce9374551b348fffbf
|
||||
)
|
||||
|
||||
find_program(GIT NAMES git git.cmd)
|
||||
set(ENV{GIT_EXECUTABLE} "${GIT}")
|
||||
function(checkout_in_path PATH URL REF)
|
||||
if(EXISTS "${PATH}")
|
||||
return()
|
||||
endif()
|
||||
|
||||
vcpkg_from_git(
|
||||
OUT_SOURCE_PATH DEP_SOURCE_PATH
|
||||
URL "${URL}"
|
||||
REF "${REF}"
|
||||
)
|
||||
file(RENAME "${DEP_SOURCE_PATH}" "${PATH}")
|
||||
file(REMOVE_RECURSE "${DEP_SOURCE_PATH}")
|
||||
endfunction()
|
||||
|
||||
vcpkg_find_acquire_program(PYTHON2)
|
||||
get_filename_component(PYTHON2_DIR "${PYTHON2}" DIRECTORY)
|
||||
vcpkg_add_to_path(PREPEND "${PYTHON2_DIR}")
|
||||
set(EXTERNALS "${SOURCE_PATH}/third_party/externals")
|
||||
file(MAKE_DIRECTORY "${EXTERNALS}")
|
||||
|
||||
vcpkg_find_acquire_program(NINJA)
|
||||
|
||||
message(STATUS "Syncing git dependencies...")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${PYTHON2}" tools/git-sync-deps
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}"
|
||||
LOGNAME sync-deps-${TARGET_TRIPLET}
|
||||
# these following aren't available in vcpkg
|
||||
checkout_in_path("${EXTERNALS}/sfntly"
|
||||
"https://github.com/googlefonts/sfntly"
|
||||
"b55ff303ea2f9e26702b514cf6a3196a2e3e2974"
|
||||
)
|
||||
checkout_in_path("${EXTERNALS}/dng_sdk"
|
||||
"https://android.googlesource.com/platform/external/dng_sdk"
|
||||
"c8d0c9b1d16bfda56f15165d39e0ffa360a11123"
|
||||
)
|
||||
checkout_in_path("${EXTERNALS}/libgifcodec"
|
||||
"https://skia.googlesource.com/libgifcodec"
|
||||
"d06d2a6d42baf6c0c91cacc28df2542a911d05fe"
|
||||
)
|
||||
checkout_in_path("${EXTERNALS}/piex"
|
||||
"https://android.googlesource.com/platform/external/piex"
|
||||
"bb217acdca1cc0c16b704669dd6f91a1b509c406"
|
||||
)
|
||||
|
||||
find_program(GN gn PATHS "${SOURCE_PATH}/bin" "${DEPOT_TOOLS_PATH}")
|
||||
# turn a CMake list into a GN list of quoted items
|
||||
# "a;b;c" -> ["a","b","c"]
|
||||
function(cmake_to_gn_list OUTPUT_ INPUT_)
|
||||
if(NOT INPUT_)
|
||||
set(${OUTPUT_} "[]" PARENT_SCOPE)
|
||||
else()
|
||||
string(REPLACE ";" "\",\"" TEMP "${INPUT_}")
|
||||
set(${OUTPUT_} "[\"${TEMP}\"]" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# multiple libraries with multiple names may be passed as
|
||||
# "libA,libA2;libB,libB2,libB3;..."
|
||||
function(find_libraries RESOLVED LIBRARY_NAMES PATHS)
|
||||
set(_RESOLVED "")
|
||||
foreach(_LIB_GROUP ${LIBRARY_NAMES})
|
||||
string(REPLACE "," ";" _LIB_GROUP_NAMES "${_LIB_GROUP}")
|
||||
unset(_LIB CACHE)
|
||||
find_library(_LIB NAMES ${_LIB_GROUP_NAMES}
|
||||
PATHS "${PATHS}"
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if(_LIB MATCHES "-NOTFOUND")
|
||||
message(FATAL_ERROR "Could not find library with names: ${_LIB_GROUP_NAMES}")
|
||||
endif()
|
||||
|
||||
list(APPEND _RESOLVED "${_LIB}")
|
||||
endforeach()
|
||||
set(${RESOLVED} "${_RESOLVED}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# For each .gn file in the current list directory, configure and install at
|
||||
# the corresponding directory to replace Skia dependencies with ones from vcpkg.
|
||||
function(replace_skia_dep NAME INCLUDES LIBS_DBG LIBS_REL DEFINITIONS)
|
||||
list(TRANSFORM INCLUDES PREPEND "${CURRENT_INSTALLED_DIR}")
|
||||
cmake_to_gn_list(_INCLUDES "${INCLUDES}")
|
||||
|
||||
find_libraries(_LIBS_DBG "${LIBS_DBG}" "${CURRENT_INSTALLED_DIR}/debug/lib")
|
||||
cmake_to_gn_list(_LIBS_DBG "${_LIBS_DBG}")
|
||||
|
||||
find_libraries(_LIBS_REL "${LIBS_REL}" "${CURRENT_INSTALLED_DIR}/lib")
|
||||
cmake_to_gn_list(_LIBS_REL "${_LIBS_REL}")
|
||||
|
||||
cmake_to_gn_list(_DEFINITIONS "${DEFINITIONS}")
|
||||
|
||||
set(OUT_FILE "${SOURCE_PATH}/third_party/${NAME}/BUILD.gn")
|
||||
file(REMOVE "${OUT_FILE}")
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/${NAME}.gn" "${OUT_FILE}" @ONLY)
|
||||
endfunction()
|
||||
|
||||
set(_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include")
|
||||
|
||||
replace_skia_dep(expat "/include" "expat" "expat" "")
|
||||
replace_skia_dep(freetype2 "/include" "freetype,freetyped" "freetype" "")
|
||||
replace_skia_dep(harfbuzz "/include/harfbuzz" "harfbuzz-icu" "harfbuzz-icu" "")
|
||||
replace_skia_dep(icu "/include" "icuuc,icuucd" "icuuc" "U_USING_ICU_NAMESPACE=0")
|
||||
replace_skia_dep(libjpeg-turbo "/include" "jpeg,jpegd;turbojpeg,turbojpegd" "jpeg;turbojpeg" "")
|
||||
replace_skia_dep(libpng "/include" "libpng16,libpng16d" "libpng16" "")
|
||||
replace_skia_dep(libwebp "/include"
|
||||
"webp,webpd;webpdemux,webpdemuxd;webpdecoder,webpdecoderd;libwebpmux,libwebpmuxd"
|
||||
"webp;webpdemux;webpdecoder;libwebpmux" "")
|
||||
replace_skia_dep(zlib "/include" "z,zlib,zlibd" "z,zlib" "")
|
||||
|
||||
set(OPTIONS "\
|
||||
skia_use_system_libjpeg_turbo=false \
|
||||
skia_use_system_libpng=false \
|
||||
skia_use_system_libwebp=false \
|
||||
skia_use_system_icu=false \
|
||||
skia_use_system_expat=false \
|
||||
skia_use_system_zlib=false")
|
||||
skia_use_lua=false \
|
||||
skia_enable_tools=false \
|
||||
skia_enable_spirv_validation=false")
|
||||
|
||||
# used for passing feature-specific definitions to the config file
|
||||
set(SKIA_PUBLIC_DEFINITIONS "")
|
||||
@ -86,35 +163,15 @@ if(CMAKE_HOST_WIN32)
|
||||
|
||||
endif()
|
||||
|
||||
set(BUILD_DIR_REL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
|
||||
set(BUILD_DIR_DBG "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
|
||||
|
||||
message(STATUS "Generating build (debug)...")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${GN}" gen "${BUILD_DIR_DBG}" --args=${OPTIONS_DBG}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}"
|
||||
LOGNAME generate-${TARGET_TRIPLET}-dbg
|
||||
vcpkg_configure_gn(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
OPTIONS_DEBUG "${OPTIONS_DBG}"
|
||||
OPTIONS_RELEASE "${OPTIONS_REL}"
|
||||
)
|
||||
|
||||
message(STATUS "Generating build (release)...")
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND "${GN}" gen "${BUILD_DIR_REL}" --args=${OPTIONS_REL}
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}"
|
||||
LOGNAME generate-${TARGET_TRIPLET}-rel
|
||||
)
|
||||
|
||||
message(STATUS "Building Skia (debug)...")
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND "${NINJA}" -C "${BUILD_DIR_DBG}" skia
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}"
|
||||
LOGNAME build-${TARGET_TRIPLET}-dbg
|
||||
)
|
||||
|
||||
message(STATUS "Building Skia (release)...")
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND "${NINJA}" -C "${BUILD_DIR_REL}" skia
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}"
|
||||
LOGNAME build-${TARGET_TRIPLET}-rel
|
||||
vcpkg_install_gn(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
TARGETS ":skia"
|
||||
)
|
||||
|
||||
message(STATUS "Installing: ${CURRENT_PACKAGES_DIR}/include/${PORT}")
|
||||
@ -128,65 +185,9 @@ foreach(file_ ${SKIA_INCLUDE_FILES})
|
||||
vcpkg_replace_string("${file_}" "#include \"include/" "#include \"${PORT}/")
|
||||
endforeach()
|
||||
|
||||
# Finds and stores a single file that matches GLOBBING_EXPR
|
||||
# into the OUT_VAR or fails otherwise
|
||||
function(glob_single_file OUT_VAR GLOBBING_EXPR)
|
||||
file(GLOB RESULTS LIST_DIRECTORIES false "${GLOBBING_EXPR}")
|
||||
list(LENGTH RESULTS RESULTS_LENGTH)
|
||||
if(NOT RESULTS_LENGTH EQUAL 1)
|
||||
message(FATAL_ERROR "Expected one file to match glob: '${GLOBBING_EXPR}'; found: '${RESULTS}'")
|
||||
endif()
|
||||
list(GET RESULTS 0 FIRST_RESULT)
|
||||
set(${OUT_VAR} "${FIRST_RESULT}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
glob_single_file(SKIA_LIBRARY_DBG "${BUILD_DIR_DBG}/skia*.lib")
|
||||
file(INSTALL "${SKIA_LIBRARY_DBG}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
||||
|
||||
glob_single_file(SKIA_LIBRARY_REL "${BUILD_DIR_REL}/skia*.lib")
|
||||
file(INSTALL "${SKIA_LIBRARY_REL}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
get_filename_component(SKIA_LIBRARY_IMPLIB_DBG
|
||||
"${SKIA_LIBRARY_DBG}" NAME)
|
||||
get_filename_component(SKIA_LIBRARY_IMPLIB_REL
|
||||
"${SKIA_LIBRARY_REL}" NAME)
|
||||
|
||||
glob_single_file(SKIA_LIBRARY_DBG "${BUILD_DIR_DBG}/skia*.dll")
|
||||
file(INSTALL "${SKIA_LIBRARY_DBG}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
get_filename_component(SKIA_LIBRARY_NAME_DBG "${SKIA_LIBRARY_DBG}" NAME)
|
||||
|
||||
glob_single_file(SKIA_LIBRARY_DBG "${BUILD_DIR_DBG}/skia*.pdb")
|
||||
file(INSTALL "${SKIA_LIBRARY_DBG}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
|
||||
|
||||
glob_single_file(SKIA_LIBRARY_REL "${BUILD_DIR_REL}/skia*.dll")
|
||||
file(INSTALL "${SKIA_LIBRARY_REL}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
|
||||
get_filename_component(SKIA_LIBRARY_NAME_REL "${SKIA_LIBRARY_REL}" NAME)
|
||||
else()
|
||||
get_filename_component(SKIA_LIBRARY_NAME_DBG "${SKIA_LIBRARY_DBG}" NAME)
|
||||
get_filename_component(SKIA_LIBRARY_NAME_REL "${SKIA_LIBRARY_REL}" NAME)
|
||||
endif()
|
||||
else()
|
||||
find_library(SKIA_LIBRARY_DBG skia PATHS "${BUILD_DIR_DBG}" NO_DEFAULT_PATH)
|
||||
file(INSTALL "${SKIA_LIBRARY_DBG}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
||||
|
||||
find_library(SKIA_LIBRARY_REL skia PATHS "${BUILD_DIR_REL}" NO_DEFAULT_PATH)
|
||||
file(INSTALL "${SKIA_LIBRARY_REL}"
|
||||
DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
||||
|
||||
get_filename_component(SKIA_LIBRARY_NAME_DBG "${SKIA_LIBRARY_DBG}" NAME)
|
||||
get_filename_component(SKIA_LIBRARY_NAME_REL "${SKIA_LIBRARY_REL}" NAME)
|
||||
endif()
|
||||
|
||||
# get a list of library dependencies for TARGET
|
||||
function(gn_desc_target_libs SOURCE_PATH BUILD_DIR TARGET OUTPUT)
|
||||
function(gn_desc_target_libs OUTPUT BUILD_DIR TARGET)
|
||||
vcpkg_find_acquire_program(GN)
|
||||
execute_process(
|
||||
COMMAND ${GN} desc "${BUILD_DIR}" "${TARGET}" libs
|
||||
WORKING_DIRECTORY "${SOURCE_PATH}"
|
||||
@ -198,8 +199,12 @@ function(gn_desc_target_libs SOURCE_PATH BUILD_DIR TARGET OUTPUT)
|
||||
endfunction()
|
||||
|
||||
# skiaConfig.cmake.in input variables
|
||||
gn_desc_target_libs("${SOURCE_PATH}" "${BUILD_DIR_DBG}" //:skia SKIA_DEP_DBG)
|
||||
gn_desc_target_libs("${SOURCE_PATH}" "${BUILD_DIR_REL}" //:skia SKIA_DEP_REL)
|
||||
gn_desc_target_libs(SKIA_DEP_DBG
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
||||
//:skia)
|
||||
gn_desc_target_libs(SKIA_DEP_REL
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
||||
//:skia)
|
||||
|
||||
configure_file("${CMAKE_CURRENT_LIST_DIR}/skiaConfig.cmake.in"
|
||||
"${CURRENT_PACKAGES_DIR}/share/skia/skiaConfig.cmake" @ONLY)
|
||||
|
@ -1,4 +1,5 @@
|
||||
add_library(skia::skia SHARED IMPORTED)
|
||||
add_library(skia INTERFACE)
|
||||
add_library(skia::skia ALIAS skia)
|
||||
set(SKIA_DEP_DBG @SKIA_DEP_DBG@)
|
||||
set(SKIA_DEP_REL @SKIA_DEP_REL@)
|
||||
|
||||
@ -17,62 +18,68 @@ if(_IMPORT_PREFIX STREQUAL "/")
|
||||
set(_IMPORT_PREFIX "")
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(SKIA_LIBRARY_IMPLIB_DBG)
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/debug/lib/${SKIA_LIBRARY_IMPLIB_DBG}"
|
||||
)
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/debug/bin/${SKIA_LIBRARY_NAME_DBG}"
|
||||
)
|
||||
else()
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/debug/lib/${SKIA_LIBRARY_NAME_DBG}"
|
||||
)
|
||||
endif()
|
||||
find_library(SKIA_LIB NAMES skia skia.dll)
|
||||
target_link_libraries(skia INTERFACE "${SKIA_LIB}")
|
||||
|
||||
if(SKIA_LIBRARY_IMPLIB_REL)
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/${SKIA_LIBRARY_IMPLIB_REL}"
|
||||
)
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/${SKIA_LIBRARY_NAME_REL}"
|
||||
)
|
||||
else()
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/${SKIA_LIBRARY_NAME_REL}"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/debug/lib/${SKIA_LIBRARY_NAME_DBG}"
|
||||
)
|
||||
set_property(TARGET skia::skia PROPERTY
|
||||
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/lib/${SKIA_LIBRARY_NAME_REL}"
|
||||
)
|
||||
endif()
|
||||
function(set_dependencies CONFIG LIBRARIES)
|
||||
foreach(LIB ${LIBRARIES})
|
||||
if(LIB MATCHES "^/")
|
||||
if(WIN32)
|
||||
string(SUBSTRING "${LIB}" 1 -1 LIB)
|
||||
endif()
|
||||
target_link_libraries(skia INTERFACE
|
||||
"$<$<CONFIG:${CONFIG}>:${LIB}>")
|
||||
else()
|
||||
string(REGEX REPLACE "\\.framework" "" LIB ${LIB})
|
||||
string(REGEX REPLACE "[^a-zA-Z]" "_" LIB_NAME ${LIB})
|
||||
string(TOUPPER ${LIB_NAME} LIB_NAME)
|
||||
set(LIB_NAME SKIA_${LIB_NAME}_LIBRARY)
|
||||
find_library(${LIB_NAME} ${LIB})
|
||||
target_link_libraries(skia INTERFACE
|
||||
"$<$<CONFIG:${CONFIG}>:${${LIB_NAME}}>")
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
foreach(LIB ${SKIA_DEP_DBG})
|
||||
string(REGEX REPLACE "\\.framework" "" LIB ${LIB})
|
||||
string(REGEX REPLACE "[^a-zA-Z]" "_" LIB_NAME ${LIB})
|
||||
string(TOUPPER ${LIB_NAME} LIB_NAME)
|
||||
set(LIB_NAME SKIA_${LIB_NAME}_LIBRARY)
|
||||
find_library(${LIB_NAME} ${LIB})
|
||||
set_property(TARGET skia::skia
|
||||
APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"$<$<CONFIG:Debug>:${${LIB_NAME}}>")
|
||||
endforeach()
|
||||
set_dependencies(Debug "${SKIA_DEP_DBG}")
|
||||
set_dependencies(Release "${SKIA_DEP_REL}")
|
||||
|
||||
foreach(LIB ${SKIA_DEP_REL})
|
||||
string(REGEX REPLACE "\\.framework" "" LIB ${LIB})
|
||||
string(REGEX REPLACE "[^a-zA-Z]" "_" LIB_NAME ${LIB})
|
||||
string(TOUPPER ${LIB_NAME} LIB_NAME)
|
||||
set(LIB_NAME SKIA_${LIB_NAME}_LIBRARY)
|
||||
find_library(${LIB_NAME} ${LIB})
|
||||
set_property(TARGET skia::skia
|
||||
APPEND PROPERTY INTERFACE_LINK_LIBRARIES
|
||||
"$<$<CONFIG:Release>:${${LIB_NAME}}>")
|
||||
endforeach()
|
||||
set(SKIA_DEFINITIONS_DBG
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_HAS_EXCEPTIONS=0
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
SK_GL
|
||||
SK_ENABLE_DUMP_GPU
|
||||
SK_SUPPORT_PDF
|
||||
SK_HAS_JPEG_LIBRARY
|
||||
SK_USE_LIBGIFCODEC
|
||||
SK_HAS_HEIF_LIBRARY
|
||||
SK_HAS_PNG_LIBRARY
|
||||
SK_ENABLE_SKSL_INTERPRETER
|
||||
SK_HAS_WEBP_LIBRARY
|
||||
SK_XML
|
||||
SKIA_DLL
|
||||
SK_SUPPORT_ATLAS_TEXT=1)
|
||||
|
||||
target_include_directories(skia::skia INTERFACE ${_IMPORT_PREFIX}/include)
|
||||
target_compile_definitions(skia::skia INTERFACE ${SKIA_PUBLIC_DEFINITIONS})
|
||||
set(SKIA_DEFINITIONS_REL
|
||||
_CRT_SECURE_NO_WARNINGS
|
||||
_HAS_EXCEPTIONS=0
|
||||
WIN32_LEAN_AND_MEAN
|
||||
NOMINMAX
|
||||
NDEBUG
|
||||
SK_GL
|
||||
SK_SUPPORT_PDF
|
||||
SK_HAS_JPEG_LIBRARY
|
||||
SK_USE_LIBGIFCODEC
|
||||
SK_HAS_PNG_LIBRARY
|
||||
SK_HAS_WEBP_LIBRARY
|
||||
SK_XML
|
||||
SKIA_DLL)
|
||||
|
||||
target_compile_definitions(skia INTERFACE
|
||||
$<$<CONFIG:Debug>:${SKIA_DEFINITIONS_DBG}>
|
||||
$<$<CONFIG:Release>:${SKIA_DEFINITIONS_REL}>)
|
||||
|
||||
target_include_directories(skia INTERFACE ${_IMPORT_PREFIX}/include)
|
||||
target_compile_definitions(skia INTERFACE ${SKIA_PUBLIC_DEFINITIONS})
|
||||
|
10
ports/skia/zlib.gn
Normal file
10
ports/skia/zlib.gn
Normal file
@ -0,0 +1,10 @@
|
||||
import("../third_party.gni")
|
||||
|
||||
system("zlib") {
|
||||
include_dirs = @_INCLUDES@
|
||||
if(is_debug) {
|
||||
libs = @_LIBS_DBG@
|
||||
} else {
|
||||
libs = @_LIBS_REL@
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ $StorageAccountKey = $env:StorageAccountKey
|
||||
function Remove-DirectorySymlink {
|
||||
Param([string]$Path)
|
||||
if (Test-Path $Path) {
|
||||
[System.IO.Directory]::Delete($Path)
|
||||
[System.IO.Directory]::Delete($Path, $true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,12 @@ function(vcpkg_install_gn)
|
||||
string(REGEX REPLACE "^/" "" OUTPUT "${OUTPUT}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT EXISTS "${OUTPUT}")
|
||||
message(STATUS "Output for target, ${TARGET} doesn't exist: ${OUTPUT}.")
|
||||
continue()
|
||||
endif()
|
||||
|
||||
if(TARGET_TYPE STREQUAL "executable")
|
||||
file(INSTALL "${OUTPUT}" DESTINATION "${INSTALL_DIR}/tools")
|
||||
elseif("${OUTPUT}" MATCHES "(\\.dll|\\.pdb)$")
|
||||
|
Loading…
x
Reference in New Issue
Block a user