From e6f98f87fc60e58e03788a409b2dd6fff92263db Mon Sep 17 00:00:00 2001 From: Andreas Tillack Date: Fri, 1 Nov 2024 16:19:12 -0400 Subject: [PATCH] Adjust setup.py to work on newer M3 Macs. --- build/python/setup.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/build/python/setup.py b/build/python/setup.py index 37ad08d..8966469 100644 --- a/build/python/setup.py +++ b/build/python/setup.py @@ -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: @@ -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)