Browse Source

build p3dpython.exe even without HAVE_P3D_PLUGIN

David Rose 16 years ago
parent
commit
fd68014d7b
1 changed files with 110 additions and 66 deletions
  1. 110 66
      direct/src/plugin/Sources.pp

+ 110 - 66
direct/src/plugin/Sources.pp

@@ -1,13 +1,25 @@
-// This directory builds the code for the "Core API" part of the
-// Panda3D browser plugin system.  Most Panda3D developers will have
-// no need to build this, unless you are developing the plugin system
-// itself.  Define HAVE_P3D_PLUGIN in your Config.pp to build this
-// directory.
-
-#define BUILD_DIRECTORY $[HAVE_P3D_PLUGIN]
+// This directory contains the code for the "Core API" part of the
+// Panda3D browser plugin system, which is not built unless you have
+// defined HAVE_P3D_PLUGIN in your Config.pp.  Most Panda3D developers
+// will have no need to build this, unless you are developing the
+// plugin system itself.
+
+// This directory also contains the code for p3dpython.exe, which is
+// part of the Panda3D plugin runtime.  It's not strictly part of the
+// "Core API"; it is packaged as part of each downloadable version of
+// Panda3D.  It is only built if you have defined
+// PANDA_PACKAGE_HOST_URL in your Config.pp, which indicates an
+// intention to build a downloadable version of Panda3D.  Developers
+// who are preparing a custom Panda3D package for download by the
+// plugin will need to build this.
 
 
 #begin lib_target
 #begin lib_target
-  #define BUILD_TARGET $[and $[HAVE_TINYXML],$[HAVE_OPENSSL],$[HAVE_ZLIB],$[HAVE_JPEG],$[HAVE_PNG]]
+
+// 
+// libp3d_plugin.dll, the main entry point to the Core API.
+//
+
+  #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_TINYXML],$[HAVE_OPENSSL],$[HAVE_ZLIB],$[HAVE_JPEG],$[HAVE_PNG]]
   #define USE_PACKAGES tinyxml openssl zlib jpeg png x11
   #define USE_PACKAGES tinyxml openssl zlib jpeg png x11
   #define TARGET p3d_plugin
   #define TARGET p3d_plugin
   #define LIB_PREFIX
   #define LIB_PREFIX
@@ -103,45 +115,61 @@
 
 
 #end lib_target
 #end lib_target
 
 
+#begin bin_target
 
 
-#begin lib_target
-// *****
-// Note!  This lib is used to run P3DPythonRun within the parent 
-// (browser) process, instead of forking a child.  This seems like
-// it's going to be a bad idea in the long term.  This lib remains
-// for now as an experiment, but it will likely be removed very soon.
-// ****
-  #define BUILD_TARGET $[and $[HAVE_TINYXML],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
-  #define USE_PACKAGES tinyxml python openssl
-  #define TARGET libp3dpython
-  #define LIB_PREFIX
+//
+// p3dcert.exe, the authorization GUI invoked when the user clicks the
+// red "play" button to approve an unknown certificate.  Considered
+// part of the Core API, though it is a separate download.
+//
 
 
-  #define OTHER_LIBS \
-    dtoolutil:c dtoolbase:c dtool:m \
-    interrogatedb:c dconfig:c dtoolconfig:m \
-    express:c pandaexpress:m \
-    pgraph:c pgraphnodes:c cull:c gsgbase:c gobj:c \
-    mathutil:c lerp:c downloader:c pnmimage:c \
-    prc:c pstatclient:c pandabase:c linmath:c putil:c \
-    pipeline:c event:c nativenet:c net:c display:c panda:m
+  #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_WX],$[HAVE_OPENSSL]]
+  #define USE_PACKAGES wx openssl
+  #define TARGET p3dcert
+
+  #define SOURCES p3dCert.cxx
+  #define OSX_SYS_FRAMEWORKS Carbon
+
+  #if $[OSX_PLATFORM]
+    // Squelch objections about ___dso_handle.
+    #define LFLAGS $[LFLAGS] -undefined dynamic_lookup
+  #endif
+#end bin_target
+
+
+#begin static_lib_target
+
+// 
+// libplugin_common.lib, a repository of code shared between the core
+// API and the various plugin implementations.
+//
+
+  #define BUILD_TARGET $[and $[HAVE_P3D_PLUGIN],$[HAVE_TINYXML],$[HAVE_OPENSSL]]
+  #define TARGET plugin_common
+  #define USE_PACKAGES tinyxml openssl
 
 
   #define SOURCES \
   #define SOURCES \
-    binaryXml.cxx binaryXml.h \
-    fhandle.h \
-    handleStream.cxx handleStream.h handleStream.I \
-    handleStreamBuf.cxx handleStreamBuf.h handleStreamBuf.I \
-    p3d_lock.h p3d_plugin.h \
-    p3d_plugin_config.h \
-    p3dCInstance.cxx \
-    p3dCInstance.h p3dCInstance.I \
-    p3dPythonRun.cxx p3dPythonRun.h p3dPythonRun.I \
-    run_p3dpython.h run_p3dpython.cxx
+    load_plugin.cxx load_plugin.h \
+    fileSpec.cxx fileSpec.h fileSpec.I \
+    find_root_dir.cxx find_root_dir.h \
+    is_pathsep.h is_pathsep.I \
+    mkdir_complete.cxx mkdir_complete.h
+
+#end static_lib_target
 
 
-  #define WIN_SYS_LIBS user32.lib
-#end lib_target
+
+
+// The remaining targets build p3dpython.exe and variants.
 
 
 #begin bin_target
 #begin bin_target
