Skip to content

Commit 8cea05b

Browse files
PaliCfacebook-github-bot
authored andcommitted
add cxx abi flag to setup.py (#204)
Summary: Pull Request resolved: #204 Tested by running ` pip install -e . --install-option="--abicxx"` on a manually built version of pytorch. We'd likely have to use a pytorch docker image if we want to do unit tests for this. Test Plan: Imported from OSS Reviewed By: d4l3k Differential Revision: D40450067 Pulled By: PaliC fbshipit-source-id: f873ab77b2389fc8adfbe935cac1d96ef5792556
1 parent 41385b1 commit 8cea05b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

setup.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def get_cmake_version():
2828

2929

3030
class MultipyRuntimeCmake(object):
31-
user_options = [("cmakeoff", None, None)]
31+
user_options = [("cmakeoff", None, None), ("abicxx", None, None)]
3232

3333

3434
class MultipyRuntimeDevelop(MultipyRuntimeCmake, develop):
@@ -37,16 +37,20 @@ class MultipyRuntimeDevelop(MultipyRuntimeCmake, develop):
3737
def initialize_options(self):
3838
develop.initialize_options(self)
3939
self.cmakeoff = None
40+
self.abicxx = None
4041

4142
def finalize_options(self):
4243
develop.finalize_options(self)
4344
if self.cmakeoff is not None:
4445
self.distribution.get_command_obj("build_ext").cmake_off = True
46+
if self.abicxx is not None:
47+
self.distribution.get_command_obj("build_ext").abicxx = True
4548

4649

4750
class MultipyRuntimeBuild(MultipyRuntimeCmake, build_ext):
4851
user_options = build_ext.user_options + MultipyRuntimeCmake.user_options
4952
cmake_off = False
53+
abicxx = False
5054

5155
def run(self):
5256
if self.cmake_off:
@@ -67,11 +71,14 @@ def run(self):
6771
if not os.path.exists(build_dir_abs):
6872
os.makedirs(build_dir_abs)
6973
legacy_python_cmake_flag = "OFF" if sys.version_info.minor > 7 else "ON"
74+
cxx_abi_flag = "ON" if self.abicxx else "OFF"
7075

7176
print(f"-- Running multipy runtime makefile in dir {build_dir_abs}")
7277
try:
7378
subprocess.run(
74-
[f"cmake -DLEGACY_PYTHON_PRE_3_8={legacy_python_cmake_flag} .."],
79+
[
80+
f"cmake -DLEGACY_PYTHON_PRE_3_8={legacy_python_cmake_flag} -DABI_EQUALS_1={cxx_abi_flag} .."
81+
],
7582
cwd=build_dir_abs,
7683
shell=True,
7784
check=True,

0 commit comments

Comments
 (0)