From 6c42d2db0372ee2843676d9657c14d3336f5de81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Kov=C3=A1=C5=99?= Date: Wed, 17 Apr 2024 20:59:47 +0200 Subject: [PATCH] Use OIIO_R3D_LIBRARY_PATH environment variable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Kovář --- src/r3d.imageio/r3dinput.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/r3d.imageio/r3dinput.cpp b/src/r3d.imageio/r3dinput.cpp index 67a5e0f312..18eed0eb6f 100644 --- a/src/r3d.imageio/r3dinput.cpp +++ b/src/r3d.imageio/r3dinput.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -167,11 +168,22 @@ R3dInput::initialize() { DBG("R3dInput::initialize()\n"); + std::string library_path + = Sysutil::getenv("OIIO_R3D_LIBRARY_PATH", +#if defined(__linux__) + "/opt/R3DSDKv8_5_1/Redistributable/linux" +#elif defined(__APPLE__) + "/Library/R3DSDKv8_5_1/Redistributable/mac" +#elif defined(__WINDOWS__) + "C:\\R3DSDKv8_5_1\\Redistributable\\win" +#else +#error "Unknown OS" +#endif + ); // initialize SDK // R3DSDK::InitializeStatus init_status = R3DSDK::InitializeSdk(".", OPTION_RED_CUDA); R3DSDK::InitializeStatus init_status - = R3DSDK::InitializeSdk("/opt/R3DSDKv8_5_1/Redistributable/linux", - OPTION_RED_NONE); + = R3DSDK::InitializeSdk(library_path.c_str(), OPTION_RED_NONE); if (init_status != R3DSDK::ISInitializeOK) { R3DSDK::FinalizeSdk(); DBG("Failed to load R3DSDK Library\n");