Cycles: first batch of windows build fixes, not quite there yet.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 3 May 2011 18:29:11 +0000 (18:29 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 3 May 2011 18:29:11 +0000 (18:29 +0000)
28 files changed:
intern/cycles/blender/CMakeLists.txt
intern/cycles/blender/blender_camera.cpp
intern/cycles/blender/blender_util.h
intern/cycles/bvh/bvh.cpp
intern/cycles/bvh/bvh.h
intern/cycles/bvh/bvh_build.cpp
intern/cycles/cmake/external_libs.cmake
intern/cycles/cmake/platforms.cmake
intern/cycles/device/CMakeLists.txt
intern/cycles/device/device_cuda.cpp
intern/cycles/kernel/kernel_film.h
intern/cycles/kernel/svm/svm_noise.h
intern/cycles/kernel/svm/svm_texture.h
intern/cycles/render/CMakeLists.txt
intern/cycles/render/buffers.h
intern/cycles/render/nodes.cpp
intern/cycles/render/object.h
intern/cycles/render/shader.h
intern/cycles/render/svm.h
intern/cycles/subd/subd_build.cpp
intern/cycles/subd/subd_split.cpp
intern/cycles/util/util_map.h
intern/cycles/util/util_math.h
intern/cycles/util/util_set.h
intern/cycles/util/util_types.h
intern/guardedalloc/MEM_guardedalloc.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/makesrna.c

index 096363e5d9fcbac01c88e854d515af8d268811d3..56d08b61b65d98bb90c051dc66769f1db597e4eb 100644 (file)
@@ -29,7 +29,8 @@ INCLUDE_DIRECTORIES(
        ../util
        ../subd
        ${BLENDER_INCLUDE_DIRS}
-       ${PYTHON_INCLUDE_DIRS})
+       ${PYTHON_INCLUDE_DIRS}
+       ${GLEW_INCLUDE_PATH})
 
 SET(LIBRARIES
        cycles_render
@@ -41,7 +42,6 @@ SET(LIBRARIES
        ${Boost_LIBRARIES}
        ${OPENGL_LIBRARIES}
        ${OPENIMAGEIO_LIBRARY}
-       ${PYTHON_LIBRARIES}
        ${GLUT_LIBRARIES}
        ${GLEW_LIBRARIES}
        ${BLENDER_LIBRARIES})
@@ -58,10 +58,21 @@ IF(WITH_CYCLES_OPENCL)
        LIST(APPEND LIBRARIES ${OPENCL_LIBRARIES})
 ENDIF()
 
+LINK_DIRECTORIES(${PYTHON_LIBPATH})
 SET(CMAKE_MODULE_LINKER_FLAGS ${PYTHON_MODULE_FLAGS})
 
 ADD_LIBRARY(cycles_blender MODULE ${sources} ${headers})
 ADD_DEPENDENCIES(cycles_blender bf_rna)
+
+IF(WIN32)
+       TARGET_LINK_LIBRARIES(cycles_blender ${PYTHON_LINKFLAGS})
+       TARGET_LINK_LIBRARIES(cycles_blender debug ${PYTHON_LIBRARY}_d)
+       TARGET_LINK_LIBRARIES(cycles_blender optimized ${PYTHON_LIBRARY})
+
+       SET_TARGET_PROPERTIES(cycles_blender PROPERTIES PREFIX "lib")
+       SET_TARGET_PROPERTIES(cycles_blender PROPERTIES SUFFIX ".pyd")
+ENDIF()
+
 TARGET_LINK_LIBRARIES(cycles_blender ${LIBRARIES})
 
 INSTALL(FILES ${addonfiles} DESTINATION ${CYCLES_INSTALL_PATH}/cycles)
@@ -71,3 +82,13 @@ IF(UNIX AND NOT APPLE)
        SET_TARGET_PROPERTIES(cycles_blender PROPERTIES INSTALL_RPATH $ORIGIN/lib)
 ENDIF()
 
+# Install DLL's
+
+IF(WIN32)
+       FILE(GLOB OIIO_DLLS "${CYCLES_OIIO}/bin/*.dll")
+       FILE(GLOB BOOST_DLLS "${CYCLES_BOOST}/lib/*.dll")
+       INSTALL(FILES ${OIIO_DLLS} ${BOOST_DLLS}
+               DESTINATION ${CYCLES_INSTALL_PATH}/cycles)
+ENDIF()
+
+
index cc4cfda8793341e4da0fdadc630e92204e38c3c3..530193247ae22d2cf389b92deb228c8bf82da3e9 100644 (file)
@@ -218,7 +218,7 @@ void BlenderSync::sync_view(BL::SpaceView3D b_v3d, BL::RegionView3D b_rv3d, int
                        blender_camera_from_object(&bcam, b_ob);
 
                        /* magic zoom formula */
-                       bcam.zoom = b_rv3d.view_camera_zoom();
+                       bcam.zoom = (float)b_rv3d.view_camera_zoom();
                        bcam.zoom = (1.41421f + bcam.zoom/50.0f);
                        bcam.zoom *= bcam.zoom;
                        bcam.zoom = 2.0f/bcam.zoom;
index 9da1c1dfe05ffe1801ae73b14f3c579856c84336..715dc7e6fb02f8b34ee0d380817a9abebf1dd9cb 100644 (file)
@@ -77,7 +77,7 @@ static inline void object_free_duplilist(BL::Object self)
 
 static inline bool object_is_modified(BL::Object self, BL::Scene scene, bool preview)
 {
-       return rna_Object_is_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1));
+       return rna_Object_is_modified(self.ptr.data, scene.ptr.data, (preview)? (1<<0): (1<<1))? true: false;
 }
 
 /* Utilities */
