build: Allow Objective-C++ code to be used

Change-Id: I63e5d866dd1dd04987572941d1c842e09c4494b4
diff --git a/.waf-tools/osx-frameworks.py b/.waf-tools/osx-frameworks.py
index 31c2bad..5366b72 100644
--- a/.waf-tools/osx-frameworks.py
+++ b/.waf-tools/osx-frameworks.py
@@ -1,7 +1,7 @@
 #! /usr/bin/env python
 # encoding: utf-8
 
-from waflib import Logs, Utils
+from waflib import Logs, Utils, TaskGen
 from waflib.Configure import conf
 
 OSX_SECURITY_CODE = '''
@@ -40,3 +40,8 @@
             Logs.warn("Compiling on OSX, but CoreFoundation, CoreServices, Security, or SystemConfiguration " +
                       "framework is not functional.")
             Logs.warn("The frameworks are known to work only with the Apple clang compiler")
+
+@TaskGen.extension('.mm')
+def m_hook(self, node):
+    """Alias .mm files to be compiled the same as .cpp files, gcc/clang will do the right thing."""
+    return self.create_compiled_task('cxx', node)
diff --git a/wscript b/wscript
index e414340..0d5a9c4 100644
--- a/wscript
+++ b/wscript
@@ -160,6 +160,15 @@
         VERSION_MINOR=VERSION_SPLIT[1],
         VERSION_PATCH=VERSION_SPLIT[2])
 
+    if bld.env['HAVE_OSX_FRAMEWORKS']:
+        # Need to disable precompiled headers for Objective-C++ code
+        bld(features=['cxx'],
+            target="ndn-cxx-mm",
+            name="ndn-cxx-mm",
+            source=bld.path.ant_glob(['src/**/*-osx.mm']),
+            use='version BOOST CRYPTOPP OPENSSL SQLITE3 RT PTHREAD OSX_COREFOUNDATION OSX_CORESERVICES OSX_SECURITY OSX_SYSTEMCONFIGURATION',
+            includes=". src")
+
     libndn_cxx = dict(
         target="ndn-cxx",
         name="ndn-cxx",
@@ -168,7 +177,7 @@
                                        'src/**/*-rtnl.cpp',
                                        'src/**/*-sqlite3.cpp']),
         headers='src/common-pch.hpp',
-        use='version BOOST CRYPTOPP OPENSSL SQLITE3 RT PTHREAD',
+        use='version ndn-cxx-mm BOOST CRYPTOPP OPENSSL SQLITE3 RT PTHREAD',
         includes=". src",
         export_includes="src",
         install_path='${LIBDIR}')