From 489737d34c78e4c35c479a11c8b7f209eb2fa6fc Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Tue, 19 Apr 2016 16:08:33 -0500 Subject: [PATCH] Release 15.2.0 It's been a while since we tested 15.x on the mac. The makefile for ICG needed updating to what is essentially in 16. Added the one change required for clang 3.8. Updated the version to 15.2.0 in trick_ver.txt. Finally removed the check for libclang.a. The more recent clang releases are delivering libclang.dylib and I'm too lazy to make big changes in the configure script to search for it. The header file check should be enough. refs #228 --- bin/trick_ver.txt | 2 +- configure | 3 +- .../codegen/Interface_Code_Gen/main.cpp | 4 + .../codegen/Interface_Code_Gen/makefile | 81 +++++++------------ 4 files changed, 37 insertions(+), 53 deletions(-) diff --git a/bin/trick_ver.txt b/bin/trick_ver.txt index 10a4b9c3..e15f39d7 100644 --- a/bin/trick_ver.txt +++ b/bin/trick_ver.txt @@ -1 +1 @@ -current_version = "15.1.0" +current_version = "15.2.0" diff --git a/configure b/configure index 5181e83f..f17140b2 100755 --- a/configure +++ b/configure @@ -713,7 +713,8 @@ if [ -e "$TRICK_HOME/.git" -o $dev == 1 ] ; then check_exists "clang compiler" `$llvm/bin/$llvm_config --bindir`/clang check_exists "clang header files" `$llvm/bin/$llvm_config --includedir`/clang - check_exists "clang library" `$llvm/bin/$llvm_config --libdir`/libclang.a + # The newer clang releases on the mac have libclang.dylib + #check_exists "clang library" `$llvm/bin/$llvm_config --libdir`/libclang.a if [ "$gtest" != "" ] ; then check_exists "Google Test" "$gtest/include/gtest" diff --git a/trick_source/codegen/Interface_Code_Gen/main.cpp b/trick_source/codegen/Interface_Code_Gen/main.cpp index f509ee98..9c8bf1a5 100644 --- a/trick_source/codegen/Interface_Code_Gen/main.cpp +++ b/trick_source/codegen/Interface_Code_Gen/main.cpp @@ -145,7 +145,11 @@ int main( int argc , char * argv[] ) { // Tell the preprocessor to use its default predefines clang::PreprocessorOptions & ppo = ci.getPreprocessorOpts() ; ppo.UsePredefines = true; +#if (__clang_major__ == 3) && (__clang_minor__ >= 8) + pp.getBuiltinInfo().initializeBuiltins(pp.getIdentifierTable(), pp.getLangOpts()); +#else pp.getBuiltinInfo().InitializeBuiltins(pp.getIdentifierTable(), pp.getLangOpts()); +#endif // Add all of the #define from the command line to the default predefines. hsd.addDefines ( defines ) ; diff --git a/trick_source/codegen/Interface_Code_Gen/makefile b/trick_source/codegen/Interface_Code_Gen/makefile index 3caf0080..02679e1c 100644 --- a/trick_source/codegen/Interface_Code_Gen/makefile +++ b/trick_source/codegen/Interface_Code_Gen/makefile @@ -2,21 +2,15 @@ # The config_${HOST_TYPE}.mk file provides LLVM_HOME include ${TRICK_HOME}/makefiles/Makefile.common -RTTIFLAG := -fno-rtti -LLVM_VERSION := $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --version) -ifneq ($(LLVM_HOME),) CC := $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --bindir)/clang CXX := $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --bindir)/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 -LLVMLIBDIR := -L$(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --libdir) -endif -LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --ldflags) -OBJ_DIR := object_$(TRICK_HOST_CPU) +CLANG_MINOR_GTEQ5 := $(shell expr `$(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d. ` \>= 5 ) -CLANG_VERSION := $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --version) -CLANG_MINOR_GTEQ5 := $(shell expr `$(LLVM_HOME)/bin/$(LLVM_CONFIG) --version | cut -f2 -d. ` \>= 5 ) -CLANG_LIBDIR := $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --libdir) +LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags) + +OBJ_DIR := object_$(TRICK_HOST_CPU) ifeq ($(IS_CC_CLANG), 0) CXXFLAGS += -DGCC_MAJOR=$(GCC_MAJOR) -DGCC_MINOR=$(GCC_MINOR) @@ -32,53 +26,41 @@ UNITS_CONV_SRC = ${TRICK_HOME}/trick_source/trick_utils/units/src/units_conv.c UNITS_CONV_INCLUDE = -I${TRICK_HOME}/trick_source/trick_utils/units/include UNITS_CONV_OBJ = $(OBJ_DIR)/units_conv.o +CLANGLIBS = \ + -lclangFrontend \ + -lclangDriver \ + -lclangSerialization \ + -lclangParse \ + -lclangSema \ + -lclangAnalysis \ + -lclangEdit \ + -lclangAST \ + -lclangLex \ + -lclangBasic \ + +ifeq ($(TRICK_HOST_TYPE),Linux) +CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --libs) ifeq ($(CLANG_MINOR_GTEQ5),1) -LLVMLDFLAGS += $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --system-libs) +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 endif -ifeq ($(CLANG_VERSION),3.1) -CLANGLIBS = \ - -lclangFrontend \ - -lclangDriver \ - -lclangSerialization \ - -lclangParse \ - -lclangSema \ - -lclangAnalysis \ - -lclangRewrite \ - -lclangEdit \ - -lclangAST \ - -lclangLex \ - -lclangBasic \ - -lLLVMMC \ - -lLLVMSupport -else -CLANGLIBS = \ - -lclangFrontend \ - -lclangDriver \ - -lclangSerialization \ - -lclangParse \ - -lclangSema \ - -lclangAnalysis \ - -lclangEdit \ - -lclangAST \ - -lclangLex \ - -lclangBasic \ - $(shell $(LLVM_HOME)/bin/$(LLVM_CONFIG) --libs) +ifeq ($(TRICK_HOST_TYPE),Darwin) +CXXFLAGS += -std=c++11 +CLANGLIBS += -lLLVMOption -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMSupport $(shell $(LLVM_HOME)/bin/llvm-config --system-libs) +CLANGLIBS += -lc++abi endif -all: $(ICG) lib/clang/$(LLVM_VERSION) +all: $(ICG) $(ICG): $(OBJECTS) $(UNITS_CONV_OBJ) - $(CXX) -o $@ $(OBJECTS) $(UNITS_CONV_OBJ) $(LLVMLIBDIR) $(CLANGLIBS) $(LLVMLDFLAGS) - -lib/clang: - mkdir -p $@ - -lib/clang/$(LLVM_VERSION): | lib/clang - cp -r $(CLANG_LIBDIR)/clang/$(LLVM_VERSION) lib/clang + $(CXX) -o $@ $(OBJECTS) $(UNITS_CONV_OBJ) $(LLVMLDFLAGS) $(CLANGLIBS) # Only FieldDescription.cpp includes the units conversion header. $(OBJ_DIR)/FieldDescription.o : CXXFLAGS += $(UNITS_CONV_INCLUDE) +$(OBJ_DIR)/HeaderSearchDirs.o : CXXFLAGS += -DLLVM_HOME=\"${LLVM_HOME}\" $(OBJ_DIR)/main.o : CXXFLAGS += $(UNITS_CONV_INCLUDE) $(OBJECTS): $(OBJ_DIR)/%.o : %.cpp @@ -92,8 +74,5 @@ $(OBJECTS) $(UNITS_CONV_OBJ) : | $(OBJ_DIR) $(OBJ_DIR): mkdir -p $(OBJ_DIR) -# if an LLVM_HOME is not specified, then ICG cannot be rebuilt... don't delete it clean: -ifneq ($(LLVM_HOME),) - -rm -rf $(OBJ_DIR) $(ICG) lib -endif + rm -rf $(OBJ_DIR) $(ICG)