Cycles: first batch of windows build fixes, not quite there yet.

This commit is contained in:
Brecht Van Lommel
2011-05-03 18:29:11 +00:00
parent 170f8c8c41
commit 2996f08f84
28 changed files with 112 additions and 57 deletions

View File

@@ -29,7 +29,8 @@ INCLUDE_DIRECTORIES(
../util ../util
../subd ../subd
${BLENDER_INCLUDE_DIRS} ${BLENDER_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS}) ${PYTHON_INCLUDE_DIRS}
${GLEW_INCLUDE_PATH})
SET(LIBRARIES SET(LIBRARIES
cycles_render cycles_render
@@ -41,7 +42,6 @@ SET(LIBRARIES
${Boost_LIBRARIES} ${Boost_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${OPENIMAGEIO_LIBRARY} ${OPENIMAGEIO_LIBRARY}
${PYTHON_LIBRARIES}
${GLUT_LIBRARIES} ${GLUT_LIBRARIES}
${GLEW_LIBRARIES} ${GLEW_LIBRARIES}
${BLENDER_LIBRARIES}) ${BLENDER_LIBRARIES})
@@ -58,10 +58,21 @@ IF(WITH_CYCLES_OPENCL)
LIST(APPEND LIBRARIES ${OPENCL_LIBRARIES}) LIST(APPEND LIBRARIES ${OPENCL_LIBRARIES})
ENDIF() ENDIF()
LINK_DIRECTORIES(${PYTHON_LIBPATH})
SET(CMAKE_MODULE_LINKER_FLAGS ${PYTHON_MODULE_FLAGS}) SET(CMAKE_MODULE_LINKER_FLAGS ${PYTHON_MODULE_FLAGS})
ADD_LIBRARY(cycles_blender MODULE ${sources} ${headers}) ADD_LIBRARY(cycles_blender MODULE ${sources} ${headers})
ADD_DEPENDENCIES(cycles_blender bf_rna) 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}) TARGET_LINK_LIBRARIES(cycles_blender ${LIBRARIES})
INSTALL(FILES ${addonfiles} DESTINATION ${CYCLES_INSTALL_PATH}/cycles) 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) SET_TARGET_PROPERTIES(cycles_blender PROPERTIES INSTALL_RPATH $ORIGIN/lib)
ENDIF() 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()

