Skip to content

Commit 656cd7a

Browse files
authored
Move embree symbols into mitsuba namespace to prevent symbol conflicts (#1663)
This commit fixes symbol clashes that were encountered when using Mitsuba from within Blender's Python environment (as in the Blender plugin)
1 parent da2de91 commit 656cd7a

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

ext/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ if (MI_ENABLE_EMBREE)
9393
set(EMBREE_MAX_INSTANCE_LEVEL_COUNT 1 CACHE STRING " " FORCE)
9494
set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE STRING " " FORCE)
9595
set(EMBREE_ISA_SSE2 OFF CACHE BOOL " " FORCE)
96+
set(EMBREE_API_NAMESPACE "mitsuba" CACHE STRING " " FORCE)
9697

9798
if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))
9899
set(EMBREE_ISA_SSE42 OFF CACHE BOOL " " FORCE)

include/mitsuba/core/fwd.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,16 +319,20 @@ NAMESPACE_END(filesystem)
319319

320320
namespace fs = filesystem;
321321

322-
NAMESPACE_END(mitsuba)
323-
324-
extern "C" {
325322
#if defined(MI_ENABLE_EMBREE)
326-
// Forward declarations for Embree
323+
extern "C" {
324+
// Forward declarations for Embree (we import Embree into mitsuba's namespace
325+
// to avoid name clashes with other libraries).
327326
typedef struct RTCDeviceTy* RTCDevice;
328327
typedef struct RTCSceneTy* RTCScene;
329328
typedef struct RTCGeometryTy* RTCGeometry;
329+
}
330330
#endif
331331

332+
NAMESPACE_END(mitsuba)
333+
334+
extern "C" {
335+
332336
// =============================================================
333337
//! @{ \name Helper macros
334338
// =============================================================

0 commit comments

Comments
 (0)