Skip to content

Instantly share code, notes, and snippets.

@techrah
Last active April 11, 2021 15:40
Show Gist options
  • Save techrah/efad63c28827763822068a3f09012b19 to your computer and use it in GitHub Desktop.
Save techrah/efad63c28827763822068a3f09012b19 to your computer and use it in GitHub Desktop.
~/.R/Makevars
# macOS Makevars configuration for LLVM/GCC
# for OpenMP support with R v4.0.x
#
# For installation details, see
# http://ryanhomer.github.io/posts/build-openmp-macos-catalina-complete
#
# Some sources used as reference:
# https://github.com/Rdatatable/data.table/wiki/Installation
# https://asieira.github.io/using-openmp-with-r-packages-in-os-x.html
# https://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/
# https://bit.ly/3d16TuW
# https://www.kthohr.com/r-mac-source.html
XCBASE:=$(shell xcrun --show-sdk-path)
GCCBASE:=$(shell brew --prefix gcc)
GETTEXT:=$(shell brew --prefix gettext)
GCCVERSION:=$(shell find "${GCCBASE}/bin" -type f -name "gcc-[0-9]*" | sed "s/[^-]*-//")
CC=$(GCCBASE)/bin/gcc-${GCCVERSION}
CXX=$(GCCBASE)/bin/g++-${GCCVERSION}
CXX11=$(GCCBASE)/bin/g++-${GCCVERSION}
CXX14=$(GCCBASE)/bin/g++-${GCCVERSION}
CXX17=$(GCCBASE)/bin/g++-${GCCVERSION}
CXX1X=$(GCCBASE)/bin/g++-${GCCVERSION}
CPPFLAGS=-isystem "$(GCCBASE)/include" -isysroot "$(XCBASE)"
LDFLAGS=-L"$(GCCBASE)/lib" -L"$(GETTEXT)/lib" --sysroot="$(XCBASE)"
FC=$(GCCBASE)/bin/gfortran
F77=$(GCCBASE)/bin/gfortran
FLIBS=-L$(GCCBASE)/lib/gcc/${GCCVERSION}/ -lm -lgfortran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment