win32: Make vfw32 optional

The features it was used for are very seldomly used, and some build
environments don't have the import library.
Günther Brammer 2011-05-12 17:13:38 +02:00
parent cfc247d360
commit 273acfff80
5 changed files with 42 additions and 8 deletions

View File

@ -1055,8 +1055,11 @@ if(NOT HAVE_GETOPT_H)
add_subdirectory(thirdparty/getopt)
target_link_libraries(clonk getopt)
elseif(MINGW)
# Link libiberty which contains getopt with mingw
target_link_libraries(clonk iberty)
# Link libiberty which my contain getopt with mingw
FINDLIB(iberty_LIBRARIES iberty)
if(iberty_LIBRARIES)
target_link_libraries(clonk iberty)
endif()
endif()
CHECK_INCLUDE_FILE_CXX(getopt.h HAVE_GETOPT_H)
@ -1126,12 +1129,13 @@ if (WIN32)
# CMake is too incompetent to check whether these libraries can be linked to
# So just pretend that everything is fine
FINDLIB(VFW32_LIBRARIES vfw32)
FINDLIB(wavifil32_LIBRARIES wavifil32)
if (VFW32_LIBRARIES)
target_link_libraries(clonk vfw32)
else()
# Mingw64 has the AviStream* and _DrawDibDraw* symbols in
# other library files
set(HAVE_VFW32 TRUE)
elseif(wavifil32_LIBRARIES)
target_link_libraries(clonk wavifil32 msvfw32)
set(HAVE_VFW32 TRUE)
endif()
target_link_libraries(clonk ws2_32 winmm)

View File

@ -112,6 +112,8 @@
/* Define to 1 if you have the `vasprintf' function. */
#cmakedefine HAVE_VASPRINTF 1
#cmakedefine HAVE_VFW32
/* Define to 1 if you have the <X11/extensions/xf86vmode.h> header file. */
#cmakedefine HAVE_X11_EXTENSIONS_XF86VMODE_H 1

View File

@ -114,6 +114,9 @@
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF
/* */
#undef HAVE_VFW32
/* Define to 1 if you have the <X11/extensions/xf86vmode.h> header file. */
#undef HAVE_X11_EXTENSIONS_XF86VMODE_H
@ -166,7 +169,7 @@
/* DirectX graphics */
#undef USE_DIRECTX
/* Wether FMOD shall be used */
/* Whether FMOD shall be used */
#undef USE_FMOD
/* OpenGL graphics */

View File

@ -318,14 +318,19 @@ if test $win32 = false; then
AM_CONDITIONAL(USE_FMOD, false)
else
# Windows
for WIN32LIB in gdi32 comdlg32 winmm ws2_32 vfw32
for WIN32LIB in gdi32 comdlg32 winmm ws2_32
do
AC_CHECK_LIB([$WIN32LIB], main, [CLONK_LIBS="-l$WIN32LIB $CLONK_LIBS"], [AC_MSG_ERROR([$WIN32LIB not found.])])
done
AC_CHECK_LIB([vfw32], main, [
CLONK_LIBS="-lvfw32 $CLONK_LIBS"
AC_DEFINE([HAVE_VFW32], 1, [ ])
], [])
# FMod (Library comes with standard)
if test "$enable_sound" = yes; then
AC_DEFINE([USE_FMOD], 1, [Wether FMOD shall be used])
AC_DEFINE([USE_FMOD], 1, [Whether FMOD shall be used])
fi
AM_CONDITIONAL(USE_FMOD, test "$enable_sound" = yes)

View File

@ -22,6 +22,7 @@
#include "C4Include.h"
#ifdef _WIN32
#ifdef HAVE_VFW32
#include <StdVideo.h>
#include <StdSurface2.h>
@ -331,4 +332,23 @@ void CStdAVIFile::CloseAudioStream()
iAudioBufferLength = 0;
}
#else //HAVE_VFW32
#include <StdVideo.h>
#include <StdSurface2.h>
bool AVIOpenOutput(const char *, PAVIFILE *, PAVISTREAM *, int, int) { return false; }
bool AVICloseOutput(PAVIFILE *, PAVISTREAM *) { return true; }
bool AVIPutFrame(PAVISTREAM, long, void *, long, void *, long) { return false; }
bool AVIOpenGrab(const char *, PAVISTREAM *, PGETFRAME *, int &, int &, int &, int &, int &) { return false; }
void AVICloseGrab(PAVISTREAM *, PGETFRAME *) { }
CStdAVIFile::CStdAVIFile() { }
CStdAVIFile::~CStdAVIFile() { }
void CStdAVIFile::Clear() { }
bool CStdAVIFile::OpenFile(const char *, HWND, int32_t) { return false; }
bool CStdAVIFile::GetFrameByTime(time_t, int32_t *) { return false; }
bool CStdAVIFile::GrabFrame(int32_t, CSurface *) const { return false; }
bool CStdAVIFile::OpenAudioStream() { return false; }
BYTE *CStdAVIFile::GetAudioStreamData(size_t *) { return NULL; }
void CStdAVIFile::CloseAudioStream() { }
#endif // HAVE_VFW32
#endif // _WIN32