2020-03-05 05:06:24 +08:00
|
|
|
vcpkg_from_git(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
2022-04-26 06:39:10 +08:00
|
|
|
URL https://github.com/google/skia
|
2022-09-01 04:32:04 +08:00
|
|
|
REF f86f242886692a18f5adc1cf9cbd6740cd0870fd
|
2022-04-26 06:39:10 +08:00
|
|
|
PATCHES
|
|
|
|
"use_vcpkg_fontconfig.patch"
|
2020-03-05 05:06:24 +08:00
|
|
|
)
|
|
|
|
|
2022-04-26 06:39:10 +08:00
|
|
|
# Replace hardcoded python paths
|
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/.gn" "script_executable = \"python3\"" "script_executable = \"${PYTHON3}\"")
|
|
|
|
|
2022-09-01 04:32:04 +08:00
|
|
|
if(VCPKG_TARGET_IS_LINUX)
|
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/gn/toolchain/BUILD.gn" "command = \"$shell python3" "command = \"$shell '${PYTHON3}'")
|
|
|
|
else()
|
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/gn/toolchain/BUILD.gn" "command = \"$shell python" "command = \"$shell '${PYTHON3}'")
|
|
|
|
endif()
|
2022-04-26 06:39:10 +08:00
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
function(checkout_in_path PATH URL REF)
|
|
|
|
if(EXISTS "${PATH}")
|
|
|
|
return()
|
|
|
|
endif()
|
2022-01-26 02:31:15 +08:00
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
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()
|
2020-03-05 05:06:24 +08:00
|
|
|
|
2022-04-26 06:39:10 +08:00
|
|
|
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()
|
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
set(EXTERNALS "${SOURCE_PATH}/third_party/externals")
|
|
|
|
file(MAKE_DIRECTORY "${EXTERNALS}")
|
2020-03-05 05:06:24 +08:00
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
# these following aren't available in vcpkg
|
2022-04-26 06:39:10 +08:00
|
|
|
# to update, visit the DEPS file in Skia's root directory
|
|
|
|
# define SKIA_USE_MIRROR in a triplet to use the mirrors
|
2020-05-20 06:20:18 +08:00
|
|
|
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"
|
2020-03-05 05:06:24 +08:00
|
|
|
)
|
2020-05-20 06:20:18 +08:00
|
|
|
checkout_in_path("${EXTERNALS}/libgifcodec"
|
|
|
|
"https://skia.googlesource.com/libgifcodec"
|
2022-04-26 06:39:10 +08:00
|
|
|
"fd59fa92a0c86788dcdd84d091e1ce81eda06a77"
|
2020-05-20 06:20:18 +08:00
|
|
|
)
|
|
|
|
checkout_in_path("${EXTERNALS}/piex"
|
|
|
|
"https://android.googlesource.com/platform/external/piex"
|
|
|
|
"bb217acdca1cc0c16b704669dd6f91a1b509c406"
|
|
|
|
)
|
|
|
|
|
|
|
|
# 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_}")
|
2022-01-26 02:31:15 +08:00
|
|
|
set(${OUTPUT_} "[\"${TEMP}\"]" PARENT_SCOPE)
|
2020-05-20 06:20:18 +08:00
|
|
|
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}")
|
2020-03-05 05:06:24 +08:00
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
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")
|
|
|
|
|
2020-08-17 23:33:44 +08:00
|
|
|
replace_skia_dep(expat "/include" "libexpat,libexpatd,libexpatdMD" "libexpat,libexpatMD" "")
|
2020-05-20 06:20:18 +08:00
|
|
|
replace_skia_dep(freetype2 "/include" "freetype,freetyped" "freetype" "")
|
2022-04-26 06:39:10 +08:00
|
|
|
replace_skia_dep(harfbuzz "/include/harfbuzz" "harfbuzz;harfbuzz-subset" "harfbuzz;harfbuzz-subset" "")
|
2020-05-20 06:20:18 +08:00
|
|
|
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" "")
|
2022-04-26 06:39:10 +08:00
|
|
|
replace_skia_dep(libwebp "/include"
|
|
|
|
"webp,webpd;webpdemux,webpdemuxd;webpdecoder,webpdecoderd;webpmux,webpmuxd"
|
|
|
|
"webp;webpdemux;webpdecoder;webpmux" "")
|
2020-05-20 06:20:18 +08:00
|
|
|
replace_skia_dep(zlib "/include" "z,zlib,zlibd" "z,zlib" "")
|
2022-04-26 06:39:10 +08:00
|
|
|
if(CMAKE_HOST_UNIX)
|
|
|
|
replace_skia_dep(fontconfig "/include" "fontconfig" "fontconfig" "")
|
|
|
|
endif()
|
2020-03-05 05:06:24 +08:00
|
|
|
|
|
|
|
set(OPTIONS "\
|
2020-05-20 06:20:18 +08:00
|
|
|
skia_use_lua=false \
|
|
|
|
skia_enable_tools=false \
|
2022-04-26 06:39:10 +08:00
|
|
|
skia_enable_spirv_validation=false \
|
|
|
|
target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\"")
|
2022-02-25 02:35:14 +08:00
|
|
|
|
2020-03-05 05:06:24 +08:00
|
|
|
# used for passing feature-specific definitions to the config file
|
2022-04-26 06:39:10 +08:00
|
|
|
set(SKIA_PUBLIC_DEFINITIONS
|
|
|
|
SK_SUPPORT_PDF
|
|
|
|
SK_HAS_JPEG_LIBRARY
|
|
|
|
SK_USE_LIBGIFCODEC
|
|
|
|
SK_HAS_PNG_LIBRARY
|
|
|
|
SK_HAS_WEBP_LIBRARY
|
|
|
|
SK_XML)
|
2020-03-05 05:06:24 +08:00
|
|
|
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
2022-04-26 06:39:10 +08:00
|
|
|
string(APPEND OPTIONS " is_component_build=true")
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
set(SKIA_PUBLIC_DEFINITIONS SKIA_DLL)
|
|
|
|
endif()
|
2020-03-05 05:06:24 +08:00
|
|
|
else()
|
2022-04-26 06:39:10 +08:00
|
|
|
string(APPEND OPTIONS " is_component_build=false")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_HOST_APPLE)
|
|
|
|
if("metal" IN_LIST FEATURES)
|
|
|
|
set(OPTIONS "${OPTIONS} skia_use_metal=true")
|
|
|
|
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_METAL)
|
|
|
|
endif()
|
2020-03-05 05:06:24 +08:00
|
|
|
endif()
|
|
|
|
|
2022-04-26 06:39:10 +08:00
|
|
|
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"
|
2022-09-01 04:32:04 +08:00
|
|
|
"61c603f3baa5270e04bcfb6acf83c654e3c57679"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/spirv-headers"
|
|
|
|
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git"
|
2022-09-01 04:32:04 +08:00
|
|
|
"0bcc624926a25a2a273d07877fd25a6ff5ba1cfb"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/spirv-tools"
|
|
|
|
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git"
|
2022-09-01 04:32:04 +08:00
|
|
|
"0073a1fa36f7c52ad3d58059cb5d5de8efa825ad"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/d3d12allocator"
|
|
|
|
"https://skia.googlesource.com/external/github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git"
|
|
|
|
"169895d529dfce00390a20e69c2f516066fe7a3b"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if("dawn" IN_LIST FEATURES)
|
|
|
|
|
|
|
|
if (VCPKG_TARGET_IS_LINUX)
|
|
|
|
message(WARNING
|
|
|
|
[[
|
|
|
|
dawn support requires the following libraries from the system package manager:
|
|
|
|
|
|
|
|
libx11-xcb-dev mesa-common-dev
|
|
|
|
|
|
|
|
They can be installed on Debian based systems via
|
|
|
|
|
|
|
|
apt-get install libx11-xcb-dev mesa-common-dev
|
|
|
|
]]
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
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"
|
2022-09-01 04:32:04 +08:00
|
|
|
"61c603f3baa5270e04bcfb6acf83c654e3c57679"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/spirv-headers"
|
|
|
|
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Headers.git"
|
2022-09-01 04:32:04 +08:00
|
|
|
"0bcc624926a25a2a273d07877fd25a6ff5ba1cfb"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/spirv-tools"
|
|
|
|
"https://skia.googlesource.com/external/github.com/KhronosGroup/SPIRV-Tools.git"
|
2022-09-01 04:32:04 +08:00
|
|
|
"0073a1fa36f7c52ad3d58059cb5d5de8efa825ad"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/tint"
|
|
|
|
"https://dawn.googlesource.com/tint"
|
2022-09-01 04:32:04 +08:00
|
|
|
"200492e32b94f042d9942154fb4fa7f93bb8289a"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/jinja2"
|
|
|
|
"https://chromium.googlesource.com/chromium/src/third_party/jinja2"
|
|
|
|
"ee69aa00ee8536f61db6a451f3858745cf587de6"
|
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/markupsafe"
|
|
|
|
"https://chromium.googlesource.com/chromium/src/third_party/markupsafe"
|
|
|
|
"0944e71f4b2cb9a871bcbe353f95e889b64a611a"
|
|
|
|
)
|
|
|
|
|
|
|
|
## Remove
|
|
|
|
checkout_in_path("${EXTERNALS}/vulkan-headers"
|
|
|
|
"https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Headers"
|
2022-09-01 04:32:04 +08:00
|
|
|
"c896e2f920273bfee852da9cca2a356bc1c2031e"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/vulkan-tools"
|
|
|
|
"https://chromium.googlesource.com/external/github.com/KhronosGroup/Vulkan-Tools"
|
2022-09-01 04:32:04 +08:00
|
|
|
"d55c7aaf041af331bee8c22fb448a6ff4c797f73"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
checkout_in_path("${EXTERNALS}/abseil-cpp"
|
|
|
|
"https://skia.googlesource.com/external/github.com/abseil/abseil-cpp.git"
|
|
|
|
"c5a424a2a21005660b182516eb7a079cd8021699"
|
|
|
|
)
|
|
|
|
|
|
|
|
## REMOVE ^
|
|
|
|
checkout_in_path("${EXTERNALS}/dawn"
|
|
|
|
"https://dawn.googlesource.com/dawn.git"
|
2022-09-01 04:32:04 +08:00
|
|
|
"30fa0d8d2ced43e44baa522dd4bd4684b14a3099"
|
2022-04-26 06:39:10 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
vcpkg_find_acquire_program(GIT)
|
|
|
|
file(READ "${SOURCE_PATH}/third_party/externals/dawn/generator/dawn_version_generator.py" DVG_CONTENT)
|
|
|
|
string(REPLACE "return 'git.bat' if sys.platform == 'win32' else 'git'" "return '${GIT}'" DVG_CONTENT ${DVG_CONTENT})
|
|
|
|
file(WRITE "${SOURCE_PATH}/third_party/externals/dawn/generator/dawn_version_generator.py" ${DVG_CONTENT})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if("gl" IN_LIST FEATURES)
|
|
|
|
string(APPEND OPTIONS " skia_use_gl=true")
|
|
|
|
list(APPEND SKIA_PUBLIC_DEFINITIONS SK_GL)
|
2020-03-05 05:06:24 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(OPTIONS_DBG "${OPTIONS} is_debug=true")
|
2022-04-26 06:39:10 +08:00
|
|
|
set(OPTIONS_REL "${OPTIONS} is_official_build=true")
|
2020-03-05 05:06:24 +08:00
|
|
|
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
# Load toolchains
|
|
|
|
if(NOT VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
|
|
|
|
set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "${SCRIPTS}/toolchains/windows.cmake")
|
|
|
|
endif()
|
|
|
|
include("${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}")
|
|
|
|
|
|
|
|
# turn a space delimited string into a gn list:
|
|
|
|
# "a b c" -> ["a","b","c"]
|
|
|
|
function(to_gn_list OUTPUT_ INPUT_)
|
|
|
|
string(STRIP "${INPUT_}" TEMP)
|
|
|
|
string(REPLACE " " " " TEMP "${TEMP}")
|
|
|
|
string(REPLACE " " "\",\"" TEMP "${TEMP}")
|
|
|
|
set(${OUTPUT_} "[\"${TEMP}\"]" PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
to_gn_list(SKIA_C_FLAGS_DBG "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_DEBUG}")
|
|
|
|
to_gn_list(SKIA_C_FLAGS_REL "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
|
|
|
|
to_gn_list(SKIA_CXX_FLAGS_DBG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG}")
|
|
|
|
to_gn_list(SKIA_CXX_FLAGS_REL "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE}")
|
|
|
|
|
2022-04-26 06:39:10 +08:00
|
|
|
string(APPEND OPTIONS_DBG " extra_cflags_c=${SKIA_C_FLAGS_DBG} \
|
2020-03-05 05:06:24 +08:00
|
|
|
extra_cflags_cc=${SKIA_CXX_FLAGS_DBG}")
|
2022-04-26 06:39:10 +08:00
|
|
|
string(APPEND OPTIONS_REL " extra_cflags_c=${SKIA_C_FLAGS_REL} \
|
2020-03-05 05:06:24 +08:00
|
|
|
extra_cflags_cc=${SKIA_CXX_FLAGS_REL}")
|
|
|
|
|
2020-03-24 02:56:44 +08:00
|
|
|
set(WIN_VC "$ENV{VCINSTALLDIR}")
|
|
|
|
string(REPLACE "\\VC\\" "\\VC" WIN_VC "${WIN_VC}")
|
2022-04-26 06:39:10 +08:00
|
|
|
string(APPEND OPTIONS_DBG " win_vc=\"${WIN_VC}\"")
|
|
|
|
string(APPEND OPTIONS_REL " win_vc=\"${WIN_VC}\"")
|
2020-03-05 05:06:24 +08:00
|
|
|
endif()
|
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
vcpkg_configure_gn(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
OPTIONS_DEBUG "${OPTIONS_DBG}"
|
|
|
|
OPTIONS_RELEASE "${OPTIONS_REL}"
|
2020-03-05 05:06:24 +08:00
|
|
|
)
|
|
|
|
|
2022-04-26 06:39:10 +08:00
|
|
|
set(DAWN_LINKAGE "")
|
|
|
|
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(DAWN_LINKAGE "shared")
|
|
|
|
else()
|
|
|
|
set(DAWN_LINKAGE "static")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
vcpkg_list(SET SKIA_TARGETS ":skia")
|
|
|
|
if("dawn" IN_LIST FEATURES)
|
|
|
|
vcpkg_list(APPEND SKIA_TARGETS
|
|
|
|
"third_party/externals/dawn/src/dawn:proc_${DAWN_LINKAGE}"
|
|
|
|
"third_party/externals/dawn/src/dawn/native:${DAWN_LINKAGE}"
|
|
|
|
"third_party/externals/dawn/src/dawn/platform:${DAWN_LINKAGE}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
vcpkg_install_gn(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2022-04-26 06:39:10 +08:00
|
|
|
TARGETS
|
|
|
|
${SKIA_TARGETS}
|
2020-03-05 05:06:24 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
message(STATUS "Installing: ${CURRENT_PACKAGES_DIR}/include/${PORT}")
|
2022-01-26 02:31:15 +08:00
|
|
|
file(COPY "${SOURCE_PATH}/include"
|
2020-03-05 05:06:24 +08:00
|
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/include")
|
2022-01-26 02:31:15 +08:00
|
|
|
file(RENAME "${CURRENT_PACKAGES_DIR}/include/include"
|
2020-03-05 05:06:24 +08:00
|
|
|
"${CURRENT_PACKAGES_DIR}/include/${PORT}")
|
2022-01-26 02:31:15 +08:00
|
|
|
file(GLOB_RECURSE SKIA_INCLUDE_FILES LIST_DIRECTORIES false
|
2020-03-05 05:06:24 +08:00
|
|
|
"${CURRENT_PACKAGES_DIR}/include/${PORT}/*")
|
|
|
|
foreach(file_ ${SKIA_INCLUDE_FILES})
|
|
|
|
vcpkg_replace_string("${file_}" "#include \"include/" "#include \"${PORT}/")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# get a list of library dependencies for TARGET
|
2020-05-20 06:20:18 +08:00
|
|
|
function(gn_desc_target_libs OUTPUT BUILD_DIR TARGET)
|
2022-04-26 06:39:10 +08:00
|
|
|
z_vcpkg_install_gn_get_desc("${OUTPUT}"
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
BUILD_DIR "${BUILD_DIR}"
|
|
|
|
TARGET "${TARGET}"
|
|
|
|
WHAT_TO_DISPLAY libs)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
function(gn_desc_target_defines OUTPUT BUILD_DIR TARGET)
|
|
|
|
z_vcpkg_install_gn_get_desc(OUTPUT_
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
|
|
|
BUILD_DIR "${BUILD_DIR}"
|
|
|
|
TARGET "${TARGET}"
|
|
|
|
WHAT_TO_DISPLAY defines)
|
|
|
|
# exclude system defines such as _HAS_EXCEPTIONS=0
|
|
|
|
list(FILTER OUTPUT_ EXCLUDE REGEX "^_")
|
2020-03-05 05:06:24 +08:00
|
|
|
set(${OUTPUT} ${OUTPUT_} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# skiaConfig.cmake.in input variables
|
2022-04-26 06:39:10 +08:00
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
|
|
|
gn_desc_target_libs(SKIA_DEP_DBG
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
|
|
|
//:skia)
|
|
|
|
gn_desc_target_defines(SKIA_DEFINITIONS_DBG
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
|
2022-06-18 04:57:34 +08:00
|
|
|
//:skia)
|
2022-04-26 06:39:10 +08:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
|
|
|
gn_desc_target_libs(SKIA_DEP_REL
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
|
|
|
//:skia)
|
|
|
|
gn_desc_target_defines(SKIA_DEFINITIONS_REL
|
|
|
|
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
|
2022-06-18 04:57:34 +08:00
|
|
|
//:skia)
|
2022-04-26 06:39:10 +08:00
|
|
|
endif()
|
2020-03-05 05:06:24 +08:00
|
|
|
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/skiaConfig.cmake.in"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/share/skia/skiaConfig.cmake" @ONLY)
|
|
|
|
|
|
|
|
file(INSTALL "${SOURCE_PATH}/LICENSE"
|
|
|
|
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
|
|
|
|
RENAME copyright)
|