Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Config/testthat/edition: 3
Depends:
R (>= 4.2)
VignetteBuilder: knitr
SystemRequirements: C++20, GNU make, GCC >= 12 (or Clang with equivalent C++20 support)
SystemRequirements: C++20, GNU make, GCC >= 12 or Clang >= 15 (Apple Clang from Xcode 15+)
17 changes: 13 additions & 4 deletions src/Makevars
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
CXX_STD=CXX20

# Check compiler version for GCC
# ada-url requires GCC >= 12 for full C++20 support
# ada-url requires GCC >= 12 or Clang >= 15 for full C++20 support
# (including <ranges> and correct concept syntax).
# Apple Clang 14 / Xcode 14 (default on macOS Big Sur) is NOT sufficient.
CXX_VERSION := $(shell $(CXX) -dumpversion 2>/dev/null)
CXX_MAJOR := $(shell echo $(CXX_VERSION) | cut -d. -f1)
IS_GCC := $(shell $(CXX) --version 2>&1 | grep -c "^g++\|GCC")
IS_CLANG := $(shell $(CXX) --version 2>&1 | grep -c "[Cc]lang")

ifeq ($(shell $(CXX) -v 2>&1 | grep -c "gcc"),1)
ifeq ($(IS_GCC),1)
ifeq ($(shell [ $(CXX_MAJOR) -lt 12 ] && echo 1),1)
$(error adaR requires GCC >= 12 for C++20 support. Current version: $(CXX_VERSION). Please upgrade your compiler or use Clang.)
$(error adaR requires GCC >= 12 for C++20 support (found GCC $(CXX_VERSION)). On Ubuntu 22.04 the default is GCC 11 -- install gcc-12 or later.)
endif
endif

ifeq ($(IS_CLANG),1)
ifeq ($(shell [ $(CXX_MAJOR) -lt 15 ] && echo 1),1)
$(error adaR requires Clang >= 15 for C++20 support (found Clang $(CXX_VERSION)). Apple Clang from Xcode 15+ or upstream Clang 15+ is required.)
endif
endif