diff options
Diffstat (limited to 'src/rebuild.cc')
-rw-r--r-- | src/rebuild.cc | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/rebuild.cc b/src/rebuild.cc index 1db5e83..865a45b 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -38,7 +38,10 @@ int reg(ctor::build_configurations (*cb)(const ctor::settings&), { auto pwd = std::filesystem::current_path(); auto rel = std::filesystem::relative(loc, pwd); - configFiles[numConfigFiles].file = strdup(rel.string().data()); // NOTE: This intentionally leaks memory + auto str = rel.string(); + auto file = new char[str.size() + 1]; + strncpy(file, str.data(), str.size() + 1); + configFiles[numConfigFiles].file = file; // NOTE: This intentionally leaks memory } else { @@ -71,7 +74,7 @@ int reg(const char* location) int unreg(const char* location) { - std::size_t found{0}; + int found{0}; for(std::size_t i = 0; i < numConfigFiles;) { if(std::string(location) == configFiles[i].file) @@ -169,6 +172,8 @@ bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[ config.flags.cxxflags.emplace_back(ctor::cxx_opt::optimization, "3"); config.flags.cxxflags.emplace_back(ctor::cxx_opt::cpp_std, "c++20"); + config.flags.cxxflags.push_back({ctor::toolchain::msvc, ctor::cxx_opt::custom, "/EHsc"}); + const auto& c = ctor::get_configuration(); if(c.has(ctor::cfg::ctor_includedir)) { @@ -180,13 +185,20 @@ bool recompileCheck(const ctor::settings& global_settings, int argc, char* argv[ config.flags.ldflags.emplace_back(ctor::ld_opt::library_path, c.get(ctor::cfg::ctor_libdir)); } - config.flags.ldflags.emplace_back(ctor::ld_opt::link, "ctor"); + config.flags.ldflags.emplace_back(ctor::toolchain::msvc, ctor::ld_opt::link, "libctor.lib"); + config.flags.ldflags.emplace_back(ctor::toolchain::gcc, ctor::ld_opt::link, "ctor"); + config.flags.ldflags.emplace_back(ctor::toolchain::clang, ctor::ld_opt::link, "ctor"); config.flags.ldflags.emplace_back(ctor::ld_opt::strip); config.flags.ldflags.emplace_back(ctor::ld_opt::threads); + config.flags.ldflags.push_back({ctor::toolchain::msvc, ctor::ld_opt::custom, "/subsystem:console"}); + ctor::settings settings{global_settings}; settings.verbose = -1; // Make check completely silent. - settings.builddir += "/ctor"; // override builddir to use ctor subdir + + // override builddir to use ctor subdir + auto ctor_builddir = std::filesystem::path(settings.builddir) / "ctor"; + settings.builddir = ctor_builddir.string(); { std::filesystem::path buildfile = settings.builddir; |