Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions ports/skia/add-missing-tuple.patch

This file was deleted.

13 changes: 13 additions & 0 deletions ports/skia/dawn_use_vcpkg_spirv.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/dawn_native/BUILD.gn b/src/dawn_native/BUILD.gn
index f73bfe24..e37792a0 100644
--- a/src/dawn_native/BUILD.gn
+++ b/src/dawn_native/BUILD.gn
@@ -145,7 +145,7 @@ source_set("dawn_native_sources") {
":dawn_native_headers",
":dawn_native_utils_gen",
"${dawn_root}/src/common",
- "${dawn_root}/third_party/gn/spirv_cross:spirv_cross",
+ "//third_party/spirv-cross:spirv_cross",
"${dawn_spirv_tools_dir}:spvtools_opt",
"${dawn_spirv_tools_dir}:spvtools_val",
"${dawn_tint_dir}/src:libtint",
10 changes: 10 additions & 0 deletions ports/skia/fontconfig.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import("../third_party.gni")

system("fontconfig") {
include_dirs = @_INCLUDES@
if(is_debug) {
libs = @_LIBS_DBG@
} else {
libs = @_LIBS_REL@
}
}
158 changes: 139 additions & 19 deletions ports/skia/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL https://skia.googlesource.com/skia.git
REF fb0b35fed5580d49392df7ce9374551b348fffbf
PATCHES add-missing-tuple.patch
REF a40ddcd63d40d647fcc5ed3b11acd2fa8ee834ed
PATCHES
"use_vcpkg_fontconfig.patch"
)

function(checkout_in_path PATH URL REF)
Expand All @@ -19,6 +20,21 @@ function(checkout_in_path PATH URL REF)
file(REMOVE_RECURSE "${DEP_SOURCE_PATH}")
endfunction()

function(checkout_in_path_with_patch PATH URL REF PATCH)
if(EXISTS "${PATH}")
return()
endif()

vcpkg_from_git(
OUT_SOURCE_PATH DEP_SOURCE_PATH
URL "${URL}"
REF "${REF}"
PATCHES "${PATCH}"
)
file(RENAME "${DEP_SOURCE_PATH}" "${PATH}")
file(REMOVE_RECURSE "${DEP_SOURCE_PATH}")
endfunction()

set(EXTERNALS "${SOURCE_PATH}/third_party/externals")
file(MAKE_DIRECTORY "${EXTERNALS}")

Expand All @@ -33,7 +49,7 @@ checkout_in_path("${EXTERNALS}/dng_sdk"
)
checkout_in_path("${EXTERNALS}/libgifcodec"
"https://skia.googlesource.com/libgifcodec"
"d06d2a6d42baf6c0c91cacc28df2542a911d05fe"
"fd59fa92a0c86788dcdd84d091e1ce81eda06a77"
)
checkout_in_path("${EXTERNALS}/piex"
"https://android.googlesource.com/platform/external/piex"
Expand Down Expand Up @@ -94,36 +110,123 @@ set(_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include")

replace_skia_dep(expat "/include" "libexpat,libexpatd,libexpatdMD" "libexpat,libexpatMD" "")
replace_skia_dep(freetype2 "/include" "freetype,freetyped" "freetype" "")
replace_skia_dep(harfbuzz "/include/harfbuzz" "harfbuzz-icu" "harfbuzz-icu" "")
replace_skia_dep(harfbuzz "/include/harfbuzz" "harfbuzz;harfbuzz-icu;harfbuzz-subset" "harfbuzz;harfbuzz-icu;harfbuzz-subset" "")
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" "")
replace_skia_dep(fontconfig "/include" "fontconfig" "fontconfig" "")

set(OPTIONS "\
skia_use_lua=false \
skia_enable_tools=false \
skia_enable_spirv_validation=false")

if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(OPTIONS "${OPTIONS} target_cpu=\"arm64\"")
endif()
skia_use_lua=false \
skia_enable_tools=false \
skia_enable_spirv_validation=false \
target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\"")

# used for passing feature-specific definitions to the config file
set(SKIA_PUBLIC_DEFINITIONS "")
set(SKIA_PUBLIC_DEFINITIONS
SK_SUPPORT_PDF
SK_HAS_JPEG_LIBRARY
SK_USE_LIBGIFCODEC
SK_HAS_PNG_LIBRARY
SK_HAS_WEBP_LIBRARY
SK_XML)

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(OPTIONS "${OPTIONS} is_component_build=true")
if(CMAKE_HOST_WIN32)
set(SKIA_PUBLIC_DEFINITIONS SKIA_DLL)
endif()
else()
set(OPTIONS "${OPTIONS} is_component_build=false")
endif()

if("metal" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} skia_use_metal=true")
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_METAL)
if(CMAKE_HOST_APPLE)
if("metal" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} skia_use_metal=true")
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_METAL)
endif()
endif()

