Last active
March 5, 2022 13:00
-
-
Save luispuerto/9b5fc37a117c94ebb07f1a1d93e6665e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------- | |
# RMakevars | |
# -------- | |
# General note | |
# - need to repeat options across C++ flavors (e.g., 11, 14) | |
# Homebrew bin / opt / lib locations | |
## Add the full path to have everything on here. | |
export PATH=/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/ruby/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/usr/local/munki:/opt/X11/bin:/Library/Apple/usr/bin:/Users/luis.puerto/Code/golang/bin:/opt/homebrew/opt/go/libexec/bin:/opt/homebrew/opt/ccache/libexec | |
## Figure out the Homebrew path | |
BP=`brew --prefix` | |
HB=$(BP)/bin | |
HO=$(BP)/opt | |
HL=$(BP)/lib | |
HI=$(BP)/include | |
# MacOS 10.14.6 Xcode header location (August 2019) | |
# (do "xcrun -show-sdk-path" in terminal to get path; change if yours is different) | |
XH=$(shell xcrun -show-sdk-path) | |
# ccache | |
CCACHE=$(HB)/ccache | |
# Make using all cores (set # to # of cores on your machine) | |
# Check https://stackoverflow.com/q/2499070 for more info. | |
# Run `nproc` to check the number of threads https://stackoverflow.com/a/56607839 | |
# As a rule of thumb the number should be between cores and threads. | |
MAKE=make -j4 | |
# GNU version (May 2021) | |
GNU_VER=11 | |
# LLVM (Clang) compiler options | |
CC=$(CCACHE) $(HO)/llvm/bin/clang | |
CXX=$(CC)++ | |
CXX98=$(CC)++ | |
CXX11=$(CC)++ | |
CXX14=$(CC)++ | |
CXX17=$(CC)++ | |
# FORTRAN | |
FC=$(CCACHE) $(HB)/gfortran-$(GNU_VER) | |
F77=$(FC) | |
FLIBS=-L$(HL)/gcc/$(GNU_VER) -lgfortran -lquadmath -lm | |
# STD libraries | |
CXX1XSTD=-std=c++0x | |
CXX11STD=-std=c++11 | |
CXX14STD=-std=c++14 | |
CXX17STD=-std=c++17 | |
# FLAGS | |
STD_FLAGS=-g -O3 -Wall -pedantic -mtune=native -pipe | |
CFLAGS=$(STD_FLAGS) | |
CXXFLAGS=$(STD_FLAGS) | |
CXX98FLAGS=$(STD_FLAGS) | |
CXX11FLAGS=$(STD_FLAGS) | |
CXX14FLAGS=$(STD_FLAGS) | |
CXX17FLAGS=$(STD_FLAGS) | |
# Preprocessor FLAGS | |
# NB: -isysroot refigures the include path to the Xcode SDK we set above | |
CPPFLAGS=-isysroot $(XH) -I$(HI) \ | |
-I$(HO)/llvm/include -I$(HO)/openssl/include \ | |
-I$(HO)/gettext/include -I$(HO)/tcl-tk/include | |
# Linker flags (suggested by homebrew) | |
LDFLAGS+=-L$(HO)/llvm/lib -Wl,-rpath,$(HO)/llvm/lib | |
# Flags for OpenMP support that should allow packages that want to use | |
# OpenMP to do so (data.table), and other packages that bork with | |
# -fopenmp flag (stringi) to be left alone | |
SHLIB_OPENMP_CFLAGS=-fopenmp | |
SHLIB_OPENMP_CXXFLAGS=-fopenmp | |
SHLIB_OPENMP_CXX98FLAGS=-fopenmp | |
SHLIB_OPENMP_CXX11FLAGS=-fopenmp | |
SHLIB_OPENMP_CXX14FLAGS=-fopenmp | |
SHLIB_OPENMP_CXX17FLAGS=-fopenmp | |
SHLIB_OPENMP_FCFLAGS=-fopenmp | |
SHLIB_OPENMP_FFLAGS=-fopenmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment