Skip to content
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
5 changes: 4 additions & 1 deletion mip/cbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Dict, List, Tuple, Optional, Union
from sys import platform, maxsize
from os.path import dirname, isfile, exists
from platform import machine as platform_machine
import os
import multiprocessing as multip
import numbers
Expand Down Expand Up @@ -97,7 +98,9 @@
elif platform.lower().startswith("darwin") or platform.lower().startswith(
"macos"
):
if os_is_64_bit:
if platform_machine().lower().startswith("arm64"):
libfile = os.path.join(pathlib, "cbc-c-darwin-arm64.dylib")
elif os_is_64_bit:
libfile = os.path.join(pathlib, "cbc-c-darwin-x86-64.dylib")
if not libfile:
raise NotImplementedError("You operating system/platform is not supported")
Expand Down
Binary file added mip/libraries/cbc-c-darwin-arm64.dylib
Binary file not shown.
85 changes: 85 additions & 0 deletions scripts/buildCBCMacARM.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
export MACOSX_DEPLOYMENT_TARGET="10.9"
export CFLAGS="-fPIC -Ofast -DNDEBUG -ffast-math -mmacosx-version-min=10.9"
export CXXFLAGS="-fPIC -Og -DNDEBUG -ffast-math -std=c++11 -stdlib=libc++ -mmacosx-version-min=10.9"
export F77FLAGS="-fPIC -Ofast -DNDEBUG -ffast-math"
export LDFLAGS="-fPIC -Ofast -DNDEBUG -ffast-math"

DIR=`pwd`
OUTDIR="/opt/cbc/bin"
export PKG_CONFIG_PATH="${OUTDIR}/lib/pkgconfig/:${PKG_CONFIG_PATH}"

echo
echo "Making and installing Glpk"
cd ${DIR}/ThirdParty-Glpk
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing Lapack"
cd ${DIR}/ThirdParty-Lapack
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing Blas"
cd ${DIR}/ThirdParty-Blas
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing CoinUtils"
cd ${DIR}/CoinUtils
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing Osi"
cd ${DIR}/Osi
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing Clp"
cd ${DIR}/Clp
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing Cgl"
cd ${DIR}/Cgl
./configure --prefix=${OUTDIR}/ --enable-static --disable-shared
git pull
make
make install

echo
echo "Making and installing Cbc"
cd ${DIR}/Cbc
./configure --prefix=${OUTDIR}/ --enable-cbc-parallel --enable-static --disable-shared
git pull
make
make install

echo
echo "Compiling dynamic library"
cd ${DIR}
clang++ -shared -Ofast -fPIC -o cbc-c-darwin-arm64.dylib \
-I${OUTDIR}/include/coin-or/ -I${OUTDIR}/include/coin-or/glpk -I${OUTDIR}/include/coin \
-L${OUTDIR}/lib \
./Cbc/src/Cbc_C_Interface.cpp \
-lCbc -lCgl -lClp -lCoinUtils -lOsi -lOsiCbc -lOsiClp -lOsiGlpk \
-lcoinblas -lcoinglpk -lcoinlapack \
-lbz2 -lz -llapack ${CXXFLAGS} -stdlib=libc++ -lreadline
echo "Done!"