From 1731390c98ed96141ff820cd82adcd078cb12c7c Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Wed, 29 Jun 2016 17:33:04 -0500 Subject: [PATCH] Switch compilation of ICG from clang++ to g++ Removed the lines that set the compiler to clang++, defaulting it to g++. Added lines in the makefile to set __clang_major__, __clang_minor__, and __clang_patchlevel__. These are required to compile several of the files in the ICG directory. refs #259 --- trick_source/codegen/Interface_Code_Gen/makefile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/trick_source/codegen/Interface_Code_Gen/makefile b/trick_source/codegen/Interface_Code_Gen/makefile index 9f632d34..aabb4faf 100644 --- a/trick_source/codegen/Interface_Code_Gen/makefile +++ b/trick_source/codegen/Interface_Code_Gen/makefile @@ -2,11 +2,13 @@ # The config_${HOST_TYPE}.mk file provides LLVM_HOME include ${TRICK_HOME}/share/trick/makefiles/Makefile.common -CC := $(CLANG) -CXX := $(CLANG)++ CXXFLAGS := -g -I$(shell $(LLVM_HOME)/bin/llvm-config --includedir) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti $(UDUNITS_INCLUDES) -CLANG_MINOR_GTEQ5 := $(shell expr `$(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d. ` \>= 5 ) +CLANG_MAJOR := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f1 -d.) +CLANG_MINOR := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d.) +CLANG_PATCHLEVEL := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f3 -d.) +# check to see if version is greater than 3.5 +CLANG_MINOR_GTEQ5 := $(shell [ $(CLANG_MAJOR) -gt 3 -o \( $(CLANG_MAJOR) -eq 3 -a $(CLANG_MINOR) -ge 5 \) ] && echo 1) LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags) $(UDUNITS_LDFLAGS) @@ -37,9 +39,10 @@ CLANGLIBS = \ -lclangBasic \ ifeq ($(TRICK_HOST_TYPE),Linux) +CXXFLAGS += -std=c++11 +CXXFLAGS += -D__clang_major__=$(CLANG_MAJOR) -D__clang_minor__=$(CLANG_MINOR) -D__clang_patchlevel__=$(CLANG_PATCHLEVEL) CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --libs) ifeq ($(CLANG_MINOR_GTEQ5),1) -CXXFLAGS += -std=c++11 # Fedora 21 adds -ledit as a system lib, but it isn't installed, or required. CLANGLIBS += $(filter-out -ledit,$(shell $(LLVM_HOME)/bin/llvm-config --system-libs)) endif