Repository navigation
Expand file tree
/
Copy pathmake.inc.mac
More file actions
58 lines (46 loc) · 1.49 KB
/
Copy pathmake.inc.mac
File metadata and controls
58 lines (46 loc) · 1.49 KB
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
57
# macOS build configuration (local development)
#
# Usage:
# make MAKEINC=make.inc.mac
# make -C src MAKEINC=../make.inc.mac
# make -C examples MAKEINC=../make.inc.mac
#
# Prereqs:
# - Eigen headers installed (e.g. `brew install eigen`)
# Typical include path: /opt/homebrew/include/eigen3 (Apple Silicon)
# /usr/local/include/eigen3 (Intel)
# Repository root (works even when included from src/ or examples/)
HOME := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
PLAT ?= Mac
CXX ?= clang++
CC ?= clang
MAKE ?= make
AR ?= ar
ARFLAGS?= rcs
RANLIB ?= ranlib
ECHO ?= echo
# Eigen include root (should contain Eigen/Dense).
EIGEN ?= /opt/homebrew/include/eigen3
ifeq ($(wildcard $(EIGEN)/Eigen/Dense),)
EIGEN := /usr/local/include/eigen3
endif
# Optional OpenMP (recommended for performance).
# Install with: `brew install libomp`
LIBOMP_PREFIX ?= /opt/homebrew/opt/libomp
ifeq ($(wildcard $(LIBOMP_PREFIX)/include/omp.h),)
LIBOMP_PREFIX := /usr/local/opt/libomp
endif
OMP_CXXFLAGS :=
OMP_LDFLAGS :=
ifeq ($(wildcard $(LIBOMP_PREFIX)/include/omp.h),)
# OpenMP not found: build will still work, but runs single-threaded.
else
OMP_CXXFLAGS := -Xpreprocessor -fopenmp -I$(LIBOMP_PREFIX)/include
OMP_LDFLAGS := -L$(LIBOMP_PREFIX)/lib -lomp
endif
# Optional BLAS/LAPACK (empty by default).
MKL ?=
LDFLAGS?=
CXXFLAGS ?= -O3 -DNDEBUG -std=c++17 -I$(HOME)/include -I$(EIGEN) $(OMP_CXXFLAGS)
LDFLAGS += $(OMP_LDFLAGS)
LIBFASTEIG = $(HOME)/libfasteig_$(PLAT).a