windows compilation fixes

metadata
Wenzel Jakob 2013-01-28 17:24:33 -08:00
parent 62851d28a4
commit 568baf1c89
9 changed files with 43 additions and 22 deletions

View File

@ -23,6 +23,9 @@
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN
struct AABB; struct AABB;
class AbstractAnimationTrack;
template <typename T> class AnimationTrack;
class AnimatedTransform;
class Appender; class Appender;
class Bitmap; class Bitmap;
class BlackBodySpectrum; class BlackBodySpectrum;
@ -163,6 +166,11 @@ class WorkResult;
class WorkUnit; class WorkUnit;
class ZStream; class ZStream;
typedef AnimationTrack<Float> FloatTrack;
typedef AnimationTrack<Quaternion> QuatTrack;
typedef AnimationTrack<Vector> VectorTrack;
typedef AnimationTrack<Point> PointTrack;
MTS_NAMESPACE_END MTS_NAMESPACE_END
#if BOOST_VERSION >= 105000 #if BOOST_VERSION >= 105000

View File

@ -196,7 +196,7 @@ MTS_NAMESPACE_END
/// \cond /// \cond
// Try to make MSVC++ behave a bit more like C++ // Try to make MSVC++ behave a bit more like C++
// with an underlying C99 implementation // with an underlying C99 implementation
// (and dn't include this in the documentation) // (and don't include this in the documentation)
#if defined(_MSC_VER) #if defined(_MSC_VER)
#include <float.h> #include <float.h>
@ -204,8 +204,13 @@ MTS_NAMESPACE_END
#define snprintf _snprintf #define snprintf _snprintf
#define vsnprintf _vsnprintf #define vsnprintf _vsnprintf
namespace std { #if defined(__64BIT__)
typedef long long ssize_t;
#else
typedef long ssize_t;
#endif
namespace std {
inline char tolower(char c) { inline char tolower(char c) {
return ::tolower(c); return ::tolower(c);
} }

View File

@ -324,7 +324,7 @@ template<> inline void AnimationTrack<Quaternion>::serialize(Stream *stream, con
class MTS_EXPORT_CORE AnimatedTransform : public Object { class MTS_EXPORT_CORE AnimatedTransform : public Object {
private: private:
/// Internal functor used by \ref eval() and \ref SimpleCache /// Internal functor used by \ref eval() and \ref SimpleCache
struct MTS_EXPORT_RENDER TransformFunctor { struct MTS_EXPORT_CORE TransformFunctor {
public: public:
inline TransformFunctor(const std::vector<AbstractAnimationTrack *> &tracks) inline TransformFunctor(const std::vector<AbstractAnimationTrack *> &tracks)
: m_tracks(tracks) {} : m_tracks(tracks) {}

View File

@ -22,13 +22,6 @@
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN
class AbstractAnimationTrack;
template <typename T> class AnimationTrack;
typedef AnimationTrack<Float> FloatTrack;
typedef AnimationTrack<Quaternion> QuatTrack;
typedef AnimationTrack<Vector> VectorTrack;
typedef AnimationTrack<Point> PointTrack;
class AnimatedTransform;
class BlockedImageProcess; class BlockedImageProcess;
class BlockedRenderProcess; class BlockedRenderProcess;
class BlockListener; class BlockListener;

View File

@ -145,7 +145,7 @@ set(LIBS ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARIES}
${ILMBASE_LIBRARIES} ${OPENEXR_LIBRARIES} ${ILMBASE_LIBRARIES} ${OPENEXR_LIBRARIES}
${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS}) ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${CMAKE_DL_LIBS})
if(WIN32) if(WIN32)
list(APPEND LIBS ws2_32) list(APPEND LIBS ws2_32 psapi)
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND LIBS rt) list(APPEND LIBS rt)
elseif (APPLE) elseif (APPLE)

View File

@ -24,6 +24,11 @@ if coreEnv.has_key('JPEGLIB'):
coreEnv.Prepend(LIBS=env['JPEGLIB']) coreEnv.Prepend(LIBS=env['JPEGLIB'])
coreEnv.Prepend(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_CORE']]) coreEnv.Prepend(CPPDEFINES = [['MTS_BUILD_MODULE', 'MTS_MODULE_CORE']])
if sys.platform == 'win32':
coreEnv.Append(LIBS=['psapi'])
libcore_objects = [ libcore_objects = [
'class.cpp', 'object.cpp', 'statistics.cpp', 'thread.cpp', 'brent.cpp', 'class.cpp', 'object.cpp', 'statistics.cpp', 'thread.cpp', 'brent.cpp',
'logger.cpp', 'appender.cpp', 'formatter.cpp', 'lock.cpp', 'qmc.cpp', 'logger.cpp', 'appender.cpp', 'formatter.cpp', 'lock.cpp', 'qmc.cpp',

View File

@ -191,15 +191,20 @@ template <typename T> struct FormatConverterImpl : public FormatConverter {
case Bitmap::EXYZ: case Bitmap::EXYZ:
for (size_t i=0; i<count; ++i) { for (size_t i=0; i<count; ++i) {
DestFormat value = convertScalar<DestFormat>(*source++, sourceGamma, precomp, multiplier, invDestGamma); Float value = convertScalar<Float>(*source++, sourceGamma);
*dest++ = 0.950456f*value; *dest++ = value; *dest++ = 1.08875f*value; *dest++ = convertScalar<DestFormat>(value * 0.950456f, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value * 1.08875f, 1.0f, NULL, multiplier, invDestGamma);
} }
break; break;
case Bitmap::EXYZA: case Bitmap::EXYZA:
for (size_t i=0; i<count; ++i) { for (size_t i=0; i<count; ++i) {
DestFormat value = convertScalar<DestFormat>(*source++, sourceGamma, precomp, multiplier, invDestGamma); Float value = convertScalar<Float>(*source++, sourceGamma);
*dest++ = 0.950456f*value; *dest++ = value; *dest++ = 1.08875f*value; *dest++ = one; *dest++ = convertScalar<DestFormat>(value * 0.950456f, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value * 1.08875f, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = one;
} }
break; break;
@ -269,16 +274,20 @@ template <typename T> struct FormatConverterImpl : public FormatConverter {
case Bitmap::EXYZ: case Bitmap::EXYZ:
for (size_t i=0; i<count; ++i) { for (size_t i=0; i<count; ++i) {
DestFormat value = convertScalar<DestFormat>(*source++, sourceGamma, precomp, multiplier, invDestGamma); Float value = convertScalar<Float>(*source++, sourceGamma);
*dest++ = 0.950456f*value; *dest++ = value; *dest++ = 1.08875f*value; *dest++ = convertScalar<DestFormat>(value * 0.950456f, 1.0f, NULL, multiplier, invDestGamma);
source++; *dest++ = convertScalar<DestFormat>(value, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value * 1.08875f, 1.0f, NULL, multiplier, invDestGamma);
*source++;
} }
break; break;
case Bitmap::EXYZA: case Bitmap::EXYZA:
for (size_t i=0; i<count; ++i) { for (size_t i=0; i<count; ++i) {
DestFormat value = convertScalar<DestFormat>(*source++, sourceGamma, precomp, multiplier, invDestGamma); Float value = convertScalar<Float>(*source++, sourceGamma);
*dest++ = 0.950456f*value; *dest++ = value; *dest++ = 1.08875f*value; *dest++ = convertScalar<DestFormat>(value * 0.950456f, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(value * 1.08875f, 1.0f, NULL, multiplier, invDestGamma);
*dest++ = convertScalar<DestFormat>(*source++); *dest++ = convertScalar<DestFormat>(*source++);
} }
break; break;

View File

@ -258,7 +258,7 @@ void AnimatedTransform::collectKeyframes(std::set<Float> &result) const {
} }
if (result.size() == 0) if (result.size() == 0)
result.insert(0); result.insert((Float) 0);
} }
void AnimatedTransform::serialize(Stream *stream) const { void AnimatedTransform::serialize(Stream *stream) const {

View File

@ -30,6 +30,7 @@
#include <sys/sysctl.h> #include <sys/sysctl.h>
#include <mach/mach.h> #include <mach/mach.h>
#elif defined(__WINDOWS__) #elif defined(__WINDOWS__)
#include <windows.h>
#include <direct.h> #include <direct.h>
#include <psapi.h> #include <psapi.h>
#else #else
@ -174,7 +175,7 @@ int getCoreCount() {
size_t getPrivateMemoryUsage() { size_t getPrivateMemoryUsage() {
#if defined(__WINDOWS__) #if defined(__WINDOWS__)
PROCESS_MEMORY_COUNTERS_EX pmc; PROCESS_MEMORY_COUNTERS_EX pmc;
GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc)); GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS *) &pmc, sizeof(pmc));
return (size_t) pmc.PrivateUsage; /* Process-private memory usage (RAM + swap) */ return (size_t) pmc.PrivateUsage; /* Process-private memory usage (RAM + swap) */
#elif defined(__OSX__) #elif defined(__OSX__)
struct task_basic_info_64 t_info; struct task_basic_info_64 t_info;