@@ -139,7 +139,7 @@ static inline uint get_layer(BL::Array<int, 20> array)
 
 static inline bool get_boolean(PointerRNA& ptr, const char *name)
 {
-       return RNA_boolean_get(&ptr, name);
+       return RNA_boolean_get(&ptr, name)? true: false;
 }
 
 static inline float get_float(PointerRNA& ptr, const char *name)
index ab230794774890cb16e146247939c9e50109fe7f..664bdd98b1f67b9779f141581178e4e47fed54b2 100644 (file)
@@ -467,7 +467,7 @@ void RegularBVH::refit_nodes()
        assert(!params.top_level);
 
        BoundBox bbox;
-       refit_node(0, pack.is_leaf[0], bbox);
+       refit_node(0, (pack.is_leaf[0])? true: false, bbox);
 }
 
 void RegularBVH::refit_node(int idx, bool leaf, BoundBox& bbox)
index acc25291da398d8c0f27d06c5fbcdc644b37342d..6b877594422539f0a877318cc906c34597681acf 100644 (file)
@@ -26,7 +26,7 @@
 CCL_NAMESPACE_BEGIN
 
 class BVHNode;
-class BVHStackEntry;
+struct BVHStackEntry;
 class BVHParams;
 class BoundBox;
 class CacheData;
index 6a9cc915f012b0270b8bdacffd1ec2d75a62d684..3e47cb75014e4b6169d402019ec986d70422f791 100644 (file)
@@ -359,8 +359,8 @@ BVHBuild::SpatialSplit BVHBuild::find_spatial_split(const NodeSpec& spec, float
                const Reference& ref = references[refIdx];
                float3 firstBinf = (ref.bounds.min - origin) * invBinSize;
                float3 lastBinf = (ref.bounds.max - origin) * invBinSize;
-               int3 firstBin = make_int3(firstBinf.x, firstBinf.y, firstBinf.z);
-               int3 lastBin = make_int3(lastBinf.x, lastBinf.y, lastBinf.z);
+               int3 firstBin = make_int3((int)firstBinf.x, (int)firstBinf.y, (int)firstBinf.z);
+               int3 lastBin = make_int3((int)lastBinf.x, (int)lastBinf.y, (int)lastBinf.z);
 
                firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1);
                lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1);
