浏览代码

added PYTHON_FRAMEWORK

Dave Schuyler 22 年之前
父节点
当前提交
9693d442cd
共有 3 个文件被更改,包括 14 次插入3 次删除
  1. 2 0
      dtool/LocalSetup.pp
  2. 6 1
      dtool/metalibs/dtoolconfig/pydtool.cxx
  3. 6 2
      dtool/src/interrogate/interfaceMakerPython.cxx

+ 2 - 0
dtool/LocalSetup.pp

@@ -15,6 +15,8 @@
 
 /* Define if we have Python installed.  */
 $[cdefine HAVE_PYTHON]
+/* Define if we have Python as a framework (Mac OS X).  */
+$[cdefine PYTHON_FRAMEWORK]
 
 /* Define if we have RAD game tools, Miles Sound System installed.  */
 $[cdefine HAVE_RAD_MSS]

+ 6 - 1
dtool/metalibs/dtoolconfig/pydtool.cxx

@@ -9,7 +9,12 @@
 #include "dtoolbase.h"
 
 #undef HAVE_LONG_LONG
-#include "Python.h"
+
+#ifdef PYTHON_FRAMEWORK
+  #include "Python/Python.h"
+#else
+  #include "Python.h"
+#endif
 
 extern "C" {
 

+ 6 - 2
dtool/src/interrogate/interfaceMakerPython.cxx

@@ -41,8 +41,12 @@ InterfaceMakerPython(InterrogateModuleDef *def) :
 void InterfaceMakerPython::
 write_includes(ostream &out) {
   InterfaceMaker::write_includes(out);
-  out << "#undef HAVE_LONG_LONG\n"
-      << "#include <Python.h>\n\n";
+  out << "#undef HAVE_LONG_LONG\n\n"
+      << "#if PYTHON_FRAMEWORK\n"
+      << "  #include \"Python/Python.h\"\n"
+      << "#else\n"
+      << "  #include \"Python.h\"\n"
+      << "#endif\n\n";
 }
 
 ////////////////////////////////////////////////////////////////////