浏览代码

New stuff for makepanda:
* Compile fixes for FCollada on Unix
* Compile correctly against WxWidgets on Windows and OSX
* Now supports .idl/.tlb/.ocx on Windows
* Step towards getting the ActiveX plugin compiled
* pkg-config fixes

rdb 16 年之前
父节点
当前提交
63d6ed7ae4
共有 2 个文件被更改,包括 71 次插入14 次删除
  1. 61 7
      makepanda/makepanda.py
  2. 10 7
      makepanda/makepandacore.py

+ 61 - 7
makepanda/makepanda.py

@@ -44,7 +44,7 @@ PkgListSet(MAYAVERSIONS + MAXVERSIONS + DXVERSIONS + [
   "PYTHON","ZLIB","PNG","JPEG","TIFF","VRPN","TINYXML",
   "FMODEX","OPENAL","NVIDIACG","OPENSSL","FREETYPE",
   "FFTW","ARTOOLKIT","SQUISH","ODE","DIRECTCAM","NPAPI",
-  "OPENCV","FFMPEG","FCOLLADA","GTK2","PANDATOOL"
+  "OPENCV","FFMPEG","FCOLLADA","GTK2","WX", "PANDATOOL"
 ])
 
 CheckPandaSourceTree()
@@ -224,6 +224,9 @@ SdkAutoDisableDirectX()
 SdkAutoDisableMaya()
 SdkAutoDisableMax()
 
+if (RUNTIME and SDK["PYTHONVERSION"] != "python2.6" and DISTRIBUTOR == "cmu"):
+    exit("The CMU runtime distribution must be built against Python 2.6!")
+
 ########################################################################
 ##
 ## Choose a Compiler.
@@ -308,6 +311,8 @@ if (COMPILER=="MSVC"):
     LibName("WINMM", "winmm.lib")
     LibName("WINIMM", "imm32.lib")
     LibName("WINKERNEL", "kernel32.lib")
+    LibName("WINOLE", "ole32.lib")
+    LibName("WINOLEAUT", "oleaut32.lib")
     LibName("WINOLDNAMES", "oldnames.lib")
     LibName("WINSHELL", "shell32.lib")
     LibName("WINGDI", "gdi32.lib")
@@ -348,6 +353,12 @@ if (COMPILER=="MSVC"):
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/ml.lib")
     if (PkgSkip("OPENCV")==0):   LibName("OPENCV",   GetThirdpartyDir() + "opencv/lib/cxcore.lib")
     if (PkgSkip("TINYXML")==0):  LibName("TINYXML",  GetThirdpartyDir() + "tinyxml/lib/tinyxml.lib")
+    if (PkgSkip("WX")==0):
+        LibName("WX",       GetThirdpartyDir() + "wx/lib/wxbase28u.lib")
+        LibName("WX",       GetThirdpartyDir() + "wx/lib/wxmsw28u_core.lib")
+        DefSymbol("WX",     "__WXMSW__", "")
+        DefSymbol("WX",     "_UNICODE", "")
+        DefSymbol("WX",     "UNICODE", "")
     for pkg in MAYAVERSIONS:
         if (PkgSkip(pkg)==0):
             LibName(pkg, '"' + SDK[pkg] + '/lib/Foundation.lib"')
@@ -383,7 +394,7 @@ if (COMPILER=="LINUX"):
         IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include")
 
     ffmpeg_libs = ("libavutil", "libavcodec", "libavformat", "libswscale")
-    fcollada_libs = ("FColladaUD", "FColladaD", "FColladaSUD", "FColladaSD")
+    fcollada_libs = ("FColladaD", "FColladaSD")
 
     #         Name         pkg-config   libs, include(dir)s
     PkgEnable("ARTOOLKIT", "",          ("AR"), "AR/ar.h")
@@ -792,9 +803,9 @@ def CompileLink(dll, obj, opts):
                 else:
                     cmd += ' ' + x
         for (opt, dir) in LIBDIRECTORIES:
-            if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' -L' + BracketNameWithQuotes(dir)
+            if (opt=="ALWAYS") or (opt in opts): cmd += ' -L' + BracketNameWithQuotes(dir)
         for (opt, name) in LIBNAMES:
-            if (opt=="ALWAYS") or (opts.count(opt)): cmd += ' ' + BracketNameWithQuotes(name)
+            if (opt=="ALWAYS") or (opt in opts): cmd += ' ' + BracketNameWithQuotes(name)
         cmd += " -lpthread"
         if (not sys.platform.startswith("freebsd")):
             cmd += " -ldl"
@@ -947,6 +958,26 @@ def CompileBundle(target, inputs, opts):
     for r in resources:
         oscmd("cp %s %s/Contents/Resources/" % (r, target))
 
