Skip to content

Commit

Permalink
Added case in ICG makefile to use C++17 for clang 16 as clang 16 or l…
Browse files Browse the repository at this point in the history
…ater builds C++ code according to the C++17 by default. (#1621)
  • Loading branch information
hchen99 committed Nov 30, 2023
1 parent e40fe00 commit 9ead0a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions trick_source/codegen/Interface_Code_Gen/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ CLANG_PATCHLEVEL := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f3 -d.
CLANG_MINOR_GTEQ5 := $(shell [ $(CLANG_MAJOR) -gt 3 -o \( $(CLANG_MAJOR) -eq 3 -a $(CLANG_MINOR) -ge 5 \) ] && echo 1)

CLANG_MAJOR_GTEQ10 := $(shell [ $(CLANG_MAJOR) -ge 10 ] && echo 1)
# By default, Clang 16 or later builds C++ code according to the C++17 standard.
CLANG_MAJOR_GTEQ16 := $(shell [ $(CLANG_MAJOR) -ge 16 ] && echo 1)
ifeq ($(CLANG_MAJOR_GTEQ16),1)
CXXFLAGS += -std=c++17
else
ifeq ($(CLANG_MAJOR_GTEQ10),1)
CXXFLAGS += -std=c++14
else
CXXFLAGS += -std=c++11
endif
endif

LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags) $(UDUNITS_LDFLAGS)

Expand Down Expand Up @@ -48,8 +54,12 @@ endif
ifeq ($(TRICK_HOST_TYPE),Darwin)
CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --libs)
CLANGLIBS += $(filter-out -llibxml2.tbd,$(shell $(LLVM_HOME)/bin/llvm-config --system-libs))
ifeq ($(CLANG_MAJOR_GTEQ16),1)
CLANGLIBS += -lc++abi -lclang-cpp
else
CLANGLIBS += -lc++abi
endif
endif

all: $(ICG)

Expand Down

0 comments on commit 9ead0a2

Please sign in to comment.