if("vulkan" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} skia_use_vulkan=true")
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_VULKAN)
endif()

if(CMAKE_HOST_WIN32)
if("direct3d" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} skia_use_direct3d=true")
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_DIRECT3D)

checkout_in_path("${EXTERNALS}/spirv-cross"
"https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross"
"bdbef7b1f3982fe99a62d076043036abe6dd6d80"
)

checkout_in_path("${EXTERNALS}/spirv-headers"
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git"
"cf653e4ca4858583802b0d1656bc934edff6bd7f"
)

checkout_in_path("${EXTERNALS}/spirv-tools"
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git"
"11cd875ed88484f93943071083b4821b4c3d2193"
)

checkout_in_path("${EXTERNALS}/d3d12allocator"
"https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git"
"169895d529dfce00390a20e69c2f516066fe7a3b"
)
endif()
endif()

if("dawn" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} skia_use_dawn=true")
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_DAWN)

checkout_in_path("${EXTERNALS}/spirv-cross"
"https://chromium.googlesource.com/external/github.com/KhronosGroup/SPIRV-Cross"
"bdbef7b1f3982fe99a62d076043036abe6dd6d80"
)

checkout_in_path("${EXTERNALS}/spirv-headers"
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git"
"cf653e4ca4858583802b0d1656bc934edff6bd7f"
)

checkout_in_path("${EXTERNALS}/spirv-tools"
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git"
"11cd875ed88484f93943071083b4821b4c3d2193"
)

checkout_in_path("${EXTERNALS}/tint"
"https://dawn.googlesource.com/tint"
"b612c505939bf86c80a55c193b93c41ed0f252a1"
)

checkout_in_path("${EXTERNALS}/jinja2"
"https://chromium.googlesource.com/chromium/src/third_party/jinja2"
"a82a4944a7f2496639f34a89c9923be5908b80aa"
)

checkout_in_path("${EXTERNALS}/markupsafe"
"https://chromium.googlesource.com/chromium/src/third_party/markupsafe"
"0944e71f4b2cb9a871bcbe353f95e889b64a611a"
)

checkout_in_path_with_patch("${EXTERNALS}/dawn"
"https://dawn.googlesource.com/dawn.git"
"9096fc290f8677a0d395e4a5b6bf1443553629d6"
"dawn_use_vcpkg_spirv.patch"
)
endif()

if("gl" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} skia_use_gl=true")
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_GL)
endif()

set(OPTIONS_REL "${OPTIONS} is_official_build=true")
Expand Down Expand Up @@ -164,17 +267,35 @@ if(CMAKE_HOST_WIN32)

endif()

vcpkg_configure_gn(
vcpkg_gn_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS_DEBUG "${OPTIONS_DBG}"
OPTIONS_RELEASE "${OPTIONS_REL}"
)

