Skip to content

Commit

Permalink
update bazelrc
Browse files Browse the repository at this point in the history
  • Loading branch information
zewenli98 committed Jan 21, 2025
1 parent 2159e9c commit 43f2352
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
7 changes: 4 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ build:windows --cxxopt="/GS-" --cxxopt="/std:c++17" --cxxopt="/permissive-"
build:windows --cxxopt="/wd4244" --cxxopt="/wd4267" --cxxopt="/wd4819"
build:windows --features=windows_export_all_symbols

build:python --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
build:python --linkopt="-D_GLIBCXX_USE_CXX11_ABI=0"
build:python --define=abi=pre_cxx11_abi
build --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=1"
build --linkopt="-D_GLIBCXX_USE_CXX11_ABI=1"
build --define=abi=cxx11_abi

build:python --define=target_lang=python

build:pre_cxx11_abi --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
Expand Down
24 changes: 17 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,12 @@ def load_dep_info():
sys.exit("Could not find bazel in PATH")


def build_libtorchtrt_pre_cxx11_abi(
develop=True, use_dist_dir=True, pre_cxx11_abi=True, rt_only=False
def build_libtorchtrt_cxx11_abi(
develop=True,
use_dist_dir=True,
pre_cxx11_abi=False,
rt_only=False,
target_python=True,
):
cmd = [BAZEL_EXE, "build"]
if rt_only:
Expand All @@ -196,9 +200,15 @@ def build_libtorchtrt_pre_cxx11_abi(
cmd.append("--compilation_mode=opt")
if use_dist_dir:
cmd.append("--distdir=third_party/dist_dir/x86_64-linux-gnu")
if pre_cxx11_abi:

if target_python:
cmd.append("--config=python")

if pre_cxx11_abi:
cmd.append("--config=pre_cxx11_abi")
print("using PRE CXX11 ABI build")
else:
cmd.append("--config=cxx11_abi")
print("using CXX11 ABI build")

if IS_WINDOWS:
Expand Down Expand Up @@ -293,7 +303,7 @@ def run(self):

if not PY_ONLY:
global PRE_CXX11_ABI
build_libtorchtrt_pre_cxx11_abi(
build_libtorchtrt_cxx11_abi(
develop=True, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
)
copy_libtorchtrt(rt_only=NO_TS)
Expand All @@ -317,7 +327,7 @@ def run(self):

if not PY_ONLY:
global PRE_CXX11_ABI
build_libtorchtrt_pre_cxx11_abi(
build_libtorchtrt_cxx11_abi(
develop=False, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
)
copy_libtorchtrt(rt_only=NO_TS)
Expand All @@ -340,7 +350,7 @@ def finalize_options(self):
def run(self):
if not PY_ONLY:
global PRE_CXX11_ABI
build_libtorchtrt_pre_cxx11_abi(
build_libtorchtrt_cxx11_abi(
develop=False, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
)
copy_libtorchtrt(rt_only=NO_TS)
Expand All @@ -366,7 +376,7 @@ def run(self):
editable_wheel.run(self)
else:
global PRE_CXX11_ABI
build_libtorchtrt_pre_cxx11_abi(
build_libtorchtrt_cxx11_abi(
develop=True, pre_cxx11_abi=PRE_CXX11_ABI, rt_only=NO_TS
)
gen_version_file()
Expand Down

0 comments on commit 43f2352

Please sign in to comment.