-  #define BUILD_TARGET $[and $[HAVE_TINYXML],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
+
+//
+// p3dpython.exe, the primary entry point to the downloaded Panda3D
+// runtime.  This executable is run in a child process by the Core API
+// to invoke a particular instance of Panda.
+//
+
+  #define BUILD_TARGET $[and $[PANDA_PACKAGE_HOST_URL],$[HAVE_TINYXML],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
   #define USE_PACKAGES tinyxml python openssl
   #define USE_PACKAGES tinyxml python openssl
   #define TARGET p3dpython
   #define TARGET p3dpython
 
 
@@ -184,9 +212,17 @@
 #end bin_target
 #end bin_target
 
 
 #begin bin_target
 #begin bin_target
-  // Windows requires a special executable, p3dpythonw.exe, to launch
-  // a desktop-friendly application.
-  #define BUILD_TARGET $[and $[HAVE_TINYXML],$[HAVE_PYTHON],$[HAVE_OPENSSL],$[WINDOWS_PLATFORM]]
+
+//
+// p3dpythonw.exe, a special variant on p3dpython.exe required by
+// Windows (and built only on a Windows platform).  This variant is
+// compiled as a desktop application, as opposed to p3dpython.exe,
+// which is a console application.  (Both variants are required,
+// because the plugin might be invoked either from a console or from
+// the desktop.)
+//
+
+  #define BUILD_TARGET $[and $[PANDA_PACKAGE_HOST_URL],$[HAVE_TINYXML],$[HAVE_PYTHON],$[HAVE_OPENSSL],$[WINDOWS_PLATFORM]]
   #define USE_PACKAGES tinyxml python openssl
   #define USE_PACKAGES tinyxml python openssl
   #define TARGET p3dpythonw
   #define TARGET p3dpythonw
   #define EXTRA_CDEFS NON_CONSOLE
   #define EXTRA_CDEFS NON_CONSOLE
@@ -229,34 +265,42 @@
   #define WIN_SYS_LIBS user32.lib
   #define WIN_SYS_LIBS user32.lib
 #end bin_target
 #end bin_target
 
 
-#begin static_lib_target
-  #define BUILD_TARGET $[and $[HAVE_TINYXML],$[HAVE_OPENSSL]]
-  #define TARGET plugin_common
-  #define USE_PACKAGES tinyxml openssl
-
-  #define SOURCES \
-    load_plugin.cxx load_plugin.h \
-    fileSpec.cxx fileSpec.h fileSpec.I \
-    find_root_dir.cxx find_root_dir.h \
-    is_pathsep.h is_pathsep.I \
-    mkdir_complete.cxx mkdir_complete.h
+#begin lib_target
 
 
-#end static_lib_target
+//
+// libp3dpython.dll, a special library used to run P3DPythonRun within
+// the parent (browser) process, instead of forking a child, as a
+// desparation fallback in case forking fails for some reason.
+//
 
 
+  #define BUILD_TARGET $[and $[PANDA_PACKAGE_HOST_URL],$[HAVE_TINYXML],$[HAVE_PYTHON],$[HAVE_OPENSSL]]
+  #define USE_PACKAGES tinyxml python openssl
+  #define TARGET libp3dpython
+  #define LIB_PREFIX
 
 
-#begin bin_target
-  #define BUILD_TARGET $[and $[HAVE_WX],$[HAVE_OPENSSL]]
-  #define USE_PACKAGES wx openssl
-  #define TARGET p3dcert
+  #define OTHER_LIBS \
+    dtoolutil:c dtoolbase:c dtool:m \
+    interrogatedb:c dconfig:c dtoolconfig:m \
+    express:c pandaexpress:m \
+    pgraph:c pgraphnodes:c cull:c gsgbase:c gobj:c \
+    mathutil:c lerp:c downloader:c pnmimage:c \
+    prc:c pstatclient:c pandabase:c linmath:c putil:c \
+    pipeline:c event:c nativenet:c net:c display:c panda:m
 
 
-  #define SOURCES p3dCert.cxx
-  #define OSX_SYS_FRAMEWORKS Carbon
+  #define SOURCES \
+    binaryXml.cxx binaryXml.h \
+    fhandle.h \
+    handleStream.cxx handleStream.h handleStream.I \
+    handleStreamBuf.cxx handleStreamBuf.h handleStreamBuf.I \
+    p3d_lock.h p3d_plugin.h \
+    p3d_plugin_config.h \
+    p3dCInstance.cxx \
+    p3dCInstance.h p3dCInstance.I \
+    p3dPythonRun.cxx p3dPythonRun.h p3dPythonRun.I \
+    run_p3dpython.h run_p3dpython.cxx
 
 
-  #if $[OSX_PLATFORM]
-    // Squelch objections about ___dso_handle.
-    #define LFLAGS $[LFLAGS] -undefined dynamic_lookup
-  #endif
-#end bin_target
+  #define WIN_SYS_LIBS user32.lib
+#end lib_target
 
 
 
 
 #include $[THISDIRPREFIX]p3d_plugin_config.h.pp
 #include $[THISDIRPREFIX]p3d_plugin_config.h.pp