vcpkg_install_gn(
vcpkg_gn_install(
SOURCE_PATH "${SOURCE_PATH}"
TARGETS ":skia"
)

if("dawn" IN_LIST FEATURES)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
vcpkg_gn_install(
SOURCE_PATH "${SOURCE_PATH}"
TARGETS
"third_party/externals/dawn/src/dawn:dawn_proc_shared"
"third_party/externals/dawn/src/dawn_native:dawn_native_shared"
"third_party/externals/dawn/src/dawn_platform:dawn_platform_shared")
else()
vcpkg_gn_install(
SOURCE_PATH "${SOURCE_PATH}"
TARGETS
"third_party/externals/dawn/src/dawn:dawn_proc_static"
"third_party/externals/dawn/src/dawn_native:dawn_native_static"
"third_party/externals/dawn/src/dawn_platform:dawn_platform_static")
endif()
endif()

message(STATUS "Installing: ${CURRENT_PACKAGES_DIR}/include/${PORT}")
file(COPY "${SOURCE_PATH}/include"
DESTINATION "${CURRENT_PACKAGES_DIR}/include")
Expand All @@ -188,9 +309,8 @@ endforeach()

# get a list of library dependencies for TARGET
function(gn_desc_target_libs OUTPUT BUILD_DIR TARGET)
vcpkg_find_acquire_program(GN)
execute_process(
COMMAND ${GN} desc "${BUILD_DIR}" "${TARGET}" libs
COMMAND ${VCPKG_GN} desc "${BUILD_DIR}" "${TARGET}" libs
WORKING_DIRECTORY "${SOURCE_PATH}"
OUTPUT_VARIABLE OUTPUT_
OUTPUT_STRIP_TRAILING_WHITESPACE
Expand Down
36 changes: 5 additions & 31 deletions ports/skia/skiaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ endif()
set(SKIA_DEP_DBG @SKIA_DEP_DBG@)
set(SKIA_DEP_REL @SKIA_DEP_REL@)

find_library(SKIA_LIB NAMES skia skia.dll)
target_link_libraries(skia INTERFACE "${SKIA_LIB}")
target_link_libraries(skia INTERFACE
debug "${_IMPORT_PREFIX}/debug/lib/${CMAKE_STATIC_LIBRARY_PREFIX}skia${CMAKE_STATIC_LIBRARY_SUFFIX}"
optimized "${_IMPORT_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}skia${CMAKE_STATIC_LIBRARY_SUFFIX}")

function(set_dependencies CONFIG LIBRARIES)
foreach(LIB ${LIBRARIES})
Expand All @@ -43,44 +44,17 @@ function(set_dependencies CONFIG LIBRARIES)
endfunction()

set_dependencies(Debug "${SKIA_DEP_DBG}")
set_dependencies(RelWithDebInfo "${SKIA_DEP_REL}")
set_dependencies(Release "${SKIA_DEP_REL}")

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)

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}>)
$<$<CONFIG:Debug>:${SKIA_DEFINITIONS_DBG}>)

target_include_directories(skia INTERFACE ${_IMPORT_PREFIX}/include)
target_compile_definitions(skia INTERFACE ${SKIA_PUBLIC_DEFINITIONS})
42 changes: 42 additions & 0 deletions ports/skia/use_vcpkg_fontconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/BUILD.gn b/BUILD.gn
index aeb46b4664..2ddbcd0ebe 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -452,7 +452,7 @@ optional("fontmgr_fontconfig") {
enabled = skia_enable_fontmgr_fontconfig

# The public header includes fontconfig.h and uses FcConfig*
- public_deps = [ "//third_party:fontconfig" ]
+ public_deps = [ "//third_party/fontconfig" ]
public = [ "include/ports/SkFontMgr_fontconfig.h" ]
deps = [ ":typeface_freetype" ]
sources = [ "src/ports/SkFontMgr_fontconfig.cpp" ]
@@ -469,7 +469,7 @@ optional("fontmgr_FontConfigInterface") {

deps = [
":typeface_freetype",
- "//third_party:fontconfig",
+ "//third_party/fontconfig",
]
public = [
"include/ports/SkFontConfigInterface.h",
diff --git a/third_party/BUILD.gn b/third_party/BUILD.gn
index 63fa748d16..6760e0f41b 100644
--- a/third_party/BUILD.gn
+++ b/third_party/BUILD.gn
@@ -6,9 +6,9 @@
declare_args() {
}

-config("system_fontconfig") {
- libs = [ "fontconfig" ]
-}
-group("fontconfig") {
- public_configs = [ ":system_fontconfig" ]
-}
+#config("system_fontconfig") {
+# libs = [ "fontconfig" ]
+#}
+#group("fontconfig") {
+# public_configs = [ ":system_fontconfig" ]
+#}
Loading