Browse Source

Remove some settings from dtool_config.h to prevent rebuilds:
- HAVE_OPENCV
- OPENCV_VER_23
- HAVE_FFMPEG
- HAVE_SWSCALE
- HAVE_SWRESAMPLE

rdb 9 years ago
parent
commit
c410d812ff

+ 21 - 9
makepanda/makepanda.py

@@ -2236,11 +2236,7 @@ DTOOL_CONFIG=[
     ("HAVE_CG",                        'UNDEF',                  'UNDEF'),
     ("HAVE_CGGL",                      'UNDEF',                  'UNDEF'),
     ("HAVE_CGDX9",                     'UNDEF',                  'UNDEF'),
-    ("HAVE_FFMPEG",                    'UNDEF',                  'UNDEF'),
-    ("HAVE_SWSCALE",                   'UNDEF',                  'UNDEF'),
-    ("HAVE_SWRESAMPLE",                'UNDEF',                  'UNDEF'),
     ("HAVE_ARTOOLKIT",                 'UNDEF',                  'UNDEF'),
-    ("HAVE_OPENCV",                    'UNDEF',                  'UNDEF'),
     ("HAVE_DIRECTCAM",                 'UNDEF',                  'UNDEF'),
     ("HAVE_SQUISH",                    'UNDEF',                  'UNDEF'),
     ("HAVE_CARBON",                    'UNDEF',                  'UNDEF'),
@@ -2295,9 +2291,6 @@ def WriteConfigSettings():
             else:
                 dtool_config["HAVE_"+x] = 'UNDEF'
 
-    if not PkgSkip("OPENCV"):
-        dtool_config["OPENCV_VER_23"] = '1' if OPENCV_VER_23 else 'UNDEF'
-
     dtool_config["HAVE_NET"] = '1'
 
     if (PkgSkip("NVIDIACG")==0):
@@ -4128,8 +4121,20 @@ if (not RUNTIME):
 #
 
 if (PkgSkip("VISION") == 0) and (not RUNTIME):
+  # We want to know whether we have ffmpeg so that we can override the .avi association.
+  if not PkgSkip("FFMPEG"):
+    DefSymbol("OPENCV", "HAVE_FFMPEG")
+  if not PkgSkip("OPENCV"):
+    DefSymbol("OPENCV", "HAVE_OPENCV")
+    if OPENCV_VER_23:
+        DefSymbol("OPENCV", "OPENCV_VER_23")
+
   OPTS=['DIR:panda/src/vision', 'BUILDING:VISION', 'ARTOOLKIT', 'OPENCV', 'DX9', 'DIRECTCAM', 'JPEG', 'EXCEPTIONS']
-  TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx')
+  TargetAdd('p3vision_composite1.obj', opts=OPTS, input='p3vision_composite1.cxx', dep=[
+    'dtool_have_ffmpeg.dat',
+    'dtool_have_opencv.dat',
+    'dtool_have_directcam.dat',
+  ])
 
   TargetAdd('libp3vision.dll', input='p3vision_composite1.obj')
   TargetAdd('libp3vision.dll', input=COMMON_PANDA_LIBS)
@@ -4318,8 +4323,15 @@ if (PkgSkip("VRPN")==0 and not RUNTIME):
 # DIRECTORY: panda/src/ffmpeg
 #
 if PkgSkip("FFMPEG") == 0 and not RUNTIME:
+  if not PkgSkip("SWSCALE"):
+    DefSymbol("FFMPEG", "HAVE_SWSCALE")
+  if not PkgSkip("SWRESAMPLE"):
+    DefSymbol("FFMPEG", "HAVE_SWRESAMPLE")
+
   OPTS=['DIR:panda/src/ffmpeg', 'BUILDING:FFMPEG', 'FFMPEG', 'SWSCALE', 'SWRESAMPLE']
-  TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx')
+  TargetAdd('p3ffmpeg_composite1.obj', opts=OPTS, input='p3ffmpeg_composite1.cxx', dep=[
+    'dtool_have_swscale.dat', 'dtool_have_swresample.dat'])
+
   TargetAdd('libp3ffmpeg.dll', input='p3ffmpeg_composite1.obj')
   TargetAdd('libp3ffmpeg.dll', input=COMMON_PANDA_LIBS)
   TargetAdd('libp3ffmpeg.dll', opts=OPTS)

+ 0 - 2
panda/src/ffmpeg/ffmpegAudioCursor.cxx

@@ -50,9 +50,7 @@ FfmpegAudioCursor(FfmpegAudio *src) :
   _packet_data(0),
   _format_ctx(0),
   _audio_ctx(0),
-#ifdef HAVE_SWRESAMPLE
   _resample_ctx(0),
-#endif
   _buffer(0),
   _buffer_alloc(0),
   _frame(0)

+ 0 - 5
panda/src/ffmpeg/ffmpegAudioCursor.h

@@ -31,10 +31,7 @@ struct AVFormatContext;
 struct AVCodecContext;
 struct AVStream;
 struct AVPacket;
-
-#ifdef HAVE_SWRESAMPLE
 struct SwrContext;
-#endif
 
 /**
  * A stream that generates a sequence of audio samples.
@@ -72,9 +69,7 @@ protected:
   int       _buffer_head;
   int       _buffer_tail;
 
-#ifdef HAVE_SWRESAMPLE
   SwrContext *_resample_ctx;
-#endif
 
 public:
   static TypeHandle get_class_type() {

+ 16 - 0
panda/src/vision/openCVTexture.cxx

@@ -21,6 +21,22 @@
 #include "bamReader.h"
 #include "bamCacheRecord.h"
 
+// This symbol is predefined by the Panda3D build system to select whether we
+// are using the OpenCV 2.3 or later interface, or if it is not defined, we
+// are using the original interface.
+#ifdef OPENCV_VER_23
+
+#include <opencv2/core/core.hpp>
+// #include <opencv2videovideo.hpp>
+#include <opencv2/highgui/highgui.hpp>
+
+#else
+#include <cv.h>
+#include <cxcore.h>
+#include <highgui.h>
+
+#endif  // OPENCV_VER_23
+
 TypeHandle OpenCVTexture::_type_handle;
 
 /**

+ 1 - 15
panda/src/vision/openCVTexture.h

@@ -19,21 +19,7 @@
 
 #include "videoTexture.h"
 
-// This symbol is predefined by the Panda3D build system to select whether we
-// are using the OpenCV 2.3 or later interface, or if it is not defined, we
-// are using the original interface.
-#ifdef OPENCV_VER_23
-
-#include <opencv2/core/core.hpp>
-// #include <opencv2videovideo.hpp>
-#include <opencv2/highgui/highgui.hpp>
-
-#else
-#include <cv.h>
-#include <cxcore.h>
-#include <highgui.h>
-
-#endif  // OPENCV_VER_23
+struct CvCapture;
 
 /**
  * A specialization on VideoTexture that takes its input using the CV library,