Fixed compile and linker problems on Windows 7 with Visual C++ 2010 Express Edition

This commit is contained in:
Robert Beckebans 2012-11-28 11:27:27 +01:00
parent ac30c96ccb
commit 1c08bda8dd
5 changed files with 104 additions and 17 deletions

View file

@ -655,7 +655,11 @@ void I_InitSoundChannel( int channel, int numOutputChannels_ ) {
activeSound_t *soundchannel = &activeSounds[ channel ]; activeSound_t *soundchannel = &activeSounds[ channel ];
// RB: fixed non-aggregates cannot be initialized with initializer list // RB: fixed non-aggregates cannot be initialized with initializer list
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
X3DAUDIO_VECTOR ZeroVector( 0.0f, 0.0f, 0.0f ); X3DAUDIO_VECTOR ZeroVector( 0.0f, 0.0f, 0.0f );
#else
X3DAUDIO_VECTOR ZeroVector = { 0.0f, 0.0f, 0.0f };
#endif
// RB end // RB end
// Set up emitter parameters // Set up emitter parameters
@ -721,7 +725,11 @@ void I_InitSound() {
int i; int i;
// RB: non-aggregates cannot be initialized with initializer list // RB: non-aggregates cannot be initialized with initializer list
#if (_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
X3DAUDIO_VECTOR ZeroVector( 0.0f, 0.0f, 0.0f ); X3DAUDIO_VECTOR ZeroVector( 0.0f, 0.0f, 0.0f );
#else
X3DAUDIO_VECTOR ZeroVector = { 0.0f, 0.0f, 0.0f };
#endif
// RB end // RB end
// Set up listener parameters // Set up listener parameters

View file

@ -879,6 +879,7 @@ if(MSVC)
dxguid dxguid
#dxerr #dxerr
Xinput Xinput
xaudio2.lib
) )
add_definitions(-DUSE_XINPUT) add_definitions(-DUSE_XINPUT)
else() else()
@ -888,18 +889,6 @@ if(MSVC)
endif() endif()
if(USE_MFC_TOOLS) if(USE_MFC_TOOLS)
# find_package(MFC REQUIRED)
# if(MFC_FOUND)
# include_directories(${MFC_INCLUDE_DIR})
# link_directories(${MFC_LIBRARY_DIR})
# endif()
# find_package(ATL REQUIRED)
# if(ATL_FOUND)
# include_directories(${ATL_INCLUDE_DIR})
# link_directories(${ATL_LIBRARY_DIR})
# add_definitions(-DUSE_MFC6_WITH_ATL7)
# endif()
include_directories(libs/atlmfc/include) include_directories(libs/atlmfc/include)
if(CMAKE_CL_64) if(CMAKE_CL_64)
@ -957,6 +946,5 @@ if(MSVC)
iphlpapi iphlpapi
winmm winmm
wsock32.lib wsock32.lib
xaudio2.lib
) )
endif() endif()

View file

@ -17,15 +17,17 @@ if(WIN32)
find_library(DirectX_DINPUT8_LIBRARY NAMES dinput8 HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DINPUT8_LIBRARY NAMES dinput8 HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DSOUND_LIBRARY NAMES dsound HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DSOUND_LIBRARY NAMES dsound HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXERR_LIBRARY NAMES dxerr HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) #find_library(DirectX_DXERR_LIBRARY NAMES dxerr HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_XINPUT_LIBRARY NAMES Xinput HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_XINPUT_LIBRARY NAMES Xinput HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_X3DAUDIO_LIBRARY NAMES x3daudio HINTS $ENV{DXSDK_DIR} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
set(DirectX_LIBRARIES set(DirectX_LIBRARIES
${DirectX_DINPUT8_LIBRARY} ${DirectX_DINPUT8_LIBRARY}
${DirectX_DSOUND_LIBRARY} ${DirectX_DSOUND_LIBRARY}
${DirectX_DXGUID_LIBRARY} ${DirectX_DXGUID_LIBRARY}
${DirectX_DXERR_LIBRARY} #${DirectX_DXERR_LIBRARY}
${DirectX_XINPUT_LIBRARY} ${DirectX_XINPUT_LIBRARY}
${DirectX_X3DAUDIO_LIBRARY}
) )
# handle the QUIETLY and REQUIRED arguments and set DirectX_FOUND to TRUE if # handle the QUIETLY and REQUIRED arguments and set DirectX_FOUND to TRUE if
@ -37,8 +39,9 @@ if(WIN32)
DirectX_DINPUT8_LIBRARY DirectX_DINPUT8_LIBRARY
DirectX_DSOUND_LIBRARY DirectX_DSOUND_LIBRARY
DirectX_DXGUID_LIBRARY DirectX_DXGUID_LIBRARY
DirectX_DXERR_LIBRARY #DirectX_DXERR_LIBRARY
DirectX_XINPUT_LIBRARY DirectX_XINPUT_LIBRARY
DirectX_X3DAUDIO_LIBRARY
) )
mark_as_advanced(DirectX_LIBRARIES DirectX_INCLUDE_DIR) mark_as_advanced(DirectX_LIBRARIES DirectX_INCLUDE_DIR)

View file

@ -0,0 +1,80 @@
#ifndef __WIN_NANOAFX_HPP__
#define __WIN_NANOAFX_HPP__
#define _T(n) L##n
class CComBSTR : public _bstr_t
{
public:
inline CComBSTR( const wchar_t* str ) : _bstr_t( str )
{
}
inline CComBSTR( const char* str ) : _bstr_t( str )
{
}
};
class CComVariant : public tagVARIANT
{
};
template<class T>
class CComPtr
{
private:
T* _ptr;
public:
inline CComPtr()
{
_ptr = NULL;
}
inline CComPtr( T* ptr )
{
if( ptr )
{
ptr->AddRef();
_ptr = ptr;
}
}
inline ~CComPtr()
{
if( _ptr )
_ptr->Release();
_ptr = NULL;
}
inline CComPtr& operator = ( T* ptr )
{
if( ptr )
{
ptr->AddRef();
_ptr = ptr;
}
}
inline bool operator == ( T* ptr )
{
return _ptr == ptr;
}
inline T* operator -> ()
{
return _ptr;
}
inline T** operator & ()
{
return &_ptr;
}
inline operator T* ()
{
return _ptr;
}
};
#endif

View file

@ -41,12 +41,20 @@ If you have questions concerning this license or the applicable additional terms
#undef StrCmpN #undef StrCmpN
#undef StrCmpNI #undef StrCmpNI
#undef StrCmpI #undef StrCmpI
#include <atlbase.h>
#include <comdef.h> #include <comdef.h>
#include <comutil.h> #include <comutil.h>
#include <Wbemidl.h> #include <Wbemidl.h>
// RB: no <atlbase.h> with Visual C++ 2010 Express
#if defined(USE_MFC_TOOLS)
#include <atlbase.h>
#else
#include "win_nanoafx.h"
#endif
// RB end
#pragma comment (lib, "wbemuuid.lib") #pragma comment (lib, "wbemuuid.lib")
#pragma warning(disable:4740) // warning C4740: flow in or out of inline asm code suppresses global optimization #pragma warning(disable:4740) // warning C4740: flow in or out of inline asm code suppresses global optimization