From 8ee0ec169919dc6c2e0379803a35f135d064dceb Mon Sep 17 00:00:00 2001 From: Dale Stammen Date: Mon, 28 Nov 2016 13:01:55 -0800 Subject: [PATCH] fix for uwp builds --- ports/libiconv/0003-Fix-uwp.patch | 25 +++++++++++++++++++++++++ ports/libiconv/CMakeLists.txt | 2 ++ ports/libiconv/portfile.cmake | 1 + 3 files changed, 28 insertions(+) create mode 100644 ports/libiconv/0003-Fix-uwp.patch diff --git a/ports/libiconv/0003-Fix-uwp.patch b/ports/libiconv/0003-Fix-uwp.patch new file mode 100644 index 000000000..0b2444166 --- /dev/null +++ b/ports/libiconv/0003-Fix-uwp.patch @@ -0,0 +1,25 @@ +diff --git a/libcharset/lib/localcharset.c b/libcharset/lib/localcharset.c +index 3aceb42..dadd95a 100644 +--- a/libcharset/lib/localcharset.c ++++ b/libcharset/lib/localcharset.c +@@ -455,7 +455,10 @@ locale_charset (void) + # endif + + #elif defined WIN32_NATIVE +- ++#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) ++ // GetACP() not available to UWP apps ++ codeset = NULL; ++#else + static char buf[2 + 10 + 1]; + + /* Woe32 has a function returning the locale's codepage as a number: +@@ -467,7 +470,7 @@ locale_charset (void) + encoding is the best bet. */ + sprintf (buf, "CP%u", GetACP ()); + codeset = buf; +- ++#endif + #elif defined OS2 + + const char *locale; diff --git a/ports/libiconv/CMakeLists.txt b/ports/libiconv/CMakeLists.txt index 46575ca27..0d2a2a4d3 100644 --- a/ports/libiconv/CMakeLists.txt +++ b/ports/libiconv/CMakeLists.txt @@ -55,6 +55,8 @@ list(APPEND Libiconv_headers ${Libiconv_BINARY_DIR}/localcharset.h) # set(libname libiconv) +add_definitions(-D_CRT_SECURE_NO_WARNINGS) + configure_file( ${Libiconv_SOURCE_DIR}/include/iconv.h.build.in ${Libiconv_BINARY_DIR}/iconv.h diff --git a/ports/libiconv/portfile.cmake b/ports/libiconv/portfile.cmake index cfb96391b..46bd2f9e9 100644 --- a/ports/libiconv/portfile.cmake +++ b/ports/libiconv/portfile.cmake @@ -14,6 +14,7 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH} PATCHES ${CMAKE_CURRENT_LIST_DIR}/0001-Add-export-definitions.patch ${CMAKE_CURRENT_LIST_DIR}/0002-Config-for-MSVC.patch + ${CMAKE_CURRENT_LIST_DIR}/0003-Fix-uwp.patch ) vcpkg_configure_cmake(