+##########################################################################################
+#
+# CompileMIDL
+#
+##########################################################################################
+
+def CompileMIDL(target, src, opts):
+    ipath = GetListOption(opts, "DIR:")
+    if (COMPILER=="MSVC"):
+        cmd = "midl"
+        cmd += " /out" + BracketNameWithQuotes(os.path.dirname(target))
+        for x in ipath: cmd += " /I" + x
+        for (opt,dir) in INCDIRECTORIES:
+            if (opt=="ALWAYS") or (opts.count(opt)): cmd += " /I" + BracketNameWithQuotes(dir)
+        for (opt,var,val) in DEFSYMBOLS:
+            if (opt=="ALWAYS") or (opts.count(opt)): cmd += " /D" + var + "=" + val
+        cmd += " " + BracketNameWithQuotes(src)
+
+        oscmd(cmd)
+
 ##########################################################################################
 #
 # CompileAnything
@@ -969,6 +1000,9 @@ def CompileAnything(target, inputs, opts, progress = None):
         else:
             ProgressOutput(progress, "Building frozen library", target)
         return FreezePy(target, inputs, opts)
+    elif (infile.endswith(".idl")):
+        ProgressOutput(progress, "Compiling MIDL file", infile)
+        return CompileMIDL(target, infile, opts)
     elif (infile.endswith(".pdef")):
         ProgressOutput(progress, "Building package from pdef file", infile)
         return Package(target, inputs, opts)
@@ -3145,7 +3179,7 @@ if (RUNTIME):
   TargetAdd('p3d_plugin.dll', input='plugin_binaryXml.obj')
   TargetAdd('p3d_plugin.dll', input='plugin_handleStream.obj')
   TargetAdd('p3d_plugin.dll', input='plugin_handleStreamBuf.obj')
-  TargetAdd('p3d_plugin.dll', opts=['TINYXML', 'OPENSSL', 'ZLIB', 'JPEG', 'PNG', 'X11', 'WINUSER', 'WINGDI', 'WINSHELL', 'WINCOMCTL', 'MSIMG'])
+  TargetAdd('p3d_plugin.dll', opts=['TINYXML', 'OPENSSL', 'ZLIB', 'JPEG', 'PNG', 'X11', 'WINUSER', 'WINGDI', 'WINSHELL', 'WINCOMCTL', 'WINOLE', 'MSIMG'])
 
   if (PkgSkip("PYTHON")==0):
     TargetAdd('plugin_p3dCInstance.obj', opts=OPTS, input='p3dCInstance.cxx')
@@ -3166,7 +3200,7 @@ if (RUNTIME):
     OPTS=['DIR:direct/src/plugin', 'DIR:panda/src/express', 'OPENSSL', 'WX']
     TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert.cxx')
     TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj')
-    TargetAdd('p3dcert.exe', opts=['OPENSSL', 'WX', 'CARBON'])
+    TargetAdd('p3dcert.exe', opts=['OPENSSL', 'WX', 'CARBON', 'WINOLE', 'WINOLEAUT', 'WINUSER', 'ADVAPI', 'WINSHELL', 'WINCOMCTL', 'WINGDI', 'WINCOMDLG'])
 
 #
 # DIRECTORY: direct/src/plugin_npapi/
@@ -3194,7 +3228,27 @@ if (RUNTIME and PkgSkip("NPAPI")==0):
     if (sys.platform.startswith("win")):
       TargetAdd('nppanda3d.dll', input='nppanda3d.res')
       TargetAdd('nppanda3d.dll', input='nppanda3d.def', ipath=OPTS)
-    TargetAdd('nppanda3d.dll', opts=['NPAPI', 'TINYXML', 'OPENSSL', 'WINUSER', 'WINSHELL'])
+    TargetAdd('nppanda3d.dll', opts=['NPAPI', 'TINYXML', 'OPENSSL', 'WINUSER', 'WINSHELL', 'WINOLE'])
+
+#
+# DIRECTORY: direct/src/plugin_activex/
+#
+
+#if (RUNTIME and sys.platform.startswith("win")):
+#  OPTS=['DIR:direct/src/plugin_activex', 'PLUGIN', 'ACTIVEX', 'TINYXML']
+#  DefSymbol('ACTIVEX', '_USRDLL', '')
+#  DefSymbol('ACTIVEX', '_WINDLL', '')
+#  DefSymbol('ACTIVEX', '_AFXDLL', '')
+#  DefSymbol('ACTIVEX', '_MBCS', '')
+#  TargetAdd('P3DActiveX.tlb', opts=OPTS, input='P3DActiveX.idl')
+#  TargetAdd('P3DActiveX.res', opts=OPTS, input='P3DActiveX.rc')
+#  
+#  TargetAdd('plugin_activex_p3dactivex_composite1.obj', opts=OPTS, input='p3dactivex_composite1.cxx')
+#  
+#  TargetAdd('p3dactivex.ocx', input='plugin_common.obj')
+#  TargetAdd('p3dactivex.ocx', input='plugin_activex_p3dactivex_composite1.obj')
+#  TargetAdd('p3dactivex.ocx', input='P3DActiveX.res')
+#  TargetAdd('p3dactivex.ocx', input='P3DActiveX.def', ipath=OPTS)
 
 #
 # DIRECTORY: direct/src/plugin_standalone/

