[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
This commit is contained in:
Park DongHa 2021-04-08 06:16:28 +09:00 committed by GitHub
parent 7d596220f9
commit b466bd598e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 56 additions and 12 deletions

View File

@ -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)

View File

@ -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

View File

@ -3,14 +3,19 @@ if(NOT VCPKG_TARGET_IS_WINDOWS)
return() return()
endif() 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") 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) if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(PATCH_FILE use-md.patch) list(APPEND PATCH_FILES use-md.patch)
else() else()
set(PATCH_FILE use-mt.patch) list(APPEND PATCH_FILES use-mt.patch)
endif() endif()
vcpkg_from_sourceforge( vcpkg_from_sourceforge(
@ -18,7 +23,9 @@ vcpkg_from_sourceforge(
REPO pthreads4w REPO pthreads4w
FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip" FILENAME "pthreads4w-code-v${PTHREADS4W_VERSION}.zip"
SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013 SHA512 49e541b66c26ddaf812edb07b61d0553e2a5816ab002edc53a38a897db8ada6d0a096c98a9af73a8f40c94283df53094f76b429b09ac49862465d8697ed20013
PATCHES ${PATCH_FILE} PATCHES
fix-arm-macro.patch
${PATCH_FILES}
) )
find_program(NMAKE nmake REQUIRED) find_program(NMAKE nmake REQUIRED)

View File

@ -1,8 +1,7 @@
{ {
"name": "pthreads", "name": "pthreads",
"version": "3.0.0", "version": "3.0.0",
"port-version": 7, "port-version": 8,
"description": "pthreads for windows", "description": "pthreads for windows",
"homepage": "https://sourceware.org/pub/pthreads-win32/", "homepage": "https://sourceware.org/pub/pthreads-win32/"
"supports": "!(uwp | arm | arm64)"
} }

View File

@ -118,6 +118,7 @@ chromium-base:x64-linux=skip
civetweb:arm64-windows = skip civetweb:arm64-windows = skip
civetweb:arm-uwp = skip civetweb:arm-uwp = skip
civetweb:x64-uwp = skip civetweb:x64-uwp = skip
clamav:arm64-windows=fail
clblas:arm64-windows=fail clblas:arm64-windows=fail
clblast:x64-linux=fail clblast:x64-linux=fail
clblast:x64-windows-static=fail clblast:x64-windows-static=fail
@ -177,6 +178,8 @@ cudnn:arm-uwp=fail
cudnn:x64-uwp=fail cudnn:x64-uwp=fail
cudnn:x64-windows-static=fail cudnn:x64-windows-static=fail
cudnn:x86-windows=fail cudnn:x86-windows=fail
darknet:arm64-windows=fail
darknet:arm-uwp=fail
# Since pipeline cannot automatically install dbghelp dependency, skip this detection # Since pipeline cannot automatically install dbghelp dependency, skip this detection
dbghelp:arm-uwp=skip dbghelp:arm-uwp=skip
dbghelp:arm64-windows=skip dbghelp:arm64-windows=skip
@ -332,6 +335,9 @@ fmilib:arm64-windows=fail
fmilib:arm-uwp=fail fmilib:arm-uwp=fail
fmilib:x64-linux=fail fmilib:x64-linux=fail
fmilib:x64-uwp=fail fmilib:x64-uwp=fail
fontconfig:x64-uwp=fail
fontconfig:arm-uwp=fail
fontconfig:arm64-windows=fail
foonathan-memory:arm64-windows=fail foonathan-memory:arm64-windows=fail
foonathan-memory:arm-uwp=fail foonathan-memory:arm-uwp=fail
foonathan-memory:x64-uwp=fail foonathan-memory:x64-uwp=fail
@ -1283,9 +1289,6 @@ protobuf-c:x64-windows-static-md=fail
protobuf-c:x64-uwp=fail protobuf-c:x64-uwp=fail
protobuf-c:arm64-windows=fail protobuf-c:arm64-windows=fail
protobuf-c:arm-uwp=fail protobuf-c:arm-uwp=fail
pthreads:arm64-windows=fail
pthreads:arm-uwp=fail
pthreads:x64-uwp=fail
python2:arm64-windows=fail python2:arm64-windows=fail
python2:arm-uwp=fail python2:arm-uwp=fail
python2:x64-linux=fail python2:x64-linux=fail

View File

@ -4906,7 +4906,7 @@
}, },
"pthreads": { "pthreads": {
"baseline": "3.0.0", "baseline": "3.0.0",
"port-version": 7 "port-version": 8
}, },
"pugixml": { "pugixml": {
"baseline": "1.11.4", "baseline": "1.11.4",

View File

@ -1,5 +1,10 @@
{ {
"versions": [ "versions": [
{
"git-tree": "e03999fb593f35daefdea06f7c99af233f3a7f3d",
"version": "3.0.0",
"port-version": 8
},
{ {
"git-tree": "f76c9c365aff8cf663941bbe6dac93379e856345", "git-tree": "f76c9c365aff8cf663941bbe6dac93379e856345",
"version": "3.0.0", "version": "3.0.0",