From d967687f14ebffeb44153211aaca338eab629bd4 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 12 Oct 2010 10:57:08 +0200 Subject: [PATCH] ENH: add settings/rules for clang-2.8 --- etc/settings.csh | 25 +++++++++++++++++++++++++ etc/settings.sh | 25 +++++++++++++++++++++++++ wmake/rules/linux64Clang/c | 16 ++++++++++++++++ wmake/rules/linux64Clang/c++ | 21 +++++++++++++++++++++ wmake/rules/linux64Clang/c++Debug | 2 ++ wmake/rules/linux64Clang/c++Opt | 3 +++ wmake/rules/linux64Clang/c++Prof | 2 ++ wmake/rules/linux64Clang/cDebug | 2 ++ wmake/rules/linux64Clang/cOpt | 2 ++ wmake/rules/linux64Clang/cProf | 2 ++ wmake/rules/linux64Clang/general | 8 ++++++++ wmake/rules/linux64Clang/mplibHPMPI | 3 +++ wmake/rules/linuxClang/c | 16 ++++++++++++++++ wmake/rules/linuxClang/c++ | 21 +++++++++++++++++++++ wmake/rules/linuxClang/c++Debug | 2 ++ wmake/rules/linuxClang/c++Opt | 2 ++ wmake/rules/linuxClang/c++Prof | 2 ++ wmake/rules/linuxClang/cDebug | 2 ++ wmake/rules/linuxClang/cOpt | 2 ++ wmake/rules/linuxClang/cProf | 2 ++ wmake/rules/linuxClang/general | 9 +++++++++ wmake/rules/linuxClang/mplibHPMPI | 3 +++ 22 files changed, 172 insertions(+) create mode 100644 wmake/rules/linux64Clang/c create mode 100644 wmake/rules/linux64Clang/c++ create mode 100644 wmake/rules/linux64Clang/c++Debug create mode 100644 wmake/rules/linux64Clang/c++Opt create mode 100644 wmake/rules/linux64Clang/c++Prof create mode 100644 wmake/rules/linux64Clang/cDebug create mode 100644 wmake/rules/linux64Clang/cOpt create mode 100644 wmake/rules/linux64Clang/cProf create mode 100644 wmake/rules/linux64Clang/general create mode 100644 wmake/rules/linux64Clang/mplibHPMPI create mode 100644 wmake/rules/linuxClang/c create mode 100644 wmake/rules/linuxClang/c++ create mode 100644 wmake/rules/linuxClang/c++Debug create mode 100644 wmake/rules/linuxClang/c++Opt create mode 100644 wmake/rules/linuxClang/c++Prof create mode 100644 wmake/rules/linuxClang/cDebug create mode 100644 wmake/rules/linuxClang/cOpt create mode 100644 wmake/rules/linuxClang/cProf create mode 100644 wmake/rules/linuxClang/general create mode 100644 wmake/rules/linuxClang/mplibHPMPI diff --git a/etc/settings.csh b/etc/settings.csh index 8b51bb7b41..d1d9a413fc 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -108,6 +108,12 @@ case OpenFOAM: set gmp_version=gmp-4.2.4 set mpfr_version=mpfr-2.4.1 breaksw + case Clang: + # using clang - not gcc + setenv WM_CC 'clang' + setenv WM_CXX 'clang++' + set clang_version=llvm-2.8 + breaksw default: echo echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" @@ -159,6 +165,25 @@ case OpenFOAM: endif unset gcc_version gccDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir + + if ( $?clang_version ) then + set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version + + # Check that the compiler directory can be found + if ( ! -d "$clangDir" ) then + echo + echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:" + echo " Cannot find $clangDir installation." + echo " Please install this compiler version or if you wish to use the system compiler," + echo " change the 'compilerInstall' setting to 'system' in this file" + echo + endif + + _foamAddMan $clangDir/man + _foamAddPath $clangDir/bin + endif + unset clang_version clangDir + breaksw endsw diff --git a/etc/settings.sh b/etc/settings.sh index aae19a764b..4a1ce214c3 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -131,6 +131,12 @@ OpenFOAM) gmp_version=gmp-4.2.4 mpfr_version=mpfr-2.4.1 ;; + Clang) + # using clang - not gcc + export WM_CC='clang' + export WM_CXX='clang++' + clang_version=llvm-2.8 + ;; *) echo echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" @@ -183,6 +189,25 @@ OpenFOAM) fi unset gcc_version gccDir unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir + + if [ -n "$clang_version" ] + then + clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version + + # Check that the compiler directory can be found + [ -d "$clangDir" ] || { + echo + echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:" + echo " Cannot find $clangDir installation." + echo " Please install this compiler version or if you wish to use the system compiler," + echo " change the 'compilerInstall' setting to 'system' in this file" + echo + } + + _foamAddMan $clangDir/share/man + _foamAddPath $clangDir/bin + fi + unset clang_version clangDir ;; esac diff --git a/wmake/rules/linux64Clang/c b/wmake/rules/linux64Clang/c new file mode 100644 index 0000000000..7d7d4f61a1 --- /dev/null +++ b/wmake/rules/linux64Clang/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = clang -m64 + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -shared +LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linux64Clang/c++ b/wmake/rules/linux64Clang/c++ new file mode 100644 index 0000000000..75da3e4ad2 --- /dev/null +++ b/wmake/rules/linux64Clang/c++ @@ -0,0 +1,21 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wnon-virtual-dtor + +CC = clang++ -m64 + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-60 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) + +LINKLIBSO = $(CC) $(c++FLAGS) -shared +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed diff --git a/wmake/rules/linux64Clang/c++Debug b/wmake/rules/linux64Clang/c++Debug new file mode 100644 index 0000000000..19bdb9c334 --- /dev/null +++ b/wmake/rules/linux64Clang/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb3 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/linux64Clang/c++Opt b/wmake/rules/linux64Clang/c++Opt new file mode 100644 index 0000000000..3363be8090 --- /dev/null +++ b/wmake/rules/linux64Clang/c++Opt @@ -0,0 +1,3 @@ +#c++DBUG = -O0 -DFULLDEBUG -g +c++DBUG = +c++OPT = -O3 diff --git a/wmake/rules/linux64Clang/c++Prof b/wmake/rules/linux64Clang/c++Prof new file mode 100644 index 0000000000..3bda4dad55 --- /dev/null +++ b/wmake/rules/linux64Clang/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/linux64Clang/cDebug b/wmake/rules/linux64Clang/cDebug new file mode 100644 index 0000000000..72b638f458 --- /dev/null +++ b/wmake/rules/linux64Clang/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/linux64Clang/cOpt b/wmake/rules/linux64Clang/cOpt new file mode 100644 index 0000000000..17318709f1 --- /dev/null +++ b/wmake/rules/linux64Clang/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/linux64Clang/cProf b/wmake/rules/linux64Clang/cProf new file mode 100644 index 0000000000..ca3ac9bf5f --- /dev/null +++ b/wmake/rules/linux64Clang/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/linux64Clang/general b/wmake/rules/linux64Clang/general new file mode 100644 index 0000000000..809751cd0a --- /dev/null +++ b/wmake/rules/linux64Clang/general @@ -0,0 +1,8 @@ +CPP = cpp -traditional-cpp $(GFLAGS) + +PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl + +include $(GENERAL_RULES)/standard + +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/linux64Clang/mplibHPMPI b/wmake/rules/linux64Clang/mplibHPMPI new file mode 100644 index 0000000000..574492a236 --- /dev/null +++ b/wmake/rules/linux64Clang/mplibHPMPI @@ -0,0 +1,3 @@ +PFLAGS = +PINC = -I$(MPI_ARCH_PATH)/include -D_MPICC_H +PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_amd64 -lmpi diff --git a/wmake/rules/linuxClang/c b/wmake/rules/linuxClang/c new file mode 100644 index 0000000000..99b3238306 --- /dev/null +++ b/wmake/rules/linuxClang/c @@ -0,0 +1,16 @@ +.SUFFIXES: .c .h + +cWARN = -Wall + +cc = clang -m32 + +include $(RULES)/c$(WM_COMPILE_OPTION) + +cFLAGS = $(GFLAGS) $(cWARN) $(cOPT) $(cDBUG) $(LIB_HEADER_DIRS) -fPIC + +ctoo = $(WM_SCHEDULER) $(cc) $(cFLAGS) -c $$SOURCE -o $@ + +LINK_LIBS = $(cDBUG) + +LINKLIBSO = $(cc) -shared +LINKEXE = $(cc) -Xlinker --add-needed -Xlinker -z -Xlinker nodefs diff --git a/wmake/rules/linuxClang/c++ b/wmake/rules/linuxClang/c++ new file mode 100644 index 0000000000..2f7a3bde44 --- /dev/null +++ b/wmake/rules/linuxClang/c++ @@ -0,0 +1,21 @@ +.SUFFIXES: .C .cxx .cc .cpp + +c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast + +CC = clang++ -m32 + +include $(RULES)/c++$(WM_COMPILE_OPTION) + +ptFLAGS = -DNoRepository -ftemplate-depth-60 + +c++FLAGS = $(GFLAGS) $(c++WARN) $(c++OPT) $(c++DBUG) $(ptFLAGS) $(LIB_HEADER_DIRS) -fPIC + +Ctoo = $(WM_SCHEDULER) $(CC) $(c++FLAGS) -c $$SOURCE -o $@ +cxxtoo = $(Ctoo) +cctoo = $(Ctoo) +cpptoo = $(Ctoo) + +LINK_LIBS = $(c++DBUG) + +LINKLIBSO = $(CC) $(c++FLAGS) -shared +LINKEXE = $(CC) $(c++FLAGS) -Xlinker --add-needed diff --git a/wmake/rules/linuxClang/c++Debug b/wmake/rules/linuxClang/c++Debug new file mode 100644 index 0000000000..19bdb9c334 --- /dev/null +++ b/wmake/rules/linuxClang/c++Debug @@ -0,0 +1,2 @@ +c++DBUG = -ggdb3 -DFULLDEBUG +c++OPT = -O0 -fdefault-inline diff --git a/wmake/rules/linuxClang/c++Opt b/wmake/rules/linuxClang/c++Opt new file mode 100644 index 0000000000..2aedabd628 --- /dev/null +++ b/wmake/rules/linuxClang/c++Opt @@ -0,0 +1,2 @@ +c++DBUG = +c++OPT = -O3 diff --git a/wmake/rules/linuxClang/c++Prof b/wmake/rules/linuxClang/c++Prof new file mode 100644 index 0000000000..3bda4dad55 --- /dev/null +++ b/wmake/rules/linuxClang/c++Prof @@ -0,0 +1,2 @@ +c++DBUG = -pg +c++OPT = -O2 diff --git a/wmake/rules/linuxClang/cDebug b/wmake/rules/linuxClang/cDebug new file mode 100644 index 0000000000..72b638f458 --- /dev/null +++ b/wmake/rules/linuxClang/cDebug @@ -0,0 +1,2 @@ +cDBUG = -ggdb -DFULLDEBUG +cOPT = -O1 -fdefault-inline -finline-functions diff --git a/wmake/rules/linuxClang/cOpt b/wmake/rules/linuxClang/cOpt new file mode 100644 index 0000000000..17318709f1 --- /dev/null +++ b/wmake/rules/linuxClang/cOpt @@ -0,0 +1,2 @@ +cDBUG = +cOPT = -O3 diff --git a/wmake/rules/linuxClang/cProf b/wmake/rules/linuxClang/cProf new file mode 100644 index 0000000000..ca3ac9bf5f --- /dev/null +++ b/wmake/rules/linuxClang/cProf @@ -0,0 +1,2 @@ +cDBUG = -pg +cOPT = -O2 diff --git a/wmake/rules/linuxClang/general b/wmake/rules/linuxClang/general new file mode 100644 index 0000000000..97ce8c940c --- /dev/null +++ b/wmake/rules/linuxClang/general @@ -0,0 +1,9 @@ +CPP = cpp -traditional-cpp $(GFLAGS) +LD = ld -melf_i386 + +PROJECT_LIBS = -l$(WM_PROJECT) -liberty -ldl + +include $(GENERAL_RULES)/standard + +include $(RULES)/c +include $(RULES)/c++ diff --git a/wmake/rules/linuxClang/mplibHPMPI b/wmake/rules/linuxClang/mplibHPMPI new file mode 100644 index 0000000000..8aff40632b --- /dev/null +++ b/wmake/rules/linuxClang/mplibHPMPI @@ -0,0 +1,3 @@ +PFLAGS = +PINC = -I$(MPI_ARCH_PATH)/include -D_MPICC_H +PLIBS = -L$(MPI_ARCH_PATH)/lib/linux_ia32 -lmpi