Skip to content

Commit

Permalink
enforce passage of -std flag (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Oct 11, 2024
1 parent b478b62 commit 69d50f6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
23 changes: 12 additions & 11 deletions src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ ifeq ($(OS), Windows_NT)

MAKE = make
MAKEFLAGS = -e -j1
MAKE_CMD = \
MSYS2_ARG_CONV_EXCL="*" \
CYGWIN=nodosfilewarning \
CONLY="@WINDOWS_CC@" \
CPLUS="@WINDOWS_CXX11@" \
CXXFLAGS="$(TBB_CXXFLAGS)" \
PIC_KEY="@CXX11PICFLAGS@" \
WARNING_SUPPRESS="" \
WINARM64_CLANG="$(WINARM64_CLANG)" \
MAKE_CMD = \
MSYS2_ARG_CONV_EXCL="*" \
CYGWIN=nodosfilewarning \
CONLY="@WINDOWS_CC@" \
CPLUS="@WINDOWS_CXX11@" \
CXXFLAGS="$(TBB_CXXFLAGS)" \
PIC_KEY="@CXX11PICFLAGS@" \
WARNING_SUPPRESS="" \
WINARM64_CLANG="$(WINARM64_CLANG)" \
$(MAKE)

else
Expand All @@ -71,7 +71,7 @@ else
endif

MAKEFLAGS += -e
MAKE_CMD = \
MAKE_CMD = \
CONLY="@CC@ $(PKG_CPPFLAGS) @CPPFLAGS@" \
CPLUS="@CXX11@ $(PKG_CPPFLAGS) @CPPFLAGS@" \
CXXFLAGS="@CXX11FLAGS@ -DTBB_NO_LEGACY=1" \
Expand All @@ -93,6 +93,7 @@ ifeq ($(USE_TBB), Windows)
# rtools: turn on hacks to compensate for make and shell differences rtools<=>MinGW
# compiler: overwrite default (which is cl = MS compiler)
MAKE_ARGS += rtools=true compiler=gcc

# TBB configure will detect mingw runtime with unknown arch on WINARM64_CLANG but not an
# issue as we are using compiler built-ins instead of arch-specific code
ifneq ($(WINARM64_CLANG), true)
Expand Down Expand Up @@ -160,7 +161,7 @@ else
@mkdir -p ../inst/include
@cp -R tbb/include/* ../inst/include/
@(cd tbb/src && $(MAKE_CMD) $(MAKE_ARGS) info)
@(cd tbb/src && $(MAKE_CMD) @STDVER@ $(MAKE_ARGS) $(MAKE_TARGETS) $(MAKE_LOG))
@(cd tbb/src && $(MAKE_CMD) $(MAKE_ARGS) $(MAKE_TARGETS) $(MAKE_LOG))
endif

# NOTE: we do not want to clean ../inst/lib or ../inst/libs here,
Expand Down
17 changes: 10 additions & 7 deletions tools/config/configure.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ broken <-
if (broken)
cxxflags <- gsub("-Werror=format-security", "-Wformat -Werror=format-security", cxxflags)

# add C++ standard if not set
if (!grepl("-std=", cxxflags, fixed = TRUE)) {
stdflag <- if (getRversion() < "4.0") {
"-std=c++0x"
} else {
"$(CXX11STD)"
}
cxxflags <- paste(stdflag, cxxflags)
}

# avoid including /usr/local/include, as this can cause
# RcppParallel to find and use a version of libtbb installed
# there as opposed to the bundled version
Expand Down Expand Up @@ -115,13 +125,6 @@ if (info[["sysname"]] == "Windows") {

}

# use c++0x for compatibility with older compilers
if (getRversion() < "4.0") {
define(STDVER = "stdver=c++0x")
} else {
define(STDVER = "")
}

# on Solaris, check if we're using gcc or g++
if (Sys.info()[["sysname"]] == "SunOS") {
cxx <- r_cmd_config("CXX")
Expand Down

0 comments on commit 69d50f6

Please sign in to comment.