本文整理汇总了C++中One::AddMakeFile方法的典型用法代码示例。如果您正苦于以下问题:C++ One::AddMakeFile方法的具体用法?C++ One::AddMakeFile怎么用?C++ One::AddMakeFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类One
的用法示例。
在下文中一共展示了One::AddMakeFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveMakeFile
void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
{
BeginBuilding(false, true);
VectorMap<String, String> bm = GetMethodVars(method);
One<Host> host = CreateHost(false);
One<Builder> b = CreateBuilder(~host);
if(!b)
return;
const TargetMode& tm = GetTargetMode();
String makefile;
Vector<String> uppdirs = GetUppDirs();
String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/";
String inclist;
Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b);
bool win32 = allconfig.Find("WIN32") >= 0;
Workspace wspc;
wspc.Scan(GetMain(), allconfig.GetKeys());
for(int i = 1; i < wspc.GetCount(); i++) {
Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
for(int a = allconfig.GetCount(); --a >= 0;)
if(modconfig.Find(allconfig[a]) < 0)
allconfig.Remove(a);
}
if(!exporting)
for(int i = 0; i < uppdirs.GetCount(); i++) {
String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32);
makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n";
inclist << " -I$(UPPDIR" << (i + 1) << ")";
}
else
inclist << "-I./";
Vector<String> includes = SplitDirs(bm.Get("INCLUDE",""));
for(int i = 0; i < includes.GetCount(); i++)
inclist << " -I" << includes[i];
makefile << "\n"
"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n"
"CINC = " << inclist << "\n"
"Macro = ";
for(int i = 0; i < allconfig.GetCount(); i++)
makefile << " -Dflag" << allconfig[i];
makefile << "\n";
String output, config, install, rules, linkdep, linkfiles, linkfileend;
for(int i = 0; i < wspc.GetCount(); i++) {
b->config = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
b->version = tm.version;
b->method = method;
MakeFile mf;
b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i),
GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig,
exporting);
if(!i) {
String tdir = mf.outdir;
String trg;
if(tm.target_override) {
trg = GetMakePath(AdjustMakePath(tm.target), win32);
if(!trg.IsEmpty() && *trg.Last() == (win32 ? '\\' : '/'))
trg << mf.outfile;
else if(trg.Find(win32 ? '\\' : '/') < 0)
trg.Insert(0, "$(OutDir)");
}
output = Nvl(trg, mf.output);
if(exporting)
output = wspc[i] + ".out";
install << "\n"
"OutDir = " << tdir << "\n"
"OutFile = " << output << "\n"
"\n"
".PHONY: all\n"
"all: prepare $(OutFile)\n"
"\n"
".PHONY: prepare\n"
"prepare:\n";
}
config << mf.config;
install << mf.install;
rules << mf.rules;
linkdep << mf.linkdep;
linkfiles << mf.linkfiles;
linkfileend << mf.linkfileend;
}
makefile
<< config
<< install
<< "\n"
"$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << " -Wl,--end-group\n\n"
<< rules
//.........这里部分代码省略.........