Kumo
A hand-rolled game engine.
git clone https://git.sentomk.me/Kumo.git
commit f0871a8b3f357864011a6887c7da2b4183b4dc63 parent fcea5c65d2eef3c17fb1ce733f9b5e816b5c3e4c Author: sentomk <sentomk@proton.me> Date: Tue, 6 Oct 2026 22:44:17 +0800 build: compile .mm files with ARC Diffstat:
| M | kumo_builder.cpp | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/kumo_builder.cpp b/kumo_builder.cpp @@ -62,6 +62,11 @@ static const Cmd CXX_FLAGS = { "-Isrc", // allows includes relative to src/, e.g. #include "core/math.h" }; +/// @brief Extra flags for Objective-C++ (`.mm`) files only. +/// +/// ARC makes the compiler insert retain/release calls for Objective-C objects. +static const Cmd OBJCXX_FLAGS = {"-fobjc-arc"}; + /// @brief Flags passed to the link command. static const Cmd LINK_FLAGS = { "-framework", "Cocoa", "-framework", "Metal", "-framework", "QuartzCore", @@ -335,6 +340,9 @@ int main(int argc, char** argv) { // -MD -MF <dep>: write the dependency list to dep while compiling. Cmd cmd = {CXX}; cmd.insert(cmd.end(), CXX_FLAGS.begin(), CXX_FLAGS.end()); + if (src.extension() == ".mm") { + cmd.insert(cmd.end(), OBJCXX_FLAGS.begin(), OBJCXX_FLAGS.end()); + } cmd.insert(cmd.end(), {"-MD", "-MF", dep.string(), "-c", src.string(), "-o", obj.string()});
