early-access version 2853
This commit is contained in:
23
externals/vcpkg/ports/tensorflow-common/LICENSE.txt
vendored
Executable file
23
externals/vcpkg/ports/tensorflow-common/LICENSE.txt
vendored
Executable file
@@ -0,0 +1,23 @@
|
||||
Copyright (c) Microsoft Corporation
|
||||
|
||||
All rights reserved.
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
13
externals/vcpkg/ports/tensorflow-common/README-linux
vendored
Executable file
13
externals/vcpkg/ports/tensorflow-common/README-linux
vendored
Executable file
@@ -0,0 +1,13 @@
|
||||
Warning: Static TensorFlow build contains several external dependencies that may cause linking conflicts
|
||||
(for example, one cannot use both openssl and TensorFlow in the same project, since TensorFlow contains boringssl).
|
||||
|
||||
Note: Besides TensorFlow itself, you'll also need to pass its dependencies to the linker:
|
||||
* libm
|
||||
* libdl
|
||||
* libpthread
|
||||
for example, '-ltensorflow_cc -lm -ldl -lpthread'.
|
||||
|
||||
Note: There is no separate libtensorflow_framework.a as it got merged into libtensorflow_cc.a to avoid linking conflicts.
|
||||
|
||||
Note: For some TensorFlow features (e.g. OpRegistry), it might be necessary to tell the linker to include the whole library:
|
||||
'-Wl,--whole-archive -ltensorflow_cc -Wl,--no-whole-archive [rest of linker arguments]'
|
12
externals/vcpkg/ports/tensorflow-common/README-macos
vendored
Executable file
12
externals/vcpkg/ports/tensorflow-common/README-macos
vendored
Executable file
@@ -0,0 +1,12 @@
|
||||
Warning: Static TensorFlow build contains several external dependencies that may cause linking conflicts
|
||||
(for example, one cannot use both openssl and TensorFlow in the same project, since TensorFlow contains boringssl).
|
||||
|
||||
Note: Besides TensorFlow itself, you'll also need to pass its dependencies to the linker:
|
||||
* CoreFoundation
|
||||
* Security (only when linking against the whole library, see below)
|
||||
for example, '-ltensorflow_cc -framework CoreFoundation -framework Security'.
|
||||
|
||||
Note: There is no separate libtensorflow_framework.a as it got merged into libtensorflow_cc.a to avoid linking conflicts.
|
||||
|
||||
Note: For some TensorFlow features (e.g. OpRegistry), it might be necessary to tell the linker to include the whole library:
|
||||
'-Wl,-force_load,path/to/libtensorflow_cc.a [rest of linker arguments]'
|
5
externals/vcpkg/ports/tensorflow-common/README-windows
vendored
Executable file
5
externals/vcpkg/ports/tensorflow-common/README-windows
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
Warning: Static TensorFlow build contains several external dependencies that may cause linking conflicts
|
||||
(for example, one cannot use both openssl and TensorFlow in the same project, since TensorFlow contains boringssl).
|
||||
|
||||
Note: For some TensorFlow features (e.g. OpRegistry), it might be necessary to convince the linker to include the whole library, i.e., link using options
|
||||
'/WHOLEARCHIVE:tensorflow_cc.lib /WHOLEARCHIVE:tensorflow_cc-part2.lib /WHOLEARCHIVE:tensorflow_cc-part3.lib ...'
|
318
externals/vcpkg/ports/tensorflow-common/change-macros-for-static-lib.patch
vendored
Executable file
318
externals/vcpkg/ports/tensorflow-common/change-macros-for-static-lib.patch
vendored
Executable file
@@ -0,0 +1,318 @@
|
||||
diff --git a/tensorflow/core/platform/macros.h b/tensorflow/core/platform/macros.h
|
||||
--- a/tensorflow/core/platform/macros.h
|
||||
+++ b/tensorflow/core/platform/macros.h
|
||||
@@ -57,16 +57,7 @@
|
||||
#define TF_SCANF_ATTRIBUTE(string_index, first_to_check)
|
||||
#endif
|
||||
|
||||
-// Control visibility outside .so
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
+#define TF_EXPORT
|
||||
|
||||
#ifdef __has_builtin
|
||||
#define TF_HAS_BUILTIN(x) __has_builtin(x)
|
||||
|
||||
diff --git a/tensorflow/c/c_api.h b/tensorflow/c/c_api.h
|
||||
--- a/tensorflow/c/c_api.h
|
||||
+++ b/tensorflow/c/c_api.h
|
||||
@@ -71,24 +71,7 @@
|
||||
// and the API just provides high level controls over the number of
|
||||
// devices of each type.
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/c_api_experimental.h b/tensorflow/c/c_api_experimental.h
|
||||
--- a/tensorflow/c/c_api_experimental.h
|
||||
+++ b/tensorflow/c/c_api_experimental.h
|
||||
@@ -28,24 +28,7 @@
|
||||
// The API here is subject to changes in the future.
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.$a
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/c_api_macros.h b/tensorflow/c/c_api_macros.h
|
||||
--- a/tensorflow/c/c_api_macros.h
|
||||
+++ b/tensorflow/c/c_api_macros.h
|
||||
@@ -16,17 +16,5 @@
|
||||
#ifndef TENSORFLOW_C_C_API_MACROS_H_
|
||||
#define TENSORFLOW_C_C_API_MACROS_H_
|
||||
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
|
||||
diff --git a/tensorflow/c/kernels.h b/tensorflow/c/kernels.h
|
||||
--- a/tensorflow/c/kernels.h
|
||||
+++ b/tensorflow/c/kernels.h
|
||||
@@ -24,24 +24,7 @@
|
||||
#include "tensorflow/c/tf_status.h"
|
||||
#include "tensorflow/c/tf_tensor.h"
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/kernels_experimental.h b/tensorflow/c/kernels_experimental.h
|
||||
--- a/tensorflow/c/kernels_experimental.h
|
||||
+++ b/tensorflow/c/kernels_experimental.h
|
||||
@@ -25,24 +25,7 @@
|
||||
// The API here is subject to changes in the future.
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/ops.h b/tensorflow/c/ops.h
|
||||
--- a/tensorflow/c/ops.h
|
||||
+++ b/tensorflow/c/ops.h
|
||||
@@ -76,19 +76,7 @@
|
||||
#include "tensorflow/c/tf_datatype.h"
|
||||
#include "tensorflow/c/tf_status.h"
|
||||
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/tf_datatype.h b/tensorflow/c/tf_datatype.h
|
||||
--- a/tensorflow/c/tf_datatype.h
|
||||
+++ b/tensorflow/c/tf_datatype.h
|
||||
@@ -18,24 +18,7 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/tf_status.h b/tensorflow/c/tf_status.h
|
||||
--- a/tensorflow/c/tf_status.h
|
||||
+++ b/tensorflow/c/tf_status.h
|
||||
@@ -16,19 +16,7 @@
|
||||
#ifndef TENSORFLOW_C_TF_STATUS_H_
|
||||
#define TENSORFLOW_C_TF_STATUS_H_
|
||||
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/tf_tensor.h b/tensorflow/c/tf_tensor.h
|
||||
--- a/tensorflow/c/tf_tensor.h
|
||||
+++ b/tensorflow/c/tf_tensor.h
|
||||
@@ -23,24 +23,7 @@
|
||||
#include "tensorflow/c/tf_datatype.h"
|
||||
#include "tensorflow/c/tf_status.h"
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/tf_tstring.h b/tensorflow/c/tf_tstring.h
|
||||
--- a/tensorflow/c/tf_tstring.h
|
||||
+++ b/tensorflow/c/tf_tstring.h
|
||||
@@ -18,19 +18,7 @@
|
||||
#include "tensorflow/c/tf_tensor.h"
|
||||
#include "tensorflow/core/platform/ctstring.h"
|
||||
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
diff --git a/tensorflow/c/eager/c_api.h b/tensorflow/c/eager/c_api.h
|
||||
--- a/tensorflow/c/eager/c_api.h
|
||||
+++ b/tensorflow/c/eager/c_api.h
|
||||
@@ -22,24 +22,7 @@
|
||||
|
||||
#include "tensorflow/c/c_api.h"
|
||||
|
||||
-// Macro to control visibility of exported symbols in the shared library (.so,
|
||||
-// .dylib, .dll).
|
||||
-// This duplicates the TF_EXPORT macro definition in
|
||||
-// tensorflow/core/platform/macros.h in order to keep this .h file independent
|
||||
-// of any other includes.$a
|
||||
-#ifdef SWIG
|
||||
#define TF_CAPI_EXPORT
|
||||
-#else
|
||||
-#if defined(_WIN32)
|
||||
-#ifdef TF_COMPILE_LIBRARY
|
||||
-#define TF_CAPI_EXPORT __declspec(dllexport)
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __declspec(dllimport)
|
||||
-#endif // TF_COMPILE_LIBRARY
|
||||
-#else
|
||||
-#define TF_CAPI_EXPORT __attribute__((visibility("default")))
|
||||
-#endif // _WIN32
|
||||
-#endif // SWIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
30
externals/vcpkg/ports/tensorflow-common/convert_lib_params_linux.py
vendored
Executable file
30
externals/vcpkg/ports/tensorflow-common/convert_lib_params_linux.py
vendored
Executable file
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
|
||||
version = sys.argv[1]
|
||||
lib_suffix = "" if len(sys.argv) < 3 else sys.argv[2]
|
||||
|
||||
with open(f"libtensorflow{lib_suffix}.a.{version}-2.params", "w") as f_out:
|
||||
parts = []
|
||||
with open(f"libtensorflow_framework.so.{version}-2.params", "r") as f_in:
|
||||
skip_next = False
|
||||
for line in f_in:
|
||||
if skip_next:
|
||||
skip_next = False
|
||||
continue
|
||||
if line.startswith("-o"):
|
||||
skip_next = True
|
||||
elif line.startswith("bazel-out"):
|
||||
f_out.write(line)
|
||||
parts.append(line)
|
||||
parts = set(parts)
|
||||
with open(f"libtensorflow{lib_suffix}.so.{version}-2.params", "r") as f_in:
|
||||
skip_next = False
|
||||
for line in f_in:
|
||||
if skip_next:
|
||||
skip_next = False
|
||||
continue
|
||||
if line.startswith("-o"):
|
||||
skip_next = True
|
||||
elif line.startswith("bazel-out"):
|
||||
if line not in parts:
|
||||
f_out.write(line)
|
20
externals/vcpkg/ports/tensorflow-common/convert_lib_params_macos.py
vendored
Executable file
20
externals/vcpkg/ports/tensorflow-common/convert_lib_params_macos.py
vendored
Executable file
@@ -0,0 +1,20 @@
|
||||
import os.path
|
||||
import sys
|
||||
|
||||
version = sys.argv[1]
|
||||
lib_suffix = "" if len(sys.argv) < 3 else sys.argv[2]
|
||||
|
||||
if os.path.isfile(f"libtensorflow_framework.{version}.dylib-2.params"):
|
||||
with open(f"libtensorflow{lib_suffix}.{version}.a-2.params", "w") as f_out:
|
||||
parts = []
|
||||
with open(f"libtensorflow_framework.{version}.dylib-2.params", "r") as f_in:
|
||||
for line in f_in:
|
||||
if line.startswith("-Wl,-force_load,"):
|
||||
f_out.write(line[16:])
|
||||
parts.append(line[16:])
|
||||
parts = set(parts)
|
||||
with open(f"libtensorflow{lib_suffix}.{version}.dylib-2.params", "r") as f_in:
|
||||
for line in f_in:
|
||||
if line.startswith("-Wl,-force_load,"):
|
||||
if line[16:] not in parts:
|
||||
f_out.write(line[16:])
|
28
externals/vcpkg/ports/tensorflow-common/convert_lib_params_windows.py
vendored
Executable file
28
externals/vcpkg/ports/tensorflow-common/convert_lib_params_windows.py
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
lib_suffix = "" if len(sys.argv) < 2 else sys.argv[1]
|
||||
|
||||
file_no = 1
|
||||
with open(f"tensorflow{lib_suffix}.dll-2.params", "r") as f_in:
|
||||
lib_name = None
|
||||
acc_size = 0
|
||||
f_out = open(f"tensorflow{lib_suffix}.lib-2.params-part1", "w")
|
||||
for line in f_in:
|
||||
if line.startswith("/OUT:"):
|
||||
lib_name = line
|
||||
line = line.replace(".dll", "-part1.lib")
|
||||
f_out.write(line)
|
||||
elif line.startswith("/WHOLEARCHIVE:"):
|
||||
line = line[len("/WHOLEARCHIVE:"):]
|
||||
size = os.stat(f"../../{line.strip()}").st_size
|
||||
if acc_size + size > 0xFFFFFFFF:
|
||||
# we need to split the library if it is >4GB, because it's not supported even on x64 Windows
|
||||
f_out.close()
|
||||
file_no += 1
|
||||
f_out = open(f"tensorflow{lib_suffix}.lib-2.params-part{file_no}", "w")
|
||||
acc_size = 0
|
||||
f_out.write(lib_name.replace(".dll", f"-part{file_no}.lib"))
|
||||
acc_size += size
|
||||
f_out.write(line)
|
||||
f_out.close()
|
21
externals/vcpkg/ports/tensorflow-common/fix-build-error.patch
vendored
Executable file
21
externals/vcpkg/ports/tensorflow-common/fix-build-error.patch
vendored
Executable file
@@ -0,0 +1,21 @@
|
||||
diff --git a/tensorflow/core/platform/default/logging.h b/tensorflow/core/platform/default/logging.h
|
||||
--- a/tensorflow/core/platform/default/logging.h
|
||||
+++ b/tensorflow/core/platform/default/logging.h
|
||||
@@ -104,13 +104,13 @@ class LogMessageFatal : public LogMessage {
|
||||
};
|
||||
|
||||
#define _TF_LOG_INFO \
|
||||
- ::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow::INFO)
|
||||
+ tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::INFO)
|
||||
#define _TF_LOG_WARNING \
|
||||
- ::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow::WARNING)
|
||||
+ tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::WARNING)
|
||||
#define _TF_LOG_ERROR \
|
||||
- ::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow::ERROR)
|
||||
+ tensorflow::internal::LogMessage(__FILE__, __LINE__, tensorflow::ERROR)
|
||||
#define _TF_LOG_FATAL \
|
||||
- ::tensorflow::internal::LogMessageFatal(__FILE__, __LINE__)
|
||||
+ tensorflow::internal::LogMessageFatal(__FILE__, __LINE__)
|
||||
|
||||
#define _TF_LOG_QFATAL _TF_LOG_FATAL
|
||||
|
25
externals/vcpkg/ports/tensorflow-common/fix-windows-build.patch
vendored
Executable file
25
externals/vcpkg/ports/tensorflow-common/fix-windows-build.patch
vendored
Executable file
@@ -0,0 +1,25 @@
|
||||
diff --git a/tensorflow/core/kernels/depthtospace_op.cc b/tensorflow/core/kernels/depthtospace_op.cc
|
||||
--- a/tensorflow/core/kernels/depthtospace_op.cc
|
||||
+++ b/tensorflow/core/kernels/depthtospace_op.cc
|
||||
@@ -112,7 +112,7 @@
|
||||
auto Tinput = input.tensor<T, kDims>();
|
||||
auto Toutput = outputs_tensor->tensor<T, kDims>();
|
||||
|
||||
- if (std::is_same<Device, GPUDevice>::value) {
|
||||
+ if constexpr (std::is_same<Device, GPUDevice>::value) {
|
||||
if (is_int8x4) {
|
||||
// NCHW_VECT_C with 4 x qint8 can be treated as NCHW int32.
|
||||
auto Tinput_v = input.template reinterpret_last_dimension<int32, 4>();
|
||||
|
||||
diff --git a/tensorflow/core/kernels/spacetodepth_op.cc b/tensorflow/core/kernels/spacetodepth_op.cc
|
||||
--- a/tensorflow/core/kernels/spacetodepth_op.cc
|
||||
+++ b/tensorflow/core/kernels/spacetodepth_op.cc
|
||||
@@ -126,7 +126,7 @@
|
||||
output_width, output_depth),
|
||||
&outputs_tensor));
|
||||
|
||||
- if (std::is_same<Device, GPUDevice>::value) {
|
||||
+ if constexpr (std::is_same<Device, GPUDevice>::value) {
|
||||
using RT = typename RawType<T>::type;
|
||||
if (data_format_ == FORMAT_NCHW_VECT_C) {
|
||||
// NCHW_VECT_C with 4 x qint8 can be treated as NCHW int32.
|
26
externals/vcpkg/ports/tensorflow-common/generate_static_link_cmd_linux.py
vendored
Executable file
26
externals/vcpkg/ports/tensorflow-common/generate_static_link_cmd_linux.py
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
import re
|
||||
import sys
|
||||
|
||||
params_path = sys.argv[2]
|
||||
version = sys.argv[3]
|
||||
lib_suffix = "" if len(sys.argv) < 5 else sys.argv[4]
|
||||
|
||||
with open(sys.argv[1], "r") as f_in:
|
||||
with open("static_link.sh", "w") as f_out:
|
||||
p_cd = re.compile(r"^\((cd .*) && \\$")
|
||||
p_linker = re.compile(fr"^\s*(.+)gcc.+(@bazel-out\S+libtensorflow{lib_suffix}\.so\.\d\.\d\.\d-2\.params).*")
|
||||
f_out.write("#!/bin/bash\n# note: ar/binutils version 2.27 required to support output files > 4GB\n")
|
||||
env = []
|
||||
for line in f_in:
|
||||
if line.startswith("(cd"):
|
||||
# new command, reset
|
||||
env = [line]
|
||||
else:
|
||||
m1 = p_linker.match(line)
|
||||
if m1:
|
||||
m2 = p_cd.match(env[0])
|
||||
f_out.write(m2.group(1) + "\n")
|
||||
line = f'"{m1.group(1)}ar" rcs {m1.group(2)[1:-9].replace(".so", ".a")} {m1.group(2).replace(".so", ".a")}\n'
|
||||
f_out.write(line)
|
||||
else:
|
||||
env.append(line)
|
71
externals/vcpkg/ports/tensorflow-common/generate_static_link_cmd_macos.py
vendored
Executable file
71
externals/vcpkg/ports/tensorflow-common/generate_static_link_cmd_macos.py
vendored
Executable file
@@ -0,0 +1,71 @@
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
|
||||
params_path = sys.argv[2]
|
||||
version = sys.argv[3]
|
||||
lib_suffix = "" if len(sys.argv) < 5 else sys.argv[4]
|
||||
|
||||
with open(sys.argv[1], "r") as f_in:
|
||||
with open("static_link.sh", "w") as f_out:
|
||||
if os.path.isfile(f"{params_path}/libtensorflow_framework.{version}.dylib-2.params"):
|
||||
p_cd = re.compile(r"^\((cd .*) && \\$")
|
||||
p_linker = re.compile(fr"^\s*.+cc_wrapper.sh.+(@bazel-out\S+libtensorflow{lib_suffix}\.\d\.\d\.\d\.dylib-2\.params).*")
|
||||
f_out.write("#!/bin/bash\n# note: ar/binutils version 2.27 required to support output files > 4GB\n")
|
||||
env = []
|
||||
for line in f_in:
|
||||
if line.startswith("(cd"):
|
||||
# new command, reset
|
||||
env = [line]
|
||||
else:
|
||||
m1 = p_linker.match(line)
|
||||
if m1:
|
||||
m2 = p_cd.match(env[0])
|
||||
f_out.write(m2.group(1) + "\n")
|
||||
line = f'"/usr/bin/libtool" -static -o {m1.group(1)[1:-9].replace(".dylib", ".a")} {m1.group(1).replace(".dylib", ".a")}\n'
|
||||
f_out.write(line)
|
||||
else:
|
||||
env.append(line)
|
||||
else:
|
||||
# old behaviour (still on some platforms): inline all parameters instead of using -2.params file
|
||||
p_cd = re.compile(r"^\((cd .*) && \\$")
|
||||
p_linker1 = re.compile(fr"^.*cc_wrapper.sh.+-shared.+-o (bazel-out\S+libtensorflow{lib_suffix}\.\d\.\d\.\d\.dylib)")
|
||||
p_linker2 = re.compile("^.*cc_wrapper.sh.+-shared.+-o (bazel-out\\S+libtensorflow_framework\\.\\d\\.\\d\\.\\d\\.dylib)")
|
||||
f_out.write("#!/bin/bash\n# note: ar/binutils version 2.27 required to support output files > 4GB\n")
|
||||
env = []
|
||||
parts = None
|
||||
for line in f_in:
|
||||
if line.startswith("(cd"):
|
||||
# new command, reset
|
||||
env = [line]
|
||||
else:
|
||||
m1 = p_linker1.match(line)
|
||||
m2 = p_linker2.match(line)
|
||||
if m1:
|
||||
tokens = line.split()
|
||||
if parts is None:
|
||||
parts = [t[16:] for t in tokens if t.startswith("-Wl,-force_load,")]
|
||||
else:
|
||||
m = p_cd.match(env[0])
|
||||
f_out.write(m.group(1) + "\n")
|
||||
tmp = [t[16:] for t in tokens if t.startswith("-Wl,-force_load,")]
|
||||
old = set(parts)
|
||||
parts += [t for t in tmp if t not in old]
|
||||
line = f"libtool -static -o {m1.group(1).replace('.dylib', '.a')} {' '.join(parts)}\n"
|
||||
f_out.write(line)
|
||||
break
|
||||
elif m2 and len(env) > 6:
|
||||
tokens = line.split()
|
||||
if parts is None:
|
||||
parts = [t[16:] for t in tokens if t.startswith("-Wl,-force_load,")]
|
||||
else:
|
||||
m = p_cd.match(env[0])
|
||||
f_out.write(m.group(1) + "\n")
|
||||
tmp = [t[16:] for t in tokens if t.startswith("-Wl,-force_load,")]
|
||||
old = set(parts)
|
||||
parts += [t for t in tmp if t not in old]
|
||||
line = f"libtool -static -o {m2.group(1).replace('_framework', lib_suffix).replace('.dylib', '.a')} {' '.join(parts)}\n"
|
||||
f_out.write(line)
|
||||
break
|
||||
else:
|
||||
env.append(line)
|
45
externals/vcpkg/ports/tensorflow-common/generate_static_link_cmd_windows.py
vendored
Executable file
45
externals/vcpkg/ports/tensorflow-common/generate_static_link_cmd_windows.py
vendored
Executable file
@@ -0,0 +1,45 @@
|
||||
import os.path
|
||||
import re
|
||||
import sys
|
||||
|
||||
params_path = sys.argv[2]
|
||||
version = sys.argv[3]
|
||||
lib_suffix = "" if len(sys.argv) < 5 else sys.argv[4]
|
||||
|
||||
with open(sys.argv[1], "r") as f_in:
|
||||
with open("static_link.bat", "w") as f_out:
|
||||
p_setenv = re.compile(r"^\s*(SET .+=.*)$")
|
||||
p_linker = re.compile(fr".+link\.exe.+tensorflow{lib_suffix}\.dll-2\.params.*")
|
||||
env = []
|
||||
for line in f_in:
|
||||
if line.startswith("cd"):
|
||||
# new command, reset
|
||||
env = []
|
||||
else:
|
||||
m = p_setenv.match(line)
|
||||
if m:
|
||||
env.append(m.group(1))
|
||||
else:
|
||||
m = p_linker.match(line)
|
||||
if m:
|
||||
for e in env:
|
||||
f_out.write(e + "\n")
|
||||
tokens = line.split()
|
||||
line = "\""
|
||||
params_file = None
|
||||
for t in tokens:
|
||||
if t.endswith("link.exe"):
|
||||
t = t[:-len("link.exe")] + "lib.exe\""
|
||||
elif t == "/DLL" or t.lower()[1:].startswith("defaultlib:") or t.lower()[1:].startswith("ignore") or t.startswith("/OPT:") or t.startswith("/DEF:") or t.startswith("/DEBUG:") or t.startswith("/INCREMENTAL:"):
|
||||
continue
|
||||
elif t[0] == '@' and t.endswith(f"tensorflow{lib_suffix}.dll-2.params"):
|
||||
t = t[:-len("dll-2.params")] + "lib-2.params-part1"
|
||||
params_file = t[1:-len("-part1")]
|
||||
line += t + " "
|
||||
f_out.write(line + "\n")
|
||||
# check for more parts if library needs to be split
|
||||
file_no = 2
|
||||
while os.path.isfile(f"{params_file}-part{file_no}"):
|
||||
f_out.write(line.replace("lib-2.params-part1", f"lib-2.params-part{file_no}") + "\n")
|
||||
file_no += 1
|
||||
break
|
26
externals/vcpkg/ports/tensorflow-common/portfile.cmake
vendored
Executable file
26
externals/vcpkg/ports/tensorflow-common/portfile.cmake
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
|
||||
|
||||
set(TENSORFLOW_FILES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/change-macros-for-static-lib.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_linux.py"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_macos.py"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_windows.py"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fix-build-error.patch"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fix-windows-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"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/README-linux"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/README-macos"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/README-windows"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-common.cmake"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-shared.cmake.in"
|
||||
"${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"
|
||||
)
|
||||
|
||||
file(COPY ${TENSORFLOW_FILES} DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
|
||||
# Use vcpkg's license
|
||||
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
|
468
externals/vcpkg/ports/tensorflow-common/tensorflow-common.cmake
vendored
Executable file
468
externals/vcpkg/ports/tensorflow-common/tensorflow-common.cmake
vendored
Executable file
@@ -0,0 +1,468 @@
|
||||
set(TF_VERSION 2.7.0)
|
||||
set(TF_VERSION_SHORT 2.7)
|
||||
|
||||
vcpkg_find_acquire_program(BAZEL)
|
||||
get_filename_component(BAZEL_DIR "${BAZEL}" DIRECTORY)
|
||||
vcpkg_add_to_path(PREPEND ${BAZEL_DIR})
|
||||
set(ENV{BAZEL_BIN_PATH} "${BAZEL}")
|
||||
|
||||
function(tensorflow_try_remove_recurse_wait PATH_TO_REMOVE)
|
||||
file(REMOVE_RECURSE ${PATH_TO_REMOVE})
|
||||
if(EXISTS "${PATH_TO_REMOVE}")
|
||||
vcpkg_execute_required_process(COMMAND ${CMAKE_COMMAND} -E sleep 5 WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-sleep-${TARGET_TRIPLET})
|
||||
file(REMOVE_RECURSE ${PATH_TO_REMOVE})
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
vcpkg_find_acquire_program(GIT)
|
||||
get_filename_component(GIT_DIR "${GIT}" DIRECTORY)
|
||||
vcpkg_add_to_path(PREPEND ${GIT_DIR})
|
||||
|
||||
string(FIND "${CURRENT_BUILDTREES_DIR}" " " POS)
|
||||
if(NOT POS EQUAL -1)
|
||||
message(FATAL_ERROR "Your vcpkg path contains spaces. This is not supported by the bazel build tool. Aborting.")
|
||||
endif()
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
string(FIND "$ENV{USERNAME}" " " POS)
|
||||
if(NOT POS EQUAL -1)
|
||||
message(WARNING "Your Windows username '$ENV{USERNAME}' contains spaces. Applying work-around to bazel. Be warned of possible further issues.")
|
||||
endif()
|
||||
|
||||
vcpkg_acquire_msys(MSYS_ROOT PACKAGES bash unzip patch diffutils libintl gzip coreutils mingw-w64-x86_64-python-numpy)
|
||||
vcpkg_add_to_path(${MSYS_ROOT}/usr/bin)
|
||||
vcpkg_add_to_path(${MSYS_ROOT}/mingw64/bin)
|
||||
set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
|
||||
|
||||
set(ENV{BAZEL_SH} ${MSYS_ROOT}/usr/bin/bash.exe)
|
||||
set(ENV{BAZEL_VC} $ENV{VCInstallDir})
|
||||
set(ENV{BAZEL_VC_FULL_VERSION} $ENV{VCToolsVersion})
|
||||
|
||||
set(PYTHON3 "${MSYS_ROOT}/mingw64/bin/python3.exe")
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import site; print(site.getsitepackages()[0])" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pypath-${TARGET_TRIPLET} OUTPUT_VARIABLE PYTHON_LIB_PATH)
|
||||
else()
|
||||
vcpkg_find_acquire_program(PYTHON3)
|
||||
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m venv --symlinks "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-venv-${TARGET_TRIPLET})
|
||||
vcpkg_add_to_path(PREPEND ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv/bin)
|
||||
set(PYTHON3 ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv/bin/python3)
|
||||
set(ENV{VIRTUAL_ENV} ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-venv)
|
||||
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install -U pip WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pip-${TARGET_TRIPLET})
|
||||
# acceleration libs currently broken on macOS => force numpy user space reinstall without BLAS/LAPACK/ATLAS
|
||||
# remove this work-around again, i.e. default to "else" branch, once acceleration libs are fixed upstream
|
||||
set(ENV{BLAS} "None")
|
||||
set(ENV{LAPACK} "None")
|
||||
set(ENV{ATLAS} "None")
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install -U --force-reinstall numpy WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequistes-pip-${TARGET_TRIPLET})
|
||||
else()
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -m pip install -U pip numpy WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pip-${TARGET_TRIPLET})
|
||||
endif()
|
||||
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import site; print(site.getusersitepackages())" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-pypath-${TARGET_TRIPLET} OUTPUT_VARIABLE PYTHON_LIB_PATH)
|
||||
endif()
|
||||
set(ENV{PYTHON_BIN_PATH} "${PYTHON3}")
|
||||
set(ENV{PYTHON_LIB_PATH} "${PYTHON_LIB_PATH}")
|
||||
|
||||
# check if numpy can be loaded
|
||||
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import numpy" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequisites-numpy-${TARGET_TRIPLET})
|
||||
|
||||
set(ENV{USE_DEFAULT_PYTHON_LIB_PATH} 1)
|
||||
set(ENV{TF_NEED_KAFKA} 0)
|
||||
set(ENV{TF_NEED_OPENCL_SYCL} 0)
|
||||
set(ENV{TF_NEED_AWS} 0)
|
||||
set(ENV{TF_NEED_GCP} 0)
|
||||
set(ENV{TF_NEED_HDFS} 0)
|
||||
set(ENV{TF_NEED_S3} 0)
|
||||
set(ENV{TF_ENABLE_XLA} 0)
|
||||
set(ENV{TF_NEED_GDR} 0)
|
||||
set(ENV{TF_NEED_VERBS} 0)
|
||||
set(ENV{TF_NEED_OPENCL} 0)
|
||||
set(ENV{TF_NEED_MPI} 0)
|
||||
set(ENV{TF_NEED_TENSORRT} 0)
|
||||
set(ENV{TF_NEED_NGRAPH} 0)
|
||||
set(ENV{TF_NEED_IGNITE} 0)
|
||||
set(ENV{TF_NEED_ROCM} 0)
|
||||
set(ENV{TF_SET_ANDROID_WORKSPACE} 0)
|
||||
set(ENV{TF_DOWNLOAD_CLANG} 0)
|
||||
set(ENV{TF_NCCL_VERSION} ${TF_VERSION_SHORT})
|
||||
set(ENV{NCCL_INSTALL_PATH} "")
|
||||
set(ENV{CC_OPT_FLAGS} "/arch:AVX")
|
||||
set(ENV{TF_NEED_CUDA} 0)
|
||||
set(ENV{TF_CONFIGURE_IOS} 0)
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(BAZEL_LIB_NAME tensorflow${TF_LIB_SUFFIX}.dll)
|
||||
set(PLATFORM_SUFFIX windows)
|
||||
set(STATIC_LINK_CMD static_link.bat)
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
set(BAZEL_LIB_NAME libtensorflow${TF_LIB_SUFFIX}.dylib)
|
||||
set(PLATFORM_SUFFIX macos)
|
||||
set(STATIC_LINK_CMD sh static_link.sh)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(TF_LIB_NAME "libtensorflow${TF_LIB_SUFFIX}.dylib")
|
||||
set(TF_LIB_NAME_SHORT "libtensorflow${TF_LIB_SUFFIX}.2.dylib")
|
||||
set(TF_LIB_NAME_FULL "libtensorflow${TF_LIB_SUFFIX}.${TF_VERSION}.dylib")
|
||||
set(TF_FRAMEWORK_NAME "libtensorflow_framework.dylib")
|
||||
set(TF_FRAMEWORK_NAME_SHORT "libtensorflow_framework.2.dylib")
|
||||
set(TF_FRAMEWORK_NAME_FULL "libtensorflow_framework.${TF_VERSION}.dylib")
|
||||
else()
|
||||
set(TF_LIB_NAME "libtensorflow${TF_LIB_SUFFIX}.a")
|
||||
set(TF_LIB_NAME_SHORT "libtensorflow${TF_LIB_SUFFIX}.2.a")
|
||||
set(TF_LIB_NAME_FULL "libtensorflow${TF_LIB_SUFFIX}.${TF_VERSION}.a")
|
||||
endif()
|
||||
else()
|
||||
set(BAZEL_LIB_NAME libtensorflow${TF_LIB_SUFFIX}.so)
|
||||
set(PLATFORM_SUFFIX linux)
|
||||
set(STATIC_LINK_CMD sh static_link.sh)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
set(TF_LIB_NAME "libtensorflow${TF_LIB_SUFFIX}.so")
|
||||
set(TF_LIB_NAME_SHORT "libtensorflow${TF_LIB_SUFFIX}.so.2")
|
||||
set(TF_LIB_NAME_FULL "libtensorflow${TF_LIB_SUFFIX}.so.${TF_VERSION}")
|
||||
set(TF_FRAMEWORK_NAME "libtensorflow_framework.so")
|
||||
set(TF_FRAMEWORK_NAME_SHORT "libtensorflow_framework.so.2")
|
||||
set(TF_FRAMEWORK_NAME_FULL "libtensorflow_framework.so.${TF_VERSION}")
|
||||
else()
|
||||
set(TF_LIB_NAME "libtensorflow${TF_LIB_SUFFIX}.a")
|
||||
set(TF_LIB_NAME_SHORT "libtensorflow${TF_LIB_SUFFIX}.a.2")
|
||||
set(TF_LIB_NAME_FULL "libtensorflow${TF_LIB_SUFFIX}.a.${TF_VERSION}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
list(APPEND PORT_BUILD_CONFIGS "dbg")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
|
||||
list(APPEND PORT_BUILD_CONFIGS "rel")
|
||||
endif()
|
||||
|
||||
foreach(BUILD_TYPE IN LISTS PORT_BUILD_CONFIGS)
|
||||
# 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(WINDOWS_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_WINDOWS)
|
||||
set(WINDOWS_ONLY_PATCHES "${CMAKE_CURRENT_LIST_DIR}/fix-windows-build.patch")
|
||||
endif()
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO tensorflow/tensorflow
|
||||
REF "v${TF_VERSION}"
|
||||
SHA512 f1e892583c7b3a73d4d39ec65dc135a5b02c789b357d57414ad2b6d05ad9fbfc8ef81918ba6410e314abd6928b76f764e6ef64c0b0c84b58b50796634be03f39
|
||||
HEAD_REF master
|
||||
PATCHES
|
||||
"${CMAKE_CURRENT_LIST_DIR}/fix-build-error.patch" # Fix namespace error
|
||||
${STATIC_ONLY_PATCHES}
|
||||
${WINDOWS_ONLY_PATCHES}
|
||||
)
|
||||
|
||||
message(STATUS "Configuring TensorFlow (${BUILD_TYPE})")
|
||||
tensorflow_try_remove_recurse_wait(${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE})
|
||||
file(RENAME ${SOURCE_PATH} ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE})
|
||||
set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}")
|
||||
|
||||
vcpkg_execute_required_process(
|
||||
COMMAND ${PYTHON3} ${SOURCE_PATH}/configure.py --workspace "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}"
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
LOGNAME config-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
|
||||
if(DEFINED ENV{BAZEL_CUSTOM_CACERTS})
|
||||
file(APPEND ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/.bazelrc "startup --host_jvm_args=-Djavax.net.ssl.trustStore='$ENV{BAZEL_CUSTOM_CACERTS}'\n")
|
||||
message(STATUS "Using custom CA certificate store at: $ENV{BAZEL_CUSTOM_CACERTS}")
|
||||
if(DEFINED ENV{BAZEL_CUSTOM_CACERTS_PASSWORD})
|
||||
file(APPEND ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/.bazelrc "startup --host_jvm_args=-Djavax.net.ssl.trustStorePassword='$ENV{BAZEL_CUSTOM_CACERTS_PASSWORD}'\n")
|
||||
message(STATUS "Using supplied custom CA certificate store password.")
|
||||
endif()
|
||||
else()
|
||||
if(DEFINED ENV{HTTPS_PROXY})
|
||||
message(STATUS "You are using HTTPS_PROXY. In case you encounter bazel certificate errors, you might want to set: BAZEL_CUSTOM_CACERTS=/path/to/trust.store (and optionally BAZEL_CUSTOM_CACERTS_PASSWORD), and to enable vcpkg to actually use it: VCPKG_KEEP_ENV_VARS=BAZEL_CUSTOM_CACERTS;BAZEL_CUSTOM_CACERTS_PASSWORD")
|
||||
if(CMAKE_HOST_WIN32)
|
||||
message(STATUS "(For BAZEL_CUSTOM_CACERTS please use forward slashes instead of backslashes on Windows systems.")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Warning: Building TensorFlow can take an hour or more.")
|
||||
set(COPTS)
|
||||
set(CXXOPTS)
|
||||
set(LINKOPTS)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(PLATFORM_COMMAND WINDOWS_COMMAND)
|
||||
else()
|
||||
set(PLATFORM_COMMAND UNIX_COMMAND)
|
||||
endif()
|
||||
if(BUILD_TYPE STREQUAL dbg)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
set(BUILD_OPTS "--compilation_mode=dbg --features=fastbuild") # link with /DEBUG:FASTLINK instead of /DEBUG:FULL to avoid .pdb >4GB error
|
||||
elseif(VCPKG_TARGET_IS_OSX)
|
||||
set(BUILD_OPTS --compilation_mode=fastbuild) # debug build on macOS currently broken
|
||||
else()
|
||||
set(BUILD_OPTS --compilation_mode=dbg)
|
||||
endif()
|
||||
|
||||
separate_arguments(VCPKG_C_FLAGS ${PLATFORM_COMMAND} ${VCPKG_C_FLAGS})
|
||||
separate_arguments(VCPKG_C_FLAGS_DEBUG ${PLATFORM_COMMAND} ${VCPKG_C_FLAGS_DEBUG})
|
||||
foreach(OPT IN LISTS VCPKG_C_FLAGS VCPKG_C_FLAGS_DEBUG)
|
||||
list(APPEND COPTS "--copt=${OPT}")
|
||||
endforeach()
|
||||
separate_arguments(VCPKG_CXX_FLAGS ${PLATFORM_COMMAND} ${VCPKG_CXX_FLAGS})
|
||||
separate_arguments(VCPKG_CXX_FLAGS_DEBUG ${PLATFORM_COMMAND} ${VCPKG_CXX_FLAGS_DEBUG})
|
||||
foreach(OPT IN LISTS VCPKG_CXX_FLAGS VCPKG_CXX_FLAGS_DEBUG)
|
||||
list(APPEND CXXOPTS "--cxxopt=${OPT}")
|
||||
endforeach()
|
||||
separate_arguments(VCPKG_LINKER_FLAGS ${PLATFORM_COMMAND} ${VCPKG_LINKER_FLAGS})
|
||||
separate_arguments(VCPKG_LINKER_FLAGS_DEBUG ${PLATFORM_COMMAND} ${VCPKG_LINKER_FLAGS_DEBUG})
|
||||
foreach(OPT IN LISTS VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_DEBUG)
|
||||
list(APPEND LINKOPTS "--linkopt=${OPT}")
|
||||
endforeach()
|
||||
else()
|
||||
set(BUILD_OPTS --compilation_mode=opt)
|
||||
|
||||
separate_arguments(VCPKG_C_FLAGS ${PLATFORM_COMMAND} ${VCPKG_C_FLAGS})
|
||||
separate_arguments(VCPKG_C_FLAGS_RELEASE ${PLATFORM_COMMAND} ${VCPKG_C_FLAGS_RELEASE})
|
||||
foreach(OPT IN LISTS VCPKG_C_FLAGS VCPKG_C_FLAGS_RELEASE)
|
||||
list(APPEND COPTS "--copt=${OPT}")
|
||||
endforeach()
|
||||
separate_arguments(VCPKG_CXX_FLAGS ${PLATFORM_COMMAND} ${VCPKG_CXX_FLAGS})
|
||||
separate_arguments(VCPKG_CXX_FLAGS_RELEASE ${PLATFORM_COMMAND} ${VCPKG_CXX_FLAGS_RELEASE})
|
||||
foreach(OPT IN LISTS VCPKG_CXX_FLAGS VCPKG_CXX_FLAGS_RELEASE)
|
||||
list(APPEND CXXOPTS "--cxxopt=${OPT}")
|
||||
endforeach()
|
||||
separate_arguments(VCPKG_LINKER_FLAGS ${PLATFORM_COMMAND} ${VCPKG_LINKER_FLAGS})
|
||||
separate_arguments(VCPKG_LINKER_FLAGS_RELEASE ${PLATFORM_COMMAND} ${VCPKG_LINKER_FLAGS_RELEASE})
|
||||
foreach(OPT IN LISTS VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE)
|
||||
list(APPEND LINKOPTS "--linkopt=${OPT}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
list(JOIN COPTS " " COPTS)
|
||||
list(JOIN CXXOPTS " " CXXOPTS)
|
||||
list(JOIN LINKOPTS " " LINKOPTS)
|
||||
# use --output_user_root to work-around too-long-path-names issue and username-with-spaces issue
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${BASH} --noprofile --norc -c "'${BAZEL}' --output_user_root='${CURRENT_BUILDTREES_DIR}/.bzl' --max_idle_secs=1 build --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///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} --output_user_root=${CURRENT_BUILDTREES_DIR}/.bzl --max_idle_secs=1 build --verbose_failures ${BUILD_OPTS} --python_path=${PYTHON3} ${COPTS} ${CXXOPTS} ${LINKOPTS} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
if(BUILD_TYPE STREQUAL dbg)
|
||||
list(APPEND COPTS "--copt=-MTd")
|
||||
else()
|
||||
list(APPEND COPTS "--copt=-MT")
|
||||
endif()
|
||||
endif()
|
||||
list(JOIN COPTS " " COPTS)
|
||||
list(JOIN CXXOPTS " " CXXOPTS)
|
||||
list(JOIN LINKOPTS " " LINKOPTS)
|
||||
# use --output_user_root to work-around too-long-path-names issue and username-with-spaces issue
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${BASH} --noprofile --norc -c "${BAZEL} --output_user_root='${CURRENT_BUILDTREES_DIR}/.bzl' --max_idle_secs=1 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"
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
else()
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${BAZEL} --output_user_root=${CURRENT_BUILDTREES_DIR}/.bzl --max_idle_secs=1 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
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
endif()
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${PYTHON3} "${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_${PLATFORM_SUFFIX}.py" ${TF_LIB_SUFFIX}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow
|
||||
LOGNAME postbuild1-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
else()
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${PYTHON3} "${CMAKE_CURRENT_LIST_DIR}/convert_lib_params_${PLATFORM_SUFFIX}.py" ${TF_VERSION} ${TF_LIB_SUFFIX}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow
|
||||
LOGNAME postbuild1-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
endif()
|
||||
# for some reason stdout of bazel ends up in stderr, so use err log file in the following command
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${PYTHON3} "${CMAKE_CURRENT_LIST_DIR}/generate_static_link_cmd_${PLATFORM_SUFFIX}.py" "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-${BUILD_TYPE}-err.log" "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow" ${TF_VERSION} ${TF_LIB_SUFFIX}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
LOGNAME postbuild2-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
vcpkg_execute_build_process(
|
||||
COMMAND ${STATIC_LINK_CMD}
|
||||
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
LOGNAME postbuild3-${TARGET_TRIPLET}-${BUILD_TYPE}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(BUILD_TYPE STREQUAL "dbg")
|
||||
set(DIR_PREFIX "/debug")
|
||||
else()
|
||||
set(DIR_PREFIX "")
|
||||
endif()
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/tensorflow${TF_LIB_SUFFIX}.dll DESTINATION ${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/bin)
|
||||
# rename before copy because after copy the file might be locked by anti-malware scanners for some time so that renaming fails
|
||||
file(RENAME ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/tensorflow${TF_LIB_SUFFIX}.dll.if.lib ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/tensorflow${TF_LIB_SUFFIX}.lib)
|
||||
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/tensorflow${TF_LIB_SUFFIX}.lib DESTINATION ${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib)
|
||||
if(BUILD_TYPE STREQUAL dbg)
|
||||
file(COPY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/tensorflow${TF_LIB_SUFFIX}.pdb DESTINATION ${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/bin)
|
||||
message(STATUS "Warning: debug information tensorflow${TF_LIB_SUFFIX}.pdb will be of limited use because only a reduced set could be produced due to the 4GB internal PDB file limit even on x64.")
|
||||
endif()
|
||||
else()
|
||||
if(BUILD_TYPE STREQUAL dbg)
|
||||
set(library_parts_variable TF_LIB_PARTS_DEBUG)
|
||||
else()
|
||||
set(library_parts_variable TF_LIB_PARTS_RELEASE)
|
||||
endif()
|
||||
set(${library_parts_variable})
|
||||
|
||||
# library might have been split because no more than 4GB are supported even on x64 Windows
|
||||
foreach(PART_NO RANGE 1 100)
|
||||
set(source "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/tensorflow${TF_LIB_SUFFIX}-part${PART_NO}.lib")
|
||||
if(EXISTS "${source}")
|
||||
file(COPY "${source}" DESTINATION "${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib")
|
||||
list(APPEND ${library_parts_variable} "tensorflow${TF_LIB_SUFFIX}-part${PART_NO}.lib")
|
||||
else()
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
else()
|
||||
file(COPY
|
||||
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/${TF_LIB_NAME_FULL}
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib
|
||||
)
|
||||
|
||||
# Note: these use relative links
|
||||
file(CREATE_LINK ${TF_LIB_NAME_FULL}
|
||||
${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib/${TF_LIB_NAME_SHORT}
|
||||
SYMBOLIC
|
||||
)
|
||||
file(CREATE_LINK ${TF_LIB_NAME_FULL}
|
||||
${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib/${TF_LIB_NAME}
|
||||
SYMBOLIC
|
||||
)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
file(COPY
|
||||
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}/bazel-bin/tensorflow/${TF_FRAMEWORK_NAME_FULL}
|
||||
DESTINATION ${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib
|
||||
)
|
||||
file(CREATE_LINK
|
||||
${TF_FRAMEWORK_NAME_FULL}
|
||||
${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib/${TF_FRAMEWORK_NAME_SHORT}
|
||||
SYMBOLIC
|
||||
)
|
||||
file(CREATE_LINK
|
||||
${TF_FRAMEWORK_NAME_FULL}
|
||||
${CURRENT_PACKAGES_DIR}${DIR_PREFIX}/lib/${TF_FRAMEWORK_NAME}
|
||||
SYMBOLIC
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
message(STATUS "Warning: Static TensorFlow build contains several external dependencies that may cause linking conflicts (for example, one cannot use both openssl and TensorFlow in the same project, since TensorFlow contains boringssl).")
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
message(STATUS "Note: For some TensorFlow features (e.g. OpRegistry), it might be necessary to tell the linker to include the whole library, i.e., link using options '/WHOLEARCHIVE:tensorflow${TF_LIB_SUFFIX}-part1.lib /WHOLEARCHIVE:tensorflow${TF_LIB_SUFFIX}-part2.lib ...'")
|
||||
else()
|
||||
message(STATUS "Note: There is no separate libtensorflow_framework.a as it got merged into libtensorflow${TF_LIB_SUFFIX}.a to avoid linking conflicts.")
|
||||
if(VCPKG_TARGET_IS_OSX)
|
||||
message(STATUS "Note: Beside TensorFlow itself, you'll need to also pass its dependancies to the linker, for example '-ltensorflow${TF_LIB_SUFFIX} -framework CoreFoundation'")
|
||||
message(STATUS "Note: For some TensorFlow features (e.g. OpRegistry), it might be necessary to tell the linker to include the whole library: '-Wl,-force_load,path/to/libtensorflow${TF_LIB_SUFFIX}.a -framework CoreFoundation -framework Security [rest of linker arguments]'")
|
||||
else()
|
||||
message(STATUS "Note: Beside TensorFlow itself, you'll need to also pass its dependancies to the linker, for example '-ltensorflow${TF_LIB_SUFFIX} -lm -ldl -lpthread'")
|
||||
message(STATUS "Note: For some TensorFlow features (e.g. OpRegistry), it might be necessary to tell the linker to include the whole library: '-Wl,--whole-archive -ltensorflow${TF_LIB_SUFFIX} -Wl,--no-whole-archive [rest of linker arguments]'")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/README-${PLATFORM_SUFFIX}
|
||||
${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/README
|
||||
COPYONLY)
|
||||
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)
|
||||
|
||||
|
||||
# NOTE: if this port ever supports VCPKG_BUILD_TYPE, use that to set these.
|
||||
set(TENSORFLOW_HAS_RELEASE ON)
|
||||
set(TENSORFLOW_HAS_DEBUG ON)
|
||||
|
||||
if(VCPKG_TARGET_IS_WINDOWS)
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-windows-dll.cmake.in
|
||||
${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/tensorflow${TF_PORT_SUFFIX}-config.cmake
|
||||
@ONLY)
|
||||
else()
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-windows-lib.cmake.in
|
||||
${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/tensorflow${TF_PORT_SUFFIX}-config.cmake
|
||||
@ONLY)
|
||||
|
||||
set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled)
|
||||
|
||||
set(prefix [[${TENSORFLOW_INSTALL_PREFIX}]])
|
||||
|
||||
set(libs_to_link)
|
||||
foreach(lib IN LISTS TF_LIB_PARTS_RELEASE)
|
||||
list(APPEND libs_to_link "$<$<CONFIG:Release>:${prefix}/lib/${lib}>")
|
||||
endforeach()
|
||||
foreach(lib IN LISTS TF_LIB_PARTS_DEBUG)
|
||||
list(APPEND libs_to_link "$<$<CONFIG:Debug>:${prefix}/debug/lib/${lib}>")
|
||||
endforeach()
|
||||
if(TENSORFLOW_HAS_RELEASE)
|
||||
set(TF_LIB_PARTS_DEFAULT ${TF_LIB_PARTS_RELEASE})
|
||||
set(prefix_DEFAULT "${prefix}")
|
||||
elseif(TENSORFLOW_HAS_DEBUG)
|
||||
set(TF_LIB_PARTS_DEFAULT ${TF_LIB_PARTS_DEBUG})
|
||||
set(prefix_DEFAULT "${prefix}/debug")
|
||||
endif()
|
||||
|
||||
foreach(lib IN LISTS TF_LIB_PARTS_DEFAULT)
|
||||
list(APPEND libs_to_link
|
||||
"$<$<NOT:$<OR:$<CONFIG:Release>,$<CONFIG:Debug>>>:${prefix}/lib/${lib}>")
|
||||
endforeach()
|
||||
|
||||
string(REPLACE ";" "\n\t\t" libs_to_link "${libs_to_link}")
|
||||
file(APPEND ${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/tensorflow${TF_PORT_SUFFIX}-config.cmake "
|
||||
target_link_libraries(tensorflow${TF_LIB_SUFFIX}::tensorflow${TF_LIB_SUFFIX}
|
||||
INTERFACE
|
||||
${libs_to_link}
|
||||
)"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
if(VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-shared.cmake.in
|
||||
${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/tensorflow${TF_PORT_SUFFIX}-config.cmake
|
||||
@ONLY)
|
||||
else()
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/tensorflow-config-static.cmake.in
|
||||
${CURRENT_PACKAGES_DIR}/share/tensorflow${TF_PORT_SUFFIX}/tensorflow${TF_PORT_SUFFIX}-config.cmake
|
||||
@ONLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "You may want to delete ${CURRENT_BUILDTREES_DIR} to free diskspace.")
|
85
externals/vcpkg/ports/tensorflow-common/tensorflow-config-shared.cmake.in
vendored
Executable file
85
externals/vcpkg/ports/tensorflow-common/tensorflow-config-shared.cmake.in
vendored
Executable file
@@ -0,0 +1,85 @@
|
||||
if(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@ OR TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework)
|
||||
if(NOT (TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@ AND TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework))
|
||||
message(FATAL_ERROR "Some (but not all) targets in this config.cmake were already defined.")
|
||||
endif()
|
||||
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@ SHARED IMPORTED GLOBAL)
|
||||
add_library(tensorflow@TF_LIB_SUFFIX@::tensorflow_framework SHARED IMPORTED GLOBAL)
|
||||
|
||||
# Compute the installation prefix from this tensorflow@TF_PORT_SUFFIX@-config.cmake file location.
|
||||
# CMAKE_CURRENT_LIST_DIR = [vcpkg_installed_dir]/[target_triplet]/share/tensorflow@TF_PORT_SUFFIX@
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]/share
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${TENSORFLOW_INSTALL_PREFIX}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]
|
||||
|
||||
target_include_directories(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
INTERFACE
|
||||
@TF_INCLUDE_DIRS@
|
||||
)
|
||||
target_include_directories(tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
INTERFACE
|
||||
@TF_INCLUDE_DIRS@
|
||||
)
|
||||
|
||||
if(@TENSORFLOW_HAS_RELEASE@)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_FRAMEWORK_NAME@"
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION_RELEASE
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
PROPERTY IMPORTED_LOCATION_RELEASE
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_FRAMEWORK_NAME@"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(@TENSORFLOW_HAS_DEBUG)
|
||||
if(NOT @TENSORFLOW_HAS_RELEASE)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_FRAMEWORK_NAME@"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION_DEBUG
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow_framework
|
||||
PROPERTY IMPORTED_LOCATION_DEBUG
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_FRAMEWORK_NAME@"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(tensorflow@TF_LIB_SUFFIX@_FOUND TRUE)
|
||||
set(tensorflow_framework_FOUND TRUE)
|
55
externals/vcpkg/ports/tensorflow-common/tensorflow-config-static.cmake.in
vendored
Executable file
55
externals/vcpkg/ports/tensorflow-common/tensorflow-config-static.cmake.in
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
if(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@ STATIC IMPORTED GLOBAL)
|
||||
|
||||
# Compute the installation prefix from this tensorflow@TF_PORT_SUFFIX@-config.cmake file location.
|
||||
# CMAKE_CURRENT_LIST_DIR = [vcpkg_installed_dir]/[target_triplet]/share/tensorflow@TF_PORT_SUFFIX@
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]/share
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${TENSORFLOW_INSTALL_PREFIX}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]
|
||||
|
||||
target_include_directories(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
INTERFACE
|
||||
@TF_INCLUDE_DIRS@
|
||||
)
|
||||
|
||||
if(@TENSORFLOW_HAS_RELEASE@)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS
|
||||
RELEASE
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION_RELEASE
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(@TENSORFLOW_HAS_DEBUG@)
|
||||
if(NOT @TENSORFLOW_HAS_RELEASE@)
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS
|
||||
DEBUG
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTY IMPORTED_LOCATION_DEBUG
|
||||
"${TENSORFLOW_INSTALL_PREFIX}/debug/lib/@TF_LIB_NAME@"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(tensorflow@TF_LIB_SUFFIX@_FOUND TRUE)
|
55
externals/vcpkg/ports/tensorflow-common/tensorflow-config-windows-dll.cmake.in
vendored
Executable file
55
externals/vcpkg/ports/tensorflow-common/tensorflow-config-windows-dll.cmake.in
vendored
Executable file
@@ -0,0 +1,55 @@
|
||||
if(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@)
|
||||
return()
|
||||
endif()
|
||||
|
||||
add_library(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@ SHARED IMPORTED GLOBAL)
|
||||
|
||||
# Compute the installation prefix from this tensorflow@TF_PORT_SUFFIX@-config.cmake file location.
|
||||
# CMAKE_CURRENT_LIST_DIR = [vcpkg_installed_dir]/[target_triplet]/share/tensorflow@TF_PORT_SUFFIX@
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]/share
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${TENSORFLOW_INSTALL_PREFIX}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]
|
||||
|
||||
target_include_directories(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
INTERFACE
|
||||
@TF_INCLUDE_DIRS@
|
||||
)
|
||||
|
||||
if(@TENSORFLOW_HAS_RELEASE@)
|
||||
set_target_properties(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${TENSORFLOW_INSTALL_PREFIX}/bin/tensorflow@TF_LIB_SUFFIX@.dll"
|
||||
IMPORTED_IMPLIB "${TENSORFLOW_INSTALL_PREFIX}/lib/tensorflow@TF_LIB_SUFFIX@.lib"
|
||||
)
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE
|
||||
)
|
||||
set_target_properties(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION_RELEASE "${TENSORFLOW_INSTALL_PREFIX}/bin/tensorflow@TF_LIB_SUFFIX@.dll"
|
||||
IMPORTED_IMPLIB_RELEASE "${TENSORFLOW_INSTALL_PREFIX}/lib/tensorflow@TF_LIB_SUFFIX@.lib"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(@TENSORFLOW_HAS_DEBUG@)
|
||||
if(NOT @TENSORFLOW_HAS_RELEASE@)
|
||||
set_target_properties(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION "${TENSORFLOW_INSTALL_PREFIX}/debug/bin/tensorflow@TF_LIB_SUFFIX@.dll"
|
||||
IMPORTED_IMPLIB "${TENSORFLOW_INSTALL_PREFIX}/debug/lib/tensorflow@TF_LIB_SUFFIX@.lib"
|
||||
)
|
||||
endif()
|
||||
|
||||
set_property(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG
|
||||
)
|
||||
set_target_properties(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
PROPERTIES
|
||||
IMPORTED_LOCATION_DEBUG "${TENSORFLOW_INSTALL_PREFIX}/debug/bin/tensorflow@TF_LIB_SUFFIX@.dll"
|
||||
IMPORTED_IMPLIB_DEBUG "${TENSORFLOW_INSTALL_PREFIX}/debug/lib/tensorflow@TF_LIB_SUFFIX@.lib"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(tensorflow@TF_LIB_SUFFIX@_FOUND TRUE)
|
18
externals/vcpkg/ports/tensorflow-common/tensorflow-config-windows-lib.cmake.in
vendored
Executable file
18
externals/vcpkg/ports/tensorflow-common/tensorflow-config-windows-lib.cmake.in
vendored
Executable file
@@ -0,0 +1,18 @@
|
||||
if(TARGET tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(tensorflow@TF_LIB_SUFFIX@_FOUND TRUE)
|
||||
|
||||
# Compute the installation prefix from this tensorflow@TF_PORT_SUFFIX@-config.cmake file location.
|
||||
# CMAKE_CURRENT_LIST_DIR = [vcpkg_installed_dir]/[target_triplet]/share/tensorflow@TF_PORT_SUFFIX@
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]/share
|
||||
get_filename_component(TENSORFLOW_INSTALL_PREFIX "${TENSORFLOW_INSTALL_PREFIX}" DIRECTORY)
|
||||
# TENSORFLOW_INSTALL_PREFIX = [vcpkg_installed_dir]/[target_triplet]
|
||||
|
||||
add_library(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@ INTERFACE IMPORTED GLOBAL)
|
||||
target_include_directories(tensorflow@TF_LIB_SUFFIX@::tensorflow@TF_LIB_SUFFIX@
|
||||
INTERFACE
|
||||
@TF_INCLUDE_DIRS@
|
||||
)
|
7
externals/vcpkg/ports/tensorflow-common/vcpkg.json
vendored
Executable file
7
externals/vcpkg/ports/tensorflow-common/vcpkg.json
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "tensorflow-common",
|
||||
"version-semver": "2.7.0",
|
||||
"port-version": 2,
|
||||
"description": "This meta package holds common files for the C [tensorflow] and the C++ [tensorflow-cc] API version of TensorFlow but is not installable on its own.",
|
||||
"homepage": "https://github.com/tensorflow/tensorflow"
|
||||
}
|
Reference in New Issue
Block a user