Skip to content

Commit 93cb991

Browse files
committed
macos only link flags
1 parent 6203f81 commit 93cb991

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/build.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import argparse
22
import os
3+
import platform
34
import subprocess
45
from urllib.request import urlretrieve
56

@@ -97,9 +98,10 @@ def build(self):
9798
run("./configure")
9899
make_options = [
99100
f"-j{self.cpu_count}",
100-
"AR=c++ -shared -fPIC -Wl,-headerpad_max_install_names", # fix macos install_name_tool issues
101101
"CPPFLAGS='-DNDEBUG -DSWIG'",
102102
]
103+
if platform.system() == "Darwin":
104+
make_options.append("AR=c++ -shared -fPIC -Wl,-headerpad_max_install_names") # fix macos install_name_tool issues
103105
if self.boost_prefix:
104106
make_options.append(f"BOOST_BASE={self.boost_prefix}")
105107
if self.xerces_c_prefix:

setup.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import glob
2+
import os
3+
import platform
24
import re
35
import shutil
46
import subprocess
5-
import os
67

78
from setuptools import setup, Extension
89
import setuptools.command.build_py
@@ -18,6 +19,7 @@
1819
BOOST_BASE = os.environ.get("BOOST_BASE", "")
1920
XERCES_C_BASE = os.environ.get("XERCES_C_BASE", "")
2021

22+
2123
class BuildPyCommand(setuptools.command.build_py.build_py):
2224
"""Custom build command."""
2325

@@ -57,6 +59,14 @@ def run(self):
5759
# run actual build command
5860
setuptools.command.build_py.build_py.run(self)
5961

62+
63+
def get_extra_link_args():
64+
extra_link_args = []
65+
if platform.system() == "Darwin":
66+
extra_link_args.append("-Wl,-headerpad_max_install_names") # macos install_name_tool issues
67+
return extra_link_args
68+
69+
6070
tmTable_ext = Extension(
6171
name="_tmTable",
6272
define_macros=[("SWIG", "1"), ("DNDEBUG", "1")],
@@ -74,7 +84,8 @@ def run(self):
7484
os.path.join(UTM_BASE, "lib"),
7585
],
7686
libraries=["xerces-c", "tmutil", "tmxsd", "tmtable"],
77-
extra_compile_args=["-std=c++11", "-O2"]
87+
extra_compile_args=["-std=c++11", "-O2"],
88+
extra_link_args=get_extra_link_args()
7889
)
7990

8091
setup(

0 commit comments

Comments
 (0)