Compile fixes for MinGW, checked with basic initial setup, no CUDA, gcc 4.5.2.
authorAntony Riakiotakis <kalast@gmail.com>
Sun, 4 Sep 2011 15:39:09 +0000 (15:39 +0000)
committerAntony Riakiotakis <kalast@gmail.com>
Sun, 4 Sep 2011 15:39:09 +0000 (15:39 +0000)
OpenImageIO still gives link-time errors, will try to make a lib for MinGW, see if it is fixed.

CMakeLists.txt
intern/cycles/CMakeLists.txt
intern/cycles/util/util_math.h
intern/cycles/util/util_system.cpp

index b57d58258cf111f1c0f22264e657bde90debe341..cb41d4d344cb097d2be0d59478e2dc6bc9de7d5a 100644 (file)
@@ -975,6 +975,28 @@ elseif(WIN32)
                        set(PYTHON_LIBRARIES  "${PYTHON_LIBRARY}")
                endif()
 
+               if(WITH_BOOST)
+                       set(BOOST ${LIBDIR}/boost)
+                       set(BOOST_INCLUDE_DIR ${BOOST}/include)
+                       set(BOOST_POSTFIX "vc90-mt-s-1_46_1")
+                       set(BOOST_DEBUG_POSTFIX "vc90-mt-sgd-1_46_1")
+                       set(BOOST_LIBRARIES
+                               optimized libboost_date_time-${BOOST_POSTFIX} libboost_filesystem-${BOOST_POSTFIX}
+                               libboost_regex-${BOOST_POSTFIX} libboost_system-${BOOST_POSTFIX} libboost_thread-${BOOST_POSTFIX}
+                               debug libboost_date_time-${BOOST_DEBUG_POSTFIX} libboost_filesystem-${BOOST_DEBUG_POSTFIX}
+                               libboost_regex-${BOOST_DEBUG_POSTFIX} libboost_system-${BOOST_DEBUG_POSTFIX} libboost_thread-${BOOST_DEBUG_POSTFIX})
+                       set(BOOST_LIBPATH ${BOOST}/lib)
+                       set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
+               endif()
+                       
+               if(WITH_OPENIMAGEIO)
+                       set(OPENIMAGEIO ${LIBDIR}/openimageio)
+                       set(OPENIMAGEIO_INCLUDE_DIR ${OPENIMAGEIO}/include)
+                       set(OPENIMAGEIO_LIBRARY OpenImageIO)
+                       set(OPENIMAGEIO_LIBPATH ${OPENIMAGEIO}/lib)
+                       set(OPENIMAGEIO_DEFINITIONS)
+               endif()
+
                set(PLATFORM_LINKFLAGS "--stack,2097152")
 
        endif()
index fd501b85be9c7573c4060e3ba5990670b6e5a937..5d76f57fa73ca5287efd8235c95c166c267fb25c 100644 (file)
@@ -16,8 +16,13 @@ if(APPLE)
 endif(APPLE)
 
 if(WIN32)
-       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast")
-       set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+       if(MSVC)
+               set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Ox /Ot /arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast")
+               set(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+       elseif(CMAKE_COMPILER_IS_GNUCC)
+               set(CMAKE_CXX_FLAGS "${GCC_WARNING_FLAGS} ${GCC_OPTIM_FLAGS}")
+               set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
+       endif()
 endif(WIN32)
 
 if(UNIX AND NOT APPLE)
index 8e52b98d52bdc71cb24408e0e9ace162818a69cf..ceebada9293f05b3ce2ce3817ddbe7715034140e 100644 (file)
@@ -60,8 +60,10 @@ CCL_NAMESPACE_BEGIN
 
 #ifndef __KERNEL_GPU__
 
+#if(!defined(FREE_WINDOWS))
 #define copysignf(x, y) ((float)_copysign(x, y))
 #define hypotf(x, y) _hypotf(x, y)
+#endif
 
 #endif
 
index ac3089aa7ad7b8f2ea60f78301405a520af2c71d..77a1b1ffb75b0462b3ead1e61325038b75f83224 100644 (file)
@@ -20,7 +20,9 @@
 #include "util_types.h"
 
 #ifdef _WIN32
+#if(!defined(FREE_WINDOWS))
 #include <intrin.h>
+#endif
 #include <windows.h>
 #elif defined(__APPLE__)
 #include <sys/sysctl.h>
@@ -57,7 +59,7 @@ int system_cpu_thread_count()
        return count;
 }
 
-#ifndef _WIN32
+#if !defined(_WIN32) || defined(FREE_WINDOWS)
 static void __cpuid(int data[4], int selector)
 {
 #ifdef __x86_64__