Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Windows|64-bit: Build on MSVC 2015, 64-bit Qt 5.6; cleanup of externa…
…l libs

EAX2 is not available in 64 bits, so the DirectSound plugin is
compiled without any EAX2 features when doing a 64 bit build.

LZSS is now compiled from source on all platforms.

Updated zlib to 1.2.8 on Windows, with prebuilt binaries included in
the repository (x86 and x64).

Fixed a couple of warnings about converting 64-bit values to 32-bit.

IssueID #1574
  • Loading branch information
skyjake committed Mar 17, 2016
1 parent c7b3d91 commit dc69434
Show file tree
Hide file tree
Showing 34 changed files with 498 additions and 1,690 deletions.
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/def_main.h
Expand Up @@ -40,7 +40,7 @@ struct Array : public std::vector<PODType>
return !size();
}
int size() const {
return std::vector<PODType>::size();
return (int) std::vector<PODType>::size();
}
void clear() {
_elements = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/include/resource/modeldef.h
Expand Up @@ -169,7 +169,7 @@ struct ModelDef

uint subCount() const
{
return _sub.size();
return uint(_sub.size());
}

bool testSubFlag(unsigned int subnum, int flag) const
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/client/src/network/monitor.cpp
Expand Up @@ -23,7 +23,7 @@
#if _DEBUG

static uint monitor[256];
static uint monitoredBytes;
static size_t monitoredBytes;
static uint monitoredPackets;
static size_t monitorMaxSize;

Expand Down
4 changes: 2 additions & 2 deletions doomsday/apps/client/src/render/rendersystem.cpp
Expand Up @@ -54,7 +54,7 @@ DENG2_PIMPL(RenderSystem)
Binder binder;
Record renderModule;

render::Environment environ;
render::Environment environment;
ModelRenderer models;
SkyDrawable sky;
SettingsRegister settings;
Expand Down Expand Up @@ -424,7 +424,7 @@ GLUniform const &RenderSystem::uMapTime() const

render::Environment &RenderSystem::environment()
{
return d->environ;
return d->environment;
}

ModelRenderer &RenderSystem::modelRenderer()
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/include/doomsday/filesys/file.h
Expand Up @@ -131,7 +131,7 @@ class LIBDOOMSDAY_PUBLIC File1
// Convenient lookup method for when only the size property is needed from info().
/// @return Size of the uncompressed resource.
inline uint size() const {
return info().size;
return uint(info().size);
}

// Convenient lookup method for when only the is-compressed property is needed from info().
Expand Down
2 changes: 1 addition & 1 deletion doomsday/apps/libdoomsday/include/doomsday/world/mobj.h
Expand Up @@ -24,7 +24,7 @@
#include "../players.h"

// This macro can be used to calculate a mobj-specific 'random' number.
#define MOBJ_TO_ID(mo) ( (long)(mo)->thinker.id * 48 + ((unsigned long)(mo)/1000) )
#define MOBJ_TO_ID(mo) ( (long)(mo)->thinker.id * 48 + (PTR2INT(mo)/1000) )

// Game plugins define their own mobj_s/t.
/// @todo Plugin mobjs should be derived from a class in libdoomsday, and
Expand Down
17 changes: 11 additions & 6 deletions doomsday/apps/plugins/directsound/CMakeLists.txt
Expand Up @@ -6,11 +6,16 @@ find_package (DirectX)
find_package (EAX)

if (TARGET EAX2)
include_directories (include)
file (GLOB SOURCES src/*.cpp include/*.h)
add_definitions (-DDENG_HAVE_EAX2)
else ()
message (STATUS "audio_directsound will be built *without* EAX2 support")
endif ()

include_directories (include)
file (GLOB SOURCES src/*.cpp include/*.h)

deng_add_plugin (audio_directsound ${SOURCES})
target_link_libraries (audio_directsound PRIVATE DirectX EAX2)
else ()
message (STATUS "audio_directsound will not be built because EAX2 is missing.")
deng_add_plugin (audio_directsound ${SOURCES})
target_link_libraries (audio_directsound PRIVATE DirectX)
if (TARGET EAX2)
target_link_libraries (audio_directsound PRIVATE EAX2)
endif ()
28 changes: 25 additions & 3 deletions doomsday/apps/plugins/directsound/src/driver_directsound.cpp
Expand Up @@ -40,7 +40,9 @@
#include <windows.h>
#include <mmsystem.h>
#include <dsound.h>
#include <eax.h>
#ifdef DENG_HAVE_EAX2
# include <eax.h>
#endif

#pragma warning (disable: 4035 4244)

Expand Down Expand Up @@ -154,6 +156,7 @@ static IDirectSound3DBuffer8* get3DBuffer(IDirectSoundBuffer8* buf8)
return buf3d;
}

#ifdef DENG_HAVE_EAX2
/**
* Does the EAX implementation support getting/setting of a propertry.
*
Expand All @@ -162,7 +165,7 @@ static IDirectSound3DBuffer8* get3DBuffer(IDirectSoundBuffer8* buf8)
*/
static dd_bool queryEAXSupport(int prop)
{
#define EAXSUP (KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET)
# define EAXSUP (KSPROPERTY_SUPPORT_GET | KSPROPERTY_SUPPORT_SET)

if(propertySet)
{
Expand All @@ -176,8 +179,9 @@ static dd_bool queryEAXSupport(int prop)

return false;

#undef EAXSUP
# undef EAXSUP
}
#endif

/**
* Init DirectSound, start playing the primary buffer.
Expand All @@ -189,6 +193,7 @@ int DS_Init(void)
#define NUMBUFFERS_HW_3D ((uint) dsoundCaps.dwFreeHw3DStreamingBuffers)
#define NUMBUFFERS_HW_2D ((uint) dsoundCaps.dwFreeHwMixingStreamingBuffers)

#ifdef DENG_HAVE_EAX2
typedef struct eaxproperty_s {
DSPROPERTY_EAX_LISTENERPROPERTY prop;
char* name;
Expand All @@ -202,6 +207,7 @@ int DS_Init(void)
{ DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR, "Room roll-off factor" },
{ DSPROPERTY_EAXLISTENER_NONE, NULL } // terminate.
};
#endif

DSBUFFERDESC desc;
DSCAPS dsoundCaps;
Expand Down Expand Up @@ -230,6 +236,7 @@ int DS_Init(void)

// First try to create the DirectSound8 object with EAX support.
hr = DSERR_GENERIC;
#ifdef DENG_HAVE_EAX2
if(useEAX)
{
if((hr = EAXDirectSoundCreate8(NULL, &dsound, NULL)) == DS_OK)
Expand All @@ -242,6 +249,7 @@ int DS_Init(void)
App_Log(DE2_AUDIO_VERBOSE, "[DirectSound] EAX could not be initialized (0x%x)", hr);
}
}
#endif

// Try plain old DS, then.
if(!haveInstance)
Expand Down Expand Up @@ -372,6 +380,7 @@ int DS_Init(void)
if(!(dummy3d = get3DBuffer(dummy)))
return false;

#ifdef DENG_HAVE_EAX2
// Query the property set interface
dummy3d->QueryInterface(IID_IKsPropertySet, (LPVOID*) &propertySet);
if(propertySet)
Expand All @@ -398,6 +407,7 @@ int DS_Init(void)
}
}
else
#endif
{
useEAX = false;

Expand All @@ -416,6 +426,7 @@ int DS_Init(void)
LogBuffer_Printf(DE2_LOG_AUDIO, " (%s)", useEAX? "enabled" : "disabled");
LogBuffer_Printf(DE2_LOG_AUDIO, "\n");

#ifdef DENG_HAVE_EAX2
if(eaxAvailable)
{
App_Log(DE2_LOG_AUDIO, " EAX Listner Environment:");
Expand All @@ -427,6 +438,7 @@ int DS_Init(void)
queryEAXSupport(p->prop)? "Present" : "Not available");
}
}
#endif

// Success!
App_Log(DE2_LOG_AUDIO | DE2_LOG_VERBOSE | DE2_LOG_DEV,
Expand Down Expand Up @@ -989,6 +1001,8 @@ static void listenerOrientation(float yaw, float pitch)
up[VX], up[VY], up[VZ], DS3D_DEFERRED);
}

#if DENG_HAVE_EAX2

/**
* Set the property as 'failed'. No more errors are reported for it.
*/
Expand Down Expand Up @@ -1115,6 +1129,8 @@ static void mulEAXf(DWORD prop, float mul, float min, float max)
setEAXf(prop, value);
}

#endif

/**
* Set a property of a listener.
*
Expand All @@ -1139,7 +1155,9 @@ Con_Error("dsDS9::DS_DSoundListener: Unknown prop %i.", prop);
case SFXLP_UPDATE:
// Commit any deferred settings.
dsListener->CommitDeferredSettings();
#ifdef DENG_HAVE_EAX2
commitEAXDeferred();
#endif
break;

case SFXLP_UNITS_PER_METER:
Expand All @@ -1152,6 +1170,7 @@ Con_Error("dsDS9::DS_DSoundListener: Unknown prop %i.", prop);
}
}

#ifdef DENG_HAVE_EAX2
static void commitEAXDeferred(void)
{
if(!propertySet)
Expand Down Expand Up @@ -1218,6 +1237,7 @@ static void listenerEnvironment(float* rev)
// A slightly increased roll-off.
setEAXf(DSPROPERTY_EAXLISTENER_ROOMROLLOFFFACTOR, 1.3f);
}
#endif

/**
* Call SFXLP_UPDATE at the end of every channel update.
Expand Down Expand Up @@ -1255,9 +1275,11 @@ void DS_SFX_Listenerv(int prop, float* values)
break;

case SFXLP_REVERB:
#ifdef DENG_HAVE_EAX2
if(!dsListener)
return;
listenerEnvironment(values);
#endif
break;

default:
Expand Down
9 changes: 2 additions & 7 deletions doomsday/cmake/Arch.cmake
@@ -1,14 +1,9 @@
if (NOT WIN32)
math (EXPR _bits "8*${CMAKE_SIZEOF_VOID_P}")
else ()
# Only 32-bit Windows builds supported.
set (_bits 32)
endif ()
math (EXPR _bits "8*${CMAKE_SIZEOF_VOID_P}")
set (ARCH_BITS "${_bits}" CACHE STRING "CPU architecture bits (32/64)")
set (_bits)

if (ARCH_BITS EQUAL 64)
add_definitions (-DDENG_64BIT_HOST)
add_definitions (-DDENG_64BIT_HOST -D__64BIT__)
if (WIN32)
set (DENG_ARCH x64)
else ()
Expand Down
8 changes: 4 additions & 4 deletions doomsday/cmake/FindDirectX.cmake
Expand Up @@ -3,19 +3,19 @@ if (WIN32 AND NOT TARGET DirectX)
PATHS ${DIRECTX_DIR}
HINTS ENV DXSDK_DIR
# TODO: look in the registry?
PATH_SUFFIXES Lib/x86 x86
PATH_SUFFIXES Lib/${DENG_ARCH} ${DENG_ARCH}
)
mark_as_advanced (DIRECTX_GUID_LIBRARY)
if (NOT DIRECTX_GUID_LIBRARY)
message (FATAL_ERROR "DirectX SDK not found. Set the DIRECTX_DIR variable.")
endif ()

get_filename_component (_libDir ${DIRECTX_GUID_LIBRARY} DIRECTORY)
get_filename_component (_incDir ${_libDir}/../../include REALPATH)

add_library (DirectX INTERFACE)
target_include_directories (DirectX INTERFACE ${_incDir})
target_link_libraries (DirectX INTERFACE
target_link_libraries (DirectX INTERFACE
${_libDir}/dinput8.lib
${_libDir}/dsound.lib
${DIRECTX_GUID_LIBRARY}
Expand Down
8 changes: 4 additions & 4 deletions doomsday/cmake/FindEAX.cmake
@@ -1,8 +1,8 @@
if (WIN32)
if (WIN32 AND (DENG_ARCH EQUAL 32))
set (_oldPath ${EAX2_LIBRARY})
find_library (EAX2_LIBRARY eax
find_library (EAX2_LIBRARY eax
PATHS ${EAX2_DIR} ENV DENG_DEPEND_PATH
PATH_SUFFIXES Libs "EAX 2.0 SDK/Libs"
PATH_SUFFIXES Libs "EAX 2.0 SDK/Libs"
)
mark_as_advanced (EAX2_LIBRARY)
if (NOT _oldPath STREQUAL EAX2_LIBRARY)
Expand All @@ -12,7 +12,7 @@ if (WIN32)
message (STATUS "Looking for EAX 2 - not found (set the EAX2_DIR variable)")
endif ()
endif ()

if (EAX2_LIBRARY AND NOT TARGET EAX2)
add_library (EAX2 INTERFACE)
get_filename_component (_libDir ${EAX2_LIBRARY} DIRECTORY)
Expand Down
10 changes: 7 additions & 3 deletions doomsday/cmake/FindFMOD.cmake
Expand Up @@ -28,8 +28,13 @@ if (FMOD_FMOD_H AND NOT TARGET fmodex)
set (fmodLib "${fmodApi}/lib/libfmodex.dylib")
set (fmodInstLib ${fmodLib})
elseif (MSVC)
set (fmodLib "${fmodApi}/lib/fmodex_vc.lib")
set (fmodInstLib "${fmodApi}/fmodex.dll")
if (ARCH_BITS EQUAL 64)
set (fmodLib "${fmodApi}/lib/fmodex64_vc.lib")
set (fmodInstLib "${fmodApi}/fmodex64.dll")
else ()
set (fmodLib "${fmodApi}/lib/fmodex_vc.lib")
set (fmodInstLib "${fmodApi}/fmodex.dll")
endif ()
elseif (UNIX)
if (ARCH_BITS EQUAL 64)
set (fmodLib ${fmodApi}/lib/libfmodex64.so)
Expand All @@ -41,4 +46,3 @@ if (FMOD_FMOD_H AND NOT TARGET fmodex)
target_link_libraries (fmodex INTERFACE ${fmodLib})
deng_install_library (${fmodInstLib})
endif ()

22 changes: 7 additions & 15 deletions doomsday/cmake/FindLZSS.cmake
Expand Up @@ -5,18 +5,10 @@ if (TARGET lzss)
return ()
endif ()

if (WIN32)
# Use the prebuilt library.
add_library (lzss INTERFACE)
target_include_directories (lzss INTERFACE "${DENG_LZSS_DIR}/portable/include")
target_link_libraries (lzss INTERFACE "${DENG_LZSS_DIR}/win32/lzss.lib")
deng_install_library ("${DENG_LZSS_DIR}/win32/lzss.dll")
else ()
add_library (lzss STATIC EXCLUDE_FROM_ALL ${DENG_LZSS_DIR}/unix/src/lzss.c)
target_include_directories (lzss PUBLIC "${DENG_LZSS_DIR}/portable/include")
target_link_libraries (lzss PRIVATE Deng::liblegacy)
set_target_properties (lzss PROPERTIES
AUTOMOC OFF
FOLDER Libraries
)
endif ()
add_library (lzss STATIC EXCLUDE_FROM_ALL ${DENG_LZSS_DIR}/src/lzss.c)
target_include_directories (lzss PUBLIC "${DENG_LZSS_DIR}/include")
target_link_libraries (lzss PRIVATE Deng::liblegacy)
set_target_properties (lzss PROPERTIES
AUTOMOC OFF
FOLDER Libraries
)

0 comments on commit dc69434

Please sign in to comment.