diff --git a/0001-Fix-build-with-OpenImageIO-1.9.0.patch b/0001-Fix-build-with-OpenImageIO-1.9.0.patch new file mode 100644 index 0000000..76ecdff --- /dev/null +++ b/0001-Fix-build-with-OpenImageIO-1.9.0.patch @@ -0,0 +1,373 @@ +From 6abf565c949f5effd23a996e187119428e89fca5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= +Date: Thu, 4 Apr 2019 20:32:40 +0200 +Subject: [PATCH] Fix build with OpenImageIO 1.9.0 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +OIIO plugin version 22 changed the signatures of ImageInput/ImageOutput +create() to return unique_ptr. (OIIO 1.9) + +Signed-off-by: Robert-André Mauchin +--- + include/luxcore/pyluxcore/pyluxcoreutils.h | 2 +- + samples/luxcoreui/luxcoreui.cpp | 4 +-- + src/luxcore/luxcoreimpl.cpp | 4 +-- + src/luxcore/pyluxcoreforblender.cpp | 2 +- + src/slg/engines/pathoclbase/pathoclbase.cpp | 2 +- + src/slg/engines/tilerepository.cpp | 4 +-- + src/slg/film/filmparse.cpp | 2 +- + src/slg/film/filmproperties.cpp | 4 +-- + src/slg/imagemap/imagemap.cpp | 35 +++++++++---------- + src/slg/renderconfig.cpp | 2 +- + src/slg/scene/parsecamera.cpp | 2 +- + .../luxcoreimplserializationdemo.cpp | 6 ++-- + 12 files changed, 34 insertions(+), 35 deletions(-) + +diff --git a/include/luxcore/pyluxcore/pyluxcoreutils.h b/include/luxcore/pyluxcore/pyluxcoreutils.h +index 756f273a1..e71f5c6ee 100644 +--- a/include/luxcore/pyluxcore/pyluxcoreutils.h ++++ b/include/luxcore/pyluxcore/pyluxcoreutils.h +@@ -32,7 +32,7 @@ namespace luxcore { + template boost::python::object TransferToPython(T *t) { + // Transfer ownership to a smart pointer, allowing for proper cleanup + // incase Boost.Python throws. +- std::auto_ptr ptr(t); ++ std::unique_ptr ptr(t); + + // Use the manage_new_object generator to transfer ownership to Python. + typename boost::python::manage_new_object::apply::type converter; +diff --git a/samples/luxcoreui/luxcoreui.cpp b/samples/luxcoreui/luxcoreui.cpp +index dd94c0668..9040caa83 100644 +--- a/samples/luxcoreui/luxcoreui.cpp ++++ b/samples/luxcoreui/luxcoreui.cpp +@@ -37,10 +37,10 @@ using namespace luxcore; + #include + + static void ConvertImage(const string &fileName) { +- auto_ptr in(ImageInput::open(fileName)); ++ unique_ptr in(ImageInput::open(fileName)); + + const ImageSpec &spec = in->spec(); +- auto_ptr pixels(new u_char[spec.width * spec.height * spec.nchannels] ); ++ unique_ptr pixels(new u_char[spec.width * spec.height * spec.nchannels] ); + + in->read_image(TypeDesc::UCHAR, pixels.get()); + +diff --git a/src/luxcore/luxcoreimpl.cpp b/src/luxcore/luxcoreimpl.cpp +index 558dfcea9..0bf3f7083 100644 +--- a/src/luxcore/luxcoreimpl.cpp ++++ b/src/luxcore/luxcoreimpl.cpp +@@ -876,8 +876,8 @@ RenderSessionImpl::RenderSessionImpl(const RenderConfigImpl *config, const std:: + renderConfig(config) { + film = new FilmImpl(*this); + +- auto_ptr startFilm(slg::Film::LoadSerialized(startFilmFileName)); +- auto_ptr startState(slg::RenderState::LoadSerialized(startStateFileName)); ++ unique_ptr startFilm(slg::Film::LoadSerialized(startFilmFileName)); ++ unique_ptr startState(slg::RenderState::LoadSerialized(startStateFileName)); + + renderSession = new slg::RenderSession(config->renderConfig, + startState.release(), startFilm.release()); +diff --git a/src/luxcore/pyluxcoreforblender.cpp b/src/luxcore/pyluxcoreforblender.cpp +index ffa405487..8d2e68b74 100644 +--- a/src/luxcore/pyluxcoreforblender.cpp ++++ b/src/luxcore/pyluxcoreforblender.cpp +@@ -873,7 +873,7 @@ bool Scene_DefineBlenderStrands(luxcore::detail::SceneImpl *scene, + if (uvArraySize > 0 && !imageFilename.empty()) { + ImageSpec config; + config.attribute ("oiio:UnassociatedAlpha", 1); +- auto_ptr in(ImageInput::open(imageFilename, &config)); ++ unique_ptr in(ImageInput::open(imageFilename, &config)); + + if (!in.get()) { + throw runtime_error("Error opening image file : " + imageFilename + +diff --git a/src/slg/engines/pathoclbase/pathoclbase.cpp b/src/slg/engines/pathoclbase/pathoclbase.cpp +index 52f69a611..b3bbe75fd 100644 +--- a/src/slg/engines/pathoclbase/pathoclbase.cpp ++++ b/src/slg/engines/pathoclbase/pathoclbase.cpp +@@ -133,7 +133,7 @@ PathOCLBaseRenderEngine::~PathOCLBaseRenderEngine() { + } + + void PathOCLBaseRenderEngine::InitPixelFilterDistribution() { +- auto_ptr pixelFilter(renderConfig->AllocPixelFilter()); ++ unique_ptr pixelFilter(renderConfig->AllocPixelFilter()); + + // Compile sample distribution + delete[] pixelFilterDistribution; +diff --git a/src/slg/engines/tilerepository.cpp b/src/slg/engines/tilerepository.cpp +index a36f6217d..ad17972fb 100644 +--- a/src/slg/engines/tilerepository.cpp ++++ b/src/slg/engines/tilerepository.cpp +@@ -95,7 +95,7 @@ void Tile::InitTileFilm(const Film &film, Film **tileFilm) { + + // Build an image pipeline with only an auto-linear tone mapping and + // gamma correction. +- auto_ptr imagePipeline(new ImagePipeline()); ++ unique_ptr imagePipeline(new ImagePipeline()); + imagePipeline->AddPlugin(new LinearToneMap(1.f)); + imagePipeline->AddPlugin(new GammaCorrectionPlugin(2.2f)); + (*tileFilm)->SetImagePipelines(imagePipeline.release()); +@@ -639,7 +639,7 @@ TileRepository *TileRepository::FromProperties(const luxrays::Properties &cfg) { + tileWidth = tileHeight = Max(8u, cfg.Get(GetDefaultProps().Get("tile.size")).Get()); + tileWidth = Max(8u, cfg.Get(Property("tile.size.x")(tileWidth)).Get()); + tileHeight = Max(8u, cfg.Get(Property("tile.size.y")(tileHeight)).Get()); +- auto_ptr tileRepository(new TileRepository(tileWidth, tileHeight)); ++ unique_ptr tileRepository(new TileRepository(tileWidth, tileHeight)); + + tileRepository->maxPassCount = cfg.Get(Property("batch.haltdebug")(0)).Get(); + tileRepository->enableMultipassRendering = cfg.Get(GetDefaultProps().Get("tile.multipass.enable")).Get(); +diff --git a/src/slg/film/filmparse.cpp b/src/slg/film/filmparse.cpp +index 35fa20bb4..e168d8b59 100644 +--- a/src/slg/film/filmparse.cpp ++++ b/src/slg/film/filmparse.cpp +@@ -471,7 +471,7 @@ ImagePipeline *Film::CreateImagePipeline(const Properties &props, const string & + //-------------------------------------------------------------------------- + + const u_int keyFieldCount = Property::CountFields(imagePipelinePrefix); +- auto_ptr imagePipeline(new ImagePipeline()); ++ unique_ptr imagePipeline(new ImagePipeline()); + + vector imagePipelineKeys = props.GetAllUniqueSubNames(imagePipelinePrefix); + if (imagePipelineKeys.size() > 0) { +diff --git a/src/slg/film/filmproperties.cpp b/src/slg/film/filmproperties.cpp +index 4856b5be0..695136f66 100644 +--- a/src/slg/film/filmproperties.cpp ++++ b/src/slg/film/filmproperties.cpp +@@ -109,7 +109,7 @@ Film *Film::FromProperties(const Properties &cfg) { + SLG_LOG("Film resolution: " << filmFullWidth << "x" << filmFullHeight); + if (filmSubRegionUsed) + SLG_LOG("Film sub-region: " << filmSubRegion[0] << " " << filmSubRegion[1] << filmSubRegion[2] << " " << filmSubRegion[3]); +- auto_ptr film(new Film(filmFullWidth, filmFullHeight, ++ unique_ptr film(new Film(filmFullWidth, filmFullHeight, + filmSubRegionUsed ? filmSubRegion : NULL)); + + // For compatibility with the past +@@ -130,7 +130,7 @@ Film *Film::FromProperties(const Properties &cfg) { + // Add the default image pipeline + //-------------------------------------------------------------------------- + +- auto_ptr imagePipeline(new ImagePipeline()); ++ unique_ptr imagePipeline(new ImagePipeline()); + imagePipeline->AddPlugin(new AutoLinearToneMap()); + imagePipeline->AddPlugin(new GammaCorrectionPlugin(2.2f)); + +diff --git a/src/slg/imagemap/imagemap.cpp b/src/slg/imagemap/imagemap.cpp +index 76ef7c6db..7b0874cb6 100644 +--- a/src/slg/imagemap/imagemap.cpp ++++ b/src/slg/imagemap/imagemap.cpp +@@ -493,7 +493,7 @@ void ImageMapStorageImpl::ReverseGammaCorrection(const float gamma) + template + ImageMapStorage *ImageMapStorageImpl::Copy() const { + const u_int pixelCount = width * height; +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -524,7 +524,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + // Nothing to do + return NULL; + } else if (CHANNELS == 2) { +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -542,7 +542,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + + return new ImageMapStorageImpl(newPixels.release(), width, height, wrapType); + } else { +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -564,7 +564,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + // Nothing to do + return NULL; + } else if (CHANNELS == 2) { +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -579,7 +579,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + + return new ImageMapStorageImpl(newPixels.release(), width, height, wrapType); + } else { +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -597,7 +597,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + + src++; + dst++; +- } ++ } + } + + return new ImageMapStorageImpl(newPixels.release(), width, height, wrapType); +@@ -608,7 +608,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + // Nothing to do + return NULL; + } else { +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -628,7 +628,7 @@ ImageMapStorage *ImageMapStorageImpl::SelectChannel(const ChannelSe + // Nothing to do + return NULL; + } else { +- auto_ptr > newPixels(new ImageMapPixel[pixelCount]); ++ unique_ptr[]> newPixels(new ImageMapPixel[pixelCount]); + + const ImageMapPixel *src = pixels; + ImageMapPixel *dst = newPixels.get(); +@@ -674,7 +674,7 @@ ImageMap::ImageMap(const string &fileName, const float g, + else { + ImageSpec config; + config.attribute ("oiio:UnassociatedAlpha", 1); +- auto_ptr in(ImageInput::open(resolvedFileName, &config)); ++ unique_ptr in(ImageInput::open(resolvedFileName, &config)); + if (in.get()) { + const ImageSpec &spec = in->spec(); + +@@ -735,7 +735,7 @@ ImageMap::ImageMap(const string &fileName, const float g, + pixelStorage->wrapType = wrapType; + pixelStorage->ReverseGammaCorrection(gamma); + } +- ++ + Preprocess(); + } + +@@ -774,7 +774,7 @@ float ImageMap::CalcSpectrumMean() const { + float ImageMap::CalcSpectrumMeanY() const { + const u_int pixelCount = pixelStorage->width * pixelStorage->height; + +- float mean = 0.f; ++ float mean = 0.f; + #pragma omp parallel for reduction(+:mean) + for ( + // Visual C++ 2013 supports only OpenMP 2.5 +@@ -840,7 +840,7 @@ void ImageMap::Resize(const u_int newWidth, const u_int newHeight) { + default: + throw runtime_error("Unsupported storage type in ImageMap::Resize(): " + ToString(storageType)); + } +- ++ + ImageSpec sourceSpec(width, height, channelCount, baseType); + ImageBuf source(sourceSpec, (void *)pixelStorage->GetPixelsData()); + +@@ -871,8 +871,8 @@ void ImageMap::Resize(const u_int newWidth, const u_int newHeight) { + default: + throw runtime_error("Unsupported storage type in ImageMap::Resize(): " + ToString(storageType)); + } +- +- dest.get_pixels(0, newWidth, 0, newHeight, 0, 1, baseType, pixelStorage->GetPixelsData()); ++ ++ dest.get_pixels(roi, baseType, pixelStorage->GetPixelsData()); + + Preprocess(); + } +@@ -892,7 +892,7 @@ string ImageMap::GetFileExtension() const { + } + + void ImageMap::WriteImage(const string &fileName) const { +- ImageOutput *out = ImageOutput::create(fileName); ++ unique_ptr out = ImageOutput::create(fileName); + if (out) { + ImageMapStorage::StorageType storageType = pixelStorage->GetStorageType(); + +@@ -918,7 +918,7 @@ void ImageMap::WriteImage(const string &fileName) const { + const u_int size = pixelStorage->width * pixelStorage->height; + const float *srcBuffer = (float *)pixelStorage->GetPixelsData(); + float *tmpBuffer = new float[size * 3]; +- ++ + float *tmpBufferPtr = tmpBuffer; + for (u_int i = 0; i < size; ++i) { + const float v = srcBuffer[i]; +@@ -945,7 +945,6 @@ void ImageMap::WriteImage(const string &fileName) const { + throw runtime_error("Unsupported storage type in ImageMap::WriteImage(): " + ToString(storageType)); + } + +- delete out; + } else + throw runtime_error("Failed image save: " + fileName); + } +@@ -967,7 +966,7 @@ ImageMap *ImageMap::Merge(const ImageMap *map0, const ImageMap *map1, const u_in + mergedImg[x + y * width] = map0->GetFloat(uv) * map1->GetFloat(uv); + } + } +- ++ + imgMap->Preprocess(); + + return imgMap; +diff --git a/src/slg/renderconfig.cpp b/src/slg/renderconfig.cpp +index d4c0575ae..30328061a 100644 +--- a/src/slg/renderconfig.cpp ++++ b/src/slg/renderconfig.cpp +@@ -59,7 +59,7 @@ using namespace slg; + //------------------------------------------------------------------------------ + + static boost::mutex defaultPropertiesMutex; +-static auto_ptr defaultProperties; ++static unique_ptr defaultProperties; + + BOOST_CLASS_EXPORT_IMPLEMENT(slg::RenderConfig) + +diff --git a/src/slg/scene/parsecamera.cpp b/src/slg/scene/parsecamera.cpp +index ca1733ee5..d27b57d8a 100644 +--- a/src/slg/scene/parsecamera.cpp ++++ b/src/slg/scene/parsecamera.cpp +@@ -74,7 +74,7 @@ Camera *Scene::CreateCamera(const Properties &props) { + SDL_LOG("Camera position: " << orig); + SDL_LOG("Camera target: " << target); + +- auto_ptr camera; ++ unique_ptr camera; + if ((type == "environment") || (type == "orthographic") || (type == "perspective") || (type == "stereo")) { + if (type == "orthographic") { + OrthographicCamera *orthoCamera; +diff --git a/tests/luxcoreimplserializationdemo/luxcoreimplserializationdemo.cpp b/tests/luxcoreimplserializationdemo/luxcoreimplserializationdemo.cpp +index 38c49e709..0394b524f 100644 +--- a/tests/luxcoreimplserializationdemo/luxcoreimplserializationdemo.cpp ++++ b/tests/luxcoreimplserializationdemo/luxcoreimplserializationdemo.cpp +@@ -117,7 +117,7 @@ static void TestFilmSerialization() { + + // Read the film + SLG_LOG("Read the film"); +- auto_ptr filmCopy(Film::LoadSerialized("film.flm")); ++ unique_ptr filmCopy(Film::LoadSerialized("film.flm")); + filmCopy->oclEnable = false; + + filmCopy->ExecuteImagePipeline(0); +@@ -230,7 +230,7 @@ static void TestSceneSerialization() { + + // Read the scene + SLG_LOG("Read the scene"); +- auto_ptr sceneCopy(Scene::LoadSerialized("scene.bsc")); ++ unique_ptr sceneCopy(Scene::LoadSerialized("scene.bsc")); + } + + static void TestRenderConfigSerialization() { +@@ -247,7 +247,7 @@ static void TestRenderConfigSerialization() { + + // Read the scene + SLG_LOG("Read the render configuration"); +- auto_ptr config(RenderConfig::LoadSerialized("renderconfig.bcf")); ++ unique_ptr config(RenderConfig::LoadSerialized("renderconfig.bcf")); + } + + int main(int argc, char *argv[]) { +-- +2.21.0 + diff --git a/luxcorerender.spec b/luxcorerender.spec index 886b344..880b9df 100644 --- a/luxcorerender.spec +++ b/luxcorerender.spec @@ -6,7 +6,7 @@ Name: luxcorerender Version: 2.2 %if %{with_prerelease} -Release: 0.1.%{prerelease}%{?dist} +Release: 0.2.%{prerelease}%{?dist} %else Release: 4%{?dist} %endif @@ -22,6 +22,9 @@ Source3: blender-%{name}.metainfo.xml Patch0: python.patch # drop eos portable archiver (Manjaro) Patch1: boost016900_serialization.patch +# Fix build with OpenImageIO > 1.9.0 +# https://github.com/LuxCoreRender/LuxCore/pull/181 +Patch2: 0001-Fix-build-with-OpenImageIO-1.9.0.patch # Upstream only uses 64 bit archtecture ExclusiveArch: x86_64 @@ -95,7 +98,7 @@ Provides: LuxRender-blender = 2.0 The blender-%{name} package contains the plugin for Blender to export into %{name} -%package devel +%package devel Summary: Development files for %{name} Requires: %{name}-libs%{?_isa} = %{version}-%{release} Provides: LuxRender-devel = %{version}-%{release} @@ -119,23 +122,23 @@ The %{name}-examples package contains sample binaries using %{name}. # Disable slg library # Fix all Python shebangs recursively in . -pathfix.py -pni "%{__python3} %{py3_shbang_opts}" . +pathfix.py -pni "%{__python3} %{py3_shbang_opts}" . %build mkdir -p build -pushd build +cd build #Building lux %cmake \ -DCMAKE_CXX_FLAGS="%{optflags} -Wl,--as-needed" \ -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE \ -DLUXRAYS_DISABLE_OPENCL=0 \ -DBUILD_SHARED_LIBS=ON \ -S -DPYTHON_V=%{python3_version_nodots} \ + -DPYTHON_V=%{python3_version_nodots} \ .. %make_build -popd %install +pushd build mkdir -p %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_datadir}/%{name} mkdir -p %{buildroot}%{_libdir} @@ -143,10 +146,11 @@ mkdir -p %{buildroot}%{_includedir} install -Dpm 0755 bin/* %{buildroot}%{_bindir}/ install -Dpm 0755 lib/*.so* %{buildroot}%{_libdir}/ -ln -s + # Remove rpaths chrpath --delete %{buildroot}%{_bindir}/* chrpath --delete %{buildroot}%{_libdir}/*.so* +popd # Install include files cp -pr include/{luxcore,luxrays} %{buildroot}%{_includedir}/ @@ -170,10 +174,11 @@ appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/blender-%{name %files %license COPYING.txt -%doc AUTHORS.txt +%doc AUTHORS.txt %files libs -%{_libdir}/*.so* +%{_libdir}/pyluxcore.so +%{_libdir}/libglfw.so.3* %files core %{_bindir}/* @@ -186,8 +191,12 @@ appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/blender-%{name %files devel %{_includedir}/{luxcore,luxrays,slg} +%{_libdir}/libglfw.so %changelog +* Thu Apr 04 21:56:41 CET 2019 Robert-André Mauchin - 2.2-0.2.alpha1 +- Add patch to build with OpenImageIO > 1.9.0 + * Sun Mar 31 2019 Luya Tshimbalanga - 2.2-0.1.alpha1 - Update to 2.2alpha1 @@ -212,7 +221,7 @@ appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/blender-%{name * Tue Nov 27 2018 Luya Tshimbalanga - 2.1-0.4.beta2 - Update to 2.1 beta2 - Fix conflicting installation -- Add openvdb dependency +- Add openvdb dependency - Remove unversioned .so files * Sun Nov 11 2018 Luya Tshimbalanga - 2.1-0.2.beta1