C++ Scope::addToolSet方法代码示例

本文整理汇总了C++中Scope::addToolSet方法的典型用法代码示例。如果您正苦于以下问题:C++ Scope::addToolSet方法的具体用法?C++ Scope::addToolSet怎么用?C++ Scope::addToolSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scope的用法示例。


C++ Scope::addToolSet方法代码示例

在下文中一共展示了Scope::addToolSet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

std::shared_ptr<Toolset>
DefaultTools::checkAndAddArchiver( Scope &s, const std::map<std::string, std::string> &exelist )
{
	std::shared_ptr<Toolset> cTools = std::make_shared<Toolset>( "system_ar" );
	cTools->setTag( "archive" );

	for ( const auto &e: exelist )
	{
		const std::string &name = e.first;
		const std::string &exe = e.second;
		if ( name == "ar" )
		{
			std::string rmTool;
			bool haveRM = File::findExecutable( rmTool, "rm" );

			std::shared_ptr<Tool> t = std::make_shared<Tool>( "static_lib", name );
			t->myExtensions = { ".c", ".cpp" };
			t->myExeName = exe;
			t->myInputTools = { "cc" };
			t->myOutputPrefix = "lib";
			t->myOutputs = { ".a" };
			t->myFlagPrefixes = theVarPrefixes;
			if ( haveRM )
				t->myCommand = { rmTool, "-f", "$out", "&&", "$exe", "rcs", "$out", "$in"};
			else
				t->myCommand = { "$exe", "rcs", "$out", "$in"};

			t->myDescription = " AR $out_short";

			s.addTool( t );
			cTools->addTool( t );

			t = std::make_shared<Tool>( "static_lib_cxx", name );
			t->myExeName = exe;
			t->myInputTools = { "cc", "cxx", "objcxx" };
			t->myOutputPrefix = "lib";
			t->myOutputs = { ".a" };
			t->myFlagPrefixes = theVarPrefixes;
			if ( haveRM )
				t->myCommand = { rmTool, "-f", "$out", "&&", "$exe", "rcs", "$out", "$in"};
			else
				t->myCommand = { "$exe", "rcs", "$out", "$in"};
			t->myDescription = " AR $out_short";
			s.addTool( t );
			cTools->addTool( t );
		}
	}
	if ( cTools->empty() )
		cTools.reset();
	else
		s.addToolSet( cTools );

	return cTools;
}
开发者ID:iangodin,项目名称:constructor,代码行数:54,代码来源:DefaultTools.cpp

示例2: if