View 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); blender_camera_from_object(&bcam, b_ob);
/* magic zoom formula */ /* 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 = (1.41421f + bcam.zoom/50.0f);
bcam.zoom *= bcam.zoom; bcam.zoom *= bcam.zoom;
bcam.zoom = 2.0f/bcam.zoom; bcam.zoom = 2.0f/bcam.zoom;

View 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) 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 */ /* 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) 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) static inline float get_float(PointerRNA& ptr, const char *name)

View File

@@ -467,7 +467,7 @@ void RegularBVH::refit_nodes()
assert(!params.top_level); assert(!params.top_level);
BoundBox bbox; 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) void RegularBVH::refit_node(int idx, bool leaf, BoundBox& bbox)

View File

@@ -26,7 +26,7 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
class BVHNode; class BVHNode;
class BVHStackEntry; struct BVHStackEntry;
class BVHParams; class BVHParams;
class BoundBox; class BoundBox;
class CacheData; class CacheData;

View File

@@ -359,8 +359,8 @@ BVHBuild::SpatialSplit BVHBuild::find_spatial_split(const NodeSpec& spec, float
const Reference& ref = references[refIdx]; const Reference& ref = references[refIdx];
float3 firstBinf = (ref.bounds.min - origin) * invBinSize; float3 firstBinf = (ref.bounds.min - origin) * invBinSize;
float3 lastBinf = (ref.bounds.max - origin) * invBinSize; float3 lastBinf = (ref.bounds.max - origin) * invBinSize;
int3 firstBin = make_int3(firstBinf.x, firstBinf.y, firstBinf.z); int3 firstBin = make_int3((int)firstBinf.x, (int)firstBinf.y, (int)firstBinf.z);
int3 lastBin = make_int3(lastBinf.x, lastBinf.y, lastBinf.z); int3 lastBin = make_int3((int)lastBinf.x, (int)lastBinf.y, (int)lastBinf.z);
firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1); firstBin = clamp(firstBin, 0, BVHParams::NUM_SPATIAL_BINS - 1);
lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1); lastBin = clamp(lastBin, firstBin, BVHParams::NUM_SPATIAL_BINS - 1);

View File

@@ -8,9 +8,6 @@ SET(Boost_ADDITIONAL_VERSIONS "1.45" "1.44"
"1.41" "1.41.0" "1.40" "1.40.0" "1.41" "1.41.0" "1.40" "1.40.0"
"1.39" "1.39.0" "1.38" "1.38.0" "1.39" "1.39.0" "1.38" "1.38.0"
"1.37" "1.37.0" "1.34.1" "1_34_1") "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) SET(Boost_USE_MULTITHREADED ON)
@@ -25,6 +22,8 @@ MESSAGE(STATUS "Boost libraries ${Boost_LIBRARIES}")
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}") INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}")
LINK_DIRECTORIES("${Boost_LIBRARY_DIRS}") LINK_DIRECTORIES("${Boost_LIBRARY_DIRS}")
ADD_DEFINITIONS(-DBOOST_ALL_NO_LIB)
IF(WITH_CYCLES_NETWORK) IF(WITH_CYCLES_NETWORK)
ADD_DEFINITIONS(-DWITH_NETWORK) ADD_DEFINITIONS(-DWITH_NETWORK)
ENDIF() ENDIF()
@@ -126,8 +125,10 @@ IF(WITH_CYCLES_BLENDER)
${CMAKE_SOURCE_DIR}/source/blender/blenloader ${CMAKE_SOURCE_DIR}/source/blender/blenloader
${CMAKE_BINARY_DIR}/source/blender/makesrna/intern) ${CMAKE_BINARY_DIR}/source/blender/makesrna/intern)
IF(WIN32) 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() ENDIF()
ADD_DEFINITIONS(-DBLENDER_PLUGIN)
ENDIF() ENDIF()
########################################################################### ###########################################################################

View File

@@ -11,7 +11,7 @@ IF(APPLE)
ENDIF(APPLE) ENDIF(APPLE)
IF(WIN32) 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(RTTI_DISABLE_FLAGS "/GR- -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
SET(PYTHON_MODULE_FLAGS "-DLL") SET(PYTHON_MODULE_FLAGS "-DLL")
ENDIF(WIN32) ENDIF(WIN32)

View File

@@ -7,7 +7,7 @@ INCLUDE_DIRECTORIES(
../util ../util
../render ../render
${OPENGL_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}) ${GLEW_INCLUDE_PATH})
SET(sources SET(sources
device.cpp device.cpp

View File

@@ -356,7 +356,8 @@ public:
cuda_assert(cuParamSetv(cuPathTrace, offset, &d_rng_state, sizeof(d_rng_state))) cuda_assert(cuParamSetv(cuPathTrace, offset, &d_rng_state, sizeof(d_rng_state)))
offset += 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)) cuda_assert(cuParamSeti(cuPathTrace, offset, task.pass))
offset += sizeof(task.pass); offset += sizeof(task.pass);
@@ -413,7 +414,8 @@ public:
cuda_assert(cuParamSetv(cuFilmConvert, offset, &d_buffer, sizeof(d_buffer))) cuda_assert(cuParamSetv(cuFilmConvert, offset, &d_buffer, sizeof(d_buffer)))
offset += 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)) cuda_assert(cuParamSeti(cuFilmConvert, offset, task.pass))
offset += sizeof(task.pass); offset += sizeof(task.pass);
@@ -475,7 +477,8 @@ public:
cuda_assert(cuParamSetv(cuDisplace, offset, &d_offset, sizeof(d_offset))) cuda_assert(cuParamSetv(cuDisplace, offset, &d_offset, sizeof(d_offset)))
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)) cuda_assert(cuParamSeti(cuDisplace, offset, task.displace_x))
offset += sizeof(task.displace_x); offset += sizeof(task.displace_x);
@@ -621,18 +624,18 @@ public:
glColor3f(1.0f, 1.0f, 1.0f); glColor3f(1.0f, 1.0f, 1.0f);
glPushMatrix(); glPushMatrix();
glTranslatef(0, y, 0.0f); glTranslatef(0.0f, (float)y, 0.0f);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glTexCoord2f(0, 0); glTexCoord2f(0.0f, 0.0f);
glVertex2f(0, 0); glVertex2f(0.0f, 0.0f);
glTexCoord2f((float)w/(float)width, 0); glTexCoord2f((float)w/(float)width, 0);
glVertex2f(width, 0); glVertex2f((float)width, 0.0f);
glTexCoord2f((float)w/(float)width, (float)h/(float)height); glTexCoord2f((float)w/(float)width, (float)h/(float)height);
glVertex2f(width, height); glVertex2f((float)width, (float)height);
glTexCoord2f(0, (float)h/(float)height); glTexCoord2f(0.0f, (float)h/(float)height);
glVertex2f(0, height); glVertex2f(0.0f, (float)height);
glEnd(); glEnd();

View File

@@ -44,9 +44,9 @@ __device uchar4 film_float_to_byte(float4 color)
uchar4 result; uchar4 result;
/* simple float to byte conversion */ /* simple float to byte conversion */
result.x = clamp(color.x*255.0f, 0.0f, 255.0f); result.x = (uchar)clamp(color.x*255.0f, 0.0f, 255.0f);
result.y = clamp(color.y*255.0f, 0.0f, 255.0f); result.y = (uchar)clamp(color.y*255.0f, 0.0f, 255.0f);
result.z = clamp(color.z*255.0f, 0.0f, 255.0f); result.z = (uchar)clamp(color.z*255.0f, 0.0f, 255.0f);
result.w = 255; result.w = 255;
return result; return result;

