示例#1
0
void
Project::PrecompileFile(SourceFile *file)
{
	if (!file)
		return;
	
	DPath projfolder(GetPath().GetFolder());
	file->Precompile(fBuildInfo,"");
}
示例#2
0
void
Project::PostBuild(SourceFile *file)
{
	if (!file)
	{
		STRACE(1,("%s: Post-rebuild\n",GetName()));
		return;
	}

	DPath projfolder(GetPath().GetFolder());
	file->PostBuild(fBuildInfo,NULL);
}
示例#3
0
void
Project::CompileFile(SourceFile *file)
{
	if (!file)
	{
		return;
	}
	
	BString compileString;
	if (Debug())
		compileString << "-g -O0 ";
	else
	{
		compileString << "-O" << (int)OpLevel() << " ";
		
		if (OpForSize())
			compileString << "-Os ";
	}
	
	if (Profiling())
		compileString << "-p ";
	
	if (fExtraCompilerOptions.CountChars() > 0)
		compileString << fExtraCompilerOptions << " ";
	
	compileString << "-I '" << fPath.GetFolder() << "' ";
	for (int32 i = 0; i < fLocalIncludeList.CountItems(); i++)
		compileString << "-I '" << fLocalIncludeList.ItemAt(i)->Absolute() << "' ";

	for (int32 i = 0; i < fSystemIncludeList.CountItems(); i++)
	{
		BString item = *fSystemIncludeList.ItemAt(i);
		
		if (item == ".")
			item = GetPath().GetFolder();
		else if (item.CountChars() >= 2 && item[0] == '.' && item[1] == '/')
			item.ReplaceFirst(".",GetPath().GetFolder());
		else if (item[0] != '/')
		{
			item.Prepend("/");
			item.Prepend(GetPath().GetFolder());
		}
		
		compileString << "-I '" << item.String() << "' ";
	}

	DPath projfolder(GetPath().GetFolder());
	file->Compile(fBuildInfo,compileString.String());
}
示例#4
0
void
App::ArgvReceived(int32 argc,char **argv)
{
	bool showUsage = false;
	bool verbose = false;
	int32 i = 1;
	for (i = 1; i < argc; i++)
	{
		int arglen = strlen(argv[i]);
		char *arg = argv[i];
		
		char opt;
		if (arglen == 2 && arg[0] == '-')
			opt = arg[1];
		else
			break;
			
		switch (opt)
		{
			case 'b':
			{
				gBuildMode = true;
				break;
			}
			case 'm':
			{
				gMakeMode = true;
				break;
			}
			case 'r':
			{
				gBuildMode = true;
				fBuildCleanMode = true;
				break;
			}
			case 's':
			{
				gSingleThreadedBuild = true;
				break;
			}
			
			#ifdef USE_TRACE_TOOLS
			case 'v':
			{
				verbose = true;
				break;
			}
			case 'd':
			{
				gPrintDebugMode = 1;
				break;
			}
			#endif
			
			default:
			{
				showUsage = true;
				break;
			}
		}
	}

	if (gPrintDebugMode > 0 && verbose)
		gPrintDebugMode = 2;
	
	if (showUsage)
	{
		PrintUsage();
		
		// A quick hack to not show the start window before
		// the quit request has been processed
		sWindowCount++;
		
		PostMessage(B_QUIT_REQUESTED);
		return;
	}
	
	if (gPrintDebugMode == 1)
		printf(B_TRANSLATE("Printing debug output\n"));
	else if (gPrintDebugMode == 2)
		printf(B_TRANSLATE("Printing debug output with extra detail\n"));
	
	if (gSingleThreadedBuild)
		STRACE(1,("Disabling multithreaded project building\n"));

		
	BMessage refmsg;
	int32 refcount = 0;

	// No initialization -- keep the value from the previous loop
	BEntry projfolder(gProjectPath.GetFullPath());
	entry_ref projref;
	projfolder.GetRef(&projref);
	for (; i < argc; i++)
	{
		// See if the project specified lacks an extension and append it
		BString projPath(argv[i]);
		if (projPath.FindLast(".pld") != projPath.CountChars() - 4)
		{
			projPath << ".pld";
			printf(B_TRANSLATE("Attempting to open %s\n"), projPath.String());
		}
		
		BEntry entry(projPath.String());
		
		entry_ref ref;
		
		if (!entry.Exists())
		{
			ref = FindProject(projref,projPath.String());
			if (!ref.name)
			{
				printf(B_TRANSLATE("Can't find file %s\n"),argv[i]);
				continue;
			}
		}
		else
			entry.GetRef(&ref);
		
		refmsg.AddRef("refs",&ref);
		refcount++;
		optind++;
		
		if (refcount == 1 && (gBuildMode || gMakeMode))
			break;
	}
	
	if (refcount > 0)
		RefsReceived(&refmsg);
	else if (gBuildMode || gMakeMode)
		Quit();
}