From f44d0ba6b4d7536caaa31a224224889b7318d711 Mon Sep 17 00:00:00 2001 From: Petukhov Maksim Date: Sat, 22 Jul 2023 00:38:50 +0300 Subject: [PATCH 1/3] fix --- recipes/openscenegraph/all/conandata.yml | 8 ++ recipes/openscenegraph/all/conanfile.py | 32 +++++--- .../0007-fix-msvc-with-std-c++17.patch | 50 +++++++++++++ .../patches/0008-replace-mem-fun-ref.patch | 13 ++++ .../0009-replace-auto-ptr-in-plugins.patch | 75 +++++++++++++++++++ .../0010-replace-ptr-fun-in-obj-plugin.patch | 24 ++++++ 6 files changed, 190 insertions(+), 12 deletions(-) create mode 100644 recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch create mode 100644 recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch create mode 100644 recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch create mode 100644 recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch diff --git a/recipes/openscenegraph/all/conandata.yml b/recipes/openscenegraph/all/conandata.yml index 0f1b6a2cc4790..44b21085d9ff1 100644 --- a/recipes/openscenegraph/all/conandata.yml +++ b/recipes/openscenegraph/all/conandata.yml @@ -16,3 +16,11 @@ patches: base_path: source_subfolder - patch_file: patches/0006-Declare-result-as-LONG-for-Mingw-build.patch base_path: source_subfolder + - patch_file: patches/0007-fix-msvc-with-std-c++17.patch + base_path: source_subfolder + - patch_file: patches/0008-replace-mem-fun-ref.patch + base_path: source_subfolder + - patch_file: patches/0009-replace-auto-ptr-in-plugins.patch + base_path: source_subfolder + - patch_file: patches/0010-replace-ptr-fun-in-obj-plugin.patch + base_path: source_subfolder diff --git a/recipes/openscenegraph/all/conanfile.py b/recipes/openscenegraph/all/conanfile.py index 5d6b6d3a14882..b183a5d8f0819 100644 --- a/recipes/openscenegraph/all/conanfile.py +++ b/recipes/openscenegraph/all/conanfile.py @@ -42,7 +42,7 @@ class OpenSceneGraphConanFile(ConanFile): "with_gif": [True, False], "with_gta": [True, False], "with_jasper": [True, False], - "with_jpeg": [True, False], + "with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg", False], "with_openexr": [True, False], "with_png": [True, False], "with_tiff": [True, False], @@ -70,7 +70,7 @@ class OpenSceneGraphConanFile(ConanFile): "with_gif": True, "with_gta": False, "with_jasper": False, - "with_jpeg": True, + "with_jpeg": "libjpeg", "with_openexr": False, "with_png": True, "with_tiff": True, @@ -130,29 +130,33 @@ def requirements(self): if self.options.get_safe("with_asio", False): # Should these be private requires? self.requires("asio/1.22.1") - self.requires("boost/1.81.0") + self.requires("boost/1.82.0") if self.options.with_curl: - self.requires("libcurl/8.0.1") + self.requires("libcurl/8.1.2") if self.options.get_safe("with_dcmtk"): self.requires("dcmtk/3.6.6") if self.options.with_freetype: self.requires("freetype/2.13.0") if self.options.with_gdal: - self.requires("gdal/3.4.3") + self.requires("gdal/3.5.2") if self.options.get_safe("with_gif"): self.requires("giflib/5.2.1") if self.options.with_gta: self.requires("libgta/1.2.1") if self.options.with_jasper: - self.requires("jasper/2.0.33") - if self.options.get_safe("with_jpeg"): + self.requires("jasper/4.0.0") + if self.options.get_safe("with_jpeg") == "libjpeg": self.requires("libjpeg/9e") + elif self.options.get_safe("with_jpeg") == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.5") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.get_safe("with_openexr"): - self.requires("openexr/3.1.7") + self.requires("openexr/3.1.5") if self.options.get_safe("with_png"): - self.requires("libpng/1.6.40") + self.requires("libpng/1.6.39") if self.options.with_tiff: - self.requires("libtiff/4.5.1") + self.requires("libtiff/4.5.0") if self.options.with_zlib: self.requires("zlib/1.2.13") @@ -217,7 +221,7 @@ def _configured_cmake(self): cmake.definitions["OSG_WITH_ZEROCONF"] = False cmake.definitions["OSG_WITH_LIBLAS"] = False cmake.definitions["OSG_WITH_GIF"] = self.options.get_safe("with_gif", False) - cmake.definitions["OSG_WITH_JPEG"] = self.options.get_safe("with_jpeg", False) + cmake.definitions["OSG_WITH_JPEG"] = bool(self.options.get_safe("with_jpeg", False)) cmake.definitions["OSG_WITH_PNG"] = self.options.get_safe("with_png", False) cmake.definitions["OSG_WITH_TIFF"] = self.options.with_tiff @@ -390,8 +394,12 @@ def setup_library(lib): setup_plugin("vtf") setup_plugin("ktx") - if self.options.get_safe("with_jpeg"): + if self.options.get_safe("with_jpeg") == "libjpeg": setup_plugin("jpeg").requires.append("libjpeg::libjpeg") + elif self.options.get_safe("with_jpeg") == "libjpeg-turbo": + setup_plugin("jpeg").requires.append("libjpeg-turbo::jpeg") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + setup_plugin("jpeg").requires.append("mozjpeg::libjpeg") if self.options.with_jasper: setup_plugin("jp2").requires.append("jasper::jasper") diff --git a/recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch b/recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch new file mode 100644 index 0000000000000..39046ed3994aa --- /dev/null +++ b/recipes/openscenegraph/all/patches/0007-fix-msvc-with-std-c++17.patch @@ -0,0 +1,50 @@ +diff --git a/src/osg/DisplaySettings.cpp b/src/osg/DisplaySettings.cpp +index 5c699c8b0..5c097cf66 100644 +--- a/src/osg/DisplaySettings.cpp ++++ b/src/osg/DisplaySettings.cpp +@@ -22,9 +22,6 @@ + #include + #include + +-using namespace osg; +-using namespace std; +- + #if defined(WIN32) && !defined(__CYGWIN__) + #include + extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; } +@@ -32,6 +29,9 @@ extern "C" { OSG_EXPORT DWORD NvOptimusEnablement=0x00000001; } + extern "C" { int NvOptimusEnablement=0x00000001; } + #endif + ++using namespace osg; ++using namespace std; ++ + void DisplaySettings::setNvOptimusEnablement(int value) + { + NvOptimusEnablement = value; +diff --git a/src/osgPlugins/cfg/ConfigParser.cpp b/src/osgPlugins/cfg/ConfigParser.cpp +index 263c82896..4247cc2af 100644 +--- a/src/osgPlugins/cfg/ConfigParser.cpp ++++ b/src/osgPlugins/cfg/ConfigParser.cpp +@@ -235,7 +235,7 @@ + #include "CameraConfig.h" + + +-using namespace std; ++ + using namespace osgProducer; + + static void ConfigParser_error( const char * ); +diff --git a/src/osgPlugins/cfg/ConfigParser.y b/src/osgPlugins/cfg/ConfigParser.y +index cf9adf507..5221be184 100644 +--- a/src/osgPlugins/cfg/ConfigParser.y ++++ b/src/osgPlugins/cfg/ConfigParser.y +@@ -34,7 +34,7 @@ + #include + + +-using namespace std; ++ + using namespace Producer; + + static void ConfigParser_error( const char * ); diff --git a/recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch b/recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch new file mode 100644 index 0000000000000..5f86f332a80cf --- /dev/null +++ b/recipes/openscenegraph/all/patches/0008-replace-mem-fun-ref.patch @@ -0,0 +1,13 @@ +diff --git a/src/osgUtil/tristripper/include/detail/graph_array.h b/src/osgUtil/tristripper/include/detail/graph_array.h +index dc1f38027..ce7000cc8 100644 +--- a/src/osgUtil/tristripper/include/detail/graph_array.h ++++ b/src/osgUtil/tristripper/include/detail/graph_array.h +@@ -446,7 +446,7 @@ inline void graph_array::swap(graph_type & Right) + template + inline void unmark_nodes(graph_array & G) + { +- std::for_each(G.begin(), G.end(), std::mem_fun_ref(&graph_array::node::unmark)); ++ for(typename graph_array::node_iterator itr = G.begin(); itr != G.end(); ++itr) itr->unmark(); + } + + diff --git a/recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch b/recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch new file mode 100644 index 0000000000000..fcd865d09b2d6 --- /dev/null +++ b/recipes/openscenegraph/all/patches/0009-replace-auto-ptr-in-plugins.patch @@ -0,0 +1,75 @@ +diff --git a/src/osgPlugins/dae/ReaderWriterDAE.cpp b/src/osgPlugins/dae/ReaderWriterDAE.cpp +index fc1a448d4..3b883f19a 100644 +--- a/src/osgPlugins/dae/ReaderWriterDAE.cpp ++++ b/src/osgPlugins/dae/ReaderWriterDAE.cpp +@@ -32,7 +32,7 @@ + + #define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) + +-#if __cplusplus > 199711L ++#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L) + #define smart_ptr std::unique_ptr + #else + #define smart_ptr std::auto_ptr +diff --git a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp +index 69826c456..9bba5532a 100644 +--- a/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp ++++ b/src/osgPlugins/ffmpeg/FFmpegImageStream.cpp +@@ -10,6 +10,11 @@ + + #define STREAM_TIMEOUT_IN_SECONDS_TO_CONSIDER_IT_DEAD 10 + ++#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L) ++ #define smart_ptr std::unique_ptr ++#else ++ #define smart_ptr std::auto_ptr ++#endif + + namespace osgFFmpeg { + +@@ -23,8 +28,8 @@ FFmpegImageStream::FFmpegImageStream() : + { + setOrigin(osg::Image::TOP_LEFT); + +- std::auto_ptr decoder(new FFmpegDecoder); +- std::auto_ptr commands(new CommandQueue); ++ smart_ptr decoder(new FFmpegDecoder); ++ smart_ptr commands(new CommandQueue); + + m_decoder = decoder.release(); + m_commands = commands.release(); +diff --git a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +index 298e02fcc..113c9c45f 100644 +--- a/src/osgPlugins/gdal/ReaderWriterGDAL.cpp ++++ b/src/osgPlugins/gdal/ReaderWriterGDAL.cpp +@@ -34,6 +34,12 @@ + + #define SERIALIZER() OpenThreads::ScopedLock lock(_serializerMutex) + ++#if ((defined(_MSVC_LANG) && _MSVC_LANG > 199711L) || __cplusplus > 199711L) ++ #define smart_ptr std::unique_ptr ++#else ++ #define smart_ptr std::auto_ptr ++#endif ++ + // From easyrgb.com + float Hue_2_RGB( float v1, float v2, float vH ) + { +@@ -123,7 +129,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter + + initGDAL(); + +- std::auto_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); ++ smart_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); + if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED; + + int dataWidth = dataset->GetRasterXSize(); +@@ -577,7 +583,7 @@ class ReaderWriterGDAL : public osgDB::ReaderWriter + + initGDAL(); + +- std::auto_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); ++ smart_ptr dataset((GDALDataset*)GDALOpen(fileName.c_str(),GA_ReadOnly)); + if (!dataset.get()) return ReadResult::FILE_NOT_HANDLED; + + int dataWidth = dataset->GetRasterXSize(); diff --git a/recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch b/recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch new file mode 100644 index 0000000000000..139031361bc28 --- /dev/null +++ b/recipes/openscenegraph/all/patches/0010-replace-ptr-fun-in-obj-plugin.patch @@ -0,0 +1,24 @@ +diff --git a/src/osgPlugins/obj/obj.cpp b/src/osgPlugins/obj/obj.cpp +index 859add652..3580e5181 100644 +--- a/src/osgPlugins/obj/obj.cpp ++++ b/src/osgPlugins/obj/obj.cpp +@@ -37,10 +37,15 @@ using namespace obj; + + static std::string strip( const std::string& ss ) + { +- std::string result; +- result.assign( std::find_if( ss.begin(), ss.end(), std::not1( std::ptr_fun< int, int >( isspace ) ) ), +- std::find_if( ss.rbegin(), ss.rend(), std::not1( std::ptr_fun< int, int >( isspace ) ) ).base() ); +- return( result ); ++ std::string::const_iterator it = ss.begin(); ++ while (it != ss.end() && isspace(*it)) ++ it++; ++ ++ std::string::const_reverse_iterator rit = ss.rbegin(); ++ while (rit.base() != it && isspace(*rit)) ++ rit++; ++ ++ return std::string(it, rit.base()); + } + + /* From 55a5fdb7c3d289679b1631185b643b44ecd556f9 Mon Sep 17 00:00:00 2001 From: Maksim Petukhov <6967052+maksim-petukhov@users.noreply.github.com> Date: Mon, 30 Oct 2023 12:01:01 +0100 Subject: [PATCH 2/3] Apply suggestions from code review --- recipes/openscenegraph/all/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/openscenegraph/all/conanfile.py b/recipes/openscenegraph/all/conanfile.py index b183a5d8f0819..c478df57c4d68 100644 --- a/recipes/openscenegraph/all/conanfile.py +++ b/recipes/openscenegraph/all/conanfile.py @@ -132,7 +132,7 @@ def requirements(self): self.requires("asio/1.22.1") self.requires("boost/1.82.0") if self.options.with_curl: - self.requires("libcurl/8.1.2") + self.requires("libcurl/[>=7.78 <9]") if self.options.get_safe("with_dcmtk"): self.requires("dcmtk/3.6.6") if self.options.with_freetype: @@ -158,7 +158,7 @@ def requirements(self): if self.options.with_tiff: self.requires("libtiff/4.5.0") if self.options.with_zlib: - self.requires("zlib/1.2.13") + self.requires("zlib/[>=1.2.11 <2]") def source(self): get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) From 1d0a5ce9e31968be0f627c9764a3d2e2f93b2b35 Mon Sep 17 00:00:00 2001 From: Petukhov Maksim Date: Fri, 3 Nov 2023 16:30:02 +0300 Subject: [PATCH 3/3] review --- recipes/openscenegraph/all/conandata.yml | 8 ++++++++ recipes/openscenegraph/all/conanfile.py | 18 +++++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/recipes/openscenegraph/all/conandata.yml b/recipes/openscenegraph/all/conandata.yml index 44b21085d9ff1..8e7744e3ecb43 100644 --- a/recipes/openscenegraph/all/conandata.yml +++ b/recipes/openscenegraph/all/conandata.yml @@ -18,9 +18,17 @@ patches: base_path: source_subfolder - patch_file: patches/0007-fix-msvc-with-std-c++17.patch base_path: source_subfolder + patch_type: bugfix + patch_source: https://github.com/openscenegraph/OpenSceneGraph/pull/1055 - patch_file: patches/0008-replace-mem-fun-ref.patch base_path: source_subfolder + patch_type: bugfix + patch_source: https://github.com/openscenegraph/OpenSceneGraph/commit/8a0114a46a4bad9041297950fe3bfbb2aea6e1da - patch_file: patches/0009-replace-auto-ptr-in-plugins.patch base_path: source_subfolder + patch_type: portability + patch_source: https://github.com/openscenegraph/OpenSceneGraph/pull/1246 - patch_file: patches/0010-replace-ptr-fun-in-obj-plugin.patch base_path: source_subfolder + patch_type: portability + patch_source: https://github.com/openscenegraph/OpenSceneGraph/pull/1246 diff --git a/recipes/openscenegraph/all/conanfile.py b/recipes/openscenegraph/all/conanfile.py index c478df57c4d68..d547f8ee411b8 100644 --- a/recipes/openscenegraph/all/conanfile.py +++ b/recipes/openscenegraph/all/conanfile.py @@ -129,16 +129,16 @@ def requirements(self): if self.options.get_safe("with_asio", False): # Should these be private requires? - self.requires("asio/1.22.1") - self.requires("boost/1.82.0") + self.requires("asio/1.28.2") + self.requires("boost/1.83.0") if self.options.with_curl: self.requires("libcurl/[>=7.78 <9]") if self.options.get_safe("with_dcmtk"): - self.requires("dcmtk/3.6.6") + self.requires("dcmtk/3.6.7") if self.options.with_freetype: self.requires("freetype/2.13.0") if self.options.with_gdal: - self.requires("gdal/3.5.2") + self.requires("gdal/3.7.0") if self.options.get_safe("with_gif"): self.requires("giflib/5.2.1") if self.options.with_gta: @@ -148,15 +148,15 @@ def requirements(self): if self.options.get_safe("with_jpeg") == "libjpeg": self.requires("libjpeg/9e") elif self.options.get_safe("with_jpeg") == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.5") + self.requires("libjpeg-turbo/3.0.0") elif self.options.get_safe("with_jpeg") == "mozjpeg": - self.requires("mozjpeg/4.1.1") + self.requires("mozjpeg/4.1.3") if self.options.get_safe("with_openexr"): - self.requires("openexr/3.1.5") + self.requires("openexr/3.1.9") if self.options.get_safe("with_png"): - self.requires("libpng/1.6.39") + self.requires("libpng/1.6.40") if self.options.with_tiff: - self.requires("libtiff/4.5.0") + self.requires("libtiff/4.6.0") if self.options.with_zlib: self.requires("zlib/[>=1.2.11 <2]")