18
18
19
19
__version__ = '0.0.2'
20
20
21
- def build_libtrtorch_pre_cxx11_abi (develop = True , use_dist_dir = True ):
21
+ CXX11_ABI = False
22
+
23
+ if "--use-cxx11-abi" in sys .argv :
24
+ sys .argv .remove ("--use-cxx11-abi" )
25
+ CXX11_ABI = True
26
+
27
+ def build_libtrtorch_pre_cxx11_abi (develop = True , use_dist_dir = True , cxx11_abi = False ):
22
28
cmd = ["/usr/bin/bazel" , "build" ]
23
29
cmd .append ("//cpp/api/lib:libtrtorch.so" )
24
30
if develop :
@@ -27,7 +33,10 @@ def build_libtrtorch_pre_cxx11_abi(develop=True, use_dist_dir=True):
27
33
cmd .append ("--compilation_mode=opt" )
28
34
if use_dist_dir :
29
35
cmd .append ("--distdir=third_party/dist_dir/x86_64-linux-gnu" )
30
- cmd .append ("--config=python" )
36
+ if not cxx11_abi :
37
+ cmd .append ("--config=python" )
38
+ else :
39
+ print ("using CXX11 ABI build" )
31
40
32
41
print ("building libtrtorch" )
33
42
status_code = subprocess .run (cmd ).returncode
@@ -64,7 +73,8 @@ def finalize_options(self):
64
73
develop .finalize_options (self )
65
74
66
75
def run (self ):
67
- build_libtrtorch_pre_cxx11_abi (develop = True )
76
+ global CXX11_ABI
77
+ build_libtrtorch_pre_cxx11_abi (develop = True , cxx11_abi = CXX11_ABI )
68
78
gen_version_file ()
69
79
copy_libtrtorch ()
70
80
develop .run (self )
@@ -80,7 +90,8 @@ def finalize_options(self):
80
90
install .finalize_options (self )
81
91
82
92
def run (self ):
83
- build_libtrtorch_pre_cxx11_abi (develop = False )
93
+ global CXX11_ABI
94
+ build_libtrtorch_pre_cxx11_abi (develop = False , cxx11_abi = CXX11_ABI )
84
95
gen_version_file ()
85
96
copy_libtrtorch ()
86
97
install .run (self )
@@ -95,7 +106,8 @@ def finalize_options(self):
95
106
bdist_wheel .finalize_options (self )
96
107
97
108
def run (self ):
98
- build_libtrtorch_pre_cxx11_abi (develop = False )
109
+ global CXX11_ABI
110
+ build_libtrtorch_pre_cxx11_abi (develop = False , cxx11_abi = CXX11_ABI )
99
111
gen_version_file ()
100
112
copy_libtrtorch ()
101
113
bdist_wheel .run (self )
@@ -138,15 +150,16 @@ def run(self):
138
150
dir_path + "/../bazel-TRTorch/external/tensorrt/include" ,
139
151
],
140
152
extra_compile_args = [
141
- "-D_GLIBCXX_USE_CXX11_ABI=0 " ,
142
- "-Wno-deprecated-declaration " ,
143
- ],
153
+ "-Wno-deprecated " ,
154
+ "-Wno-deprecated-declarations " ,
155
+ ] + [ "-D_GLIBCXX_USE_CXX11_ABI=1" ] if CXX11_ABI else [ "-D_GLIBCXX_USE_CXX11_ABI=0" ] ,
144
156
extra_link_args = [
145
- "-D_GLIBCXX_USE_CXX11_ABI=0"
157
+ "-Wno-deprecated" ,
158
+ "-Wno-deprecated-declarations" ,
146
159
"-Wl,--no-as-needed" ,
147
160
"-ltrtorch" ,
148
161
"-Wl,-rpath,$ORIGIN/lib"
149
- ],
162
+ ] + [ "-D_GLIBCXX_USE_CXX11_ABI=1" ] if CXX11_ABI else [ "-D_GLIBCXX_USE_CXX11_ABI=0" ] ,
150
163
undef_macros = [ "NDEBUG" ]
151
164
)
152
165
]
@@ -178,7 +191,6 @@ def run(self):
178
191
zip_safe = False ,
179
192
license = "BSD" ,
180
193
packages = find_packages (),
181
- platform = "Linux" ,
182
194
classifiers = [
183
195
"Development Status :: 3 - Alpha" ,
184
196
"Environment :: GPU :: NVIDIA CUDA" ,
0 commit comments