Skip to content

Commit

Permalink
Merge pull request #357 from atillack/M3_python
Browse files Browse the repository at this point in the history
Adjust setup.py to work on newer M3 Macs.
  • Loading branch information
atillack authored Nov 5, 2024
2 parents 4fc623c + 5289b9c commit 699949c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/compile-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
arch: x86_64
- os: macos-latest
arch: aarch64
- os: windows-latest
- os: windows-2019

steps:
- name: Checkout
Expand Down Expand Up @@ -71,11 +71,13 @@ jobs:
cd ./build/mac/release
make
- name: Compile Vina for Windows x64
if: matrix.os == 'windows-latest'
if: matrix.os == 'windows-2019'
run: |
$Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.77.0/boost_1_77_0-msvc-14.2-64.exe"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
(New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost.exe")
$wcl=(New-Object System.Net.WebClient)
$wcl.Headers.Add("user-agent", "Wget/1.21.0")
$wcl.DownloadFile($Url, "$env:TEMP\boost.exe")
Start-Process -Wait -FilePath "$env:TEMP\boost.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES"
cd .\build\windows
.\compile.bat
Expand All @@ -85,4 +87,4 @@ jobs:
with:
name: binaries-${{ matrix.os }}${{ matrix.arch }}
path: |
./**/release/vina*
./**/release/vina*
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 699949c

Please sign in to comment.