coin-or / python-mip

Python-MIP: collection of Python tools for the modeling and solution of Mixed-Integer Linear programs
Eclipse Public License 2.0
513 stars 88 forks source link

help support mac arm #365

Closed suzhenyu22 closed 5 months ago

suzhenyu22 commented 5 months ago

I compile cbc of mac arm, and fork new branch, and test.

the attch file on here. cbc-c-darwin-arm64.zip

we should change cbc.py on line 98:

from platform import machine as platform_machine

elif platform.lower().startswith("darwin") or platform.lower().startswith("macos"):
    if platform_machine().lower().startswith("arm64"):
        libfile = os.path.join(pathlib, "cbc-c-darwin-arm64.dylib")
    else:
        libfile = os.path.join(pathlib, "cbc-c-darwin-x86-64.dylib")
tuliotoffolo commented 5 months ago

Thanks, your contribution highly appreciated! I actually got myself a Mac M1 these days, and will work to update Python-MIP to the latest CBC version. I'll update the code following your suggestions.

tuliotoffolo commented 5 months ago

FYI: I also compiled the binary and included the script I used to produce the binary it in the repo. I've mentioned you in the code change to detect if the ARM64 binary should be used.