Kumo
A hand-rolled game engine.
git clone https://git.sentomk.me/Kumo.git
commit 76d6d15dcdb40773af1a5c94b6d88bdb0d9f5aaf parent 678937f448ba0ba0e781c8ad12bbd0158157c937 Author: sentomk <sentomk@proton.me> Date: Tue, 17 Nov 2026 21:32:34 +0800 feat: allow per-platform compiler override in kumo.toml Diffstat:
| M | kumo.toml | | | 1 | + |
| M | kumo_builder.cpp | | | 8 | ++++++-- |
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/kumo.toml b/kumo.toml @@ -29,6 +29,7 @@ link = [] # for it exists. [mac] +compiler = "/usr/bin/clang++" link = ["-framework", "Cocoa", "-framework", "Metal", "-framework", "QuartzCore"] [windows] diff --git a/kumo_builder.cpp b/kumo_builder.cpp @@ -322,8 +322,8 @@ static void print_command(const Cmd& cmd) { /// - `objcxx_flags`: extra compile flags for `.mm` files only; /// - `link`: link flags. /// -/// A platform table may hold `flags` and `link`. On that platform they are -/// appended to the lists above. +/// A platform table may hold `compiler`, `flags` and `link`. On that platform +/// `compiler` overrides the top-level setting, and `flags`/`link` are appended. /// @{ /// @brief The settings of the project, as read from #CONFIG_FILE. @@ -636,9 +636,11 @@ static Config load_config() { // one of this platform is used. for (const char* platform : PLATFORM_TABLES) { const std::string section = platform; + std::string compiler = take_string(section + ".compiler", ""); Cmd flags = take_list(section + ".flags"); Cmd link = take_list(section + ".link"); if (section == HOST_NAME) { + if (!compiler.empty()) cfg.compiler = compiler; cfg.flags.insert(cfg.flags.end(), flags.begin(), flags.end()); cfg.link_flags.insert(cfg.link_flags.end(), link.begin(), link.end()); } @@ -655,6 +657,8 @@ static Config load_config() { } if (first) config_error(first->line, "unknown key '" + first_key + "'"); + if (cfg.compiler.empty()) config_error(0, "'compiler' must not be empty"); + if (name.empty()) config_error(0, "'name' must not be empty"); if (name.find_first_of("/\\") != std::string::npos) { config_error(0, "'name' must be a file name, not a path");
