示例#1
0
void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) {
	if (!setup.devTools && setup.runBuildEvents) {
		project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
		           "\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n"
		           "\t\t\t/>\n"
		           "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
		           "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup.createInstaller) << "\"\n"
		           "\t\t\t/>\n";
	}
}
示例#2
0
void VisualStudioProvider::outputBuildEvents(std::ostream &project, const BuildSetup &setup, const bool isWin32) {
	if (!setup.devTools && !setup.tests && setup.runBuildEvents) {
		project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
		           "\t\t\t\tCommandLine=\"" << getPreBuildEvent() << "\"\n"
		           "\t\t\t/>\n"
		           "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
		           "\t\t\t\tCommandLine=\"" << getPostBuildEvent(isWin32, setup) << "\"\n"
		           "\t\t\t/>\n";
	}

	// Generate runner file before build for tests
	if (setup.tests) {
		project << "\t\t\t<Tool\tName=\"VCPreBuildEventTool\"\n"
			"\t\t\t\tCommandLine=\"" << getTestPreBuildEvent(setup) << "\"\n"
			"\t\t\t/>\n";

		project << "\t\t\t<Tool\tName=\"VCPostBuildEventTool\"\n"
			"\t\t\t\tCommandLine=\"$(TargetPath)\" IgnoreExitCode=\"true\"\n"
			"\t\t\t/>\n";
	}
}
示例#3
0
void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis) {
	const std::string configuration = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));

	// Check for project-specific warnings:
	std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);
	bool enableLanguageExtensions = find(_enableLanguageExtensions.begin(), _enableLanguageExtensions.end(), name) != _enableLanguageExtensions.end();
	bool disableEditAndContinue = find(_disableEditAndContinue.begin(), _disableEditAndContinue.end(), name) != _disableEditAndContinue.end();

	// Nothing to add here, move along!
	if ((!setup.devTools || !setup.tests) && name != setup.projectName && !enableLanguageExtensions && !disableEditAndContinue && warningsIterator == _projectWarnings.end())
		return;

	std::string warnings = "";
	if (warningsIterator != _projectWarnings.end())
		for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
			warnings +=  *i + ';';

	project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << (isWin32 ? "Win32" : "x64") << "'\">\n"
	           "\t\t<ClCompile>\n";

	// Language Extensions
	if (setup.devTools || setup.tests || name == setup.projectName || enableLanguageExtensions)
		project << "\t\t\t<DisableLanguageExtensions>false</DisableLanguageExtensions>\n";

	// Edit and Continue
	if ((name == setup.projectName || disableEditAndContinue) && !isRelease)
		project << "\t\t\t<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n";

	// Warnings
	if (warningsIterator != _projectWarnings.end())
		project << "\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n";

	project << "\t\t</ClCompile>\n";

	// Link configuration for main project
	if (name == setup.projectName || setup.devTools || setup.tests) {
		std::string libraries;

		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
			libraries += *i + ".lib;";

		project << "\t\t<Link>\n"
		           "\t\t\t<OutputFile>$(OutDir)" << ((setup.devTools || setup.tests) ? name : setup.projectName) << ".exe</OutputFile>\n"
		           "\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n"
		           "\t\t</Link>\n";

		if (!setup.devTools && !setup.tests && setup.runBuildEvents) {
			project << "\t\t<PreBuildEvent>\n"
			           "\t\t\t<Message>Generate revision</Message>\n"
			           "\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
			           "\t\t</PreBuildEvent>\n";

			// Copy data files to the build folder
			project << "\t\t<PostBuildEvent>\n"
					   "\t\t\t<Message>Copy data files to the build folder</Message>\n"
					   "\t\t\t<Command>" << getPostBuildEvent(isWin32, setup.createInstaller) << "</Command>\n"
					   "\t\t</PostBuildEvent>\n";
		} else if (setup.tests) {
			project << "\t\t<PreBuildEvent>\n"
			           "\t\t\t<Message>Generate runner.cpp</Message>\n"
			           "\t\t\t<Command>" << getTestPreBuildEvent(setup) << "</Command>\n"
			           "\t\t</PreBuildEvent>\n";
		}
	}

	project << "\t</ItemDefinitionGroup>\n";
}
示例#4
0
void MSBuildProvider::outputProjectSettings(std::ofstream &project, const std::string &name, const BuildSetup &setup, bool isRelease, bool isWin32, bool enableAnalysis) {
	const std::string configuration = (enableAnalysis ? "Analysis" : (isRelease ? "Release" : "Debug"));

	// Check for project-specific warnings:
	std::map<std::string, StringList>::iterator warningsIterator = _projectWarnings.find(name);

	// Nothing to add here, move along!
	if (name != "scummvm" && name != "sword25" && name != "tinsel" && warningsIterator == _projectWarnings.end())
		return;

	std::string warnings = "";
	if (warningsIterator != _projectWarnings.end())
		for (StringList::const_iterator i = warningsIterator->second.begin(); i != warningsIterator->second.end(); ++i)
			warnings +=  *i + ';';

	project << "\t<ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='" << configuration << "|" << (isWin32 ? "Win32" : "x64") << "'\">\n"
	           "\t\t<ClCompile>\n";

	// Compile configuration
	if (name == "scummvm" || name == "sword25") {
		project << "\t\t\t<DisableLanguageExtensions>false</DisableLanguageExtensions>\n";
	} else {
		if (name == "tinsel" && !isRelease)
			project << "\t\t\t<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\n";

		if (warningsIterator != _projectWarnings.end())
			project << "\t\t\t<DisableSpecificWarnings>" << warnings << ";%(DisableSpecificWarnings)</DisableSpecificWarnings>\n";
	}

	project << "\t\t</ClCompile>\n";

	// Link configuration for scummvm project
	if (name == "scummvm") {
		std::string libraries;

		for (StringList::const_iterator i = setup.libraries.begin(); i != setup.libraries.end(); ++i)
			libraries += *i + ".lib;";

		project << "\t\t<Link>\n"
		           "\t\t\t<OutputFile>$(OutDir)scummvm.exe</OutputFile>\n"
		           "\t\t\t<AdditionalDependencies>" << libraries << "%(AdditionalDependencies)</AdditionalDependencies>\n"
		           "\t\t</Link>\n";

		if (setup.runBuildEvents) {
			// Only generate revision number in debug builds
			if (!isRelease) {
				project << "\t\t<PreBuildEvent>\n"
						   "\t\t\t<Message>Generate internal_version.h</Message>\n"
						   "\t\t\t<Command>" << getPreBuildEvent() << "</Command>\n"
						   "\t\t</PreBuildEvent>\n";
			}

			// Copy data files to the build folder
			project << "\t\t<PostBuildEvent>\n"
					   "\t\t\t<Message>Copy data files to the build folder</Message>\n"
					   "\t\t\t<Command>" << getPostBuildEvent(isWin32) << "</Command>\n"
					   "\t\t</PostBuildEvent>\n";
		}
	}

	project << "\t</ItemDefinitionGroup>\n";
}