diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-12-28 21:48:09 +0100 |
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2026-02-08 17:33:45 +0100 |
| commit | 695022abfd674316e5da9c3b74b97be029adfacc (patch) | |
| tree | d113c9d819fa9b502116e2305f82fa08434cd757 /src/rebuild.cc | |
| parent | 627843d2517a5cc8885939d6396fb052cd873aa7 (diff) | |
Diffstat (limited to 'src/rebuild.cc')
| -rw-r--r-- | src/rebuild.cc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/rebuild.cc b/src/rebuild.cc index d62e998..afa1b6d 100644 --- a/src/rebuild.cc +++ b/src/rebuild.cc @@ -145,6 +145,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)) { @@ -156,13 +158,32 @@ 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"); + + // Static linking with the ctor lib is toolchain specific but to compiler + // enforce support for all toolchains a switch is used instead of a per + // target ldflags. + auto toolchain = getToolChain(config.system); + switch(toolchain) + { + case ctor::toolchain::msvc: + config.flags.ldflags.emplace_back(ctor::ld_opt::link, "libctor.lib"); + break; + case ctor::toolchain::gcc: + case ctor::toolchain::clang: + case ctor::toolchain::any: + case ctor::toolchain::none: + config.flags.ldflags.emplace_back(ctor::ld_opt::link, "ctor"); + break; + } + 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. - // 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(); |
