forked from flatironinstitute/finufft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.inc.macosx_arm64_matlab2022b_beta
56 lines (48 loc) · 2.37 KB
/
make.inc.macosx_arm64_matlab2022b_beta
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Makefile variable overrides for Mac OSX compilation with CLANG + MATLAB
#
# Note that we have not been able to link against gfortran, so if you need
# fortran interfaces, use make.inc.macosx_gcc-* instead.
#
# Copy this file to make.inc, and if needed edit for your setup.
#
# ARM64 + MATLAB R2022b-beta specific native-arm64 binary,
# overrides version thanks to Wallace Chen, 12/3/22.
# See: https://github.com/flatironinstitute/finufft/issues/246
# compile flags for use with clang: (note absence of -march, etc)
CFLAGS = -O3 -arch arm64
# If you're getting warning messages of the form:
# ld: warning: object file (lib-static/libfinufft.a(finufft1d.o)) was built for
# newer OSX version (10.13) than being linked (10.9)
# Then you can uncomment the following two lines with the older version number
# (in this example -mmacosx-version-min=10.9)
#
#CFLAGS += "-mmacosx-version-min=<OLDER OSX VERSION NUMBER>"
CXX=clang++
CC=clang
# taken from makefile...
CFLAGS += -I include -I/usr/local/include -I/opt/homebrew/include
FFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LIBS += -L/usr/local/lib -L/opt/homebrew/lib
# Use MATLAB's shipped OpenMP (not gomp otherwise segfaults), with clang...
MOMPFLAGS = -D_OPENMP
OMPFLAGS = -Xpreprocessor -fopenmp
OMPLIBS = $(shell ls -d /Applications/MATLAB_R2022b_Beta.app)/toolbox/eml/externalDependency/omp/maca64/lib/libomp.dylib
# on mac os with clang compiler, matlab mex should use iomp as omp implementation
# we need to use -Wl,-rpath to add iomp lib directory to the runtime library search path
# add iomp runtime search path to linker flags
LDFLAGS += -Wl,-rpath,$(shell ls -d /Applications/MATLAB_R2022b_Beta.app)/toolbox/eml/externalDependency/omp/maca64/lib/
# since fftw3_omp doesn't work in OSX, we need...
FFTWOMPSUFFIX=threads
# MATLAB interface:
# some of these will depend on your FFTW library location, but this is where
# brew should put things...
MFLAGS += -I/usr/local/include -I/opt/homebrew/include -L/usr/local/lib -L/opt/homebrew/lib -lm
# should work, or edit for your MATLAB version location...
MEX = $(shell ls -d /Applications/MATLAB_R2022b_Beta.app)/bin/mex
# Also see docs/install.rst or github Issues, for possible edits to MATLAB's MEX XML file.
# extras by Wallace Chen:
LDFLAGS += -L/opt/homebrew/opt/libomp/lib
CXXFLAGS += -I/opt/homebrew/opt/libomp/include
LDFLAGS += -L/opt/homebrew/opt/fftw/lib
CXXFLAGS += -I/opt/homebrew/opt/fftw/include