summaryrefslogtreecommitdiff
path: root/src/rebuild.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/rebuild.cc')
-rw-r--r--src/rebuild.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/rebuild.cc b/src/rebuild.cc
index 1db5e83..ca450dc 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());
+ 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,9 @@ 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 +186,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;