index 5d1ed868574599ad657e16545f5fb3ee0b2305e1..cfd997a6469b66ae07e7ac1bef9c816766221054 100644 (file)
@@ -8,9 +8,6 @@ SET(Boost_ADDITIONAL_VERSIONS "1.45" "1.44"
                                "1.41" "1.41.0" "1.40" "1.40.0"
                                "1.39" "1.39.0" "1.38" "1.38.0"
                                "1.37" "1.37.0" "1.34.1" "1_34_1")
-IF(LINKSTATIC)
-       SET(Boost_USE_STATIC_LIBS ON)
-ENDIF()
 
 SET(Boost_USE_MULTITHREADED ON)
 
@@ -25,6 +22,8 @@ MESSAGE(STATUS "Boost libraries ${Boost_LIBRARIES}")
 INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
 LINK_DIRECTORIES("${Boost_LIBRARY_DIRS}")
 
+ADD_DEFINITIONS(-DBOOST_ALL_NO_LIB)
+
 IF(WITH_CYCLES_NETWORK)
        ADD_DEFINITIONS(-DWITH_NETWORK)
 ENDIF()
@@ -126,8 +125,10 @@ IF(WITH_CYCLES_BLENDER)
                ${CMAKE_SOURCE_DIR}/source/blender/blenloader
                ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
        IF(WIN32)
-               SET(BLENDER_LIBRARIES ${CMAKE_BINARY_DIR}/bin/Release/blender.lib)
+               SET(BLENDER_LIBRARIES ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/blender.lib)
        ENDIF()
+
+       ADD_DEFINITIONS(-DBLENDER_PLUGIN)
 ENDIF()
 
 ###########################################################################
index 075b4761a85199dfd7f78da25a9232bbf16dd86d..659fd5dcad34a1917200b04deb0ce9979af48cbe 100644 (file)
@@ -11,7 +11,7 @@ IF(APPLE)
 ENDIF(APPLE)
 
 IF(WIN32)
