Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust setup.py to work on newer M3 Macs. #357

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading