From 54d76a11319644cabf84cc69ed22b4914091ee2f Mon Sep 17 00:00:00 2001
From: exstrim401 <exstrim401@tuta.io>
Date: Sun, 20 Nov 2022 16:47:32 +0200
Subject: [PATCH] Move mm_hook to separate file

---
 scripts/waifulib/mm_hook.py | 5 +++++
 wscript                     | 9 ++-------
 2 files changed, 7 insertions(+), 7 deletions(-)
 create mode 100644 scripts/waifulib/mm_hook.py

diff --git a/scripts/waifulib/mm_hook.py b/scripts/waifulib/mm_hook.py
new file mode 100644
index 00000000..1c8e39a5
--- /dev/null
+++ b/scripts/waifulib/mm_hook.py
@@ -0,0 +1,5 @@
+from waflib import TaskGen
+@TaskGen.extension('.mm')
+def mm_hook(self, node):
+	"""Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
+	return self.create_compiled_task('cxx', node)
\ No newline at end of file
diff --git a/wscript b/wscript
index 2cdb8021..6ec61517 100644
--- a/wscript
+++ b/wscript
@@ -292,6 +292,8 @@ def configure(conf):
 	conf.load('subproject xcompile compiler_c compiler_cxx gitversion clang_compilation_database strip_on_install waf_unit_test enforce_pic')
 	if conf.env.DEST_OS == 'win32' and conf.env.DEST_CPU == 'amd64':
 		conf.load('masm')
+	elif conf.env.DEST_OS == 'darwin':
+		conf.load('mm_hook')
 
 	define_platform(conf)
 	conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
@@ -560,13 +562,6 @@ def configure(conf):
 	else:
 		conf.add_subproject(projects['game'])
 
-from waflib import TaskGen
-@TaskGen.extension('.mm')
-def m_hook(self, node):
-	"""Alias .mm files to be compiled the same as .cpp files, gcc will do the right thing."""
-	return self.create_compiled_task('cxx', node)
-
-
 def build(bld):
 	os.environ["CCACHE_DIR"] = os.path.abspath('.ccache/'+bld.env.COMPILER_CC+'/'+bld.env.DEST_OS+'/'+bld.env.DEST_CPU)