[Compbench-devel] CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-GCC Compiler-GCC.cpp, NONE,
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-01-22 18:24:25
|
Update of /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-GCC In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv20703/Compiler-GCC Added Files: Compiler-GCC.cpp Compiler-GCC.h Makefile.am Log Message: libcompbenchmarks moved in a separate directory. --- NEW FILE: Compiler-GCC.h --- /* ---------------------------------------------------------------------------- $Id: Compiler-GCC.h,v 1.1 2007/01/22 18:24:21 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #ifndef H_CBMCOMPILER_GCC #define H_CBMCOMPILER_GCC #include <Compiler/Compiler.h> namespace CBM { /** \brief Defines the gcc compiler */ class CompilerGCC : public Compiler { private: protected: virtual std::string getCompilerName(void); virtual std::string getCompilerVersion(void); virtual char *language(void); public: CompilerGCC(class System *_system, char *_compilerBinary); virtual std::string compiler(void); virtual ~CompilerGCC(); }; /** \brief Defines the g++ compiler */ class CompilerGCC_cpp : public Compiler { private: protected: virtual std::string getCompilerName(void); virtual std::string getCompilerVersion(void); virtual char *language(void); public: CompilerGCC_cpp (class System *_system, char *_compilerBinary); virtual std::string compiler(void); virtual ~CompilerGCC_cpp(); }; } #endif --- NEW FILE: Makefile.am --- # ----------------------------------------------------------------------------- # $Id: Makefile.am,v 1.1 2007/01/22 18:24:21 xfred Exp $ # $Source: /cvsroot/compbench/CompBenchmarks++/libcompbenchmarks/Compiler/Compiler-GCC/Makefile.am,v $ # # This is free software. # For details, see the GNU Public License in the COPYING file, or # Look http://www.fsf.org # ----------------------------------------------------------------------------- noinst_LTLIBRARIES = libCompilerGCC.la sources = Compiler-GCC.cpp libCompilerGCC_la_SOURCES = $(sources) libCompilerinclude_HEADERS = $(sources:.cpp=.h) libCompilerincludedir = $(includedir)/compbenchmarks/Compiler/Compiler-GCC INCLUDES = -I $(top_srcdir)/libcompbenchmarks --- NEW FILE: Compiler-GCC.cpp --- /* ---------------------------------------------------------------------------- $Id: Compiler-GCC.cpp,v 1.1 2007/01/22 18:24:21 xfred Exp $ This is free software. For details, see the GNU Public License in the COPYING file, or Look http://www.fsf.org ------------------------------------------------------------------------- */ #include <Compiler/Compiler-GCC/Compiler-GCC.h> #include <System/System.h> #include <config.h> using namespace CBM; CompilerGCC::CompilerGCC(CBM::System *_system, char *_compilerBinary) : Compiler(_system, _compilerBinary) { } std::string CompilerGCC::compiler(void) { std::string str = "gcc"; return(str); } std::string CompilerGCC::getCompilerName(void) { std::string cmd = compilerBinary; std::string result; std::string tmp; cmd+=" --version | "; cmd+=CBM_PROG_HEAD; cmd+=" -1"; system->exec(cmd, result); /* !!! */ if ((int) result.find("gcc")<0) { tmp="gcc "; tmp+=result; result=tmp; } return(result); } std::string CompilerGCC::getCompilerVersion(void) { std::string cmd = "I=`"; std::string result; cmd+=compilerBinary; cmd+=" --version | "; cmd+=CBM_PROG_HEAD; cmd+=" -1`; echo $I | "; cmd+=CBM_PROG_GREP; cmd+=" prerelease > /dev/null; if test $? = 0; then echo $I | "; cmd+=CBM_PROG_CUT; cmd+=" -f3-5 -d' '; else echo $I | "; cmd+=CBM_PROG_CUT; cmd+=" -f3 -d' '; fi"; /* !!! */ system->exec(cmd, result); /* !!! */ return(result); } char *CompilerGCC::language(void) { return("C"); } CompilerGCC::~CompilerGCC() { } CompilerGCC_cpp::CompilerGCC_cpp(CBM::System *_system, char *_compilerBinary) : Compiler(_system, _compilerBinary) { } std::string CompilerGCC_cpp::compiler(void) { std::string str = "g++"; return(str); } std::string CompilerGCC_cpp::getCompilerName(void) { std::string cmd = compilerBinary; std::string result; std::string tmp; cmd+=" --version | "; cmd+=CBM_PROG_HEAD; cmd+=" -1"; system->exec(cmd, result); /* !!! */ if ((int) result.find("g++")<0) { tmp="g++ "; tmp+=result; result=tmp; } return(result); } std::string CompilerGCC_cpp::getCompilerVersion(void) { std::string cmd = "I=`"; std::string result; cmd+=compilerBinary; cmd+=" --version | "; cmd+=CBM_PROG_HEAD; cmd+=" -1`; echo $I | "; cmd+=CBM_PROG_GREP; cmd+=" prerelease > /dev/null; if test $? = 0; then echo $I | "; cmd+=CBM_PROG_CUT; cmd+=" -f3-5 -d' '; else echo $I | "; cmd+=CBM_PROG_CUT; cmd+=" -f3 -d' '; fi"; /* !!! */ system->exec(cmd, result); /* !!! */ return(result); } char *CompilerGCC_cpp::language(void) { return("C++"); } CompilerGCC_cpp::~CompilerGCC_cpp() { } |