+ 10 - 7
makepanda/makepandacore.py

@@ -12,8 +12,8 @@
 import sys,os,time,stat,string,re,getopt,cPickle,fnmatch,threading,Queue,signal,shutil,platform,glob,getpass
 from distutils import sysconfig
 
-SUFFIX_INC=[".cxx",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r",".plist"]
-SUFFIX_DLL=[".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd"]
+SUFFIX_INC=[".cxx",".c",".h",".I",".yxx",".lxx",".mm",".rc",".r",".plist",".idl"]
+SUFFIX_DLL=[".dll",".dlo",".dle",".dli",".dlm",".mll",".exe",".pyd",".ocx"]
 SUFFIX_LIB=[".lib",".ilb"]
 STARTTIME=time.time()
 MAINTHREAD=threading.currentThread()
@@ -829,7 +829,7 @@ def PkgSelected(pkglist, pkg):
 
 def PkgConfigHavePkg(pkgname, tool = "pkg-config"):
     """Returns a bool whether the pkg-config package is installed."""
-    if (sys.platform == "win32" or not LocateBinary("pkg-config")):
+    if (sys.platform == "win32" or not LocateBinary(tool)):
         return False
     if (tool == "pkg-config"):
         handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --modversion " + pkgname)
@@ -841,7 +841,7 @@ def PkgConfigHavePkg(pkgname, tool = "pkg-config"):
 
 def PkgConfigGetLibs(pkgname, tool = "pkg-config"):
     """Returns a list of libs for the package, prefixed by -l."""
-    if (sys.platform == "win32" or not LocateBinary("pkg-config")):
+    if (sys.platform == "win32" or not LocateBinary(tool)):
         return []
     if (tool == "pkg-config"):
         handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-l " + pkgname)
@@ -856,7 +856,7 @@ def PkgConfigGetLibs(pkgname, tool = "pkg-config"):
 
 def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"):
     """Returns a list of includes for the package, NOT prefixed by -I."""
-    if (sys.platform == "win32" or not LocateBinary("pkg-config")):
+    if (sys.platform == "win32" or not LocateBinary(tool)):
         return []
     if (tool == "pkg-config"):
         handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags-only-I " + pkgname)
@@ -873,7 +873,7 @@ def PkgConfigGetIncDirs(pkgname, tool = "pkg-config"):
 
 def PkgConfigGetLibDirs(pkgname, tool = "pkg-config"):
     """Returns a list of library paths for the package, NOT prefixed by -L."""
-    if (sys.platform == "win32" or not LocateBinary("pkg-config")):
+    if (sys.platform == "win32" or not LocateBinary(tool)):
         return []
     if (tool == "pkg-config"):
         handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --libs-only-L " + pkgname)
@@ -892,7 +892,7 @@ def PkgConfigGetLibDirs(pkgname, tool = "pkg-config"):
 
 def PkgConfigGetDefSymbols(pkgname, tool = "pkg-config"):
     """Returns a dictionary of preprocessor definitions."""
-    if (sys.platform == "win32" or not LocateBinary("pkg-config")):
+    if (sys.platform == "win32" or not LocateBinary(tool)):
         return []
     if (tool == "pkg-config"):
         handle = os.popen(LocateBinary("pkg-config") + " --silence-errors --cflags " + pkgname)
@@ -1562,10 +1562,13 @@ def CalcLocation(fn, ipath):
     if (sys.platform.startswith("win")):
         if (fn.endswith(".def")): return CxxFindSource(fn, ipath)
         if (fn.endswith(".rc")):  return CxxFindSource(fn, ipath)
+        if (fn.endswith(".idl")): return CxxFindSource(fn, ipath)
         if (fn.endswith(".obj")): return OUTPUTDIR+"/tmp/"+fn
         if (fn.endswith(".res")): return OUTPUTDIR+"/tmp/"+fn
+        if (fn.endswith(".tlb")): return OUTPUTDIR+"/tmp/"+fn
         if (fn.endswith(".dll")): return OUTPUTDIR+"/bin/"+fn[:-4]+dllext+".dll"
         if (fn.endswith(".pyd")): return OUTPUTDIR+"/bin/"+fn[:-4]+dllext+".pyd"
+        if (fn.endswith(".ocx")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".ocx"
         if (fn.endswith(".mll")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".mll"
         if (fn.endswith(".dlo")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".dlo"
         if (fn.endswith(".dli")): return OUTPUTDIR+"/plugins/"+fn[:-4]+dllext+".dli"