Example #1
0
	// setup the preprocessor
	// code provided by Reginald Stadlbauer <*****@*****.**>
	void setup()
	{
		QString kdedir = getenv( "KDEDIR" );
		if ( !kdedir.isNull() )
			addIncludePath( kdedir + "/include" );
		
		QString qtdir = getenv( "QTDIR" );
		if ( !qtdir.isNull() )
			addIncludePath( qtdir + "/include" );
		
		QString qmakespec = getenv( "QMAKESPEC" );
		if ( qmakespec.isNull() )
			qmakespec = "linux-g++";
		// #### implement other mkspecs and find a better way to find the
		// #### proper mkspec (althoigh this will be no fun :-)
		
		addIncludePath( qtdir + "/mkspecs/" + qmakespec );
		
		if ( qmakespec == "linux-g++" )
		{
			addIncludePath( "/include" );
			addIncludePath( "/usr/include" );
			addIncludePath( "/ust/local/include" );
            bool ok;    
            QString gccLibPath = SetupHelper::getGccIncludePath(&ok);
            if (!ok) 
                return;  			
			gccLibPath = gccLibPath.replace( QRegExp( "[\r\n]" ), "" );
			addIncludePath( gccLibPath );
			addIncludePath( "/usr/include/g++-3" );
			addIncludePath( "/usr/include/g++" );
            QStringList lines = SetupHelper::getGccMacros(&ok);
            if (!ok) 
                return;  
            for (QStringList::ConstIterator it = lines.constBegin(); it != lines.constEnd(); ++it) {
                QStringList lst = QStringList::split( ' ', *it );
                if ( lst.count() != 3 )
                    continue;
                addMacro( Macro( lst[1], lst[2] ) );
            }
			addMacro( Macro( "__cplusplus", "1" ) );
			
			QString incl = getenv( "INCLUDE" );
		    QStringList includePaths = QStringList::split( ':', incl );
			QStringList::Iterator it = includePaths.begin();
			while ( it != includePaths.end() )
			{
				addIncludePath( ( *it ).stripWhiteSpace() );
				++it;
			}
			
		}
		else if ( qmakespec == "win32-borland" )
		{
			QString incl = getenv( "INCLUDE" );
			QStringList includePaths = QStringList::split( ';', incl );
			QStringList::Iterator it = includePaths.begin();
			while ( it != includePaths.end() )
			{
				addIncludePath( ( *it ).stripWhiteSpace() );
				++it;
			}
			// ### I am sure there are more standard include paths on
			// ### windows. I will fix that soon
			// ### Also do the compiler specific defines on windows
		}
	}
Example #2
0
void CompilerOptions::addIncludePaths(const StringList& includePaths)
{
    StringList::const_iterator it = includePaths.begin();
    for (; it != includePaths.end(); ++it)
        addIncludePath(*it);
}