Skip to content
Permalink
Browse files

Restore initial VS generator.

  • Loading branch information...
egorpugin committed May 13, 2019
1 parent 9af9001 commit 38ddf62c5e93d35dfd6cda6bed3b2178a62c331b
@@ -148,6 +148,8 @@ static auto fetch1(const SwContext &swctx, const path &fn, const FetchOptions &o
{
auto &t = tgts.begin()->second;
if (t->sw_provided)
continue;
if (t->skip)
continue;
auto s = t->getSource().clone(); // make a copy!
s->applyVersion(pkg.getVersion());
@@ -215,6 +217,8 @@ std::unique_ptr<Build> fetch_and_load(const SwContext &swctx, const path &file_o
auto &t = tgts.begin()->second;
if (t->sw_provided)
continue;
if (t->skip)
continue;
auto s = t->getSource().clone(); // make a copy!
s->applyVersion(pkg.version);
if (opts.apply_version_to_source)
@@ -630,10 +630,14 @@ void Build::build_and_resolve(int n_runs)
sr.restoreNow(true);

sw_check_abi_version(getModuleStorage(*this).get(dll).sw_get_module_abi_version());
getModuleStorage(*this).get(dll).check(*this, checker);
// we can use new (clone of this) solution, then copy known targets
// to allow multiple passes-builds
getModuleStorage(*this).get(dll).build(*this);
for (auto &s : settings)
{
current_settings = &s;
getModuleStorage(*this).get(dll).check(*this, checker);
// we can use new (clone of this) solution, then copy known targets
// to allow multiple passes-builds
getModuleStorage(*this).get(dll).build(*this);
}

sr.restoreNow(true);

@@ -842,9 +846,12 @@ void Build::resolvePass(const Target &t, const DependenciesType &deps) const
auto i = h->getChildren().find(d->getPackage());
if (i != h->getChildren().end())
{
auto t = std::static_pointer_cast<NativeTarget>(i->second.begin()->second);
if (t)
d->setTarget(*t);
auto i2 = i->second.find(TargetSettings{ t.getSettings() });
if (i2 == i->second.end())
throw SW_RUNTIME_ERROR("no such target: " + d->getPackage().toString());
auto t2 = std::static_pointer_cast<NativeTarget>(i2->second);
if (t2)
d->setTarget(*t2);
else
throw SW_RUNTIME_ERROR("bad target cast to NativeTarget during resolve");

@@ -903,11 +910,9 @@ void Build::addFirstConfig()
addSettings(ss);
}

void Build::findCompiler()
/*void Build::findCompiler()
{
SW_UNIMPLEMENTED;

/*Settings.init();
Settings.init();
if (!disable_compiler_lookup)
detectCompilers(*this);
@@ -1154,8 +1159,8 @@ void Build::findCompiler()
add_target("org.LLVM.clangpp");
}
setSettings();*/
}
setSettings();
}*/

static auto getFilesHash(const Files &files)
{
@@ -2612,7 +2617,7 @@ void Build::load_packages(const StringSet &pkgs)
// now we set ours TargetsToBuild to this object
// execute() will propagate them to solutions
for (auto &[porig, p] : m)
TargetsToBuild[p];
TargetsToBuild[p] = getChildren()[p];
}

void Build::build_packages(const StringSet &pkgs)
@@ -2887,10 +2892,9 @@ void Build::createSolutions(const path &dll, bool usedll)
// compiler
auto set_cl = [](auto &s, const String &compiler)
{
SW_UNIMPLEMENTED;
auto t = compilerTypeFromStringCaseI(compiler);
//if (toIndex(t))
//s.Native.CompilerType = t;
if (toIndex(t))
s.Native.CompilerType1 = t;
};

mult_and_action(compiler.size(), [&set_cl](auto &s, int i)
@@ -2941,12 +2945,10 @@ void Build::load_dll(const path &dll, bool usedll)
// add cc if needed
//getHostSolution();

// initiate libc
for (auto &s : settings)
{
// apply config settings
//s.findCompiler();

// initiate libc
current_settings = &s;
//if (s.Settings.Native.libc)
//{
// Resolver r;
@@ -3001,7 +3003,10 @@ void Build::load_dll(const path &dll, bool usedll)
if (usedll)
{
for (auto &s : settings)
{
current_settings = &s;
getModuleStorage(*this).get(dll).check(*this, checker);
}
}
}

@@ -161,7 +161,6 @@ struct SW_DRIVER_CPP_API Build : TargetBase
path getSourceDir(const LocalPackage &p) const;
std::optional<path> getSourceDir(const Source &s, const Version &v) const;
bool skipTarget(TargetScope Scope) const;
void findCompiler();
//bool exists(const PackageId &p) const;
TargetMap &getChildren() { return children; }
const TargetMap &getChildren() const { return children; }
@@ -147,14 +147,26 @@ void detectCompilers(Build &s)
}

template <class T = PredefinedTarget>
static decltype(auto) addProgram(Build &s, const PackagePath &pp, const std::shared_ptr<Program> &cl)
static decltype(auto) addProgramNoFile(Build &s, const PackagePath &pp, const std::shared_ptr<Program> &p)
{
auto &t = s.add<T>(pp, cl->getVersion());
t.program = cl;
auto &t = s.add<T>(pp, p->getVersion());
t.program = p;
t.sw_provided = true;
return t;
}

template <class T = PredefinedTarget>
static void addProgram(Build &s, const PackagePath &pp, const std::shared_ptr<Program> &p)
{
if (!fs::exists(p->file))
{
//throw SW_RUNTIME_ERROR("Program does not exist: " + normalize_path(p->file));
LOG_TRACE(logger, "Program does not exist: " + normalize_path(p->file));
return;
}
addProgramNoFile(s, pp, p);
}

void detectDCompilers(Build &s)
{
path compiler;
@@ -420,6 +432,7 @@ void detectWindowsCompilers(Build &s)
}

// ASM
if (s.getSettings().TargetOS.Arch == ArchType::x86_64 || s.getSettings().TargetOS.Arch == ArchType::x86)
{
auto C = std::make_shared<VisualStudioASMCompiler>(s.swctx);
C->Type = CompilerType::MSVC;
@@ -429,7 +442,6 @@ void detectWindowsCompilers(Build &s)

if (instance.version.isPreRelease())
C->getVersion().getExtra() = instance.version.getExtra();
//C->input_extensions = { ".asm", };
addProgram(s, "com.Microsoft.VisualStudio.VC.ml", C);
}

@@ -456,7 +468,7 @@ void detectWindowsCompilers(Build &s)
}

// now register
addProgram(s, "com.Microsoft.VisualStudio", std::make_shared<VSInstance>(instance));
addProgramNoFile(s, "com.Microsoft.VisualStudio", std::make_shared<VSInstance>(instance));

continue;

@@ -131,7 +131,7 @@ struct SW_DRIVER_CPP_API NativeToolchain
// rc (resource compiler)
// ar, more tools...
// more native compilers (cuda etc.)
//::sw::CompilerType CompilerType = CompilerType::UnspecifiedCompiler;
::sw::CompilerType CompilerType1 = CompilerType::UnspecifiedCompiler;
//LinkerType LinkerType; // rename - use type from selected tool
BuildLibrariesAs LibrariesType = LibraryType::Shared;
::sw::ConfigurationType ConfigurationType = ConfigurationType::Release;
Oops, something went wrong.

0 comments on commit 38ddf62

Please sign in to comment.
You can’t perform that action at this time.