Skip to content

Commit 18a1c97

Browse files
authored
add build support for tf2.9 (#2693)
* add build support for tf2.9 * fix bugs * fix flake8
1 parent a0b6ecb commit 18a1c97

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

configure.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
import platform
2222
import logging
2323

24+
try:
25+
from packaging.version import Version
26+
except ImportError:
27+
from distutils.version import LooseVersion as Version
28+
2429
import tensorflow as tf
2530

2631
_TFA_BAZELRC = ".bazelrc"
@@ -131,6 +136,11 @@ def create_build_configuration():
131136
write("build --strategy=Genrule=standalone")
132137
write("build -c opt")
133138

139+
if Version(tf.__version__) >= Version("2.9.0"):
140+
glibcxx = '"-D_GLIBCXX_USE_CXX11_ABI=1"'
141+
else:
142+
glibcxx = '"-D_GLIBCXX_USE_CXX11_ABI=0"'
143+
134144
if is_windows():
135145
write("build --config=windows")
136146
write("build:windows --enable_runfiles")
@@ -145,7 +155,7 @@ def create_build_configuration():
145155
write("build --copt=-mavx")
146156
write("build --cxxopt=-std=c++14")
147157
write("build --host_cxxopt=-std=c++14")
148-
write('build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"')
158+
write("build --cxxopt=" + glibcxx)
149159

150160
if os.getenv("TF_NEED_CUDA", "0") == "1":
151161
print("> Building GPU & CPU ops")

0 commit comments

Comments
 (0)