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
This commit is contained in:
rdb 2009-10-19 11:58:34 +00:00
parent f851454d0e
commit 63d6ed7ae4
2 changed files with 71 additions and 14 deletions

View File

@ -44,7 +44,7 @@ PkgListSet(MAYAVERSIONS + MAXVERSIONS + DXVERSIONS + [
"PYTHON","ZLIB","PNG","JPEG","TIFF","VRPN","TINYXML", "PYTHON","ZLIB","PNG","JPEG","TIFF","VRPN","TINYXML",
"FMODEX","OPENAL","NVIDIACG","OPENSSL","FREETYPE", "FMODEX","OPENAL","NVIDIACG","OPENSSL","FREETYPE",
"FFTW","ARTOOLKIT","SQUISH","ODE","DIRECTCAM","NPAPI", "FFTW","ARTOOLKIT","SQUISH","ODE","DIRECTCAM","NPAPI",
"OPENCV","FFMPEG","FCOLLADA","GTK2","PANDATOOL" "OPENCV","FFMPEG","FCOLLADA","GTK2","WX", "PANDATOOL"
]) ])
CheckPandaSourceTree() CheckPandaSourceTree()
@ -224,6 +224,9 @@ SdkAutoDisableDirectX()
SdkAutoDisableMaya() SdkAutoDisableMaya()
SdkAutoDisableMax() 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. ## Choose a Compiler.
@ -308,6 +311,8 @@ if (COMPILER=="MSVC"):
LibName("WINMM", "winmm.lib") LibName("WINMM", "winmm.lib")
LibName("WINIMM", "imm32.lib") LibName("WINIMM", "imm32.lib")
LibName("WINKERNEL", "kernel32.lib") LibName("WINKERNEL", "kernel32.lib")
LibName("WINOLE", "ole32.lib")
LibName("WINOLEAUT", "oleaut32.lib")
LibName("WINOLDNAMES", "oldnames.lib") LibName("WINOLDNAMES", "oldnames.lib")
LibName("WINSHELL", "shell32.lib") LibName("WINSHELL", "shell32.lib")
LibName("WINGDI", "gdi32.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/ml.lib")
if (PkgSkip("OPENCV")==0): LibName("OPENCV", GetThirdpartyDir() + "opencv/lib/cxcore.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("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: for pkg in MAYAVERSIONS:
if (PkgSkip(pkg)==0): if (PkgSkip(pkg)==0):
LibName(pkg, '"' + SDK[pkg] + '/lib/Foundation.lib"') LibName(pkg, '"' + SDK[pkg] + '/lib/Foundation.lib"')
@ -383,7 +394,7 @@ if (COMPILER=="LINUX"):
IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include") IncDirectory("GTK2", "/usr/lib64/gtk-2.0/include")
ffmpeg_libs = ("libavutil", "libavcodec", "libavformat", "libswscale") ffmpeg_libs = ("libavutil", "libavcodec", "libavformat", "libswscale")
fcollada_libs = ("FColladaUD", "FColladaD", "FColladaSUD", "FColladaSD") fcollada_libs = ("FColladaD", "FColladaSD")
# Name pkg-config libs, include(dir)s # Name pkg-config libs, include(dir)s
PkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h") PkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h")
@ -792,9 +803,9 @@ def CompileLink(dll, obj, opts):
else: else:
cmd += ' ' + x cmd += ' ' + x
for (opt, dir) in LIBDIRECTORIES: 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: 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" cmd += " -lpthread"
if (not sys.platform.startswith("freebsd")): if (not sys.platform.startswith("freebsd")):
cmd += " -ldl" cmd += " -ldl"
@ -947,6 +958,26 @@ def CompileBundle(target, inputs, opts):
for r in resources: for r in resources:
oscmd("cp %s %s/Contents/Resources/" % (r, target)) 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 # CompileAnything
@ -969,6 +1000,9 @@ def CompileAnything(target, inputs, opts, progress = None):
else: else:
ProgressOutput(progress, "Building frozen library", target) ProgressOutput(progress, "Building frozen library", target)
return FreezePy(target, inputs, opts) return FreezePy(target, inputs, opts)
elif (infile.endswith(".idl")):
ProgressOutput(progress, "Compiling MIDL file", infile)
return CompileMIDL(target, infile, opts)
elif (infile.endswith(".pdef")): elif (infile.endswith(".pdef")):
ProgressOutput(progress, "Building package from pdef file", infile) ProgressOutput(progress, "Building package from pdef file", infile)
return Package(target, inputs, opts) 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_binaryXml.obj')
TargetAdd('p3d_plugin.dll', input='plugin_handleStream.obj') TargetAdd('p3d_plugin.dll', input='plugin_handleStream.obj')
TargetAdd('p3d_plugin.dll', input='plugin_handleStreamBuf.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): if (PkgSkip("PYTHON")==0):
TargetAdd('plugin_p3dCInstance.obj', opts=OPTS, input='p3dCInstance.cxx') 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'] OPTS=['DIR:direct/src/plugin', 'DIR:panda/src/express', 'OPENSSL', 'WX']
TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert.cxx') TargetAdd('plugin_p3dCert.obj', opts=OPTS, input='p3dCert.cxx')
TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj') 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/ # DIRECTORY: direct/src/plugin_npapi/
@ -3194,7 +3228,27 @@ if (RUNTIME and PkgSkip("NPAPI")==0):
if (sys.platform.startswith("win")): if (sys.platform.startswith("win")):
TargetAdd('nppanda3d.dll', input='nppanda3d.res') TargetAdd('nppanda3d.dll', input='nppanda3d.res')
TargetAdd('nppanda3d.dll', input='nppanda3d.def', ipath=OPTS) 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/ # DIRECTORY: direct/src/plugin_standalone/

View File

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