View File

@@ -143,9 +143,9 @@ __device float perlin_periodic(float x, float y, float z, float3 pperiod)
int3 p; int3 p;
p.x = fmaxf(quick_floor(pperiod.x), 1); p.x = max(quick_floor(pperiod.x), 1);
p.y = fmaxf(quick_floor(pperiod.y), 1); p.y = max(quick_floor(pperiod.y), 1);
p.z = fmaxf(quick_floor(pperiod.z), 1); p.z = max(quick_floor(pperiod.z), 1);
float u = fade(fx); float u = fade(fx);
float v = fade(fy); float v = fade(fy);

View 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(xx = xi-1; xx <= xi+1; xx++) {
for(yy = yi-1; yy <= yi+1; yy++) { for(yy = yi-1; yy <= yi+1; yy++) {
for(zz = zi-1; zz <= zi+1; zz++) { 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 vp = cellnoise_color(ip);
float3 pd = p - (vp + ip); float3 pd = p - (vp + ip);
float d = voronoi_distance(distance_metric, pd, e); 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]) { if(d < da[0]) {
da[3] = da[2]; da[3] = da[2];

View 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 SET(sources
attribute.cpp attribute.cpp

View File

@@ -28,7 +28,7 @@
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN
class Device; class Device;
class float4; struct float4;
/* Render Buffers */ /* Render Buffers */

View File

@@ -990,8 +990,8 @@ void BsdfNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *
compiler.add_node(NODE_CLOSURE_BSDF, compiler.add_node(NODE_CLOSURE_BSDF,
closure, closure,
(param1)? __float_as_int(param1->value.x): 0.0f, __float_as_int((param1)? param1->value.x: 0.0f),
(param2)? __float_as_int(param2->value.x): 0.0f); __float_as_int((param2)? param2->value.x: 0.0f));
} }
void BsdfNode::compile(SVMCompiler& compiler) void BsdfNode::compile(SVMCompiler& compiler)

View File

@@ -31,7 +31,7 @@ class DeviceScene;
class Mesh; class Mesh;
class Progress; class Progress;
class Scene; class Scene;
class Transform; struct Transform;
/* Object */ /* Object */

View File

@@ -35,7 +35,7 @@ class Mesh;
class Progress; class Progress;
class Scene; class Scene;
class ShaderGraph; class ShaderGraph;
class float3; struct float3;
/* Shader describing the appearance of a Mesh, Light or Background. /* Shader describing the appearance of a Mesh, Light or Background.
* *

View File

@@ -30,7 +30,7 @@ CCL_NAMESPACE_BEGIN
class Device; class Device;
class DeviceScene; class DeviceScene;
class ImageManager; class ImageManager;
class KernelSunSky; struct KernelSunSky;
class Scene; class Scene;
class ShaderGraph; class ShaderGraph;
class ShaderInput; class ShaderInput;

View File

@@ -228,7 +228,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
computeBoundaryTangentStencils(ring, vert, r0, r1); computeBoundaryTangentStencils(ring, vert, r0, r1);
int k = valence - 1; int k = valence - 1;
float omega = M_PI / k; float omega = M_PI_F / k;
int eid1 = edge1Indices[primitiveOffset + v]; int eid1 = edge1Indices[primitiveOffset + v];
int eid2 = edge2Indices[primitiveOffset + v]; int eid2 = edge2Indices[primitiveOffset + v];
@@ -298,7 +298,7 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
} }
} }
else { else {
float costerm = cosf(M_PI / valence); float costerm = cosf(M_PI_F / valence);
float sqrtterm = sqrtf(4.0f + costerm*costerm); float sqrtterm = sqrtf(4.0f + costerm*costerm);
/* float tangentScale = 1.0f; */ /* float tangentScale = 1.0f; */
@@ -319,11 +319,11 @@ void SubdAccBuilder::computeEdgeStencil(SubdFaceRing *ring, GregoryAccStencil *s
SubdEdge *edge = eit.current(); SubdEdge *edge = eit.current();
assert(vert->co == edge->from()->co); assert(vert->co == edge->from()->co);
float costerm1_a = cosf(M_PI * 2 * (j-i1) / valence); float costerm1_a = cosf(M_PI_F * 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_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_a = cosf(M_PI_F * 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_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; stencil->get(eid1, edge->to()) += alpha * costerm1_a;
@@ -413,10 +413,10 @@ void SubdAccBuilder::computeInteriorStencil(SubdFaceRing *ring, GregoryAccStenci
} }
else { else {
SubdVert *e0 = edge->from(); 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(); 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 /* p0 +------+ q0
* | | * | |
@@ -566,7 +566,7 @@ void SubdAccBuilder::computeBoundaryTangentStencils(SubdFaceRing *ring, SubdVert
int valence = vert->valence(); int valence = vert->valence();
int k = valence - 1; int k = valence - 1;
float omega = M_PI / k; float omega = M_PI_F / k;
float s = sinf(omega); float s = sinf(omega);
float c = cosf(omega); float c = cosf(omega);

View File

@@ -82,8 +82,8 @@ int DiagSplit::T(Patch *patch, float2 Pstart, float2 Pend)
Plast = P; Plast = P;
} }
int tmin = ceil(Lsum/dicing_rate); int tmin = (int)ceil(Lsum/dicing_rate);
int tmax = ceil((test_steps-1)*Lmax/dicing_rate); // XXX paper says N instead of N-1, seems wrong? 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) if(tmax - tmin > split_threshold)
return DSPLIT_NON_UNIFORM; return DSPLIT_NON_UNIFORM;

View File

@@ -20,7 +20,7 @@
#define __UTIL_MAP_H__ #define __UTIL_MAP_H__
#include <map> #include <map>
#include <tr1/unordered_map> #include <boost/tr1/unordered_map.hpp>
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN

View File

@@ -48,7 +48,8 @@ CCL_NAMESPACE_BEGIN
#ifdef _WIN32 #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) __device_inline float fmaxf(float a, float b)
{ {

View File

@@ -20,7 +20,7 @@
#define __UTIL_SET_H__ #define __UTIL_SET_H__
#include <set> #include <set>
#include <tr1/unordered_set> #include <boost/tr1/unordered_set.hpp>
CCL_NAMESPACE_BEGIN CCL_NAMESPACE_BEGIN

View File

@@ -34,7 +34,12 @@
#define __local #define __local
#define __shared #define __shared
#define __constant #define __constant
#ifdef __GNUC__
#define __device_inline static inline __attribute__((always_inline)) #define __device_inline static inline __attribute__((always_inline))
#else
#define __device_inline static __forceinline
#endif
#endif #endif

View File

@@ -63,7 +63,11 @@
#ifndef LIBEXPORT #ifndef LIBEXPORT
#ifdef _WIN32 #ifdef _WIN32
#ifdef BLENDER_PLUGIN
#define LIBEXPORT __declspec(dllimport)
#else
#define LIBEXPORT __declspec(dllexport) #define LIBEXPORT __declspec(dllexport)
#endif
#else #else
#define LIBEXPORT #define LIBEXPORT
#endif #endif

View File

@@ -36,11 +36,17 @@
extern "C" { extern "C" {
#endif #endif
#ifndef LIBEXPORT
#ifdef _WIN32 #ifdef _WIN32
#ifdef BLENDER_PLUGIN
#define LIBEXPORT __declspec(dllimport)
#else
#define LIBEXPORT __declspec(dllexport) #define LIBEXPORT __declspec(dllexport)
#endif
#else #else
#define LIBEXPORT #define LIBEXPORT
#endif #endif
#endif
struct ParameterList; struct ParameterList;
struct FunctionRNA; struct FunctionRNA;

View 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" " Do not edit manually, changes will be overwritten. */\n\n"
"#define RNA_RUNTIME\n\n"); "#define RNA_RUNTIME\n\n");
fprintf(f, "#ifndef LIBEXPORT\n");
fprintf(f, "#ifdef _WIN32\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, "#define LIBEXPORT __declspec(dllexport)\n");
fprintf(f, "#endif\n");
fprintf(f, "#else\n"); fprintf(f, "#else\n");
fprintf(f, "#define LIBEXPORT\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 <float.h>\n");
fprintf(f, "#include <stdio.h>\n"); fprintf(f, "#include <stdio.h>\n");
@@ -2580,7 +2586,7 @@ static const char *cpp_classes = ""
"namespace BL {\n" "namespace BL {\n"
"\n" "\n"
"#define BOOLEAN_PROPERTY(sname, identifier) \\\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" "\n"
"#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n" "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
" inline Array<int,size> sname::identifier(void) \\\n" " inline Array<int,size> sname::identifier(void) \\\n"
@@ -2622,7 +2628,7 @@ static const char *cpp_classes = ""
"public:\n" "public:\n"
" Pointer(const PointerRNA& p) : ptr(p) { }\n" " Pointer(const PointerRNA& p) : ptr(p) { }\n"
" operator const PointerRNA&() { return ptr; }\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 void*() { return ptr.data; }\n"
" operator bool() { return ptr.data != NULL; }\n" " operator bool() { return ptr.data != NULL; }\n"
"\n" "\n"