std::shared_ptr<Toolset>
DefaultTools::checkAndAddGCC( Scope &s, const std::map<std::string, std::string> &exelist )
{
	std::shared_ptr<Toolset> cTools = std::make_shared<Toolset>( "gcc" );
	cTools->setTag( "compile" );

	static Tool::OptionSet commonWarnings{
		{ "none", { "-w" } },
		{ "default", {} },
		{ "some", { "-Wall" } },
		{ "most", { "-Wall", "-Wextra" } },
		{ "strict", { "-Wall", "-Wextra" } },
		{ "error", { "-Wall", "-Werror"  } } };

	for ( const auto &e: exelist )
	{
		const std::string &name = e.first;
		const std::string &exe = e.second;
		std::shared_ptr<Tool> t;
		if ( name == "gcc" )
		{
			// TODO: Add version check for gcc to optionally enable features
			t = std::make_shared<Tool>( "cc", name );
			t->myExtensions = { ".c" };
			t->myOutputs = { ".o" };
			t->myExeName = exe;
			t->myOptions = theCommonOptions;
			t->myOptions["optimization"]["optdebug"] = { "-g", "-Og" };
			t->myOptions["warnings"] = commonWarnings;
			t->myOptions["warnings"]["most"] =
				{ "-Wall", "-Wextra", "-Wno-unused-parameter", "-Winit-self", "-Wcomment", "-Wcast-align", "-Wswitch", "-Wformat", "-Wmultichar", "-Wmissing-braces", "-Wparentheses", "-Wpointer-arith", "-Wsign-compare", "-Wreturn-type", "-Wwrite-strings", "-Wcast-align", "-Wno-unused" };
			t->myOptions["language"] = theCLanguages;
			t->myOptionDefaults = theCDefaults;
			t->myImplDepName = "$out.d";
			t->myImplDepStyle = "gcc";
			t->myImplDepCmd = { "-MMD", "-MF", "$out.d" };
			t->myFlagPrefixes = theVarPrefixes;
			t->myDescription = " CC $out_short";
			t->myCommand = theCompileCmd;

			s.addTool( t );
			cTools->addTool( t );

			t = std::make_shared<Tool>( "ld", "gcc_linker" );
			t->myExeName = exe;
			t->myInputTools = theCLinkInputTools;
			t->myOptions = theCommonOptions;
			t->myOptions["optimization"]["optdebug"] = { "-g", "-Og" };
			t->myOptions["language"] = theCLanguages;
			t->myOptionDefaults = theCDefaults;
			t->myFlagPrefixes = theVarPrefixes;
			t->myDescription = " LD $out_short";
			t->myCommand = theLinkCmd;
			s.addTool( t );
			cTools->addTool( t );
		}
		else if ( name == "g++" )
		{
			t = std::make_shared<Tool>( "cxx", name );
			t->myExtensions = { ".cpp", ".cc" };
			t->myAltExtensions = { ".c", ".C" };
			t->myOutputs = { ".o" };
			t->myExeName = exe;
			t->myOptions = theCommonOptions;
			t->myOptions["optimization"]["optdebug"] = { "-g", "-Og" };
			t->myOptions["warnings"] = commonWarnings;
			t->myOptions["warnings"]["most"] = { "-Wall", "-Wextra", "-Wno-unused-parameter", "-Winit-self", "-Wcomment", "-Wcast-align", "-Wswitch", "-Wformat", "-Wmultichar", "-Wmissing-braces", "-Wparentheses", "-Wpointer-arith", "-Wsign-compare", "-Wreturn-type", "-Wwrite-strings", "-Wcast-align", "-Wunused", "-Woverloaded-virtual", "-Wno-ctor-dtor-privacy", "-Wnon-virtual-dtor", "-Wpmf-conversions", "-Wsign-promo", "-Wmissing-field-initializers" };
			t->myOptions["language"] = theCPPLanguages;
			t->myOptionDefaults = theCPPDefaults;
			t->myImplDepName = "$out.d";
			t->myImplDepStyle = "gcc";
			t->myImplDepCmd = { "-MMD", "-MF", "$out.d" };
			t->myDescription = "CXX $out_short";
			t->myFlagPrefixes = theVarPrefixes;
			t->myCommand = theCompileCmd;
			s.addTool( t );
			cTools->addTool( t );

			t = std::make_shared<Tool>( "ld_cxx", "g++_linker" );
			t->myExeName = exe;
			t->myInputTools = theCPPLinkInputTools;
			t->myOptions = theCommonOptions;
			t->myOptions["optimization"]["optdebug"] = { "-g", "-Og" };
			t->myOptions["language"] = theCPPLinkLanguages;
			t->myOptionDefaults = theCPPDefaults;
			t->myFlagPrefixes = theVarPrefixes;
			t->myDescription = " LD $out_short";
			t->myCommand = theLinkCmd;

			s.addTool( t );
			cTools->addTool( t );
		}
	}

	if ( cTools->empty() )
		cTools.reset();
	else
		s.addToolSet( cTools );
	return cTools;
}
开发者ID:iangodin,项目名称:constructor,代码行数:100,代码来源:DefaultTools.cpp

本文标签属性:

示例:示例的拼音

代码:代码转换器

上一篇:Python sys.float_info方法代码示例
下一篇:李颖老公及李颖老公是谁?关于李颖老公的一切你需要知道的信息(李颖老公是谁?)

为您推荐