aboutsummaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorPark DongHa <luncliff@gmail.com>2021-04-08 06:16:28 +0900
committerGitHub <noreply@github.com>2021-04-07 14:16:28 -0700
commitb466bd598e561aeff6e869104ddb03705f9f2fc1 (patch)
tree21e6545b6640b42d578aad661a46e2147f56ad6d /ports
parent7d596220f91f9335313aafb926ea495b0b644d9f (diff)
downloadvcpkg-b466bd598e561aeff6e869104ddb03705f9f2fc1.tar.gz
vcpkg-b466bd598e561aeff6e869104ddb03705f9f2fc1.zip
[pthreads] support ARM arch and UWP platform (#16348)
* [pthreads] support ARM/UWP * arm: enable macro __PTW32_PROGCTR * uwp: LINK option /APPCONTAINER * uwp: link with 'kernel32', 'windowsapp' * [pthreads] update baseline and port SHA * [pthreads] extract changes to patch * [pthreads] remove pthreads from ci.baseline.txt * [pthreads] separate uwp patch * update ci.baseline.txt for arm/arm64 * [pthreads] unify patch list * update ci.baseline.txt
Diffstat (limited to 'ports')
-rw-r--r--ports/pthreads/fix-arm-macro.patch13
-rw-r--r--ports/pthreads/fix-uwp-linkage.patch17
-rw-r--r--ports/pthreads/portfile.cmake17
-rw-r--r--ports/pthreads/vcpkg.json5
4 files changed, 44 insertions, 8 deletions
diff --git a/ports/pthreads/fix-arm-macro.patch b/ports/pthreads/fix-arm-macro.patch
new file mode 100644
index 000000000..559b38579
--- /dev/null
+++ b/ports/pthreads/fix-arm-macro.patch
@@ -0,0 +1,13 @@
+diff --git a/context.h b/context.h
+index 33294c1..318b689 100644
+--- a/context.h
++++ b/context.h
+@@ -62,7 +62,7 @@
+ #endif
+
+ #if defined(_ARM_) || defined(ARM) || defined(_M_ARM) || defined(_M_ARM64)
+-#define PTW32_PROGCTR(Context) ((Context).Pc)
++#define __PTW32_PROGCTR(Context) ((Context).Pc)
+ #endif
+
+ #if !defined (__PTW32_PROGCTR)
diff --git a/ports/pthreads/fix-uwp-linkage.patch b/ports/pthreads/fix-uwp-linkage.patch
new file mode 100644
index 000000000..77d3a5b15
--- /dev/null
+++ b/ports/pthreads/fix-uwp-linkage.patch
@@ -0,0 +1,17 @@
+diff --git a/implement.h b/implement.h
+index 1579376..3a7d29b 100644
+--- a/implement.h
++++ b/implement.h
+@@ -36,6 +36,12 @@
+ #if !defined(_IMPLEMENT_H)
+ #define _IMPLEMENT_H
+
++#if 1 // The condition should be `defined(__cplusplus_winrt)` when compile option is provided correctly.
++// porvide 2 static libs to resolve link error. 'kernel32' and 'windowsapp'
++#pragma comment(lib, "kernel32")
++#pragma comment(lib, "WindowsApp")
++#endif
++
+ #if !defined (__PTW32_CONFIG_H)
+ # error "config.h was not #included"
+ #endif
diff --git a/ports/pthreads/portfile.cmake b/ports/pthreads/portfile.cmake
index 967ff54e1..52dc6c663 100644
--- a/ports/pthreads/portfile.cmake
+++ b/ports/pthreads/portfile.cmake
@@ -3,14 +3,19 @@ if(NOT VCPKG_TARGET_IS_WINDOWS)
return()
endif()
-vcpkg_fail_port_install(MESSAGE "${PORT} does not currently support UWP platform nor ARM architectures" ON_TARGET "UWP" ON_ARCH "arm" )
-
set(PTHREADS4W_VERSION "3.0.0")
+if(VCPKG_TARGET_IS_UWP)
+ list(APPEND PATCH_FILES fix-uwp-linkage.patch)
+ # Inject linker option using the `LINK` environment variable
+ # https://docs.microsoft.com/en-us/cpp/build/reference/linker-options
+ # https://docs.microsoft.com/en-us/cpp/build/reference/linking#link-environment-variables
+ set(ENV{LINK} "/APPCONTAINER")
+endif()
if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
- set(PATCH_FILE use-md.patch)
+ list(APPEND PATCH_FILES use-md.patch)
else()
- set(PATCH_FILE use-mt.patch)
+ list(APPEND PATCH_FILES use-mt.patch)
endif()
vcpkg_from_sourceforge(
@@ -18,7 +23,9 @@ vcpkg_from_sourceforge(
REPO pthreads4w
FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip"
SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013
- PATCHES ${PATCH_FILE}
+ PATCHES
+ fix-arm-macro.patch
+ ${PATCH_FILES}
)
find_program(NMAKE nmake REQUIRED)
diff --git a/ports/pthreads/vcpkg.json b/ports/pthreads/vcpkg.json
index 5a0423fb6..3c5301d76 100644
--- a/ports/pthreads/vcpkg.json
+++ b/ports/pthreads/vcpkg.json
@@ -1,8 +1,7 @@
{
"name": "pthreads",
"version": "3.0.0",
- "port-version": 7,
+ "port-version": 8,
"description": "pthreads for windows",
- "homepage": "https://sourceware.org/pub/pthreads-win32/",
- "supports": "!(uwp | arm | arm64)"
+ "homepage": "https://sourceware.org/pub/pthreads-win32/"
}