Skip to content

Commit

Permalink
Updates for OSX Mojave, including Python interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Potschka committed Feb 28, 2019
1 parent 72e8238 commit 77cb965
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/qpOASES/LapackBlasReplacement.hpp
Expand Up @@ -51,7 +51,7 @@
#else

#define SGEMM sgemm_
#define DGEMM gemm_
#define DGEMM dgemm_
#define SPOTRF spotrf_
#define DPOTRF dpotrf_
#define STRTRS strtrs_
Expand Down
6 changes: 3 additions & 3 deletions interfaces/python/qpoases.pyx
Expand Up @@ -387,7 +387,7 @@ cdef class PyQProblemB:
cdef QProblemB *thisptr # hold a C++ instance which we're wrapping
def __cinit__(self, long nV):
# FIXME: allow other HessianTypes!
self.thisptr = new QProblemB(<int_t> nV, HST_UNKNOWN, BT_FALSE)
self.thisptr = new QProblemB(<int_t> nV, HST_UNKNOWN, BT_TRUE)

def __dealloc__(self):
del self.thisptr
Expand Down Expand Up @@ -504,7 +504,7 @@ cdef class PyQProblem:
cdef QProblem *thisptr # hold a C++ instance which we're wrapping

def __cinit__(self, long nV, long nC):
self.thisptr = new QProblem(nV, nC, HST_UNKNOWN, BT_FALSE)
self.thisptr = new QProblem(nV, nC, HST_UNKNOWN, BT_TRUE)

def __dealloc__(self):
del self.thisptr
Expand Down Expand Up @@ -629,7 +629,7 @@ cdef class PySQProblem:
cdef SQProblem *thisptr # hold a C++ instance which we're wrapping

def __cinit__(self, long nV, long nC):
self.thisptr = new SQProblem(nV, nC, HST_UNKNOWN, BT_FALSE)
self.thisptr = new SQProblem(nV, nC, HST_UNKNOWN, BT_TRUE)

def __dealloc__(self):
del self.thisptr
Expand Down
12 changes: 10 additions & 2 deletions interfaces/python/setup.py
Expand Up @@ -53,13 +53,21 @@
extra_params['extra_link_args'] = ["-Wl,-O1", "-Wl,--as-needed"]

extra_params = extra_params.copy()
extra_params['libraries'] = ['qpOASES', "python2.7"]
extra_params['libraries'] = ['qpOASES']

extra_params['library_dirs'] = ['/usr/lib', os.path.join(BASEDIR, 'bin')]
extra_params['language'] = 'c++'

if platform.system() in ['Linux', 'Darwin']:
extra_params['extra_compile_args'] = ['-D__USE_LONG_INTEGERS__', '-D__USE_LONG_INTS__']
extra_params['extra_compile_args'] = ['-D__USE_LONG_INTEGERS__',
'-D__USE_LONG_FINTS__']

if platform.system() == 'Darwin':
extra_params['include_dirs'].append(
'/Library/Developer/CommandLineTools/usr/include/c++/v1')
extra_params['extra_compile_args'] += ['-stdlib=libc++',
'-Wno-c++11-long-long']
extra_params['extra_link_args'] = ['-stdlib=libc++'] # override the others!

if os.name == 'posix':
extra_params['runtime_library_dirs'] = extra_params['library_dirs']
Expand Down
10 changes: 5 additions & 5 deletions make_osx.mk
Expand Up @@ -38,15 +38,15 @@ SRCDIR = ${TOP}/src
BINDIR = ${TOP}/bin

# MacOSX SDK
SYSROOT = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
SYSROOT = /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
SDK = -isysroot ${SYSROOT} -stdlib=libc++

# Matlab include directory (ADAPT TO YOUR LOCAL SETTINGS!)
MATLAB_IDIR = /Applications/MATLAB_R2013a.app/extern/include/
MATLAB_LIBDIR =

# system or replacement BLAS/LAPACK
REPLACE_LINALG = 1
REPLACE_LINALG = 0

ifeq ($(REPLACE_LINALG), 1)
LIB_BLAS = ${SRCDIR}/BLASReplacement.o
Expand Down Expand Up @@ -91,7 +91,7 @@ DLLEXT = dylib
EXE =
MEXOCTEXT = mex
DEF_TARGET = -o $@
SHARED = -dynamiclib ${SDK} -lgcc_s.10.5 -ldylib1.o
SHARED = -dynamiclib ${SDK}

# 32 or 64 depending on target platform
BITS = $(shell getconf LONG_BIT)
Expand All @@ -103,15 +103,15 @@ else
MEXEXT = mexa64
endif

CPPFLAGS = ${SDK} -Wall -pedantic -Wshadow -Wfloat-equal -Wconversion -Wsign-conversion -O3 -fPIC -DLINUX
CPPFLAGS = ${SDK} -Wall -pedantic -Wshadow -Wfloat-equal -Wconversion -Wsign-conversion -O3 -fPIC -D__USE_LONG_INTEGERS__ -D__USE_LONG_FINTS__ -D__NO_COPYRIGHT__
# -g -D__DEBUG__ -D__NO_COPYRIGHT__ -D__SUPPRESSANYOUTPUT__ -D__USE_SINGLE_PRECISION__

# libraries to link against when building qpOASES .so files
LINK_LIBRARIES = ${LIB_LAPACK} ${LIB_BLAS} -lm ${LIB_SOLVER}
LINK_LIBRARIES_WRAPPER = -lm ${LIB_SOLVER}

# how to link against the qpOASES shared library
QPOASES_LINK = -L${BINDIR} -lqpOASES -L${SYSROOT}/usr/lib/System -lgcc_s.10.5 -lcrt1.o
QPOASES_LINK = -L${BINDIR} -lqpOASES -L${SYSROOT}/usr/lib/System
QPOASES_LINK_WRAPPER = -L${BINDIR} -lqpOASES_wrapper

# link dependencies when creating executables
Expand Down

0 comments on commit 77cb965

Please sign in to comment.