summaryrefslogtreecommitdiff
path: root/src/rebuild.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2024-12-07 17:14:45 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2024-12-21 16:21:49 +0100
commitd2e7188e33a58cab05ef6292795303ad4b92a5f7 (patch)
treea6789fb724833d4d800626bf9b4707fa4ae1e9d8 /src/rebuild.cc
parente166206702c8dbd3162452cf26f368e856ac0138 (diff)
WIPmsvc
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;