-       SET(CMAKE_CXX_FLAGS "-D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast")
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS /EHsc /fp:fast")
        SET(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
        SET(PYTHON_MODULE_FLAGS "-DLL")
 ENDIF(WIN32)
index 0885cd6fc204f76ace4e3bb4168b12bc0f22c18e..712351b9558d7f123e7e9d082f6926e2eea7767e 100644 (file)
@@ -7,7 +7,7 @@ INCLUDE_DIRECTORIES(
        ../util
        ../render
        ${OPENGL_INCLUDE_DIR}
-       ${GLEW_INCLUDE_DIR})
+       ${GLEW_INCLUDE_PATH})
 
 SET(sources
        device.cpp
index 76692ba86571626d409286b82d669b05c28f1dac..0537e231f444b0a9a8675dba89528f3cf0d72e1e 100644 (file)
@@ -356,7 +356,8 @@ public:
                cuda_assert(cuParamSetv(cuPathTrace, offset, &d_rng_state, sizeof(d_rng_state)))
                offset += sizeof(d_rng_state);
 
-               offset = cuda_align_up(offset, __alignof(task.pass));
+               int pass = task.pass;
+               offset = cuda_align_up(offset, __alignof(pass));
 
                cuda_assert(cuParamSeti(cuPathTrace, offset, task.pass))
                offset += sizeof(task.pass);
@@ -413,7 +414,8 @@ public:
                cuda_assert(cuParamSetv(cuFilmConvert, offset, &d_buffer, sizeof(d_buffer)))
                offset += sizeof(d_buffer);
 
-               offset = cuda_align_up(offset, __alignof(task.pass));
+               int pass = task.pass;
+               offset = cuda_align_up(offset, __alignof(pass));
 
                cuda_assert(cuParamSeti(cuFilmConvert, offset, task.pass))
                offset += sizeof(task.pass);
@@ -475,7 +477,8 @@ public:
                cuda_assert(cuParamSetv(cuDisplace, offset, &d_offset, sizeof(d_offset)))
                offset += sizeof(d_offset);
 
-               offset = cuda_align_up(offset, __alignof(task.displace_x));
+               int displace_x = task.displace_x;
+               offset = cuda_align_up(offset, __alignof(displace_x));
 
                cuda_assert(cuParamSeti(cuDisplace, offset, task.displace_x))
                offset += sizeof(task.displace_x);
@@ -621,18 +624,18 @@ public:
                        glColor3f(1.0f, 1.0f, 1.0f);
 
                        glPushMatrix();
-                       glTranslatef(0y, 0.0f);
+                       glTranslatef(0.0f, (float)y, 0.0f);
                        
                        glBegin(GL_QUADS);
                        
-                       glTexCoord2f(0, 0);
-                       glVertex2f(0, 0);
+                       glTexCoord2f(0.0f, 0.0f);
+                       glVertex2f(0.0f, 0.0f);
                        glTexCoord2f((float)w/(float)width, 0);
-                       glVertex2f(width, 0);
+                       glVertex2f((float)width, 0.0f);
                        glTexCoord2f((float)w/(float)width, (float)h/(float)height);
-                       glVertex2f(width, height);
-                       glTexCoord2f(0, (float)h/(float)height);
-                       glVertex2f(0height);
+                       glVertex2f((float)width, (float)height);
+                       glTexCoord2f(0.0f, (float)h/(float)height);
+                       glVertex2f(0.0f, (float)height);
 
                        glEnd();
 
index 04ea889f4c0662257011612e0f0060d73fb1325b..0bbd6c202a1840c2d6fd8bd2f99a1176164c3115 100644 (file)
@@ -44,9 +44,9 @@ __device uchar4 film_float_to_byte(float4 color)
        uchar4 result;
 
        /* simple float to byte conversion */
-       result.x = clamp(color.x*255.0f, 0.0f, 255.0f);
-       result.y = clamp(color.y*255.0f, 0.0f, 255.0f);
-       result.z = clamp(color.z*255.0f, 0.0f, 255.0f);
+       result.x = (uchar)clamp(color.x*255.0f, 0.0f, 255.0f);
+       result.y = (uchar)clamp(color.y*255.0f, 0.0f, 255.0f);
+       result.z = (uchar)clamp(color.z*255.0f, 0.0f, 255.0f);
        result.w = 255;
 
        return result;
index 745744e142c0c590faba4b034117d0028e17ba2c..f41caa99772d19052c772db3d3e325cd4728327f 100644 (file)
@@ -143,9 +143,9 @@ __device float perlin_periodic(float x, float y, float z, float3 pperiod)
 
        int3 p;
 
-       p.x = fmaxf(quick_floor(pperiod.x), 1);
-       p.y = fmaxf(quick_floor(pperiod.y), 1);
-       p.z = fmaxf(quick_floor(pperiod.z), 1);
+       p.x = max(quick_floor(pperiod.x), 1);
+       p.y = max(quick_floor(pperiod.y), 1);
+       p.z = max(quick_floor(pperiod.z), 1);
 
        float u = fade(fx);
        float v = fade(fy);
index c5f71c0d5bde02e31f294a9d23aa009bee6e63a9..c5ded6d975f961c29e4f8bb0f9973b0c9281b82f 100644 (file)
@@ -64,12 +64,12 @@ __device void voronoi(float3 p, NodeDistanceMetric distance_metric, float e, flo
        for(xx = xi-1; xx <= xi+1; xx++) {
                for(yy = yi-1; yy <= yi+1; yy++) {
                        for(zz = zi-1; zz <= zi+1; zz++) {
-                               float3 ip = make_float3(xx, yy, zz);
+                               float3 ip = make_float3((float)xx, (float)yy, (float)zz);
                                float3 vp = cellnoise_color(ip);
                                float3 pd = p - (vp + ip);
                                float d = voronoi_distance(distance_metric, pd, e);
 
-                               vp += make_float3(xx, yy, zz);
+                               vp += make_float3((float)xx, (float)yy, (float)zz);
 
                                if(d < da[0]) {
                                        da[3] = da[2];
index f2342c9032a76da474ec968b197e947f48ab860f..9a0583c48aa7fc7e69dd15498cf2ec2cb8b4da36 100644 (file)
@@ -1,5 +1,13 @@
 
-INCLUDE_DIRECTORIES(. ../device ../kernel ../kernel/svm ../kernel/osl ../bvh ../util)
+INCLUDE_DIRECTORIES(
+       .
+       ../device
+       ../kernel
+       ../kernel/svm
+       ../kernel/osl
+       ../bvh
+       ../util
+       ${GLEW_INCLUDE_PATH})
 
 SET(sources
        attribute.cpp
index f31ddd1e9bd5e698b1de6b00cafa4ee1f9ed1a8a..1922f875d86d1f5718bc6296eacbcfe33744b58b 100644 (file)
@@ -28,7 +28,7 @@
 CCL_NAMESPACE_BEGIN
 
 class Device;
-class float4;
+struct float4;
 
 /* Render Buffers */
 
index 42cadb8faa7b8d6be81def930bf333e3800a0eb3..ea1b794b1763518e0d4b6fd7810785fe84d13359 100644 (file)
@@ -990,8 +990,8 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *
 
        compiler.add_node(NODE_CLOSURE_BSDF,
                closure,
-               (param1)? __float_as_int(param1->value.x): 0.0f,
-               (param2)? __float_as_int(param2->value.x): 0.0f);
+               __float_as_int((param1)? param1->value.x: 0.0f),
+               __float_as_int((param2)? param2->value.x: 0.0f));
 }
 
 void BsdfNode::compile(SVMCompiler& compiler)
index ff92b381063270ffac5896514195298ac807f81a..7a12a06853b76a64261cffaab269e807cbff9294 100644 (file)
@@ -31,7 +31,7 @@ class DeviceScene;
 class Mesh;
 class Progress;
 class Scene;
-class Transform;
+struct Transform;
 
 /* Object */
 
index 0712100b3e789a6d90b9fa1c261926019895e5f3..cc8bc473a3f1364e708b3e6b934423fca34147d4 100644 (file)
@@ -35,7 +35,7 @@ class Mesh;
 class Progress;
 class Scene;
 class ShaderGraph;
-class float3;
+struct float3;
 
 /* Shader describing the appearance of a Mesh, Light or Background.
  *
index 346d2a73801d6a20270b5328cd58a25e5d5964f9..f76649e4a6f67ff8ab613ae5c11831b875f59dab 100644 (file)
@@ -30,7 +30,7 @@ CCL_NAMESPACE_BEGIN
 class Device;
 class DeviceScene;
 class ImageManager;
-class KernelSunSky;
+struct KernelSunSky;
 class Scene;
 class ShaderGraph;
 class ShaderInput;
index 4c2a62990141a5dccba6b7e2d25ff51d00085b4d..640c30eba9d4b1ed04be12e1e3318931e23fade0 100644 (file)
@@ -228,7 +228,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
                        computeBoundaryTangentStencils(ring, vert, r0, r1);
 
                        int k = valence - 1;
-                       float omega = M_PI / k;
+                       float omega = M_PI_F / k;
 
                        int eid1 = edge1Indices[primitiveOffset + v];
                        int eid2 = edge2Indices[primitiveOffset + v];
@@ -298,7 +298,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
                        }
                }
                else {
-                       float costerm = cosf(M_PI / valence);
+                       float costerm = cosf(M_PI_F / valence);
                        float sqrtterm = sqrtf(4.0f + costerm*costerm);
 
                        /* float tangentScale = 1.0f; */
@@ -319,11 +319,11 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
                                SubdEdge *edge = eit.current();
                                assert(vert->co == edge->from()->co);
 
-                               float costerm1_a = cosf(M_PI * 2 * (j-i1) / valence);
-                               float costerm1_b = cosf(M_PI * (2 * (j-i1)-1) / valence); /* -1 instead of +1 b/c of edge->next->to() */
+                               float costerm1_a = cosf(M_PI_F * 2 * (j-i1) / valence);
+                               float costerm1_b = cosf(M_PI_F * (2 * (j-i1)-1) / valence); /* -1 instead of +1 b/c of edge->next->to() */
 
-                               float costerm2_a = cosf(M_PI * 2 * (j-i2) / valence);
-                               float costerm2_b = cosf(M_PI * (2 * (j-i2)-1) / valence); /* -1 instead of +1 b/c of edge->next->to() */
+                               float costerm2_a = cosf(M_PI_F * 2 * (j-i2) / valence);
+                               float costerm2_b = cosf(M_PI_F * (2 * (j-i2)-1) / valence); /* -1 instead of +1 b/c of edge->next->to() */
 
 
                                stencil->get(eid1, edge->to()) += alpha * costerm1_a;
@@ -413,10 +413,10 @@ void SubdAccBuilder::computeInteriorStencil(SubdFaceRing *ring, GregoryAccStenci
                }
                else {
                        SubdVert *e0 = edge->from();
-                       float costerm0 = cosf(2.0f * M_PI / pseudoValence(e0));
+                       float costerm0 = cosf(2.0f * M_PI_F / pseudoValence(e0));
 
                        SubdVert *f0 = edge->to();
-                       float costerm1 = cosf(2.0f * M_PI / pseudoValence(f0));
+                       float costerm1 = cosf(2.0f * M_PI_F / pseudoValence(f0));
 
                        /*  p0 +------+ q0
                         *       |        |
@@ -566,7 +566,7 @@ void SubdAccBuilder::computeBoundaryTangentStencils(SubdFaceRing *ring, SubdVert
        int valence = vert->valence();
 
        int k = valence - 1;
-       float omega = M_PI / k;
+       float omega = M_PI_F / k;
        float s = sinf(omega);
        float c = cosf(omega);
 
index 712bd041e6470362074450727423ceb26f4c8e5c..d61a42e4dcf0600fcb048539e755f6d6430b61ac 100644 (file)
@@ -82,8 +82,8 @@ int DiagSplit::T(Patch *patch, float2 Pstart, float2 Pend)
                Plast = P;
        }
 
-       int tmin = ceil(Lsum/dicing_rate);
-       int tmax = ceil((test_steps-1)*Lmax/dicing_rate); // XXX paper says N instead of N-1, seems wrong?
+       int tmin = (int)ceil(Lsum/dicing_rate);
+       int tmax = (int)ceil((test_steps-1)*Lmax/dicing_rate); // XXX paper says N instead of N-1, seems wrong?
 
        if(tmax - tmin > split_threshold)
                return DSPLIT_NON_UNIFORM;
index 884f45c3b275d1c2038e7d955818e854a6755745..f0abe70f785c955a65fa93ec866adcbdfbb95098 100644 (file)
@@ -20,7 +20,7 @@
 #define __UTIL_MAP_H__
 
 #include <map>
-#include <tr1/unordered_map>
+#include <boost/tr1/unordered_map.hpp>
 
 CCL_NAMESPACE_BEGIN
 
index 26d6d429b7a749d5272c2ea08686e17e8c1d207c..0ab06f947011b9dc224cdd9339f00e8a70252d54 100644 (file)
@@ -48,7 +48,8 @@ CCL_NAMESPACE_BEGIN
 
 #ifdef _WIN32
 
-#define copysignf _copysign
+#define copysignf(x, y) ((float)_copysign(x, y))
+#define hypotf(x, y) _hypotf(x, y)
 
 __device_inline float fmaxf(float a, float b)
 {
index ac310e93e80f967a4012f64747a4f1ae8c2b4767..8904063dd86912316793a3aa836c4e8b0a751622 100644 (file)
@@ -20,7 +20,7 @@
 #define __UTIL_SET_H__
 
 #include <set>
-#include <tr1/unordered_set>
+#include <boost/tr1/unordered_set.hpp>
 
 CCL_NAMESPACE_BEGIN
 
index a0e352128d1498b5204a4f2170bd3707f1a7acd3..bc7ba0563903457214befa8b60fcb478e433ef29 100644 (file)
 #define __local
 #define __shared
 #define __constant
+
+#ifdef __GNUC__
 #define __device_inline static inline __attribute__((always_inline))
+#else
+#define __device_inline static __forceinline
+#endif
 
 #endif
 
index 1bc7f7c59dd529eb72cac1b0211fce78f6dbfbd1..a4beea6d8d5615141f1a59f5017fa3768751ecb8 100644 (file)
 
 #ifndef LIBEXPORT
 #ifdef _WIN32
+#ifdef BLENDER_PLUGIN
+#define LIBEXPORT __declspec(dllimport)
+#else
 #define LIBEXPORT __declspec(dllexport)
+#endif
 #else
 #define LIBEXPORT
 #endif
index 63cc0bb737ce315abee52ab4fd999c491ae8b277..229d0fdb0200badc9740219d7ea8750c9814b545 100644 (file)
 extern "C" {
 #endif
 
+#ifndef LIBEXPORT
 #ifdef _WIN32
+#ifdef BLENDER_PLUGIN
+#define LIBEXPORT __declspec(dllimport)
+#else
 #define LIBEXPORT __declspec(dllexport)
+#endif
 #else
 #define LIBEXPORT
 #endif
+#endif
 
 struct ParameterList;
 struct FunctionRNA;
index e056c545eadffc88c1ba09b9436b5f66d50b36e7..49f2969f72d238a2b0e6941cb81096f642d4f92d 100644 (file)
@@ -2450,11 +2450,17 @@ static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const
                                 "   Do not edit manually, changes will be overwritten.           */\n\n"
                                  "#define RNA_RUNTIME\n\n");
 
+       fprintf(f, "#ifndef LIBEXPORT\n");
        fprintf(f, "#ifdef _WIN32\n");
+       fprintf(f, "#ifdef BLENDER_PLUGIN\n");
+       fprintf(f, "#define LIBEXPORT __declspec(dllimport)\n");
+       fprintf(f, "#else\n");
        fprintf(f, "#define LIBEXPORT __declspec(dllexport)\n");
+       fprintf(f, "#endif\n");
        fprintf(f, "#else\n");
        fprintf(f, "#define LIBEXPORT\n");
-       fprintf(f, "#endif\n\n");
+       fprintf(f, "#endif\n");
+       fprintf(f, "#endif\n");
 
        fprintf(f, "#include <float.h>\n");
        fprintf(f, "#include <stdio.h>\n");
@@ -2580,7 +2586,7 @@ static const char *cpp_classes = ""
 "namespace BL {\n"
 "\n"
 "#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
-"      inline bool sname::identifier(void) { return (bool)sname##_##identifier##_get(&ptr); }\n"
+"      inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr)? true: false; }\n"
 "\n"
 "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
 "      inline Array<int,size> sname::identifier(void) \\\n"
@@ -2622,7 +2628,7 @@ static const char *cpp_classes = ""
 "public:\n"
 "      Pointer(const PointerRNA& p) : ptr(p) { }\n"
 "      operator const PointerRNA&() { return ptr; }\n"
-"      bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type); }\n"
+"      bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type)? true: false; }\n"
 "      operator void*() { return ptr.data; }\n"
 "      operator bool() { return ptr.data != NULL; }\n"
 "\n"