Skip to content

Commit

Permalink
Adjust setup.py to work on newer M3 Macs.
Browse files Browse the repository at this point in the history
  • Loading branch information
atillack committed Nov 1, 2024
1 parent 4fc623c commit e6f98f8
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions build/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,14 @@ def build_extensions(self):
# To get the right @rpath on macos for libraries
self.extensions[0].extra_link_args.append('-Wl,-rpath,' + self.library_dirs[0])
self.extensions[0].extra_link_args.append('-Wl,-rpath,' + '/usr/lib')

print('- extra link args: %s' % self.extensions[0].extra_link_args)

# Replace current compiler to g++
self.compiler.compiler_so[0] = "g++"
self.compiler.compiler_so.insert(2, "-shared")

# Remove compiler flags if we can
remove_flags = ["-Wstrict-prototypes", "-Wall"]
for remove_flag in remove_flags:
try:
Expand All @@ -270,13 +271,19 @@ def build_extensions(self):
print('Warning: compiler flag %s is not present, cannot remove it.' % remove_flag)
pass

self.compiler.compiler_so.append("-std=c++11")
self.compiler.compiler_so.append("-Wno-long-long")
self.compiler.compiler_so.append("-pedantic")
# Source: https://stackoverflow.com/questions/9723793/undefined-reference-to-boostsystemsystem-category-when-compiling
self.compiler.compiler_so.append('-DBOOST_ERROR_CODE_HEADER_ONLY')
vina_compiler_options = [
"-std=c++11",
"-Wno-long-long",
"-pedantic",
'-DBOOST_ERROR_CODE_HEADER_ONLY'
]

print('- compiler options: %s' % (self.compiler.compiler_so + vina_compiler_options))

for ext in self.extensions:
ext.extra_compile_args += vina_compiler_options

print('- compiler options: %s' % self.compiler.compiler_so)
build_ext.build_extensions(self)


Expand Down

0 comments on commit e6f98f8

Please sign in to comment.