Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tensorflow-cc/tensorflow-common] Add uwp port #14394

Closed
wants to merge 206 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
206 commits
Select commit Hold shift + click to select a range
0ab169d
fix build issues occurring from default bazel config being used becau…
Jul 23, 2020
543e19d
[tensorflow-cc] Update CONTROL and ci.baseline.txt
LilyWangL Jul 24, 2020
820c455
fix also applies to windows static build
Jul 24, 2020
9643548
fix debug and static builds as well as library naming for non-linux
Aug 11, 2020
4860a01
upgrade tensorflow from v1.14 to v2.3
Aug 15, 2020
dd6d89f
fix execute process macro
Aug 15, 2020
0d611be
extend overriden execute_process to more than one COMMAND as there ac…
Aug 17, 2020
d3121ce
Merge pull request #1 from microsoft/master
jgehw Aug 17, 2020
ee969d7
merge branch 'fix-execute-process-macro2' into 'fix-static-builds-and…
Aug 17, 2020
ad5ca5f
added another patch required for tensorflow v2.3, fixed path and work…
Aug 18, 2020
c743e49
Revert "incorporate changes from microsoft:master"
jgehw Aug 18, 2020
2571bd1
Merge pull request #2 from jgehw/revert-1-master
jgehw Aug 18, 2020
98ecc0c
Revert "Revert "incorporate changes from microsoft:master""
jgehw Aug 18, 2020
ab8fdf7
Merge branch 'master' of https://github.com/microsoft/vcpkg
Aug 18, 2020
36143ac
Merge branch 'master' of https://github.com/microsoft/vcpkg
Aug 20, 2020
ea07bb9
final fixes for static build + improving out messages
Aug 20, 2020
a12d22f
enabling linux and osx in CI to see if it works now
Aug 20, 2020
6c34a08
Merge branch 'master' into fix-static-builds-and-more
jgehw Aug 20, 2020
6e31cd6
simplified code, fixed version numbers, fixed generated include cmake…
Aug 21, 2020
afc7f1e
fix failing postbuild check on handcrafted empty dummy library by spr…
Aug 21, 2020
898bbbe
remove dead code commit by mistake again
Aug 21, 2020
2ca1f94
Merge branch 'fix-static-builds-and-more' of https://github.com/jgehw…
Aug 21, 2020
1866a82
Merge branch 'master' of https://github.com/microsoft/vcpkg
Aug 21, 2020
350b151
improvements from code review
Aug 21, 2020
630e890
cleaner fix for debug code
Aug 21, 2020
2c66c4b
find pip3 in PATH (PYTHON3_DIR apparently not valid for pip3)
Aug 22, 2020
40954e4
fix error in python helper script
Aug 22, 2020
9451d33
Merge branch 'master' of https://github.com/microsoft/vcpkg
Aug 22, 2020
d198bf1
fix wrong libname in postbuild script
Aug 24, 2020
f6acaeb
fix python detection + switch to python on msys2 (instead of embedded…
Aug 24, 2020
efd0c93
fix order of arguments
jgehw Aug 24, 2020
5c1f7ae
fix command (it may contain spaces such as C:\Program Files\...)
jgehw Aug 25, 2020
3b95e18
revert last commit (root cause for CI failures is something different…
jgehw Aug 25, 2020
bfffec6
fix regex comparision
jgehw Aug 25, 2020
c9d08e9
fix linebreaks in generated file
jgehw Aug 25, 2020
2de4912
merge branch 'fix-execute-process-macro2' into 'fix-static-builds-and…
jgehw Aug 25, 2020
cdfdc65
fix CRT linkage
jgehw Aug 25, 2020
c8c12b8
refactor implemenation to avoid as much code duplication as possible …
jgehw Aug 25, 2020
71cf605
Merge branch 'master' into fix-static-builds-and-more
jgehw Aug 26, 2020
9f67738
Merge branch 'fix-static-builds-and-more' of https://github.com/jgehw…
jgehw Aug 26, 2020
5d09b86
fix version numbers in helper scripts
jgehw Aug 26, 2020
6cb4e5b
enable work-around for Windows until bazel fix is available
jgehw Aug 26, 2020
5376c01
install missing python3-pip on linux
jgehw Aug 26, 2020
692c742
fix linux build by patching
jgehw Aug 28, 2020
fbbde32
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Aug 28, 2020
37c3528
merge branch 'master' into 'fix-static-builds-and-more'
jgehw Aug 28, 2020
1246969
apply timeout feature now available via merged master branch
jgehw Aug 28, 2020
c918214
correct linux build patch
jgehw Aug 28, 2020
e78a3df
improve debug build patches
jgehw Aug 28, 2020
9103128
improve linux patch
jgehw Aug 28, 2020
fc4404a
temporarily add debug to inspect what's going on on macOS CI
jgehw Aug 29, 2020
cc3823d
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Aug 29, 2020
74cc334
remove temporary debug code and fix static linking scripts for linux …
jgehw Aug 30, 2020
ee1082f
fix regex escaping
jgehw Aug 30, 2020
381066a
fix ambiguous match while grepping for the framework link command
jgehw Aug 30, 2020
006a21a
extend fix of ambiguous match while grepping for the framework link c…
jgehw Aug 31, 2020
f7ee6c6
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Aug 31, 2020
b667b99
Merge branch 'master' into fix-static-builds-and-more
jgehw Sep 1, 2020
37f79c6
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Sep 1, 2020
d77a47c
fix what merge of master broke
jgehw Sep 1, 2020
74c4fc8
Merge branch 'master' into fix-static-builds-and-more
jgehw Sep 1, 2020
f81922c
fix more what got broken by merging master
jgehw Sep 1, 2020
f0d1c89
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Sep 2, 2020
3d8e2f2
remove "unofficial" from filename
jgehw Sep 2, 2020
2051e9e
added switch do distinct classic and manifest mode when generating co…
jgehw Sep 2, 2020
1241b67
create symlinks for libraries without version number
jgehw Sep 3, 2020
1da9b92
fix linux postbuild script
jgehw Sep 3, 2020
3df3b9b
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Sep 3, 2020
900512c
Merge branch 'master' into fix-static-builds-and-more
jgehw Sep 3, 2020
fb609b5
temporarily disable code making problems
jgehw Sep 3, 2020
ec68741
add note for linking on Linux and macOS
jgehw Sep 4, 2020
84af4a0
forget to add README file in previous commit
jgehw Sep 4, 2020
7f599a2
add file forgotton in macro fixing patch
jgehw Sep 4, 2020
067323c
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Sep 8, 2020
b8e9523
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Sep 10, 2020
bcda036
Merge branch 'master' into fix-static-builds-and-more
jgehw Sep 10, 2020
e4f15a8
fix python library path
jgehw Sep 11, 2020
da3cb5a
fix macOS static link command
jgehw Sep 11, 2020
7273f86
update linkage instructions in README
jgehw Sep 11, 2020
fdc5cf6
Update ports/tensorflow-cc/CONTROL
JackBoosY Sep 14, 2020
05be090
Update ports/tensorflow-cc/portfile.cmake
JackBoosY Sep 14, 2020
faf3447
Update scripts/ci.baseline.txt
JackBoosY Sep 14, 2020
3787012
use vcpkg_execute_required_process
jgehw Sep 14, 2020
0877229
pass C_FLAGS and CXX_FLAGS to bazel
jgehw Sep 14, 2020
eaf1d7c
fix INTERFACE_INCLUDE_DIRECTORIES
jgehw Sep 14, 2020
0a986ac
fix optional c/cxx arguments
jgehw Sep 17, 2020
bb63d8c
also add linker opts
jgehw Sep 22, 2020
79076a2
Merge branch 'pass-cflags-to-bazel' into fix-static-builds-and-more
jgehw Sep 30, 2020
ca81fb9
update README
jgehw Sep 30, 2020
8e16503
merge static libs into one
Oct 1, 2020
8677bdb
update README
Oct 1, 2020
39312c7
Merge branch 'master' of https://github.com/microsoft/vcpkg
Oct 1, 2020
79a26c8
Merge branch 'master' into fix-static-builds-and-more
Oct 1, 2020
6384898
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Oct 9, 2020
533895b
Merge branch 'master' into fix-static-builds-and-more
jgehw Oct 9, 2020
d3e3c2a
Merge branch 'master' of https://github.com/microsoft/vcpkg
Oct 10, 2020
2ad839b
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Oct 15, 2020
f4e64da
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Oct 21, 2020
180925f
quote python path (it might contain spaces that don't get escaped ins…
jgehw Oct 22, 2020
4584d3a
fix python path also for static build
jgehw Oct 24, 2020
49f6f38
add arm(64) as currently unsupported arch
jgehw Oct 24, 2020
a174637
bazel 3.7 is available -> remove workaround
jgehw Oct 24, 2020
292013f
update README, remove necessary c-ares from deps
jgehw Oct 24, 2020
f8e004c
update msys package
Oct 24, 2020
a259f33
Merge branch 'fix-static-builds-and-more' of https://github.com/jgehw…
Oct 24, 2020
0ab5c4e
add uwp specific options, and minor general improvements
Oct 25, 2020
920af34
fix string replace
Oct 25, 2020
6594588
fix control file and windows path separator
Oct 25, 2020
0a22920
revert backslashes-fix -- the root cause was missing .exe extension
Oct 25, 2020
4ef9252
upgrade to tf 2.3.1
Oct 25, 2020
41e2f80
fix hard-coded version
Oct 25, 2020
7fa2689
Merge branch 'master' into fix-static-builds-and-more
jgehw Oct 26, 2020
fe1d24c
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Oct 27, 2020
ff1d1c9
Merge branch 'master' into fix-static-builds-and-more
jgehw Oct 27, 2020
f064862
remove uwp work-in-progress code so that PR can be merged
jgehw Oct 27, 2020
a68ae07
add [tensorflow] C API port
jgehw Oct 27, 2020
b3a6018
missing in previous commit
jgehw Oct 27, 2020
e2b95d1
fix include file
jgehw Oct 27, 2020
83149c4
remove unnecessary suffix
jgehw Oct 28, 2020
4840250
update README and print out usage info in portfile
jgehw Nov 4, 2020
24831cc
Merge branch 'fix-static-builds-and-more' into add-tensorflow-c
jgehw Nov 4, 2020
b2b19a6
add UWP patches
jgehw Nov 4, 2020
0f052b2
fix uwp patch file
jgehw Nov 5, 2020
3141fb9
fix patch again
jgehw Nov 5, 2020
756dca2
fix patch again
jgehw Nov 5, 2020
a8e88d7
fix patch again
jgehw Nov 5, 2020
2f73611
move options from command line to .bazelrc
jgehw Nov 5, 2020
73bf321
fix include paths
jgehw Nov 5, 2020
0bb4819
work around bazel restriction "The include path 'D:/buildtrees/tensor…
jgehw Nov 5, 2020
9f5ef93
go for a completely different approach: force-include uwppatch.h
jgehw Nov 5, 2020
5a05ca7
fix include path again
jgehw Nov 5, 2020
58ae817
choose different include location, which is available in bazel build …
jgehw Nov 5, 2020
9ad7b7d
fix compile errors
jgehw Nov 5, 2020
5c7817b
update header (getenv redefinition)
jgehw Nov 5, 2020
1be36c5
next try to get patched headers to work
jgehw Nov 6, 2020
b21b6fe
another try to fix include paths
jgehw Nov 6, 2020
9a5af3d
update patched header, bazel has its own naming for target triplet
jgehw Nov 8, 2020
c067c87
yet another try to fix patched include path
jgehw Nov 8, 2020
d129bd2
next try to fix includes: patch bazel deps where required
jgehw Nov 10, 2020
cfbdc9c
fix patch
jgehw Nov 11, 2020
3898892
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Nov 12, 2020
06f7a9c
Merge branch 'master' into add-tensorflow-c
jgehw Nov 12, 2020
e1c55ed
Update ports/tensorflow-cc/CONTROL
jgehw Nov 14, 2020
51cae0d
Update ports/tensorflow/portfile.cmake
jgehw Nov 14, 2020
52a905d
follow-up to code review
jgehw Nov 14, 2020
5e5c7ab
extend patch (further build deps)
jgehw Nov 15, 2020
d954930
fix suffix parameter
jgehw Nov 15, 2020
12a96ce
add more build deps
jgehw Nov 16, 2020
f3351f5
fix quoting
jgehw Nov 16, 2020
77559a6
Merge branch 'master' of https://github.com/microsoft/vcpkg into master
jgehw Nov 16, 2020
26cbca8
Merge branch 'master' into add-tensorflow-c
jgehw Nov 16, 2020
43039bc
extend linux patch
jgehw Nov 16, 2020
3e7d9b4
fix patch
jgehw Nov 16, 2020
bb66874
extend patch again
jgehw Nov 16, 2020
a1babea
yet another deps fix
jgehw Nov 16, 2020
d005d4d
another try to fix quoting of possibly empty string parameter
jgehw Nov 16, 2020
b28359c
add another deps patch
jgehw Nov 16, 2020
758a78f
extend patch again
jgehw Nov 17, 2020
6374836
different approach to fix empty string arguments
jgehw Nov 17, 2020
65c3073
Merge branch 'add-tensorflow-c' into add-tf-uwp
jgehw Nov 17, 2020
cf093d1
fix portfiles, add more bazel deps
jgehw Nov 17, 2020
e45fdcf
update list of headers for tensorflow 2.3.1 (was still 2.3.0)
jgehw Nov 17, 2020
45912df
update list of headers for v2.3.1
jgehw Nov 17, 2020
f9f8572
extend bazel deps path again
jgehw Nov 17, 2020
3b3ef9f
Update ports/tensorflow/CONTROL
jgehw Nov 18, 2020
ea05d03
fix bazel deps, bump port version
jgehw Nov 18, 2020
1665fd2
add more bazel deps
jgehw Nov 18, 2020
bb1a320
move common stuff into tensorflow-common as discussed in review
jgehw Nov 20, 2020
e0e437d
go for a different approach (patch bazel toolchain) as adding bazel d…
jgehw Nov 20, 2020
d468baf
Apply suggestions from code review
jgehw Nov 21, 2020
493fdb6
yet again a completely different approach to fix the include path
jgehw Nov 23, 2020
15ab0e7
fix path
jgehw Nov 23, 2020
4894eb2
fix path again
jgehw Nov 24, 2020
dd82b43
Merge branch 'add-tensorflow-c' into add-tf-uwp
jgehw Nov 24, 2020
d763508
merge changes from C port
jgehw Nov 24, 2020
bd71978
fix cmake variable replacement (apparently @ cannot be escaped...)
jgehw Nov 25, 2020
9e64aef
Merge branch 'master' into add-tf-uwp
jgehw Nov 25, 2020
c5a4d61
try again without escaping
jgehw Nov 26, 2020
d5014be
use absolute path
jgehw Nov 30, 2020
e9e8031
fix escaping
jgehw Dec 1, 2020
7a11dda
calculate absolute path
jgehw Dec 2, 2020
6a40066
fix replacement in configure_file
jgehw Dec 2, 2020
4e1c29c
handle directory exists error
jgehw Dec 2, 2020
d17b840
convert cygpath to windows path
jgehw Dec 2, 2020
a1b86df
overcome backslash / escaping issues
jgehw Dec 2, 2020
7bfae95
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Dec 3, 2020
6384419
try include with build-root-relative path
jgehw Dec 7, 2020
fc75c56
apply work-around until proper solution is available
jgehw Feb 4, 2021
3c9d47e
Merge branch 'master' of https://github.com/microsoft/vcpkg
jgehw Feb 4, 2021
57c8d3c
Merge branch 'master' into add-tf-uwp
jgehw Feb 4, 2021
f0804f1
merge master
jgehw Feb 4, 2021
b69ba43
resolved conflicts
jgehw Feb 4, 2021
15dda4d
Revert "merge master"
jgehw Feb 4, 2021
89a2e45
add uwp files to copy list
jgehw Feb 4, 2021
874c4b6
update uwppatch.h
jgehw Feb 4, 2021
79b3d50
fix typo
jgehw Feb 4, 2021
77b4118
patch the patch for UWP case
jgehw Feb 5, 2021
d513eb0
fix patch (missing spaces)
jgehw Feb 5, 2021
653a3bb
fix build error in AWS SDK prerequisit
jgehw Feb 6, 2021
c45bb8a
fix more compilation errors
jgehw Feb 10, 2021
9d14d06
replace previous patch with more targeted patch
jgehw Feb 10, 2021
f4192a8
add escaped quotes around Windows path with spaces
jgehw Feb 11, 2021
9ce008f
cleanup
jgehw Feb 11, 2021
52e0d0d
merge patch (there can only be one patch file per external)
jgehw Feb 11, 2021
0a91d3d
add messages to user
jgehw Feb 12, 2021
921c8ca
update versions files
jgehw Feb 22, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/tensorflow-cc/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vcpkg_fail_port_install(ON_ARCH "x86" "arm" ON_TARGET "UWP")
vcpkg_fail_port_install(ON_ARCH "x86" "arm")

set(TF_LIB_SUFFIX "_cc")
set(TF_PORT_SUFFIX "-cc")
Expand Down
4 changes: 2 additions & 2 deletions ports/tensorflow-cc/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "tensorflow-cc",
"version-string": "2.3.1",
"port-version": 2,
"port-version": 3,
"description": "Library for computation using data flow graphs for scalable machine learning (C++ API version)",
"homepage": "https://github.com/tensorflow/tensorflow",
"supports": "!(x86 | arm | uwp)",
"supports": "!(x86 | arm)",
"dependencies": [
"tensorflow-common"
]
Expand Down
137 changes: 137 additions & 0 deletions ports/tensorflow-common/fix-uwp-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
diff --git a/.bazelrc b/.bazelrc
--- a/.bazelrc
+++ b/.bazelrc
@@ -318,7 +318,9 @@
build:windows --verbose_failures

# On windows, we never cross compile
-build:windows --distinct_host_configuration=false
+build:windows --distinct_host_configuration=true
+build:windows --host_copt=-UWINAPI_FAMILY
+build:windows --host_linkopt=/APPCONTAINER:NO

# Suppress all warning messages.
build:short_logs --output_filter=DONT_MATCH_ANYTHING


diff --git a/third_party/curl.BUILD b/third_party/curl.BUILD
--- a/third_party/curl.BUILD
+++ b/third_party/curl.BUILD
@@ -472,9 +472,7 @@
"# define CURL_DISABLE_TELNET 1",
"# define CURL_DISABLE_TFTP 1",
"# define CURL_PULL_WS2TCPIP_H 1",
- "# define USE_WINDOWS_SSPI 1",
"# define USE_WIN32_IDN 1",
- "# define USE_SCHANNEL 1",
"# define WANT_IDN_PROTOTYPES 1",
"#elif defined(__APPLE__)",
"# define HAVE_FSETXATTR_6 1",


diff --git a/third_party/sqlite.BUILD b/third_party/sqlite.BUILD
--- a/third_party/sqlite.BUILD
+++ b/third_party/sqlite.BUILD
@@ -13,6 +13,7 @@
] + select({
"@org_tensorflow//tensorflow:windows": [
"-DSQLITE_MAX_TRIGGER_DEPTH=100",
+ "-DSQLITE_OS_WINRT=1",
],
"@org_tensorflow//tensorflow:macos": [
"-Os",


diff --git a/third_party/aws/workspace.bzl b/third_party/aws/workspace.bzl
--- a/third_party/aws/workspace.bzl
+++ b/third_party/aws/workspace.bzl
@@ -15,6 +15,7 @@
sha256 = "758174f9788fed6cc1e266bcecb20bf738bd5ef1c3d646131c9ed15c2d6c5720",
strip_prefix = "aws-sdk-cpp-1.7.336",
build_file = "//third_party/aws:BUILD.bazel",
+ patch_file = "//third_party/aws:FileSystem.patch",
)

third_party_http_archive(


diff --git a/third_party/aws/FileSystem.patch b/third_party/aws/FileSystem.patch
new file mode 100644
--- /dev/null
+++ b/third_party/aws/FileSystem.patch
@@ -0,0 +1,10 @@
+diff --git a/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp b/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
+--- a/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
++++ b/aws-cpp-sdk-core/source/platform/windows/FileSystem.cpp
+@@ -20,6 +20,7 @@
+ #include <cassert>
+ #include <iostream>
+ #include <Userenv.h>
++#include <Windows.h>
+
+ #pragma warning( disable : 4996)
+


diff --git a/third_party/icu/BUILD.bazel b/third_party/icu/BUILD.bazel
--- a/third_party/icu/BUILD.bazel
+++ b/third_party/icu/BUILD.bazel
@@ -45,6 +45,7 @@
copts = [
"-DU_COMMON_IMPLEMENTATION",
"-DU_HAVE_STD_ATOMICS", # TODO(gunan): Remove when TF is on ICU 64+.
+ "-DU_PLATFORM_HAS_WINUWP_API=1",
] + select({
":android": [
"-fdata-sections",


diff --git a/third_party/icu/udata.patch b/third_party/icu/udata.patch
--- a/third_party/icu/udata.patch
+++ b/third_party/icu/udata.patch
@@ -44,16 +44,32 @@

/*----------------------------------------------------------------------*
* *
-@@ -710,10 +708,11 @@
- if (uprv_getICUData_collation) {
- setCommonICUDataPointer(uprv_getICUData_collation(), FALSE, pErrorCode);
- }
-+ */
- if (uprv_getICUData_conversion) {
- setCommonICUDataPointer(uprv_getICUData_conversion(), FALSE, pErrorCode);
- }
-- */
-+
- #if U_PLATFORM_HAS_WINUWP_API == 0 // Windows UWP Platform does not support dll icu data at this time
- setCommonICUDataPointer(&U_ICUDATA_ENTRY_POINT, FALSE, pErrorCode);
- {
+--- a/icu4c/source/common/ucnvisci.cpp
+--- b/icu4c/source/common/ucnvisci.cpp
+@@ -1230,7 +1230,7 @@
+ *err =U_ILLEGAL_CHAR_FOUND;
+ /* reset */
+ *contextCharToUnicode=NO_CHAR_MARKER;
+- goto CALLBACK;
++ goto CALLBACK_LABEL;
+ }
+ }
+
+@@ -1269,7 +1269,7 @@
+ *contextCharToUnicode= NO_CHAR_MARKER;
+ *err = U_ILLEGAL_CHAR_FOUND;
+ }
+- goto CALLBACK;
++ goto CALLBACK_LABEL;
+ } else if (*contextCharToUnicode==ISCII_INV) {
+ if (sourceChar==ISCII_HALANT) {
+ targetUniChar = 0x0020; /* replace with space accoding to Indic FAQ */
+@@ -1483,7 +1483,7 @@
+ * so assign codes to reason and err
+ */
+ *err = U_INVALID_CHAR_FOUND;
+-CALLBACK:
++CALLBACK_LABEL:
+ args->converter->toUBytes[0] = (uint8_t) sourceChar;
+ args->converter->toULength = 1;
+ break;
3 changes: 3 additions & 0 deletions ports/tensorflow-common/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ set(TENSORFLOW_FILES
"${CMAKE_CURRENT_LIST_DIR}/fix-dbg-build-errors.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-linux-build.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-more-build-errors.patch"
"${CMAKE_CURRENT_LIST_DIR}/fix-uwp-build.patch"
"${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_linux.py"
"${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_macos.py"
"${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_windows.py"
Expand All @@ -19,6 +20,8 @@ set(TENSORFLOW_FILES
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-static.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-windows-dll.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-windows-lib.cmake.in"
"${CMAKE_CURRENT_LIST_DIR}/uwp_genrule.BUILD.in"
"${CMAKE_CURRENT_LIST_DIR}/uwppatch.h"
)

file(COPY ${TENSORFLOW_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
Expand Down
40 changes: 36 additions & 4 deletions ports/tensorflow-common/tensorflow-common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,16 @@ foreach(BUILD_TYPE dbg rel)
# prefer repeated source extraction here for each build type over extracting once above the loop and copying because users reported issues with copying symlinks
set(STATIC_ONLY_PATCHES)
set(LINUX_ONLY_PATCHES)
set(UWP_ONLY_PATCHES)
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(STATIC_ONLY_PATCHES "${CMAKE_CURRENT_LIST_DIR}/change-macros-for-static-lib.patch") # there is no static build option - change macros via patch and link library manually at the end
endif()
if(VCPKG_TARGET_IS_LINUX)
set(LINUX_ONLY_PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-linux-build.patch")
endif()
if(VCPKG_TARGET_IS_UWP)
set(UWP_ONLY_PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-uwp-build.patch")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tensorflow/tensorflow
Expand All @@ -131,6 +135,7 @@ foreach(BUILD_TYPE dbg rel)
"${CMAKE_CURRENT_LIST_DIR}/fix-more-build-errors.patch" # Fix no return statement
${STATIC_ONLY_PATCHES}
${LINUX_ONLY_PATCHES}
${UWP_ONLY_PATCHES}
)

message(STATUS "Configuring TensorFlow (${BUILD_TYPE})")
Expand Down Expand Up @@ -211,19 +216,39 @@ foreach(BUILD_TYPE dbg rel)
endforeach()
endif()

set(ADDITIONAL_TARGETS_PRE)
if(VCPKG_TARGET_IS_UWP)
# the following doesn't work yet, use work-around for the time being
# details: https://stackoverflow.com/questions/65184913/how-do-i-add-an-additional-system-include-directory-using-bazel
#set(AT_CHAR_FOR_CONFIGURE_FILE "@")
#configure_file(${CMAKE_CURRENT_LIST_DIR}/uwp_genrule.BUILD.in ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/patching_target/BUILD @ONLY)
#set(ADDITIONAL_TARGETS_PRE "///patching_target:patch_include_dirs")
message(STATUS "UWP build requires a patched header to be force-included. As this currently is not possible with bazel, we will copy '__vcpkg_uwppatch.h' to '$ENV{VCToolsInstallDir}/include/'. This might require vcpkg to be run as Administrator if the next command fails.")
configure_file(${CMAKE_CURRENT_LIST_DIR}/uwppatch.h $ENV{VCToolsInstallDir}/include/__vcpkg_uwppatch.h COPYONLY)
Comment on lines +226 to +227
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunately against vcpkg policy and cannot be merged as-is due to modifying global system state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I understand. So, as all other approaches I tried didn't work in the end, we need to wait until someone else has a solution or somebody answers the according question I posted for this: https://stackoverflow.com/questions/65184913/how-do-i-add-an-additional-system-include-directory-using-bazel


list(APPEND COPTS "--copt=-DWINAPI_FAMILY=WINAPI_FAMILY_APP")
list(APPEND COPTS "--copt=-D_WIN32_WINNT=0x0A00")
list(APPEND COPTS "--copt=-FI__vcpkg_uwppatch.h")
list(APPEND LINKOPTS "--linkopt=-APPCONTAINER")
list(APPEND LINKOPTS "--linkopt=WindowsApp.lib")
list(APPEND LINKOPTS "--linkopt='-LIBPATH:\"$ENV{VCToolsInstallDir}/lib/${VCPKG_TARGET_ARCHITECTURE}/store\"'")
list(APPEND LINKOPTS "--linkopt='-LIBPATH:\"$ENV{WindowsSdkDir}/lib/$ENV{WindowsSDKVersion}/um/${VCPKG_TARGET_ARCHITECTURE}\"'")
list(APPEND LINKOPTS "--linkopt=-FORCE:MULTIPLE")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
if(VCPKG_TARGET_IS_WINDOWS)
list(JOIN COPTS " " COPTS)
list(JOIN CXXOPTS " " CXXOPTS)
list(JOIN LINKOPTS " " LINKOPTS)
vcpkg_execute_build_process(
COMMAND ${BASH} --noprofile --norc -c "'${BAZEL}' build --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
COMMAND ${BASH} --noprofile --norc -c "'${BAZEL}' build --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ${ADDITIONAL_TARGETS_PRE} ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
else()
vcpkg_execute_build_process(
COMMAND ${BAZEL} build --verbose_failures ${BUILD_OPTS} --python_path=${PYTHON3} ${COPTS} ${CXXOPTS} ${LINKOPTS} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
COMMAND ${BAZEL} build --verbose_failures ${BUILD_OPTS} --python_path=${PYTHON3} ${COPTS} ${CXXOPTS} ${LINKOPTS} --define=no_tensorflow_py_deps=true ${ADDITIONAL_TARGETS_PRE} //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
Expand All @@ -241,13 +266,13 @@ foreach(BUILD_TYPE dbg rel)
list(JOIN CXXOPTS " " CXXOPTS)
list(JOIN LINKOPTS " " LINKOPTS)
vcpkg_execute_build_process(
COMMAND ${BASH} --noprofile --norc -c "${BAZEL} build -s --verbose_failures ${BUILD_OPTS} --features=fully_static_link ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
COMMAND ${BASH} --noprofile --norc -c "${BAZEL} build -s --verbose_failures ${BUILD_OPTS} --features=fully_static_link ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ${ADDITIONAL_TARGETS_PRE} ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
else()
vcpkg_execute_build_process(
COMMAND ${BAZEL} build -s --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path=${PYTHON3} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
COMMAND ${BAZEL} build -s --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path=${PYTHON3} --define=no_tensorflow_py_deps=true ${ADDITIONAL_TARGETS_PRE} //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
Expand Down Expand Up @@ -370,6 +395,13 @@ if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
COPYONLY)
endif()

if(VCPKG_TARGET_IS_UWP)
message(STATUS "Note: When using the TensorFlow UWP build in a UWP app, the 'Code Generation' capability needs to be checked in the app manifest.")
file(APPEND ${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/README "

Note: When using the TensorFlow UWP build in a UWP app, the 'Code Generation' capability needs to be checked in the app manifest.")
endif()

file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX})
file(RENAME ${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/LICENSE ${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/copyright)

Expand Down
24 changes: 24 additions & 0 deletions ports/tensorflow-common/uwp_genrule.BUILD.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
genrule(
name = "patch_include_dirs",
cmd = """
dest_path=`dirname "$@AT_CHAR_FOR_CONFIGURE_FILE@"`
# calc absolute path
if [ "$${dest_path:0:1}" != "/" ] ; then
current_dir=`pwd`
dest_path="$${current_dir}/$${dest_path}"
fi
mkdir -p "$${dest_path}"
cp '@CMAKE_CURRENT_LIST_DIR@/uwppatch.h' "$${dest_path}"
windows_path=`cygpath -w "$${dest_path}"`
# use forward slashes
windows_path=`echo $${windows_path} | sed -e s'|\\\\\\\\\\\\\\\\|/|'g`
echo \\\"$${windows_path}/\\\", >> $(location @AT_CHAR_FOR_CONFIGURE_FILE@local_config_cc//:builtin_include_directory_paths_msvc)
""",
srcs = [
"@AT_CHAR_FOR_CONFIGURE_FILE@local_config_cc//:toolchain",
"@AT_CHAR_FOR_CONFIGURE_FILE@local_config_cc//:builtin_include_directory_paths_msvc",
],
outs = [
"patched_includes/uwppatch.h"
],
)
Loading