vcpkg/ports/tensorflow-common/convert_lib_params_macos.py
Joachim Gehweiler 8ad33ead90
[tensorflow] update to 2.6 (#20015)
* Revert "incorporate changes from microsoft:master"

* Revert "Revert "incorporate changes from microsoft:master""

* WIP: update to tensorflow 2.6

* update patch

* update more patches

* fix patch again

* fix new Windows compile/linkage errors

* fix patch

* fix patch again

* temporarily revert Windows build option fix to test whether upstream fix doesn't work

* check if constexpr is sufficient (is_same_v requires C++17)

* try patch for build parameters

* remove fastbuild patch and improve constexpr patch (no C++17 requirement)
(fastbuild patch didn't work because bazel overrides it with /DEBUG:FULL)

* x-add-version

* add C++17 preprocessor switch for "if constexpr"

* x-add-version

* remove pre-processor switch (doesn't work without)

* x-add-version

* work-around toolchain issues on macOS

* x-add-version

* fix Windows build options (must be string, not list)

* x-add-version

* temporarily add code to debug CI

* temporarily add more debug output as build doesn't even start on macOS CI

* remove debug code, add switch for linker parameters on macOS and re-introduce old behaviour (some platforms still use old behaviour)

* x-add-version

* fix broken string termination

* x-add-version

* fix function name

* x-add-version

Co-authored-by: jgehw <Joachim_Gehweiler@McAfee.com>
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2021-09-29 20:43:32 -07:00

21 lines
847 B
Python

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:])