From 06ff47749fcdddcacc008d0d2eda9c217308a47b Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Wed, 12 Feb 2025 05:21:16 -0700 Subject: [PATCH] Meta: Add a workaround for missing dllimport for skcms API This should really be fixed by patching the skcms top level header, but this hack works for now on Windows for linking LibGfx. --- Meta/CMake/skia.cmake | 5 ++++- Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Meta/CMake/skia.cmake b/Meta/CMake/skia.cmake index 9d1eed1b322..c64f2a53e6c 100644 --- a/Meta/CMake/skia.cmake +++ b/Meta/CMake/skia.cmake @@ -5,10 +5,13 @@ include(fontconfig) find_package(unofficial-skia CONFIG) if(unofficial-skia_FOUND) set(SKIA_TARGET unofficial::skia::skia) - if (HAS_FONTCONFIG) + if (HAS_FONTCONFIG AND NOT WIN32) set(CMAKE_LINK_GROUP_USING_no_as_needed_SUPPORTED TRUE CACHE BOOL "Link group using no-as-needed supported") set(CMAKE_LINK_GROUP_USING_no_as_needed "LINKER:--push-state,--no-as-needed" "LINKER:--pop-state" CACHE STRING "Link group using no-as-needed") set_property(TARGET unofficial::skia::skia APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$") + elseif(WIN32) + # FIXME: Submit a proper patch to vcpkg and skia to the SKCMS header file to set this in a cross-platform way. + set_property(TARGET unofficial::skia::skia APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS "SKCMS_API=__declspec(dllimport)") endif() else() find_package(PkgConfig) diff --git a/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake b/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake index c59d3b42cb3..c7fa6f43f77 100644 --- a/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake +++ b/Meta/CMake/vcpkg/overlay-ports/skia/portfile.cmake @@ -279,7 +279,11 @@ set(SKIA_CXX_FLAGS_REL "${VCPKG_COMBINED_CXX_FLAGS_RELEASE}") if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") foreach (str IN ITEMS SKIA_CXX_FLAGS_DBG SKIA_CXX_FLAGS_REL) - string(APPEND ${str} " -DSKCMS_API=[[gnu::visibility(\\\\\\\"default\\\\\\\")]]") + if (VCPKG_TARGET_IS_WINDOWS) + string(APPEND ${str} " -DSKCMS_API=__declspec(dllexport)") + else() + string(APPEND ${str} " -DSKCMS_API=[[gnu::visibility(\\\\\\\"default\\\\\\\")]]") + endif() endforeach() endif()