diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-04-02 21:54:55 +0200 |
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-12-23 18:32:57 +0100 |
| commit | 4d0fa88d4b189d12005f36b076173d01a0d7bb87 (patch) | |
| tree | 4fae3689d84c5858630be01d806adb6d142a434c /src/rebuild.cc | |
| parent | a43e4eeb6a8c1b0906f5af0b964a301d2ec0321b (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(); |
