mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-21 06:45:39 -06:00
umk: CCJ support
git-svn-id: svn://ultimatepp.org/upp/trunk@15987 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1f2cefbb78
commit
2e0a930119
8 changed files with 341 additions and 27 deletions
|
|
@ -64,7 +64,7 @@ public:
|
||||||
String main_conf;
|
String main_conf;
|
||||||
Index<String> cfg;
|
Index<String> cfg;
|
||||||
FileTime start_time;
|
FileTime start_time;
|
||||||
|
|
||||||
bool makefile_svn_revision = true;
|
bool makefile_svn_revision = true;
|
||||||
|
|
||||||
void CreateHost(Host& host, bool darkmode = false, bool disable_uhd = false);
|
void CreateHost(Host& host, bool darkmode = false, bool disable_uhd = false);
|
||||||
|
|
@ -91,11 +91,12 @@ public:
|
||||||
void Clean();
|
void Clean();
|
||||||
void RebuildAll();
|
void RebuildAll();
|
||||||
void SaveMakeFile(const String& fn, bool exporting);
|
void SaveMakeFile(const String& fn, bool exporting);
|
||||||
|
void SaveCCJ(const String& fn, bool exporting);
|
||||||
|
|
||||||
MakeBuild();
|
MakeBuild();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static String GetInvalidBuildMethodError(const String& method);
|
static String GetInvalidBuildMethodError(const String& method);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern bool output_per_assembly;
|
extern bool output_per_assembly;
|
||||||
|
|
@ -14,12 +14,16 @@ String BrcToC(CParser& binscript, String basedir);
|
||||||
|
|
||||||
Vector<String> SvnInfo(const String& package);
|
Vector<String> SvnInfo(const String& package);
|
||||||
|
|
||||||
|
String MakeIdent(const char *name);
|
||||||
|
|
||||||
struct CppBuilder : Builder {
|
struct CppBuilder : Builder {
|
||||||
virtual String GetTargetExt() const;
|
virtual String GetTargetExt() const;
|
||||||
virtual void CleanPackage(const String& package, const String& outdir);
|
virtual void CleanPackage(const String& package, const String& outdir);
|
||||||
|
|
||||||
const Workspace& wspc;
|
const Workspace& wspc;
|
||||||
Time targettime;
|
Time targettime;
|
||||||
|
Vector<String> CFLAGS;
|
||||||
|
Vector<String> CXXFLAGS;
|
||||||
|
|
||||||
String GetSharedLibPath(const String& package) const;
|
String GetSharedLibPath(const String& package) const;
|
||||||
int AllocSlot();
|
int AllocSlot();
|
||||||
|
|
@ -40,7 +44,7 @@ struct CppBuilder : Builder {
|
||||||
|
|
||||||
String GetMakePath(String fn) const;
|
String GetMakePath(String fn) const;
|
||||||
Point ExtractVersion() const;
|
Point ExtractVersion() const;
|
||||||
|
|
||||||
// POSIX lib files has names in form of libXXXXXX.so.ver.minver(.rel)
|
// POSIX lib files has names in form of libXXXXXX.so.ver.minver(.rel)
|
||||||
// so we can't simply get file extension
|
// so we can't simply get file extension
|
||||||
String GetSrcType(String fn) const;
|
String GetSrcType(String fn) const;
|
||||||
|
|
@ -57,6 +61,9 @@ struct CppBuilder : Builder {
|
||||||
const Vector<String>& all_uses, const Vector<String>& all_libraries,
|
const Vector<String>& all_uses, const Vector<String>& all_libraries,
|
||||||
const Index<String>& common_config, bool exporting);
|
const Index<String>& common_config, bool exporting);
|
||||||
|
|
||||||
|
virtual void AddCCJ(MakeFile& mfinfo, String package,
|
||||||
|
const Index<String>& common_config, bool exporting, bool last_ws);
|
||||||
|
|
||||||
CppBuilder() : wspc(GetIdeWorkspace()) {}
|
CppBuilder() : wspc(GetIdeWorkspace()) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -88,7 +95,7 @@ struct OwcBuilder : CppBuilder {
|
||||||
String& linkoptions, const Vector<String>& all_uses, const Vector<String>& all_libraries, int optimize);
|
String& linkoptions, const Vector<String>& all_uses, const Vector<String>& all_libraries, int optimize);
|
||||||
virtual bool Link(const Vector<String>& linkfile, const String& linkoptions, bool createmap);
|
virtual bool Link(const Vector<String>& linkfile, const String& linkoptions, bool createmap);
|
||||||
virtual bool Preprocess(const String& package, const String& file, const String& target, bool asmout);
|
virtual bool Preprocess(const String& package, const String& file, const String& target, bool asmout);
|
||||||
|
|
||||||
String IncludesDefinesTargetTime(const String& package, const Package& pkg);
|
String IncludesDefinesTargetTime(const String& package, const Package& pkg);
|
||||||
|
|
||||||
String CompilerName(bool isCpp = true) const;
|
String CompilerName(bool isCpp = true) const;
|
||||||
|
|
@ -180,4 +187,4 @@ INITIALIZE(JavaBuilder)
|
||||||
INITIALIZE(AndroidBuilder)
|
INITIALIZE(AndroidBuilder)
|
||||||
INITIALIZE(ScriptBuilder)
|
INITIALIZE(ScriptBuilder)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -16,6 +16,7 @@ file
|
||||||
Builders.h options(BUILDER_OPTION) PCH,
|
Builders.h options(BUILDER_OPTION) PCH,
|
||||||
CppBuilder.cpp,
|
CppBuilder.cpp,
|
||||||
MakeFile.cpp,
|
MakeFile.cpp,
|
||||||
|
CCJ.cpp,
|
||||||
coff.h,
|
coff.h,
|
||||||
Builders readonly separator,
|
Builders readonly separator,
|
||||||
GccBuilder.cpp,
|
GccBuilder.cpp,
|
||||||
|
|
|
||||||
272
uppsrc/ide/Builders/CCJ.cpp
Normal file
272
uppsrc/ide/Builders/CCJ.cpp
Normal file
|
|
@ -0,0 +1,272 @@
|
||||||
|
#include "Builders.h"
|
||||||
|
|
||||||
|
inline
|
||||||
|
String SString(const String& s) {
|
||||||
|
if (s.Find(' ') >= 0)
|
||||||
|
return "\"" << s << "\"";
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
|
String SAppend(String l, const String& r) {
|
||||||
|
return l << SString(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CppBuilder::AddCCJ(
|
||||||
|
MakeFile& makefile,
|
||||||
|
String package,
|
||||||
|
const Index<String>& common_config,
|
||||||
|
bool exporting,
|
||||||
|
bool last_ws)
|
||||||
|
{
|
||||||
|
const char* eol = "\n";
|
||||||
|
const char* tab = "\t";
|
||||||
|
|
||||||
|
String packagepath = PackagePath(package);
|
||||||
|
Package pkg;
|
||||||
|
pkg.Load(packagepath);
|
||||||
|
String packagedir = GetFileFolder(packagepath);
|
||||||
|
Vector<String> src = GetUppDirs();
|
||||||
|
for(int i = 0; i < src.GetCount(); i++)
|
||||||
|
src[i] = UnixPath(src[i]);
|
||||||
|
|
||||||
|
bool main = HasFlag("MAIN");
|
||||||
|
bool is_shared = HasFlag("SO");
|
||||||
|
bool libout = !main && !HasFlag("NOLIB");
|
||||||
|
bool win32 = HasFlag("WIN32");
|
||||||
|
|
||||||
|
String pack_ident = MakeIdent(package);
|
||||||
|
Vector<String> macdef;
|
||||||
|
String objext = (HasFlag("MSC") || HasFlag("EVC") ? ".obj" : ".o");
|
||||||
|
|
||||||
|
macdef.Append(Macro);
|
||||||
|
|
||||||
|
Vector<String> x(config.GetKeys(), 1);
|
||||||
|
Sort(x);
|
||||||
|
for(int i = 0; i < x.GetCount(); i++) {
|
||||||
|
if(common_config.Find(x[i]) < 0) {
|
||||||
|
String str;
|
||||||
|
str << "-Dflag" << x[i];
|
||||||
|
macdef << str;
|
||||||
|
}
|
||||||
|
x[i] = InitCaps(x[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
makefile.outdir << outdir << "/";
|
||||||
|
|
||||||
|
if(main) {
|
||||||
|
Vector<String> flags;
|
||||||
|
if(HasFlag("DEBUG"))
|
||||||
|
flags << "-D_DEBUG" << debug_options;
|
||||||
|
else
|
||||||
|
flags << release_options;
|
||||||
|
if(HasFlag("DEBUG_MINIMAL"))
|
||||||
|
flags << "-ggdb" << "-g1";
|
||||||
|
if(HasFlag("DEBUG_FULL"))
|
||||||
|
flags << "-ggdb" << "-g2";
|
||||||
|
if(is_shared && !win32)
|
||||||
|
flags << "-fPIC";
|
||||||
|
flags.Append(GatherV(pkg.option, config.GetKeys()));
|
||||||
|
|
||||||
|
CFLAGS = clone(flags);
|
||||||
|
CXXFLAGS = pick(flags);
|
||||||
|
|
||||||
|
CFLAGS << c_options;
|
||||||
|
CXXFLAGS << cpp_options;
|
||||||
|
}
|
||||||
|
|
||||||
|
// String cmplr = Sys("which " + compiler);
|
||||||
|
// cmplr.TrimEnd("\n");
|
||||||
|
String cmplr = compiler;
|
||||||
|
|
||||||
|
const String inc_outdir = SAppend("-I", makefile.outdir);
|
||||||
|
for(int count = pkg.GetCount(), last = count - 1, i = 0; i < count; i++)
|
||||||
|
if(!pkg[i].separator) {
|
||||||
|
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||||
|
String fn = SourcePath(package, pkg[i]);
|
||||||
|
String ext = ToLower(GetFileExt(fn));
|
||||||
|
bool isc = ext == ".c";
|
||||||
|
const bool ish = ext == ".h";
|
||||||
|
const bool isrc = (ext == ".rc" && HasFlag("WIN32"));
|
||||||
|
const bool iscpp = (ext == ".cpp" || ext == ".cc" || ext == ".cxx");
|
||||||
|
const bool ishpp = (ext == ".hpp" || ext == ".hh" || ext == ".hxx");
|
||||||
|
const bool isicpp = (ext == ".icpp");
|
||||||
|
if(ext == ".brc") {
|
||||||
|
isc = true;
|
||||||
|
fn << "c";
|
||||||
|
}
|
||||||
|
if(isc || ish || isrc || iscpp || ishpp || isicpp) {
|
||||||
|
String outfile;
|
||||||
|
const String srcfile = SString(fn);
|
||||||
|
outfile << makefile.outdir << AdjustMakePath(GetFileTitle(fn));
|
||||||
|
if (isrc)
|
||||||
|
outfile << "_rc";
|
||||||
|
else if (ish || ishpp)
|
||||||
|
outfile << "_hpp";
|
||||||
|
else
|
||||||
|
outfile << "_cpp";
|
||||||
|
outfile << objext;
|
||||||
|
outfile = SString(outfile);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
Json j;
|
||||||
|
JsonArray ja;
|
||||||
|
ja << cmplr;
|
||||||
|
ja << "-c";
|
||||||
|
ja << "-x";
|
||||||
|
if (isc)
|
||||||
|
ja << "c" << CFLAGS;
|
||||||
|
else
|
||||||
|
ja << "c++" << CXXFLAGS;
|
||||||
|
ja << CINC ;
|
||||||
|
ja << inc_outdir;
|
||||||
|
ja << macdef;
|
||||||
|
// ja << gop; // ???
|
||||||
|
ja << srcfile << "-o" << outfile;
|
||||||
|
// j("arguments", ja)("directory", GetFileFolder(fn))("file", GetFileName(fn));
|
||||||
|
// j("arguments", ja)("directory", GetFileFolder(fn))("file", fn);
|
||||||
|
j("arguments", ja)("directory", SString(GetFileFolder(fn)))("file", srcfile);
|
||||||
|
makefile.rules << tab << j;
|
||||||
|
if (i == last && last_ws)
|
||||||
|
makefile.rules << eol;
|
||||||
|
else
|
||||||
|
makefile.rules << "," << eol;
|
||||||
|
#else
|
||||||
|
Json j;
|
||||||
|
String ja;
|
||||||
|
ja << cmplr;
|
||||||
|
ja << " -c";
|
||||||
|
ja << " -x";
|
||||||
|
if (isc)
|
||||||
|
ja << " c " << Join(CFLAGS, " ");
|
||||||
|
else
|
||||||
|
ja << " c++ " << Join(CXXFLAGS, " ");
|
||||||
|
MergeWith(ja, " ", Join(CINC, " "));
|
||||||
|
MergeWith(ja, " ", inc_outdir);
|
||||||
|
MergeWith(ja, " ", Join(macdef, " "));
|
||||||
|
ja << ' ' << srcfile << " -o" << outfile;
|
||||||
|
j("command", ja)("directory", SString(GetFileFolder(fn)))("file", srcfile);
|
||||||
|
makefile.rules << tab << j;
|
||||||
|
if (i == last && last_ws)
|
||||||
|
makefile.rules << eol;
|
||||||
|
else
|
||||||
|
makefile.rules << "," << eol;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MakeBuild::SaveCCJ(const String& fn, bool exporting)
|
||||||
|
{
|
||||||
|
const char* eol = "\n";
|
||||||
|
const char* tab = "\t";
|
||||||
|
|
||||||
|
BeginBuilding(true);
|
||||||
|
|
||||||
|
VectorMap<String, String> bm = GetMethodVars(method);
|
||||||
|
Host host;
|
||||||
|
CreateHost(host, false, false);
|
||||||
|
One<Builder> b = CreateBuilder(&host);
|
||||||
|
|
||||||
|
if(!b)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const TargetMode& tm = GetTargetMode();
|
||||||
|
|
||||||
|
String makefile;
|
||||||
|
|
||||||
|
Vector<String> uppdirs = GetUppDirs();
|
||||||
|
String uppout = exporting ? GetVar("OUTPUT") : ".cache/upp.out";
|
||||||
|
|
||||||
|
Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, host, *b);
|
||||||
|
bool win32 = allconfig.Find("WIN32") >= 0;
|
||||||
|
|
||||||
|
Workspace wspc;
|
||||||
|
wspc.Scan(GetMain(), allconfig.GetKeys());
|
||||||
|
|
||||||
|
Index<String> pkg_config;
|
||||||
|
for(int i = 0; i < wspc.GetCount(); i++) {
|
||||||
|
Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, host, *b);
|
||||||
|
PkgConfig(wspc, modconfig, pkg_config);
|
||||||
|
if(i)
|
||||||
|
for(int a = allconfig.GetCount(); --a >= 0;)
|
||||||
|
if(modconfig.Find(allconfig[a]) < 0)
|
||||||
|
allconfig.Remove(a);
|
||||||
|
}
|
||||||
|
|
||||||
|
makefile << "[" << eol;
|
||||||
|
|
||||||
|
Index<String> oi;
|
||||||
|
if(!exporting)
|
||||||
|
for(int i = 0; i < uppdirs.GetCount(); i++) {
|
||||||
|
String s;
|
||||||
|
s << "-I" << uppdirs[i];
|
||||||
|
oi.FindAdd(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(const String& s: pkg_config) {
|
||||||
|
String str;
|
||||||
|
String out;
|
||||||
|
str << "pkg-config --cflags " << s;
|
||||||
|
if (Sys(str, out) < 0)
|
||||||
|
continue;
|
||||||
|
out.TrimEnd("\n");
|
||||||
|
if (out.IsEmpty())
|
||||||
|
continue;
|
||||||
|
Vector<String> l = Split(out, ' ');
|
||||||
|
for(const String& s1: l)
|
||||||
|
oi.FindAdd(s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<String> includes = SplitDirs(bm.Get("INCLUDE",""));
|
||||||
|
for(int i = 0; i < includes.GetCount(); i++) {
|
||||||
|
String str;
|
||||||
|
str << SAppend("-I", includes[i]);
|
||||||
|
oi.FindAdd(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const String& s: allconfig) {
|
||||||
|
String str;
|
||||||
|
str << "-Dflag" << s;
|
||||||
|
b->Macro << str;
|
||||||
|
}
|
||||||
|
|
||||||
|
String UPPOUT("-I");
|
||||||
|
if (exporting)
|
||||||
|
UPPOUT << "_out/";
|
||||||
|
else
|
||||||
|
UPPOUT << GetMakePath(AdjustMakePath(AppendFileName(uppout, "")), win32);
|
||||||
|
oi.FindAdd(pick(UPPOUT));
|
||||||
|
|
||||||
|
b->CINC.Append(oi.PickKeys());
|
||||||
|
|
||||||
|
String config, rules;
|
||||||
|
|
||||||
|
for(int count = wspc.GetCount(), last = count - 1, i = 0; i < count; i++) {
|
||||||
|
const String package = wspc[i];
|
||||||
|
b->config = PackageConfig(wspc, i, bm, mainconfigparam, host, *b);
|
||||||
|
b->version = tm.version;
|
||||||
|
b->method = method;
|
||||||
|
b->outdir = OutDir(b->config, package, bm);
|
||||||
|
MakeFile mf;
|
||||||
|
b->AddCCJ(mf, package, allconfig, exporting, i == last);
|
||||||
|
config << mf.config;
|
||||||
|
rules << mf.rules;
|
||||||
|
if(i == 0) // main package
|
||||||
|
b->SaveBuildInfo(package);
|
||||||
|
}
|
||||||
|
|
||||||
|
makefile
|
||||||
|
<< config
|
||||||
|
<< rules
|
||||||
|
<< "]"
|
||||||
|
;
|
||||||
|
|
||||||
|
bool sv = ::SaveFile(fn, makefile);
|
||||||
|
if(!exporting) {
|
||||||
|
if(sv)
|
||||||
|
PutConsole(NFormat("%s(1): compile_commands.json generation complete", fn));
|
||||||
|
else
|
||||||
|
PutConsole(NFormat("%s: error writing compile_commands.json", fn));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include "Builders.h"
|
#include "Builders.h"
|
||||||
|
|
||||||
static String MakeIdent(const char *name)
|
String MakeIdent(const char *name)
|
||||||
{
|
{
|
||||||
String out;
|
String out;
|
||||||
for(; *name; name++)
|
for(; *name; name++)
|
||||||
|
|
@ -153,7 +153,7 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
|
||||||
else
|
else
|
||||||
makefile.linkfileend << " \\\n\t\t\t-l" << ln;
|
makefile.linkfileend << " \\\n\t\t\t-l" << ln;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < pkg.GetCount(); i++)
|
for(int i = 0; i < pkg.GetCount(); i++)
|
||||||
if(!pkg[i].separator) {
|
if(!pkg[i].separator) {
|
||||||
String gop = Gather(pkg[i].option, config.GetKeys());
|
String gop = Gather(pkg[i].option, config.GetKeys());
|
||||||
|
|
@ -222,6 +222,17 @@ void CppBuilder::AddMakeFile(MakeFile& makefile, String package,
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JsonArray& operator<<(JsonArray& array, const Vector<String>& v) {
|
||||||
|
for (const String& s: v)
|
||||||
|
array << s;
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector<String>& operator<<(Vector<String>& array, const Vector<String>& v) {
|
||||||
|
array.Append(v);
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
Point CppBuilder::ExtractVersion() const
|
Point CppBuilder::ExtractVersion() const
|
||||||
{
|
{
|
||||||
Point v = Point(Null, Null);
|
Point v = Point(Null, Null);
|
||||||
|
|
@ -263,10 +274,10 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
|
||||||
Host host;
|
Host host;
|
||||||
CreateHost(host, false, false);
|
CreateHost(host, false, false);
|
||||||
One<Builder> b = CreateBuilder(&host);
|
One<Builder> b = CreateBuilder(&host);
|
||||||
|
|
||||||
if(!b)
|
if(!b)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const TargetMode& tm = GetTargetMode();
|
const TargetMode& tm = GetTargetMode();
|
||||||
|
|
||||||
String makefile;
|
String makefile;
|
||||||
|
|
@ -307,7 +318,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
|
||||||
|
|
||||||
inclist << " -I./";
|
inclist << " -I./";
|
||||||
inclist << " -I$(UPPOUT)"; // build_info.h is created there
|
inclist << " -I$(UPPOUT)"; // build_info.h is created there
|
||||||
|
|
||||||
makefile << "\n"
|
makefile << "\n"
|
||||||
"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(AppendFileName(uppout, "")), win32)) << "\n"
|
"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(AppendFileName(uppout, "")), win32)) << "\n"
|
||||||
"CINC = " << inclist << "\n"
|
"CINC = " << inclist << "\n"
|
||||||
|
|
@ -386,7 +397,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
|
||||||
linkfiles << mf.linkfiles;
|
linkfiles << mf.linkfiles;
|
||||||
linkfileend << mf.linkfileend;
|
linkfileend << mf.linkfileend;
|
||||||
}
|
}
|
||||||
|
|
||||||
makefile
|
makefile
|
||||||
<< config
|
<< config
|
||||||
<< install
|
<< install
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
virtual String GetDefaultMethod();
|
virtual String GetDefaultMethod();
|
||||||
virtual VectorMap<String, String> GetMethodVars(const String& method);
|
virtual VectorMap<String, String> GetMethodVars(const String& method);
|
||||||
virtual String GetMethodName(const String& method);
|
virtual String GetMethodName(const String& method);
|
||||||
|
|
||||||
virtual bool IsPersistentFindReplace() = 0;
|
virtual bool IsPersistentFindReplace() = 0;
|
||||||
|
|
||||||
virtual int IdeGetHydraThreads() = 0;
|
virtual int IdeGetHydraThreads() = 0;
|
||||||
|
|
@ -272,7 +272,7 @@ String AsStringWhen(const String& when);
|
||||||
struct OptItem {
|
struct OptItem {
|
||||||
String when;
|
String when;
|
||||||
String text;
|
String text;
|
||||||
|
|
||||||
String ToString() const { return when + ": " + text ; }
|
String ToString() const { return when + ": " + text ; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -291,6 +291,7 @@ struct CustomStep {
|
||||||
|
|
||||||
Vector<String> Combine(const Vector<String>& conf, const char *flags);
|
Vector<String> Combine(const Vector<String>& conf, const char *flags);
|
||||||
String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospace = false);
|
String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospace = false);
|
||||||
|
Vector<String> GatherV(const Array<OptItem>& set, const Vector<String>& conf);
|
||||||
|
|
||||||
bool HasFlag(const Vector<String>& conf, const char *flag);
|
bool HasFlag(const Vector<String>& conf, const char *flag);
|
||||||
|
|
||||||
|
|
@ -432,7 +433,7 @@ struct Builder {
|
||||||
Host *host;
|
Host *host;
|
||||||
Index<String> config;
|
Index<String> config;
|
||||||
String method;
|
String method;
|
||||||
|
|
||||||
String compiler;
|
String compiler;
|
||||||
String outdir;
|
String outdir;
|
||||||
Vector<String> include;
|
Vector<String> include;
|
||||||
|
|
@ -446,16 +447,18 @@ struct Builder {
|
||||||
String debug_link;
|
String debug_link;
|
||||||
String release_link;
|
String release_link;
|
||||||
String version;
|
String version;
|
||||||
|
|
||||||
String script;
|
String script;
|
||||||
String mainpackage;
|
String mainpackage;
|
||||||
|
|
||||||
bool doall;
|
bool doall;
|
||||||
bool main_conf;
|
bool main_conf;
|
||||||
bool allow_pch;
|
bool allow_pch;
|
||||||
FileTime start_time;
|
FileTime start_time;
|
||||||
|
|
||||||
Index<String> pkg_config; // names of packages for pkg-config
|
Index<String> pkg_config; // names of packages for pkg-config
|
||||||
|
Vector<String> CINC;
|
||||||
|
Vector<String> Macro;
|
||||||
|
|
||||||
VectorMap<String, int> tmpfilei; // for naming automatic response files
|
VectorMap<String, int> tmpfilei; // for naming automatic response files
|
||||||
|
|
||||||
|
|
@ -474,11 +477,14 @@ struct Builder {
|
||||||
virtual void AddMakeFile(MakeFile& mfinfo, String package,
|
virtual void AddMakeFile(MakeFile& mfinfo, String package,
|
||||||
const Vector<String>& all_uses, const Vector<String>& all_libraries,
|
const Vector<String>& all_uses, const Vector<String>& all_libraries,
|
||||||
const Index<String>& common_config, bool exporting) {}
|
const Index<String>& common_config, bool exporting) {}
|
||||||
|
virtual void AddCCJ(MakeFile& mfinfo, String package,
|
||||||
|
const Index<String>& common_config, bool exporting, bool last_ws) {}
|
||||||
virtual String GetTargetExt() const = 0;
|
virtual String GetTargetExt() const = 0;
|
||||||
|
virtual void SaveBuildInfo(const String& package) {}
|
||||||
|
|
||||||
Builder() { doall = false; main_conf = false; }
|
Builder() { doall = false; main_conf = false; }
|
||||||
virtual ~Builder() {}
|
virtual ~Builder() {}
|
||||||
|
|
||||||
// TODO: move other methods if needed
|
// TODO: move other methods if needed
|
||||||
void ChDir(const String& path);
|
void ChDir(const String& path);
|
||||||
String GetPathQ(const String& path) const;
|
String GetPathQ(const String& path) const;
|
||||||
|
|
@ -540,7 +546,7 @@ public:
|
||||||
int offset;
|
int offset;
|
||||||
int off_meta_offset;
|
int off_meta_offset;
|
||||||
int len_meta_offset;
|
int len_meta_offset;
|
||||||
|
|
||||||
void Compress(String& data);
|
void Compress(String& data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -552,4 +558,4 @@ void DeletePCHFiles();
|
||||||
|
|
||||||
String GetLineEndings(const String& data, const String& default_eol = "\r\n");
|
String GetLineEndings(const String& data, const String& default_eol = "\r\n");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -172,6 +172,14 @@ String Gather(const Array<OptItem>& set, const Vector<String>& conf, bool nospac
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Vector<String> GatherV(const Array<OptItem>& set, const Vector<String>& conf) {
|
||||||
|
Vector<String> s;
|
||||||
|
for(int i = 0; i < set.GetCount(); i++)
|
||||||
|
if(MatchWhen(set[i].when, conf))
|
||||||
|
s << set[i].text;
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
int GetType(const Vector<String>& conf, const char *flags) {
|
int GetType(const Vector<String>& conf, const char *flags) {
|
||||||
Vector<String> f = SplitFlags(flags);
|
Vector<String> f = SplitFlags(flags);
|
||||||
int q = FLAG_UNDEFINED;
|
int q = FLAG_UNDEFINED;
|
||||||
|
|
@ -261,4 +269,4 @@ Vector<String> Workspace::GetAllAccepts(int pk) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return accepts.PickKeys();
|
return accepts.PickKeys();
|
||||||
}
|
}
|
||||||
|
|
@ -81,13 +81,14 @@ CONSOLE_APP_MAIN
|
||||||
ide.makefile_svn_revision = false;
|
ide.makefile_svn_revision = false;
|
||||||
bool clean = false;
|
bool clean = false;
|
||||||
bool makefile = false;
|
bool makefile = false;
|
||||||
|
bool ccfile = false;
|
||||||
bool deletedir = true;
|
bool deletedir = true;
|
||||||
int exporting = 0;
|
int exporting = 0;
|
||||||
bool run = false;
|
bool run = false;
|
||||||
String mkf;
|
String mkf;
|
||||||
|
|
||||||
Vector<String> param, runargs;
|
Vector<String> param, runargs;
|
||||||
|
|
||||||
const Vector<String>& args = CommandLine();
|
const Vector<String>& args = CommandLine();
|
||||||
for(int i = 0; i < args.GetCount(); i++) {
|
for(int i = 0; i < args.GetCount(); i++) {
|
||||||
String a = args[i];
|
String a = args[i];
|
||||||
|
|
@ -107,6 +108,7 @@ CONSOLE_APP_MAIN
|
||||||
case 'X': exporting = 2; break;
|
case 'X': exporting = 2; break;
|
||||||
case 'k': deletedir = false; break;
|
case 'k': deletedir = false; break;
|
||||||
case 'u': ide.use_target = true; break;
|
case 'u': ide.use_target = true; break;
|
||||||
|
case 'j': ccfile = true; break;
|
||||||
case 'M': {
|
case 'M': {
|
||||||
makefile = true;
|
makefile = true;
|
||||||
if(s[1] == '=') {
|
if(s[1] == '=') {
|
||||||
|
|
@ -154,7 +156,7 @@ CONSOLE_APP_MAIN
|
||||||
else
|
else
|
||||||
param.Add(a);
|
param.Add(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param.GetCount() >= 2) {
|
if(param.GetCount() >= 2) {
|
||||||
String v = GetUmkFile(param[0] + ".var");
|
String v = GetUmkFile(param[0] + ".var");
|
||||||
if(IsNull(v)) {
|
if(IsNull(v)) {
|
||||||
|
|
@ -232,6 +234,12 @@ CONSOLE_APP_MAIN
|
||||||
|
|
||||||
ide.method = m;
|
ide.method = m;
|
||||||
|
|
||||||
|
if(ccfile) {
|
||||||
|
ide.SaveCCJ(GetFileDirectory(PackagePath(ide.main)) + "compile_commands.json", false);
|
||||||
|
SetExitCode(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(clean)
|
if(clean)
|
||||||
ide.Clean();
|
ide.Clean();
|
||||||
if(exporting) {
|
if(exporting) {
|
||||||
|
|
@ -277,4 +285,4 @@ CONSOLE_APP_MAIN
|
||||||
"See https://www.ultimatepp.org/app$ide$umk$en-us.html for details\n");
|
"See https://www.ultimatepp.org/app$ide$umk$en-us.html for details\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
Loading…
Add table
Add a link
Reference in a new issue