# Makevars
# POUMM
# 
# Copyright 2018 Venelin Mitov
# 
# You should have received a copy of the GNU Lesser General Public
# License along with POUMM.  If not, see
# <http://www.gnu.org/licenses/>.
# 
# @author Venelin Mitov




# This file has the purpose to configure the C++ compilation and building options
# passed as command line arguments to the C++ compiler and linker. The file-contents
# has been tested for portability between Mac OS X and Linux systems but not 
# on Windows. The comments below explain some issues I have encountered and wored
# around while setting up the C++ building environment on Mac OS X.


# Having this flag below enables compiling C++11 code with the default clang 
# compiler on Mac OS X. 
# CXX_STD = CXX11

# However, the default clang compiler version does not support OpenMP on R 
# version equal or below 3.5. You can read more on that issue in the Writing
# R extension manual 
# at https://cran.r-project.org/doc/manuals/r-release/R-exts.html#OpenMP-support

# Compiling with the clang compiler
# 
# Clang supports OpenMP on Mac OS X starting from 
# version 6. Hence, to run OpenMP enabled version of SPLITT on MacOS X with R 3.5, 
# I installed the clang 6 compiler from 
# http://releases.llvm.org/6.0.1/tools/clang/docs/ReleaseNotes.html . After 
# the installation I've added the following line to the global Makevars for R 
# found in USER-HOME/.R/Makevars:
# CXX=/usr/local/clang6/bin/clang++

# Compiling with the Intel compiler
# 
# Recent version of the Intel compiler also support OpenMP. After installing the
# Intel compiler on Mac OS X, one needs to add the following lines to the global
# Makevars file USER-HOME/.R/Makevars:
# 
# CXXFLAGS +=      -v -std=c++11 -Wall -O2 -march=native
# CPP=cpp
# CXX=icpc
# 
# In addition, for linking the compiled C++ files into shared library, the 
# libiomp5.dylib file from the Intel compiler distribution should
# be copied into the R library directory, i.e. :
# /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libiomp5.dylib
# 

# The following two lines add compiler and linker options for OpenMP headers and
# shared libraries. Yet, for these options to have an effect, the compiler itself
# should support OpenMP, i.e. it should include the appropriate OpenMP headers,
# and the openmp shared library binaries in its distribution (see above comments).
PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS) 
#PKG_CFLAGS=$(SHLIB_OPENMP_CFLAGS)
PKG_LIBS=$(SHLIB_OPENMP_CXXFLAGS)

CXX_STD = CXX11
