From d781d9d4c9e2eaae93eae3e8fb4fd697389ae97e Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 11 Nov 2023 00:11:25 +0200 Subject: [PATCH 01/29] ogre: migrate to Conan v2, bump to latest version --- recipes/ogre/1.x/CMakeLists.txt | 50 +- recipes/ogre/1.x/conandata.yml | 10 +- recipes/ogre/1.x/conanfile.py | 852 ++++++++++++------ .../0001-ogre-1.10.2-cmake-fixes.patch | 532 ----------- recipes/ogre/1.x/test_package/CMakeLists.txt | 17 +- recipes/ogre/1.x/test_package/conanfile.py | 25 +- recipes/ogre/1.x/test_package/ogre_main.cpp | 22 +- .../ogre/1.x/test_v1_package/CMakeLists.txt | 8 + recipes/ogre/1.x/test_v1_package/conanfile.py | 19 + recipes/ogre/config.yml | 2 +- 10 files changed, 676 insertions(+), 861 deletions(-) delete mode 100644 recipes/ogre/1.x/patches/0001-ogre-1.10.2-cmake-fixes.patch create mode 100644 recipes/ogre/1.x/test_v1_package/CMakeLists.txt create mode 100644 recipes/ogre/1.x/test_v1_package/conanfile.py diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index 4c95ca5e84716..b454e773987c8 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -1,7 +1,47 @@ -cmake_minimum_required(VERSION 3.10.2) -project(cmake_wrapper) +cmake_minimum_required(VERSION 3.15) +project(OGRE) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +macro(custom_find_package name) + find_package(${name} ${ARGN} + # Allow only Conan packages + NO_DEFAULT_PATH + PATHS ${CMAKE_PREFIX_PATH} + ) + string(TOUPPER ${name} name_upper) + set(${name_upper}_FOUND TRUE) + set(${name_upper}_VERSION_STRING ${${name}_VERSION_STRING}) + set(${name_upper}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS}) + set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) + set(${name_upper}_LIBRARIES ${${name}_LIBRARIES}) + set(${name_upper}_DEFINITIONS ${${name}_DEFINITIONS}) + unset(name_upper) +endmacro() -add_subdirectory(source_subfolder) +# Do not allow system Qt to be used by accident +set(CMAKE_DISABLE_FIND_PACKAGE_QT TRUE) +set(CMAKE_DISABLE_FIND_PACKAGE_Qt5 TRUE) +set(CMAKE_DISABLE_FIND_PACKAGE_Qt6 TRUE) + +custom_find_package(FreeImage QUIET CONFIG) +custom_find_package(Freetype QUIET CONFIG) +custom_find_package(OpenEXR QUIET CONFIG) +custom_find_package(assimp QUIET CONFIG) +custom_find_package(pugixml REQUIRED CONFIG) + +add_subdirectory(src) + +if(TARGET Codec_FreeImage) + target_link_libraries(Codec_FreeImage PUBLIC freeimage::freeimage) +endif() +if(TARGET Codec_EXR) + target_link_libraries(Codec_EXR openexr::openexr) +endif() +if(TARGET OgreOverlay) + target_link_libraries(OgreOverlay PUBLIC Freetype::Freetype) +endif() +if(TARGET Plugin_DotScene) + target_link_libraries(Plugin_DotScene PUBLIC pugixml::pugixml) +endif() +if(TARGET OgreXMLConverter) + target_link_libraries(OgreXMLConverter pugixml::pugixml) +endif() diff --git a/recipes/ogre/1.x/conandata.yml b/recipes/ogre/1.x/conandata.yml index 2943bef50eb12..eda4c6e8ffbb5 100644 --- a/recipes/ogre/1.x/conandata.yml +++ b/recipes/ogre/1.x/conandata.yml @@ -1,8 +1,4 @@ sources: - "1.10.2": - url: "https://github.com/OGRECave/ogre/archive/refs/tags/v1.10.2.tar.gz" - sha256: "db022c682376ace2abc45b42802048ad3a8458f5052cbc180b5fb470e4f06a53" -patches: - "1.10.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-ogre-1.10.2-cmake-fixes.patch" + "14.2.4": + url: "https://github.com/OGRECave/ogre/archive/refs/tags/v14.2.4.tar.gz" + sha256: "320cf8eb020e8848d5b7ed2efec260dbff5ae8013812d2f3aca1655df4e2282a" diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 3a275358024c4..5ab1f6cd1dea1 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -1,368 +1,650 @@ import os -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration, ConanException -import conan.tools.files -import textwrap, shutil -import functools +import textwrap -class ogrecmakeconan(ConanFile): +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir, save, replace_in_file +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class OgreConanFile(ConanFile): name = "ogre" + description = "A scene-oriented, flexible 3D engine written in C++" license = "MIT" - homepage = "https://github.com/OGRECave/ogre" url = "https://github.com/conan-io/conan-center-index" - description = "A scene-oriented, flexible 3D engine written in C++ " + homepage = "https://github.com/OGRECave/ogre" topics = ("graphics", "rendering", "engine", "c++") - settings = "os", "compiler", "build_type", "arch" - - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt", "patches/**" - + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "cp_bin_dir": "ANY", - "cp_media_dir": "ANY", - "disable_plugins": [True, False], - "assert_mode": "ANY", - "build_component_bites": [True, False], - "build_component_hlms": [True, False], - "build_component_meshlodgenerator": [True, False], - "build_component_overlay": [True, False], + "resourcemanager_strict": ["PEDANTIC", "STRICT"], + "build_rendersystem_d3d9": [True, False], + "build_rendersystem_d3d11": [True, False], + "build_rendersystem_gl3plus": [True, False], + "build_rendersystem_gl": [True, False], + "build_rendersystem_gles2": [True, False], + "build_rendersystem_metal": [True, False], + "build_rendersystem_tiny": [True, False], "build_component_paging": [True, False], + "build_component_meshlodgenerator": [True, False], + "build_component_terrain": [True, False], + "build_component_volume": [True, False], "build_component_property": [True, False], + "build_component_overlay": [True, False], + "build_component_overlay_imgui": [True, False], + "build_component_bites": [True, False], + "build_component_bullet": [True, False], + "bites_static_plugins": [True, False], "build_component_python": [True, False], + "build_component_java": [True, False], + "build_component_csharp": [True, False], "build_component_rtshadersystem": [True, False], - "build_component_terrain": [True, False], - "build_component_volume": [True, False], - "build_dependencies": [True, False], + "build_rtshadersystem_shaders": [True, False], + "build_samples": [True, False], + "build_tools": [True, False], + "build_xsiexporter": [True, False], + # "build_libs_as_frameworks": [True, False], + "build_plugin_assimp": [True, False], "build_plugin_bsp": [True, False], + "build_plugin_cg": [True, False], + "build_plugin_dot_scene": [True, False], + "build_plugin_exrcodec": [True, False], + "build_plugin_freeimage": [True, False], "build_plugin_octree": [True, False], "build_plugin_pcz": [True, False], "build_plugin_pfx": [True, False], - "build_rendersystem_d3d11": [True, False], - "build_rendersystem_gl": [True, False], - "build_rendersystem_gl3plus": [True, False], - "build_samples": [True, False], - "build_tests": [True, False], - "build_tools": [True, False], + "build_plugin_stbi": [True, False], + "config_enable_meshlod": [True, False], + "config_double": [True, False], + "config_node_inherit_transform": [True, False], + "config_threads": [True, False], + "config_enable_dds": [True, False], + "config_enable_pvrtc": [True, False], + "config_enable_etc": [True, False], + "config_enable_astc": [True, False], "config_enable_quad_buffer_stereo": [True, False], + "config_enable_viewport_orientationmode": [True, False], + "config_enable_gles2_cg_support": [True, False], + "config_enable_gles2_glsl_optimiser": [True, False], + "config_enable_gl_state_cache_support": [True, False], "config_filesystem_unicode": [True, False], - "config_threads": "ANY", - "config_thread_provider": "ANY", - "config_enable_freeimage": [True, False], + "install_docs": [True, False], "install_pdb": [True, False], - "install_samples": [True, False], - "install_tools": [True, False], + "profiling": [True, False], "install_vsprops": [True, False], - "resourcemanager_strict": "ANY", - "set_double": [True, False], - "glsupport_use_egl": [True, False] + "assert_mode": [0, 1, 2], } - default_options = { "shared": False, "fPIC": True, - "cp_bin_dir": "bin", - "cp_media_dir": "Media", - "disable_plugins": False, - "assert_mode": 1, - "build_component_bites": True, - "build_component_hlms": True, - "build_component_meshlodgenerator": True, - "build_component_overlay": True, + "resourcemanager_strict": "STRICT", + "build_rendersystem_d3d9": True, + "build_rendersystem_d3d11": True, + "build_rendersystem_gl3plus": True, + "build_rendersystem_gl": True, + "build_rendersystem_gles2": True, + "build_rendersystem_metal": True, + "build_rendersystem_tiny": False, "build_component_paging": True, + "build_component_meshlodgenerator": True, + "build_component_terrain": True, + "build_component_volume": True, "build_component_property": True, + "build_component_overlay": True, + "build_component_overlay_imgui": True, + "build_component_bites": True, + "build_component_bullet": True, + "bites_static_plugins": False, "build_component_python": False, + "build_component_java": False, + "build_component_csharp": False, "build_component_rtshadersystem": True, - "build_component_terrain": True, - "build_component_volume": True, - "build_dependencies": False, + "build_rtshadersystem_shaders": True, + "build_samples": False, + "build_tools": False, + "build_xsiexporter": False, + # "build_libs_as_frameworks": True, + "build_plugin_assimp": True, "build_plugin_bsp": True, + "build_plugin_cg": False, + "build_plugin_dot_scene": True, + "build_plugin_exrcodec": True, + "build_plugin_freeimage": True, "build_plugin_octree": True, "build_plugin_pcz": True, "build_plugin_pfx": True, - "build_rendersystem_d3d11": True, - "build_rendersystem_gl": True, - "build_rendersystem_gl3plus": True, - "build_samples": False, - "build_tests": False, - "build_tools": True, + "build_plugin_stbi": True, + "config_double": False, + "config_node_inherit_transform": False, + "config_threads": True, + "config_enable_meshlod": True, + "config_enable_dds": True, + "config_enable_pvrtc": False, + "config_enable_etc": True, + "config_enable_astc": True, "config_enable_quad_buffer_stereo": False, + "config_enable_viewport_orientationmode": False, + "config_enable_gles2_cg_support": False, + "config_enable_gles2_glsl_optimiser": False, + "config_enable_gl_state_cache_support": False, "config_filesystem_unicode": True, - "config_threads": 3, - "config_thread_provider": "std", - "config_enable_freeimage": True, + "install_docs": False, "install_pdb": False, - "install_samples": False, - "install_tools": False, + "profiling": False, "install_vsprops": False, - "resourcemanager_strict": 2, - "set_double": False, - "glsupport_use_egl": True + "assert_mode": 1, + } + options_description = { + "resourcemanager_strict": ( + "Make ResourceManager strict for faster operation. Possible values:\n" + "PEDANTIC - require an explicit resource group. Case sensitive lookup.\n" + "STRICT - search in default group if not specified otherwise. Case sensitive lookup." + ), + "build_rendersystem_d3d9": "Build Direct3D9 RenderSystem", + "build_rendersystem_d3d11": "Build Direct3D11 RenderSystem", + "build_rendersystem_gl3plus": "Build OpenGL 3+ RenderSystem", + "build_rendersystem_gl": "Build OpenGL RenderSystem", + "build_rendersystem_gles2": "Build OpenGL ES 2.x RenderSystem", + "build_rendersystem_metal": "Build Metal RenderSystem", + "build_rendersystem_tiny": "Build Tiny RenderSystem (software-rendering)", + "build_component_paging": "Build Paging component", + "build_component_meshlodgenerator": "Build MeshLodGenerator component", + "build_component_terrain": "Build Terrain component", + "build_component_volume": "Build Volume component", + "build_component_property": "Build Property component", + "build_component_overlay": "Build Overlay component", + "build_component_overlay_imgui": "Include dear imgui in Overlays", + "build_component_bites": "Build OgreBites component", + "build_component_bullet": "Build Bullet physics component", + "bites_static_plugins": "Skip plugins.cfg and statically load plugins via OgreBites", + "build_component_python": "Build Python bindings", + "build_component_java": "Build Java (JNI) bindings", + "build_component_csharp": "Build Csharp bindings", + "build_component_rtshadersystem": "Build RTShader System component", + "build_rtshadersystem_shaders": "Build RTShader System FFP shaders", + "build_samples": "Build Ogre demos", + "build_tools": "Build the command-line tools", + "build_xsiexporter": "Build the Softimage exporter", + # "build_libs_as_frameworks": "Build frameworks for libraries on OS X.", + "build_plugin_assimp": "Build Open Asset Import plugin", + "build_plugin_bsp": "Build BSP SceneManager plugin", + "build_plugin_cg": "Build Cg plugin", + "build_plugin_dot_scene": "Build .scene plugin", + "build_plugin_exrcodec": "Build EXR Codec plugin", + "build_plugin_freeimage": "Build FreeImage codec.", + "build_plugin_octree": "Build Octree SceneManager plugin", + "build_plugin_pcz": "Build PCZ SceneManager plugin", + "build_plugin_pfx": "Build ParticleFX plugin", + "build_plugin_stbi": "Enable STBI image codec.", + "config_double": "Use doubles instead of floats in Ogre", + "config_node_inherit_transform": "Tells the node whether it should inherit full transform from it's parent node or derived position, orientation and scale", + "config_threads": "Enable Ogre thread safety support for multithreading. DefaultWorkQueue is threaded if True.", + "config_enable_meshlod": "Enable Mesh Lod.", + "config_enable_dds": "Build DDS codec.", + "config_enable_pvrtc": "Build PVRTC codec.", + "config_enable_etc": "Build ETC codec.", + "config_enable_astc": "Build ASTC codec.", + "config_enable_quad_buffer_stereo": "Enable stereoscopic 3D support", + "config_enable_viewport_orientationmode": "Include Viewport orientation mode support.", + "config_enable_gles2_cg_support": "Enable Cg support to ES 2 render system", + "config_enable_gles2_glsl_optimiser": "Enable GLSL optimiser use in GLES 2 render system", + "config_enable_gl_state_cache_support": "Enable OpenGL state cache management", + "config_filesystem_unicode": "paths expected to be in UTF-8 and wchar_t file IO routines are used", + "install_docs": "Install documentation.", + "install_pdb": "Install debug pdb files", + "profiling": "Enable internal instrumentation.", + "install_vsprops": "Install Visual Studio Property Page.", + "assert_mode": ( + "Enable Ogre asserts and exceptions. Possible values:\n" + "0 - Standard asserts in debug builds, nothing in release builds.\n" + "1 - Standard asserts in debug builds, exceptions in release builds.\n" + "2 - Exceptions in debug builds, exceptions in release builds." + ), } - exports_sources = "CMakeLists.txt", "patches/**" - short_paths = True - - def requirements(self): - self.requires("cppunit/1.15.1") - self.requires("freeimage/3.18.0") - self.requires("boost/1.75.0") - self.requires("openexr/2.5.7") - self.requires("freetype/2.11.1") - self.requires("poco/1.11.2") - self.requires("tbb/2020.3") - self.requires("zlib/1.2.12") - self.requires("zziplib/0.13.71") - self.requires("openssl/1.1.1o", override=True) - self.requires("xorg/system") - self.requires("glu/system") - self.requires("sdl/2.0.20") - if self.options.glsupport_use_egl and self.settings.os in ["Linux", "FreeBSD"]: - self.requires("egl/system") - else: - self.requires("libglvnd/1.4.0") - - - def validate(self): - """ - OGRE 1.x is very old and will not work with latest gcc, clang and msvc compilers. - TODO: determine incompatible msvc compilers - """ - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) >= 11: - raise ConanInvalidConfiguration("OGRE 1.x not supported with gcc version greater than 11") - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) >= 11: - raise ConanInvalidConfiguration("OGRE 1.x not supported with clang version greater than 11") - - miss_boost_required_comp = any(getattr(self.options["boost"], "without_{}".format(boost_comp), True) for boost_comp in self._required_boost_components) - if self.options["boost"].header_only or miss_boost_required_comp: - raise ConanInvalidConfiguration("OGRE requires these boost components: {}".format(", ".join(self._required_boost_components))) - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) def config_options(self): - self.options.install_tools = self.options.build_tools if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os != "Windows": + self.options.rm_safe("build_rendersystem_d3d9") + self.options.rm_safe("build_rendersystem_d3d11") + if self.settings.os == "WindowsStore": + self.options.rm_safe("build_rendersystem_d3d9") + self.options.rm_safe("build_rendersystem_gl3plus") + self.options.rm_safe("build_rendersystem_gl") + self.options.rm_safe("build_rendersystem_gles2") + self.options.rm_safe("build_plugin_cg") + if not is_apple_os(self): + self.options.rm_safe("build_rendersystem_metal") + self.options.rm_safe("build_libs_as_frameworks") + if self.settings.os == "Android": + self.options.rm_safe("build_rendersystem_tiny") + if self.settings.os == "WindowsStore" or (is_apple_os(self) and self.settings.os != "Macos"): + self.options.rm_safe("build_tools") + if not is_msvc(self): + self.options.rm_safe("config_filesystem_unicode") + self.options.rm_safe("install_pdb") + self.options.rm_safe("install_vsprops") def configure(self): if self.options.shared: - del self.options.fPIC - self._strict_options_requirements() + self.options.rm_safe("fPIC") + if not self.options.get_safe("build_component_overlay"): + self.options.rm_safe("build_component_overlay_imgui") + self.options.rm_safe("build_component_bites") + if self.options.shared or not self.options.get_safe("build_component_bites"): + self.options.rm_safe("bites_static_plugins") + if not self.options.get_safe("build_component_rtshadersystem"): + self.options.rm_safe("build_rtshadersystem_shaders") + if not self.options.get_safe("build_rendersystem_gles2"): + self.options.rm_safe("config_enable_gles2_cg_support") + self.options.rm_safe("config_enable_gles2_glsl_optimiser") + + def layout(self): + cmake_layout(self, src_folder="src") - def _strict_options_requirements(self): - self.options["boost"].header_only = False - for boost_comp in self._required_boost_components: - setattr(self.options["boost"], "without_{}".format(boost_comp), False) + def requirements(self): + self.requires("pugixml/1.14") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zziplib/0.13.72") + if self.options.get_safe("build_component_bites") or self.options.get_safe("build_rendersystem_tiny"): + self.requires("sdl/2.30.2") + if self._build_opengl: + self.requires("opengl/system", transitive_headers=True, transitive_libs=True) + if self.settings.os in ["Linux", "FreeBSD"]: + self.requires("xorg/system", transitive_headers=True, transitive_libs=True) + if self.options.build_component_bullet: + self.requires("bullet3/3.25") + if self.options.build_component_overlay: + self.requires("freetype/2.13.2") + if self.options.build_component_overlay_imgui: + self.requires("imgui/1.90.5") + if self.options.build_plugin_assimp: + self.requires("assimp/5.3.1") + if self.options.build_plugin_exrcodec: + self.requires("openexr/2.5.7") + if self.options.build_plugin_freeimage: + self.requires("freeimage/3.18.0") + + # TODO: OpenMP for RenderSystem_Tiny + # TODO: unvendor stb in Plugin_STBI + # TODO: add Cg recipe + # TODO: OGRE_BUILD_PLUGIN_GLSLANG + # TODO: OGRE_BUILD_PLUGIN_RSIMAGE @property - def _required_boost_components(self): - return ["date_time", "thread"] + def _build_opengl(self): + # https://github.com/OGRECave/ogre/blob/v14.2.4/RenderSystems/CMakeLists.txt#L32-L34 + return (self.options.get_safe("build_rendersystem_gl") or + self.options.get_safe("build_rendersystem_gles2") or + self.options.get_safe("build_rendersystem_gl3plus")) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["OGRE_STATIC"] = not self.options.shared - cmake.definitions["OGRE_CONFIG_DOUBLE"] = self.options.set_double - cmake.definitions["OGRE_CONFIG_NODE_INHERIT_TRANSFORM"] = False - cmake.definitions["OGRE_GLSUPPORT_USE_EGL"] = self.options.glsupport_use_egl - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - else: - # INFO: OpenEXR requires C++11 - cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - cmake.definitions["OGRE_BUILD_TESTS"] = self.options.build_tests - cmake.definitions["OGRE_ASSERT_MODE"] = self.options.assert_mode - cmake.definitions["OGRE_BUILD_COMPONENT_BITES"] = self.options.build_component_bites - cmake.definitions["OGRE_BUILD_COMPONENT_HLMS"] = self.options.build_component_hlms - cmake.definitions["OGRE_BUILD_COMPONENT_MESHLODGENERATOR"] = self.options.build_component_meshlodgenerator - cmake.definitions["OGRE_BUILD_COMPONENT_OVERLAY"] = self.options.build_component_overlay - cmake.definitions["OGRE_BUILD_COMPONENT_PAGING"] = self.options.build_component_paging - cmake.definitions["OGRE_BUILD_COMPONENT_PROPERTY"] = self.options.build_component_property - cmake.definitions["OGRE_BUILD_COMPONENT_PYTHON"] = self.options.build_component_python - cmake.definitions["OGRE_BUILD_COMPONENT_RTSHADERSYSTEM"] = self.options.build_component_rtshadersystem - cmake.definitions["OGRE_BUILD_COMPONENT_TERRAIN"] = self.options.build_component_terrain - cmake.definitions["OGRE_BUILD_COMPONENT_VOLUME"] = self.options.build_component_volume - cmake.definitions["OGRE_BUILD_DEPENDENCIES"] = self.options.build_dependencies - cmake.definitions["OGRE_BUILD_PLUGIN_BSP"] = self.options.build_plugin_bsp - cmake.definitions["OGRE_BUILD_PLUGIN_OCTREE"] = self.options.build_plugin_octree - cmake.definitions["OGRE_BUILD_PLUGIN_PCZ"] = self.options.build_plugin_pcz - cmake.definitions["OGRE_BUILD_PLUGIN_PFX"] = self.options.build_plugin_pfx - cmake.definitions["OGRE_BUILD_RENDERSYSTEM_D3D11"] = self.options.build_rendersystem_d3d11 - cmake.definitions["OGRE_BUILD_RENDERSYSTEM_GL"] = self.options.build_rendersystem_gl - cmake.definitions["OGRE_BUILD_RENDERSYSTEM_GL3PLUS"] = self.options.build_rendersystem_gl3plus - cmake.definitions["OGRE_BUILD_SAMPLES"] = self.options.build_samples - cmake.definitions["OGRE_BUILD_TOOLS"] = self.options.build_tools - cmake.definitions["OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO"] = self.options.config_enable_quad_buffer_stereo - cmake.definitions["OGRE_CONFIG_FILESYSTEM_UNICODE"] = self.options.config_filesystem_unicode - cmake.definitions["OGRE_CONFIG_THREADS"] = self.options.config_threads - cmake.definitions["OGRE_CONFIG_THREAD_PROVIDER"] = self.options.config_thread_provider - cmake.definitions["OGRE_CONFIG_ENABLE_FREEIMAGE"] = self.options.config_enable_freeimage - cmake.definitions["OGRE_INSTALL_PDB"] = self.options.install_pdb - cmake.definitions["OGRE_INSTALL_SAMPLES"] = self.options.install_samples - cmake.definitions["OGRE_INSTALL_TOOLS"] = self.options.install_tools - cmake.definitions["OGRE_RESOURCEMANAGER_STRICT"] = self.options.resourcemanager_strict - if self.settings.os == "Windows": - cmake.definitions["OGRE_INSTALL_VSPROPS"] = self.options.install_vsprops - cmake.configure() - return cmake + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L21-L25 + if self.options.shared and is_apple_os(self) and self.settings.os != "Macos": + raise ConanInvalidConfiguration(f"OGRE shared library is not available on {self.settings.os}") + if not self.options.shared and (self.options.get_safe("build_component_python") or self.options.get_safe("build_component_java") or self.options.get_safe("build_component_csharp")): + raise ConanInvalidConfiguration("OGRE static library does not support bindings for Python/Java/C#") + + if self.options.config_enable_gl_state_cache_support and not self._build_opengl: + raise ConanInvalidConfiguration("config_enable_gl_state_cache_support requires GL, GLES2 or GL3PLUS RenderSystem") + + def _missing_dep_warning(opt, dep): + if self.options.get_safe(opt): + self.output.warning(f"{opt} requires {dep}, which is not available in Conan Center Index. " + "Assuming it is provided by the system.") + + _missing_dep_warning("build_plugin_cg", "Cg") + _missing_dep_warning("config_enable_gles2_cg_support", "Cg") + _missing_dep_warning("config_enable_quad_buffer_stereo", "NVAPI") + _missing_dep_warning("build_xsiexporter", "Softimage") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/2.1.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + + tc = CMakeToolchain(self) + # https://github.com/OGRECave/ogre/blob/v14.2.4/CMakeLists.txt#L281-L420 + tc.variables["OGRE_STATIC"] = not self.options.shared + tc.variables["OGRE_RESOURCEMANAGER_STRICT"] = 2 if self.options.resourcemanager_strict == "STRICT" else 1 + tc.variables["OGRE_BUILD_RENDERSYSTEM_D3D9"] = self.options.get_safe("build_rendersystem_d3d9", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_D3D11"] = self.options.get_safe("build_rendersystem_d3d11", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_GL3PLUS"] = self.options.get_safe("build_rendersystem_gl3plus", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_GL"] = self.options.get_safe("build_rendersystem_gl", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_GLES2"] = self.options.get_safe("build_rendersystem_gles2", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_METAL"] = self.options.get_safe("build_rendersystem_metal", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_TINY"] = self.options.get_safe("build_rendersystem_tiny", False) + tc.variables["OGRE_BUILD_COMPONENT_PAGING"] = self.options.build_component_paging + tc.variables["OGRE_BUILD_COMPONENT_MESHLODGENERATOR"] = self.options.build_component_meshlodgenerator + tc.variables["OGRE_BUILD_COMPONENT_TERRAIN"] = self.options.build_component_terrain + tc.variables["OGRE_BUILD_COMPONENT_VOLUME"] = self.options.build_component_volume + tc.variables["OGRE_BUILD_COMPONENT_PROPERTY"] = self.options.build_component_property + tc.variables["OGRE_BUILD_COMPONENT_OVERLAY"] = self.options.build_component_overlay + tc.variables["OGRE_BUILD_COMPONENT_OVERLAY_IMGUI"] = self.options.get_safe("build_component_overlay_imgui", False) + tc.variables["OGRE_BUILD_COMPONENT_BITES"] = self.options.get_safe("build_component_bites", False) + tc.variables["OGRE_BUILD_COMPONENT_BULLET"] = self.options.build_component_bullet + tc.variables["OGRE_BITES_STATIC_PLUGINS"] = self.options.get_safe("bites_static_plugins", False) + tc.variables["OGRE_BUILD_COMPONENT_PYTHON"] = self.options.build_component_python + tc.variables["OGRE_BUILD_COMPONENT_JAVA"] = self.options.build_component_java + tc.variables["OGRE_BUILD_COMPONENT_CSHARP"] = self.options.build_component_csharp + tc.variables["OGRE_BUILD_COMPONENT_RTSHADERSYSTEM"] = self.options.build_component_rtshadersystem + tc.variables["OGRE_BUILD_RTSHADERSYSTEM_SHADERS"] = self.options.get_safe("build_rtshadersystem_shaders", False) + tc.variables["OGRE_BUILD_SAMPLES"] = self.options.get_safe("build_samples", False) + tc.variables["OGRE_BUILD_TOOLS"] = self.options.get_safe("build_tools", False) + tc.variables["OGRE_BUILD_XSIEXPORTER"] = self.options.get_safe("build_xsiexporter", False) + tc.variables["OGRE_BUILD_LIBS_AS_FRAMEWORKS"] = False # TODO: requires additional package_info() logic + tc.variables["OGRE_BUILD_TESTS"] = False + tc.variables["OGRE_BUILD_PLUGIN_ASSIMP"] = self.options.build_plugin_assimp + tc.variables["OGRE_BUILD_PLUGIN_BSP"] = self.options.build_plugin_bsp + tc.variables["OGRE_BUILD_PLUGIN_OCTREE"] = self.options.build_plugin_octree + tc.variables["OGRE_BUILD_PLUGIN_PFX"] = self.options.build_plugin_pfx + tc.variables["OGRE_BUILD_PLUGIN_DOT_SCENE"] = self.options.build_plugin_dot_scene + tc.variables["OGRE_BUILD_PLUGIN_PCZ"] = self.options.build_plugin_pcz + tc.variables["OGRE_BUILD_PLUGIN_CG"] = self.options.get_safe("build_plugin_cg", False) + tc.variables["OGRE_BUILD_PLUGIN_EXRCODEC"] = self.options.build_plugin_exrcodec + tc.variables["OGRE_BUILD_PLUGIN_STBI"] = self.options.build_plugin_stbi + tc.variables["OGRE_CONFIG_DOUBLE"] = self.options.config_double + tc.variables["OGRE_CONFIG_NODE_INHERIT_TRANSFORM"] = self.options.config_node_inherit_transform + tc.variables["OGRE_CONFIG_THREADS"] = "3" if self.options.config_threads else "0" + tc.variables["OGRE_CONFIG_ENABLE_MESHLOD"] = self.options.config_enable_meshlod + tc.variables["OGRE_CONFIG_ENABLE_DDS"] = self.options.config_enable_dds + tc.variables["OGRE_CONFIG_ENABLE_PVRTC"] = self.options.config_enable_pvrtc + tc.variables["OGRE_CONFIG_ENABLE_ETC"] = self.options.config_enable_etc + tc.variables["OGRE_CONFIG_ENABLE_ASTC"] = self.options.config_enable_astc + tc.variables["OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO"] = self.options.get_safe("config_enable_quad_buffer_stereo", False) + tc.variables["OGRE_CONFIG_ENABLE_ZIP"] = True + tc.variables["OGRE_CONFIG_ENABLE_VIEWPORT_ORIENTATIONMODE"] = self.options.config_enable_viewport_orientationmode + tc.variables["OGRE_CONFIG_ENABLE_GLES2_CG_SUPPORT"] = self.options.get_safe("config_enable_gles2_cg_support", False) + tc.variables["OGRE_CONFIG_ENABLE_GLES2_GLSL_OPTIMISER"] = self.options.get_safe("config_enable_gles2_glsl_optimiser", False) + tc.variables["OGRE_CONFIG_ENABLE_GL_STATE_CACHE_SUPPORT"] = self.options.get_safe("config_enable_gl_state_cache_support", False) + tc.variables["OGRE_CONFIG_FILESYSTEM_UNICODE"] = self.options.get_safe("config_filesystem_unicode", False) + tc.variables["OGRE_CONFIG_STATIC_LINK_CRT"] = is_msvc_static_runtime(self) + tc.variables["OGRE_INSTALL_SAMPLES"] = self.options.get_safe("build_samples", False) + tc.variables["OGRE_INSTALL_TOOLS"] = self.options.get_safe("build_tools", False) + tc.variables["OGRE_INSTALL_DOCS"] = self.options.get_safe("install_docs", False) + tc.variables["OGRE_INSTALL_PDB"] = self.options.get_safe("install_pdb", False) + tc.variables["OGRE_PROFILING"] = self.options.profiling + tc.variables["OGRE_LIB_DIRECTORY"] = "lib" + tc.variables["OGRE_BIN_DIRECTORY"] = "bin" + tc.variables["OGRE_INSTALL_VSPROPS"] = self.options.get_safe("install_vsprops", False) + # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L63-L69 + tc.variables["OGRE_ASSERT_MODE"] = self.options.assert_mode + tc.variables["OGRE_BUILD_DEPENDENCIES"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("openexr", "cmake_file_name", "OpenEXR") + deps.set_property("freeimage", "cmake_file_name", "FreeImage") + deps.set_property("freetype", "cmake_file_name", "Freetype") + deps.generate() + + deps = PkgConfigDeps(self) + deps.generate() + def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # the pkgs below are not available as conan recipes yet - # TODO: delte line 200-208 once the conan recipes are available - ogre_pkg_modules = ["AMDQBS", "Cg", "HLSL2GLSL", "GLSLOptimizer", "OpenGLES", "OpenGLES2", "OpenGLES3", "SDL2", "Softimage", "Wix"] - ogre_pkg_module_path = os.path.join(self.build_folder, self._source_subfolder, "CMake", "Packages") - for pkg_module in ogre_pkg_modules: - pkg_path = os.path.join(ogre_pkg_module_path, f"Find{pkg_module}.cmake") - if os.path.isfile(pkg_path): - shutil.copy(pkg_path, self.build_folder) - else: - raise ConanException(f"The file Find{pkg_module}.cmake is not present in f{ogre_pkg_module_path}!") + replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "Assimp", "CMakeLists.txt"), + "fix::assimp", "assimp::assimp") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_path.parent) cmake.build() - def package(self): - cmake = self._configure_cmake() - cmake.install() - self.copy(pattern="License.md", dst="licenses", src=os.path.join(self._source_subfolder, "Docs")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "OGRE", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - self._create_cmake_module_variables( - os.path.join(self.package_folder, self._module_file_rel_path), - tools.Version(self.version) - ) - - - @staticmethod - def _create_cmake_module_variables(module_file, version): - content = textwrap.dedent("""\ + @property + def _ogre_cmake_packages(self): + return ["Cg", "DirectX", "DirectX11", "Softimage", "GLSLOptimizer", "HLSL2GLSL"] + + def _create_cmake_module_variables(self, module_file, version): + content = textwrap.dedent(f"""\ set(OGRE_PREFIX_DIR ${{CMAKE_CURRENT_LIST_DIR}}/../..) - set(OGRE{major}_VERSION_MAJOR {major}) - set(OGRE{major}_VERSION_MINOR {minor}) - set(OGRE{major}_VERSION_PATCH {patch}) - set(OGRE{major}_VERSION_STRING "{major}.{minor}.{patch}") + set(OGRE{version.major}_VERSION_MAJOR {version.major}) + set(OGRE{version.major}_VERSION_MINOR {version.minor}) + set(OGRE{version.major}_VERSION_PATCH {version.patch}) + set(OGRE{version.major}_VERSION_STRING "{version.major}.{version.minor}.{version.patch}") set(OGRE_MEDIA_DIR "${{OGRE_PREFIX_DIR}}/share/OGRE/Media") set(OGRE_PLUGIN_DIR "${{OGRE_PREFIX_DIR}}/lib/OGRE") - set(OGRE_CONFIG_DIR "${{OGRE_PREFIX_DIR}}/share/OGRE") - """.format(major=version.major, minor=version.minor, patch=version.patch)) - tools.save(module_file, content) + set(OGRE_CONFIG_DIR "${{OGRE_PREFIX_DIR}}/share/OGRE") + """) + # Some hacky dependency resolution for packages that are not available from Conan + for pkg in self._ogre_cmake_packages: + content += textwrap.dedent(f"""\ + find_package({pkg} MODULE QUIET) + if({pkg}_FOUND OR {pkg.upper()}_FOUND) + target_link_libraries(OGRE::OgreMain INTERFACE ${{{pkg}}}_LIBRARIES}} ${{{pkg.upper()}}}_LIBRARIES}}) + target_include_directories(OGRE::OgreMain INTERFACE ${{{pkg}}}_INCLUDE_DIRS}} ${{{pkg.upper()}}}_INCLUDE_DIRS}}) + endif() + """) + save(self, module_file, content) + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "License.md", + dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "Docs")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "OGRE", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._module_file_rel_path), Version(self.version) + ) + # Include modules for packages that are not available from Conan + for pkg in self._ogre_cmake_packages: + copy(self, f"Find{pkg}.cmake", + src=os.path.join(self.source_folder, "CMake", "Packages"), + dst=os.path.join(self.package_folder, self._module_file_rel_dir)) + copy(self, "FindPkgMacros.cmake", + src=os.path.join(self.source_folder, "CMake", "Utils"), + dst=os.path.join(self.package_folder, self._module_file_rel_dir)) @property - def _components(self): - include_prefix = os.path.join("include", "OGRE") - plugin_lib_dir = os.path.join("lib", "OGRE") - components = { - "OgreMain": {"requires" : ["boost::boost", "cppunit::cppunit", "freeimage::freeimage", "openexr::openexr","freetype::freetype", - "sdl::sdl", "tbb::tbb", "xorg::xorg", "zlib::zlib", "zziplib::zziplib", "poco::poco","glu::glu", "egl::egl"], - "libs": ["OgreMain"], "include": [include_prefix], "libdirs" : ["lib"]}, - "Bites": {"requires" : ["OgreMain", "Overlay"], "libs": ["OgreBites"], - "include": ["include", include_prefix, f"{include_prefix}/Bites"], "libdirs" : ["lib"]}, - "HLMS" : {"requires" : ["OgreMain"], "libs": ["OgreHLMS"], - "include": ["include", include_prefix, f"{include_prefix}/HLMS"], "libdirs" : ["lib"]}, - "MeshLodGenerator" : {"requires" : ["OgreMain"], "libs": ["OgreMeshLodGenerator"], - "include": ["include", include_prefix, f"{include_prefix}/MeshLodGenerator"], "libdirs" : ["lib"]}, - "Overlay" : {"requires" : ["OgreMain"], "libs": ["OgreOverlay"], - "include": ["include", include_prefix, f"{include_prefix}/Overlay"], "libdirs" : ["lib"]}, - "Paging" : {"requires" : ["OgreMain"], "libs": ["OgrePaging"], - "include": ["include", include_prefix, f"{include_prefix}/Paging"], "libdirs" : ["lib"]}, - "Property" : {"requires" : ["OgreMain"], "libs": ["OgreProperty"], - "include": ["include", include_prefix, f"{include_prefix}/Property"], "libdirs" : ["lib"]}, - "RTShaderSystem" : {"requires" : ["OgreMain"], "libs": ["OgreRTShaderSystem"], - "include": ["include", include_prefix, f"{include_prefix}/RTShaderSystem"], "libdirs" : ["lib"]}, - "Terrain" : {"requires" : ["OgreMain"], "libs": ["OgreTerrain"], - "include": ["include", include_prefix, f"{include_prefix}/Terrain"], "libdirs" : ["lib"]}, - "Volume" : {"requires" : ["OgreMain"], "libs": ["OgreVolume"], - "include": ["include", include_prefix, f"{include_prefix}/Volume"], "libdirs" : ["lib"]} - - } - - if self.options.build_component_python: - components["Python"] = {"requires" : ["OgreMain"], "libs": ["OgrePython"], "include": ["include", include_prefix, f"{include_prefix}/Python"]} - - if self.options.build_plugin_bsp: - components["BSPSceneManager"] = {"requires" : ["OgreMain"], "libs": ["Plugin_BSPSceneManager"], - "libdirs" : ["lib", plugin_lib_dir], - "include": ["include", include_prefix, os.path.join(include_prefix, "Plugins", "BSPSceneManager")]} + def _module_file_rel_dir(self): + return os.path.join("lib", "cmake", "OGRE") - if self.options.build_plugin_octree: - components["OctreeSceneManager"] = {"requires" : ["OgreMain"], "libs": ["Plugin_OctreeSceneManager"], - "libdirs" : ["lib", plugin_lib_dir], - "include": ["include", include_prefix, os.path.join(include_prefix, "Plugins", "OctreeSceneManager")]} + @property + def _module_file_rel_path(self): + return os.path.join(self._module_file_rel_dir, f"conan-official-{self.name}-variables.cmake") - if self.options.build_plugin_pfx: - components["ParticleFX"] = {"requires" : ["OgreMain"], "libs": ["Plugin_ParticleFX"], - "libdirs" : ["lib", plugin_lib_dir], - "include": ["include", include_prefix, os.path.join(include_prefix, "Plugins", "ParticleFX")]} - - if self.options.build_plugin_pcz: - components["PCZSceneManager"] = {"requires" : ["OgreMain"], "libs": ["Plugin_PCZSceneManager"], - "libdirs" : ["lib", plugin_lib_dir], - "include": ["include", include_prefix, os.path.join(include_prefix, "Plugins", "PCZSceneManager")]} - - components["OctreeZone"] = {"requires" : ["OgreMain", "PCZSceneManager"], "libs": ["Plugin_OctreeZone"], - "libdirs" : ["lib", plugin_lib_dir], - "include": ["include", include_prefix, os.path.join(include_prefix, "Plugins", "OctreeZone")]} - + def _format_lib(self, lib): + # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L140-L145 if not self.options.shared: - for _, values in components.items(): - libs = [lib + "Static" for lib in values.get("libs")] - values["libs"] = libs - - if self.options.build_tests: - components["OgreMain"]["requires"].append("cppunit::cppunit") - - if self.settings.build_type == "Debug": - for _, values in components.items(): - libs = [lib + "_d" for lib in values.get("libs")] - values["libs"] = libs + lib += "Static" + if self.settings.os == "Windows" and self.settings.build_type == "Debug": + lib += "_d" + return lib - - return components + @property + def _shared_extension(self): + if self.settings.os == "Windows": + return ".dll" + elif is_apple_os(self): + return ".dylib" + else: + return ".so" def package_info(self): self.cpp_info.set_property("cmake_file_name", "OGRE") - self.cpp_info.names["cmake_find_package"] = "OGRE" - self.cpp_info.names["cmake_find_package_multi"] = "OGRE" + self.cpp_info.set_property("cmake_target_name", "OGRE::OGRE") + self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) + + include_prefix = os.path.join("include", "OGRE") + plugin_lib_dir = os.path.join("lib", "OGRE") + + def _add_component(comp, *, requires=None, libs=None, includedirs=None, libdirs=None, cmake_target=None, pkg_config_name=None): + self.cpp_info.components[comp].set_property("cmake_target_name", cmake_target) + self.cpp_info.components[comp].set_property("pkg_config_name", pkg_config_name) + if comp != "OgreMain": + self.cpp_info.components[comp].requires = ["OgreMain"] + self.cpp_info.components[comp].requires += requires or [] + self.cpp_info.components[comp].libs = [self._format_lib(lib) for lib in (libs or [])] + self.cpp_info.components[comp].includedirs = includedirs or [] + self.cpp_info.components[comp].libdirs = libdirs or [] + self.cpp_info.components[comp].builddirs.append(self._module_file_rel_dir) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components[comp].system_libs.append("pthread") - for comp, values in self._components.items(): + # TODO: Legacy, to be removed on Conan 2.0 self.cpp_info.components[comp].names["cmake_find_package"] = comp self.cpp_info.components[comp].names["cmake_find_package_multi"] = comp self.cpp_info.components[comp].names["cmake_paths"] = comp - self.cpp_info.components[comp].libs = values.get("libs") - self.cpp_info.components[comp].libdirs = values.get("libdirs") - self.cpp_info.components[comp].requires = values.get("requires") - self.cpp_info.components[comp].set_property("cmake_target_name", f"OGRE::{comp}") - self.cpp_info.components[comp].includedirs = values.get("include") - - self.cpp_info.components[comp].builddirs.append(self._module_file_rel_dir) self.cpp_info.components[comp].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components[comp].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] self.cpp_info.components[comp].build_modules["cmake_paths"] = [self._module_file_rel_path] - self.cpp_info.components[comp].builddirs.append(self._module_file_rel_path) - if self.settings.os == "Linux": - self.cpp_info.components[comp].system_libs.append("pthread") - - if self.options.install_tools: - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) - @property - def _module_file_rel_dir(self): - return os.path.join("lib", "cmake") + def _add_core_component(comp, *, requires=None): + _add_component( + comp, + cmake_target=f"OGRE::{comp}", + pkg_config_name=f"OGRE-{comp}", + libs=[f"Ogre{comp}"], + libdirs=["lib"], + includedirs=["include", include_prefix, os.path.join(include_prefix, comp)], + requires=requires, + ) + + def _add_plugin_component(comp, *, requires=None, extra_libs=None): + if comp.startswith("Codec_"): + dirname = f"{comp.replace('Codec_', '')}Codec" + else: + dirname = comp.replace("Plugin_", "") + _add_component( + comp, + cmake_target=None, + pkg_config_name=None, + # Adding the extension for a full name since the plugin libs don't include the standard 'lib' prefix + libs=[comp + self._shared_extension] + (extra_libs or []), + libdirs=[plugin_lib_dir], + includedirs=["include", include_prefix, os.path.join(include_prefix, "Plugins", dirname)], + requires=requires, + ) + + def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): + dirname = comp.replace("RenderSystem_", "") + _add_component( + comp, + cmake_target=None, + pkg_config_name=None, + libs=[comp + self._shared_extension] + (extra_libs or []), + libdirs=[plugin_lib_dir], + includedirs=["include", include_prefix, os.path.join(include_prefix, "RenderSystems", dirname)], + requires=requires, + ) + + _add_component( + "OgreMain", + cmake_target="OGRE::OgreMain", + pkg_config_name="OGRE", + libs=["OgreMain"], + libdirs=["lib"], + includedirs=["include", include_prefix], + requires=["pugixml::pugixml", "zlib::zlib", "zziplib::zziplib"], + ) - @property - def _module_file_rel_path(self): - return os.path.join(self._module_file_rel_dir, f"conan-official-{self.name}-variables.cmake") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["OgreMain"].requires.append("xorg::xorg") + + if self.options.get_safe("build_component_bites"): + _add_core_component("Bites", requires=["Overlay", "sdl::sdl"]) + if self.options.get_safe("build_component_bullet"): + _add_core_component("Bullet", requires=["bullet3::bullet3"]) + if self.options.build_component_meshlodgenerator: + _add_core_component("MeshLodGenerator") + if self.options.build_component_overlay: + _add_core_component("Overlay", requires=["freetype::freetype"]) + if self.options.get_safe("build_component_overlay_imgui"): + self.cpp_info.components["Overlay"].requires.append("imgui::imgui") + if self.options.build_component_paging: + _add_core_component("Paging") + if self.options.build_component_property: + _add_core_component("Property") + if self.options.build_component_rtshadersystem: + _add_core_component("RTShaderSystem") + if self.options.build_component_terrain: + _add_core_component("Terrain") + if self.options.build_component_volume: + _add_core_component("Volume") + + if self._build_opengl: + if not self.options.shared: + _add_core_component("GLSupport", requires=["libglvnd::libglvnd"]) + else: + self.cpp_info.components["OgreMain"].requires.append("libglvnd::libglvnd") + + if self.options.build_plugin_assimp: + _add_plugin_component("Codec_Assimp", requires=["assimp::assimp"]) + if self.options.build_plugin_bsp: + _add_plugin_component("Plugin_BSPSceneManager") + if self.options.get_safe("build_plugin_cg"): + _add_plugin_component("Plugin_CgProgramManager") #, requires=["cg::cg"]) + if self.options.build_plugin_dot_scene: + _add_plugin_component("Plugin_DotScene", requires=["pugixml::pugixml"]) + if self.options.build_plugin_exrcodec: + _add_plugin_component("Codec_EXR", requires=["openexr::openexr"]) + if self.options.build_plugin_freeimage: + _add_plugin_component("Codec_FreeImage", requires=["freeimage::freeimage"]) + if self.options.build_plugin_octree: + _add_plugin_component("Plugin_OctreeSceneManager") + if self.options.build_plugin_pcz: + _add_plugin_component("Plugin_PCZSceneManager") + _add_plugin_component("Plugin_OctreeZone", requires=["Plugin_PCZSceneManager"]) + if self.options.build_plugin_pfx: + _add_plugin_component("Plugin_ParticleFX") + if self.options.build_plugin_stbi: + _add_plugin_component("Codec_STBI") + + if self.options.get_safe("build_rendersystem_d3d9"): + _add_rendersystem_component("RenderSystem_Direct3D9") + # FIXME: add DirectX9 system libs + if self.options.get_safe("build_rendersystem_d3d11"): + _add_rendersystem_component("RenderSystem_Direct3D11") + if self.settings.compiler == "gcc": + self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["psapi", "d3dcompiler"] + # FIXME: add DirectX11 system libs + if self.options.get_safe("build_rendersystem_gl"): + _add_rendersystem_component("RenderSystem_GL", requires=["libglvnd::libglvnd"]) + if self.options.get_safe("build_rendersystem_gl3plus"): + _add_rendersystem_component("RenderSystem_GL3Plus", requires=["libglvnd::libglvnd"]) + if self.options.get_safe("build_rendersystem_gles2"): + _add_rendersystem_component("RenderSystem_GLES2", requires=["libglvnd::libglvnd"]) + if self.options.get_safe("build_rendersystem_metal"): + _add_rendersystem_component("RenderSystem_Metal") + if self.settings.os == "iOS": + self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "QuartzCore"] + else: + self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "AppKit", "QuartzCore"] + if self.options.get_safe("build_rendersystem_tiny"): + _add_rendersystem_component("RenderSystem_Tiny", requires=["sdl::sdl"]) + + # TODO: Legacy, to be removed on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "OGRE" + self.cpp_info.names["cmake_find_package_multi"] = "OGRE" + self.cpp_info.names["cmake_paths"] = "OGRE" + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/ogre/1.x/patches/0001-ogre-1.10.2-cmake-fixes.patch b/recipes/ogre/1.x/patches/0001-ogre-1.10.2-cmake-fixes.patch deleted file mode 100644 index 7b8bebad0458f..0000000000000 --- a/recipes/ogre/1.x/patches/0001-ogre-1.10.2-cmake-fixes.patch +++ /dev/null @@ -1,532 +0,0 @@ -diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt -index 2198fb576..20ac0bdcb 100755 ---- a/CMake/CMakeLists.txt -+++ b/CMake/CMakeLists.txt -@@ -31,23 +31,23 @@ set(INST_FILES - Utils/OgreFindFrameworks.cmake - ) - --if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "poco") -- set(INST_FILES ${INST_FILES} Packages/FindPOCO.cmake) --endif () -+#if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "poco") -+# set(INST_FILES ${INST_FILES} Packages/FindPOCO.cmake) -+#endif () - --if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "tbb") -- set(INST_FILES ${INST_FILES} Packages/FindTBB.cmake) --endif () -+#if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "tbb") -+# set(INST_FILES ${INST_FILES} Packages/FindTBB.cmake) -+#endif () - - set(STATIC_INST_FILES - Packages/FindCg.cmake - Packages/FindDirectX.cmake - Packages/FindDirectX11.cmake -- Packages/FindFreeImage.cmake -- Packages/FindFreetype.cmake -+ #Packages/FindFreeImage.cmake -+ #Packages/FindFreetype.cmake - Packages/FindOpenGLES.cmake - Packages/FindOpenGLES2.cmake -- Packages/FindZZip.cmake -+ #Packages/FindZZip.cmake - Packages/FindSoftimage.cmake - Packages/FindGLSLOptimizer.cmake - Packages/FindHLSL2GLSL.cmake -diff --git a/CMake/ConfigureBuild.cmake b/CMake/ConfigureBuild.cmake -index 0a30ca92a..eeafbcd90 100644 ---- a/CMake/ConfigureBuild.cmake -+++ b/CMake/ConfigureBuild.cmake -@@ -55,8 +55,8 @@ if (OGRE_CONFIG_THREADS) - - if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "poco") - set(OGRE_THREAD_PROVIDER 2) -- include_directories(${POCO_INCLUDE_DIRS}) -- set(OGRE_THREAD_LIBRARIES ${POCO_LIBRARIES}) -+ include_directories(${Poco_INCLUDE_DIRS}) -+ set(OGRE_THREAD_LIBRARIES ${Poco_LIBRARIES}) - endif () - - if (OGRE_CONFIG_THREAD_PROVIDER STREQUAL "tbb") -diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake -index 91ceb98e6..e350e86a2 100755 ---- a/CMake/Dependencies.cmake -+++ b/CMake/Dependencies.cmake -@@ -13,11 +13,11 @@ - - # OGRE_DEPENDENCIES_DIR can be used to specify a single base - # folder where the required dependencies may be found. --set(OGRE_DEPENDENCIES_DIR "" CACHE PATH "Path to prebuilt OGRE dependencies") --option(OGRE_BUILD_DEPENDENCIES "automaitcally build Ogre Dependencies (freetype, zzip)" TRUE) -+#set(OGRE_DEPENDENCIES_DIR "" CACHE PATH "Path to prebuilt OGRE dependencies") -+#option(OGRE_BUILD_DEPENDENCIES "automaitcally build Ogre Dependencies (freetype, zzip)" TRUE) - - include(FindPkgMacros) --getenv_path(OGRE_DEPENDENCIES_DIR) -+#getenv_path(OGRE_DEPENDENCIES_DIR) - if(OGRE_BUILD_PLATFORM_EMSCRIPTEN) - set(OGRE_DEP_SEARCH_PATH - ${OGRE_DEPENDENCIES_DIR} -@@ -27,6 +27,7 @@ if(OGRE_BUILD_PLATFORM_EMSCRIPTEN) - "${OGRE_SOURCE_DIR}/EmscriptenDependencies" - "${OGRE_BINARY_DIR}/../EmscriptenDependencies" - "${OGRE_SOURCE_DIR}/../EmscriptenDependencies" -+ "${OGRE_BINARY_DIR}" - ) - set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${OGRE_DEP_SEARCH_PATH}) - elseif(APPLE_IOS) -@@ -37,6 +38,7 @@ elseif(APPLE_IOS) - "${OGRE_SOURCE_DIR}/iOSDependencies" - "${OGRE_BINARY_DIR}/../iOSDependencies" - "${OGRE_SOURCE_DIR}/../iOSDependencies" -+ "${OGRE_BINARY_DIR}" - ) - elseif(OGRE_BUILD_PLATFORM_ANDROID) - set(OGRE_DEP_SEARCH_PATH -@@ -46,19 +48,21 @@ elseif(OGRE_BUILD_PLATFORM_ANDROID) - "${OGRE_SOURCE_DIR}/AndroidDependencies" - "${OGRE_BINARY_DIR}/../AndroidDependencies" - "${OGRE_SOURCE_DIR}/../AndroidDependencies" -+ "${OGRE_BINARY_DIR}" - ) - else() - set(OGRE_DEP_SEARCH_PATH - ${OGRE_DEPENDENCIES_DIR} - ${ENV_OGRE_DEPENDENCIES_DIR} -- "${OGRE_BINARY_DIR}/Dependencies" -- "${OGRE_SOURCE_DIR}/Dependencies" -- "${OGRE_BINARY_DIR}/../Dependencies" -- "${OGRE_SOURCE_DIR}/../Dependencies" -+ #"${OGRE_BINARY_DIR}/Dependencies" -+ #"${OGRE_SOURCE_DIR}/Dependencies" -+ #"${OGRE_BINARY_DIR}/../Dependencies" -+ #"${OGRE_SOURCE_DIR}/../Dependencies" -+ "${OGRE_BINARY_DIR}" - ) - endif() - --message(STATUS "Search path: ${OGRE_DEP_SEARCH_PATH}") -+message(STATUS "OGRE Deps Search path: ${OGRE_DEP_SEARCH_PATH}") - list(GET OGRE_DEP_SEARCH_PATH 0 OGREDEPS_PATH) - - if(CMAKE_CROSSCOMPILING) -@@ -76,81 +80,90 @@ if(CMAKE_CROSSCOMPILING) - -DIOS_PLATFORM=${IOS_PLATFORM}) - endif() - endif() -- -+####################################################################################### -+#### conan patch begin: rely on the paths and build info generated by conan -+### ------------------------------------------------------------------ - # Set hardcoded path guesses for various platforms --if (UNIX AND NOT EMSCRIPTEN) -- set(OGRE_DEP_SEARCH_PATH ${OGRE_DEP_SEARCH_PATH} /usr/local) -- # Ubuntu 11.10 has an inconvenient path to OpenGL libraries -- set(OGRE_DEP_SEARCH_PATH ${OGRE_DEP_SEARCH_PATH} /usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) --endif () -+#if (UNIX AND NOT EMSCRIPTEN) -+# set(OGRE_DEP_SEARCH_PATH ${OGRE_DEP_SEARCH_PATH} /usr/local) -+# # Ubuntu 11.10 has an inconvenient path to OpenGL libraries -+# set(OGRE_DEP_SEARCH_PATH ${OGRE_DEP_SEARCH_PATH} /usr/lib/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu) -+#endif () - - # give guesses as hints to the find_package calls --set(CMAKE_PREFIX_PATH ${OGRE_DEP_SEARCH_PATH} ${CMAKE_PREFIX_PATH}) --set(CMAKE_FRAMEWORK_PATH ${OGRE_DEP_SEARCH_PATH} ${CMAKE_FRAMEWORK_PATH}) -- --if(OGRE_BUILD_DEPENDENCIES AND NOT EXISTS ${OGREDEPS_PATH}) -- set(OGREDEPS_SHARED TRUE) -- if(OGRE_STATIC OR MSVC) -- # freetype does not like shared build on MSVC and it generally eases distribution there -- set(OGREDEPS_SHARED FALSE) -- endif() -- -- if(MSVC OR EMSCRIPTEN) # other platforms ship zlib -- message(STATUS "Building zlib") -- file(DOWNLOAD -- http://zlib.net/zlib-1.2.11.tar.gz -- ./zlib-1.2.11.tar.gz -- EXPECTED_MD5 1c9f62f0778697a09d36121ead88e08e) -- execute_process(COMMAND cmake -E tar xf zlib-1.2.11.tar.gz) -- execute_process(COMMAND cmake -- -DCMAKE_INSTALL_PREFIX=${OGREDEPS_PATH} -- -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DBUILD_SHARED_LIBS=${OGREDEPS_SHARED} -- -G ${CMAKE_GENERATOR} -- ${CROSS} -- . -- WORKING_DIRECTORY zlib-1.2.11) -- execute_process(COMMAND cmake --build zlib-1.2.11 --target install) -- endif() -- -- message(STATUS "Building ZZIPlib") -- file(DOWNLOAD -- https://github.com/paroj/ZZIPlib/archive/master.tar.gz -- ./ZZIPlib-master.tar.gz) -- execute_process(COMMAND cmake -E tar xf ZZIPlib-master.tar.gz) -- execute_process(COMMAND cmake -- -DCMAKE_INSTALL_PREFIX=${OGREDEPS_PATH} -- -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DZLIB_ROOT=${OGREDEPS_PATH} -- -DBUILD_SHARED_LIBS=${OGREDEPS_SHARED} -- -G ${CMAKE_GENERATOR} -- ${CROSS} -- . -- WORKING_DIRECTORY ZZIPlib-master) -- execute_process(COMMAND cmake --build ZZIPlib-master --target install) -- -- message(STATUS "Building freetype") -- file(DOWNLOAD -- http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz -- ./freetype-2.6.5.tar.gz) -- execute_process(COMMAND cmake -E tar xf freetype-2.6.5.tar.gz) -- # patch toolchain for iOS -- execute_process(COMMAND cmake -E copy -- ${CMAKE_SOURCE_DIR}/CMake/toolchain/ios.toolchain.xcode.cmake -- freetype-2.6.5/builds/cmake/iOS.cmake) -- execute_process(COMMAND cmake -- -DCMAKE_INSTALL_PREFIX=${OGREDEPS_PATH} -- -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -- -DBUILD_SHARED_LIBS=${OGREDEPS_SHARED} -- -DWITH_BZip2=OFF # tries to use it on iOS otherwise -- # workaround for broken iOS toolchain in freetype -- -DPROJECT_SOURCE_DIR=${CMAKE_BINARY_DIR}/freetype-2.6.5 -- ${CROSS} -- -G ${CMAKE_GENERATOR} -- .. -- WORKING_DIRECTORY freetype-2.6.5/objs) -- execute_process(COMMAND cmake --build freetype-2.6.5/objs --target install) --endif() -+#set(CMAKE_PREFIX_PATH ${OGRE_DEP_SEARCH_PATH} ${CMAKE_PREFIX_PATH}) -+#set(CMAKE_FRAMEWORK_PATH ${OGRE_DEP_SEARCH_PATH} ${CMAKE_FRAMEWORK_PATH}) -+#### conan patch end -+####################################################################################### -+ -+########################################################################################## -+### conan patch begin: conan already provides the built in binaries, no need to install and build them -+### -------------------------------------------------------------------------------- -+#if(OGRE_BUILD_DEPENDENCIES AND NOT EXISTS ${OGREDEPS_PATH}) -+# set(OGREDEPS_SHARED TRUE) -+# if(OGRE_STATIC OR MSVC) -+# # freetype does not like shared build on MSVC and it generally eases distribution there -+# set(OGREDEPS_SHARED FALSE) -+# endif() -+# -+# if(MSVC OR EMSCRIPTEN) # other platforms ship zlib -+# message(STATUS "Building zlib") -+# file(DOWNLOAD -+# http://zlib.net/zlib-1.2.11.tar.gz -+# ./zlib-1.2.11.tar.gz -+# EXPECTED_MD5 1c9f62f0778697a09d36121ead88e08e) -+# execute_process(COMMAND cmake -E tar xf zlib-1.2.11.tar.gz) -+# execute_process(COMMAND cmake -+# -DCMAKE_INSTALL_PREFIX=${OGREDEPS_PATH} -+# -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -+# -DBUILD_SHARED_LIBS=${OGREDEPS_SHARED} -+# -G ${CMAKE_GENERATOR} -+# ${CROSS} -+# . -+# WORKING_DIRECTORY zlib-1.2.11) -+# execute_process(COMMAND cmake --build zlib-1.2.11 --target install) -+# endif() -+# -+# message(STATUS "Building ZZIPlib") -+# file(DOWNLOAD -+# https://github.com/paroj/ZZIPlib/archive/master.tar.gz -+# ./ZZIPlib-master.tar.gz) -+# execute_process(COMMAND cmake -E tar xf ZZIPlib-master.tar.gz) -+# execute_process(COMMAND cmake -+# -DCMAKE_INSTALL_PREFIX=${OGREDEPS_PATH} -+# -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -+# -DZLIB_ROOT=${OGREDEPS_PATH} -+# -DBUILD_SHARED_LIBS=${OGREDEPS_SHARED} -+# -G ${CMAKE_GENERATOR} -+# ${CROSS} -+# . -+# WORKING_DIRECTORY ZZIPlib-master) -+# execute_process(COMMAND cmake --build ZZIPlib-master --target install) -+# -+# message(STATUS "Building freetype") -+# file(DOWNLOAD -+# http://download.savannah.gnu.org/releases/freetype/freetype-2.6.5.tar.gz -+# ./freetype-2.6.5.tar.gz) -+# execute_process(COMMAND cmake -E tar xf freetype-2.6.5.tar.gz) -+# # patch toolchain for iOS -+# execute_process(COMMAND cmake -E copy -+# ${CMAKE_SOURCE_DIR}/CMake/toolchain/ios.toolchain.xcode.cmake -+# freetype-2.6.5/builds/cmake/iOS.cmake) -+# execute_process(COMMAND cmake -+# -DCMAKE_INSTALL_PREFIX=${OGREDEPS_PATH} -+# -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -+# -DBUILD_SHARED_LIBS=${OGREDEPS_SHARED} -+# -DWITH_BZip2=OFF # tries to use it on iOS otherwise -+# # workaround for broken iOS toolchain in freetype -+# -DPROJECT_SOURCE_DIR=${CMAKE_BINARY_DIR}/freetype-2.6.5 -+# ${CROSS} -+# -G ${CMAKE_GENERATOR} -+# .. -+# WORKING_DIRECTORY freetype-2.6.5/objs) -+# execute_process(COMMAND cmake --build freetype-2.6.5/objs --target install) -+#endif() -+#### conan patch end -+########################################################################################## - - ####################################################################### - # Core dependencies -@@ -162,13 +175,23 @@ macro_log_feature(ZLIB_FOUND "zlib" "Simple data compression library" "http://ww - - if (ZLIB_FOUND) - # Find zziplib -- find_package(ZZip) -+ find_package(zziplib) -+ ########################################################################################## -+### coann patch begin: make ${ZZip_} cmake variables refer to conan ${zziplib_} -+set(ZZip_FOUND ${zziplib_FOUND}) -+set(ZZip_LIBRARIES ${zziplib_LIBRARIES}) -+### coann patch end -+########################################################################################## - macro_log_feature(ZZip_FOUND "zziplib" "Extract data from zip archives" "http://zziplib.sourceforge.net" FALSE "" "") - endif () - --# Find FreeImage --find_package(FreeImage) --macro_log_feature(FreeImage_FOUND "freeimage" "Support for commonly used graphics image formats" "http://freeimage.sourceforge.net" FALSE "" "") -+# Find freeimage -+find_package(freeimage) -+#if(NOT ${FreeImage_INCLUDE_DIRS} STREQUAL "" AND NOT ${FreeImage_LIBRARIES} STREQUAL "") -+# set(freeimage_FOUND 1) -+#endif() -+#message(FATAL_ERROR "freeimage_FOUND: ${freeimage_FOUND}") -+macro_log_feature(freeimage_FOUND "freeimage" "Support for commonly used graphics image formats" "http://freeimage.sourceforge.net" FALSE "" "") - - # Find FreeType - find_package(Freetype) -@@ -284,6 +307,15 @@ if(Boost_FOUND AND NOT WIN32) - list(REMOVE_DUPLICATES Boost_LIBRARIES) - endif() - -+################################################################################### -+### conan patch begin: conan recipe for boost doesn't provide the variables Boost__FOUND -+## see https://cmake.org/cmake/help/latest/module/FindBoost.html#result-variables -+## and https://github.com/conan-io/conan-center-index/issues/11085 -+set(Boost_DATE_TIME_FOUND True) -+set(Boost_THREAD_FOUND True) -+### conan patch end -+################################################################################### -+ - # Optional Boost libs (Boost_${COMPONENT}_FOUND - macro_log_feature(Boost_FOUND "boost" "Boost (general)" "http://boost.org" FALSE "" "") - if(NOT Boost_DATE_TIME_FOUND) -@@ -297,9 +329,9 @@ if(Boost_VERSION GREATER 105300 AND NOT Boost_ATOMIC_FOUND) - endif() - macro_log_feature(Boost_THREAD_FOUND "boost-thread" "Used for threading support" "http://boost.org" FALSE "" "") - --# POCO --find_package(POCO) --macro_log_feature(POCO_FOUND "POCO" "POCO framework" "http://pocoproject.org/" FALSE "" "") -+# Poco -+find_package(Poco) -+macro_log_feature(Poco_FOUND "Poco" "Poco framework" "http://pocoproject.org/" FALSE "" "") - - # ThreadingBuildingBlocks - find_package(TBB) -@@ -315,7 +347,7 @@ macro_log_feature(HLSL2GLSL_FOUND "HLSL2GLSL" "HLSL2GLSL" "http://hlsl2glslfork. - - # OpenEXR - find_package(OpenEXR) --macro_log_feature(OPENEXR_FOUND "OpenEXR" "Load High dynamic range images" "http://www.openexr.com/" FALSE "" "") -+macro_log_feature(OpenEXR_FOUND "OpenEXR" "Load High dynamic range images" "http://www.openexr.com/" FALSE "" "") - - # Python - find_package(PythonLibs) -@@ -330,6 +362,7 @@ macro_log_feature(PYTHONLIBS_FOUND "Python" "Language bindings to use OGRE from - if(NOT ANDROID) - # find script does not work in cross compilation environment - find_package(SDL2) -+set(SDL2_LIBRARY ${SDL2_LIBRARIES}) - macro_log_feature(SDL2_FOUND "SDL2" "Simple DirectMedia Library needed for input handling in samples" "https://www.libsdl.org/" FALSE "" "") - endif() - -@@ -366,7 +398,7 @@ MACRO_DISPLAY_FEATURE_LOG() - # Add library and include paths from the dependencies - include_directories( - ${ZLIB_INCLUDE_DIRS} -- ${ZZip_INCLUDE_DIRS} -+ ${zziplib_INCLUDE_DIRS} - ${FreeImage_INCLUDE_DIRS} - ${FREETYPE_INCLUDE_DIRS} - ${OPENGL_INCLUDE_DIRS} -diff --git a/CMake/Packages/FindOGRE.cmake b/CMake/Packages/FindOGRE.cmake -index f7c1727f9..d719d853e 100644 ---- a/CMake/Packages/FindOGRE.cmake -+++ b/CMake/Packages/FindOGRE.cmake -@@ -265,13 +265,13 @@ if (OGRE_STATIC) - find_package(Cg QUIET) - find_package(DirectX QUIET) - find_package(DirectX11 QUIET) -- find_package(FreeImage QUIET) -+ find_package(freeimage QUIET) - find_package(Freetype QUIET) - find_package(OpenGL QUIET) - find_package(OpenGLES QUIET) - find_package(OpenGLES2 QUIET) - find_package(ZLIB QUIET) -- find_package(ZZip QUIET) -+ find_package(zziplib QUIET) - find_package(SDL2 QUIET) - if (UNIX AND NOT APPLE AND NOT ANDROID) - find_package(X11 QUIET) -@@ -290,7 +290,7 @@ if (OGRE_STATIC) - if (NOT ZLIB_FOUND OR NOT ZZip_FOUND) - set(OGRE_DEPS_FOUND FALSE) - endif () -- if (NOT FreeImage_FOUND AND NOT OGRE_CONFIG_FREEIMAGE) -+ if (NOT freeimage_FOUND AND NOT OGRE_CONFIG_FREEIMAGE) - set(OGRE_DEPS_FOUND FALSE) - endif () - if (NOT FREETYPE_FOUND) -diff --git a/CMake/PrepareThreadingOptions.cmake b/CMake/PrepareThreadingOptions.cmake -index bdaef8884..74b937a38 100644 ---- a/CMake/PrepareThreadingOptions.cmake -+++ b/CMake/PrepareThreadingOptions.cmake -@@ -25,7 +25,7 @@ if (Boost_THREADING AND NOT OGRE_THREAD_SUPPORT_AVAILABLE) - set(OGRE_THREAD_TYPE "2") - endif () - --if (POCO_FOUND AND NOT OGRE_THREAD_SUPPORT_AVAILABLE) -+if (Poco_FOUND AND NOT OGRE_THREAD_SUPPORT_AVAILABLE) - set(OGRE_THREAD_SUPPORT_AVAILABLE TRUE) - set(OGRE_THREAD_DEFAULT_PROVIDER "poco") - set(OGRE_THREAD_TYPE "2") -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 18f295f53..c624ea101 100755 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -52,6 +52,8 @@ set(CMAKE_MODULE_PATH - "${OGRE_SOURCE_DIR}/CMake" - "${OGRE_SOURCE_DIR}/CMake/Utils" - "${OGRE_SOURCE_DIR}/CMake/Packages" -+ "${OGRE_BINARY_DIR}" -+ "${CMAKE_BINARY_DIR}" - ) - - if(CMAKE_CROSSCOMPILING) -@@ -212,6 +214,7 @@ endif() - - # Add OgreMain include path - include_directories("${OGRE_SOURCE_DIR}/OgreMain/include") -+set(OGRE_BINARY_DIR ${CMAKE_BINARY_DIR}) - include_directories("${OGRE_BINARY_DIR}/include") - if (APPLE) - if (APPLE_IOS) -@@ -363,7 +366,7 @@ cmake_dependent_option(OGRE_BUILD_RENDERSYSTEM_GL "Build OpenGL RenderSystem" TR - cmake_dependent_option(OGRE_BUILD_RENDERSYSTEM_GLES "Build OpenGL ES 1.x RenderSystem" FALSE "OPENGLES_FOUND;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" FALSE) - cmake_dependent_option(OGRE_BUILD_RENDERSYSTEM_GLES2 "Build OpenGL ES 2.x RenderSystem" FALSE "OPENGLES2_FOUND;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" FALSE) - option(OGRE_BUILD_PLUGIN_BSP "Build BSP SceneManager plugin" TRUE) --cmake_dependent_option(OGRE_BUILD_PLUGIN_EXRCODEC "Build EXR Codec plugin" TRUE "OPENEXR_FOUND" FALSE) -+cmake_dependent_option(OGRE_BUILD_PLUGIN_EXRCODEC "Build EXR Codec plugin" TRUE "OpenEXR_FOUND" FALSE) - option(OGRE_BUILD_PLUGIN_OCTREE "Build Octree SceneManager plugin" TRUE) - option(OGRE_BUILD_PLUGIN_PFX "Build ParticleFX plugin" TRUE) - cmake_dependent_option(OGRE_BUILD_PLUGIN_PCZ "Build PCZ SceneManager plugin" TRUE "" FALSE) -@@ -407,7 +410,7 @@ option(OGRE_CONFIG_MEMTRACK_DEBUG "Enable Ogre's memory tracker in debug mode" F - option(OGRE_CONFIG_MEMTRACK_RELEASE "Enable Ogre's memory tracker in release mode" FALSE) - # determine threading options - include(PrepareThreadingOptions) --cmake_dependent_option(OGRE_CONFIG_ENABLE_FREEIMAGE "Build FreeImage codec." TRUE "FreeImage_FOUND" FALSE) -+cmake_dependent_option(OGRE_CONFIG_ENABLE_FREEIMAGE "Build FreeImage codec." TRUE "freeimage_FOUND" FALSE) - cmake_dependent_option(OGRE_CONFIG_ENABLE_STBI "Enable STBI image codec." TRUE "NOT OGRE_CONFIG_ENABLE_FREEIMAGE" FALSE) - option(OGRE_CONFIG_ENABLE_MESHLOD "Enable Mesh Lod." TRUE) - option(OGRE_CONFIG_ENABLE_DDS "Build DDS codec." TRUE) -diff --git a/Components/HLMS/CMakeLists.txt b/Components/HLMS/CMakeLists.txt -index c10a77a5e..f8b962a9e 100644 ---- a/Components/HLMS/CMakeLists.txt -+++ b/Components/HLMS/CMakeLists.txt -@@ -14,7 +14,7 @@ - PROJECT(OgreHLMS) - - # define header and source files for the library --file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h" ${CMAKE_BINARY_DIR}/include/OgreHlmsPrerequisites.h) -+file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") - file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") - - # Add needed definitions -@@ -43,3 +43,7 @@ ogre_config_component(OgreHLMS) - install(FILES ${HEADER_FILES} - DESTINATION include/OGRE/HLMS - ) -+ -+install(FILES ${CMAKE_BINARY_DIR}/include/OgreHlmsPrerequisites.h -+ DESTINATION include/OGRE/HLMS -+) -\ No newline at end of file -diff --git a/Components/Overlay/CMakeLists.txt b/Components/Overlay/CMakeLists.txt -index 0ee9f3d8c..d973798e6 100644 ---- a/Components/Overlay/CMakeLists.txt -+++ b/Components/Overlay/CMakeLists.txt -@@ -40,3 +40,7 @@ ogre_config_component(OgreOverlay) - install(FILES ${HEADER_FILES} - DESTINATION include/OGRE/Overlay - ) -+ -+install(FILES ${CMAKE_BINARY_DIR}/include/OgreOverlayPrerequisites.h -+ DESTINATION include/OGRE/Overlay -+) -\ No newline at end of file -diff --git a/Components/Property/CMakeLists.txt b/Components/Property/CMakeLists.txt -index 97d481748..1b2f2640a 100644 ---- a/Components/Property/CMakeLists.txt -+++ b/Components/Property/CMakeLists.txt -@@ -16,7 +16,6 @@ PROJECT(OgreProperty) - # define header and source files for the library - set (HEADER_FILES - include/OgreProperty.h -- ${CMAKE_BINARY_DIR}/include/OgrePropertyPrerequisites.h - ) - - set (SOURCE_FILES -@@ -47,3 +46,7 @@ ogre_config_component(OgreProperty) - install(FILES ${HEADER_FILES} - DESTINATION include/OGRE/Property - ) -+ -+install(FILES ${CMAKE_BINARY_DIR}/include/OgrePropertyPrerequisites.h -+ DESTINATION include/OGRE/Property -+) -diff --git a/Components/Volume/CMakeLists.txt b/Components/Volume/CMakeLists.txt -index 998f9702f..7d4c239eb 100644 ---- a/Components/Volume/CMakeLists.txt -+++ b/Components/Volume/CMakeLists.txt -@@ -14,7 +14,7 @@ - PROJECT(OgreVolume) - - # define header and source files for the library --file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h" ${CMAKE_BINARY_DIR}/include/OgreVolumePrerequisites.h) -+file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") - file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") - - # include headers -@@ -40,3 +40,7 @@ ogre_config_component(OgreVolume) - install(FILES ${HEADER_FILES} - DESTINATION include/OGRE/Volume - ) -+ -+install(FILES ${CMAKE_BINARY_DIR}/include/OgreVolumePrerequisites.h -+ DESTINATION include/OGRE/Volume -+) -\ No newline at end of file -diff --git a/PlugIns/EXRCodec/CMakeLists.txt b/PlugIns/EXRCodec/CMakeLists.txt -index ed4bc7df9..0a7a1a250 100644 ---- a/PlugIns/EXRCodec/CMakeLists.txt -+++ b/PlugIns/EXRCodec/CMakeLists.txt -@@ -11,7 +11,8 @@ file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h" ${CMAKE_BINARY_ - file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") - - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) --include_directories(SYSTEM ${OPENEXR_INCLUDE_DIR}/OpenEXR) -+### include the conan OpenEXR_INCLUDE_DIR instead of system OpenEXR_INCLUDE_DIR -+include_directories(SYSTEM ${OpenEXR_INCLUDE_DIR}/OpenEXR) - - ogre_add_library_to_folder(Plugins Plugin_EXRCodec ${OGRE_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES}) - target_link_libraries(Plugin_EXRCodec OgreMain ${OPENEXR_LIBRARIES}) diff --git a/recipes/ogre/1.x/test_package/CMakeLists.txt b/recipes/ogre/1.x/test_package/CMakeLists.txt index b3d9f056daa16..6ddcae5e68d1d 100644 --- a/recipes/ogre/1.x/test_package/CMakeLists.txt +++ b/recipes/ogre/1.x/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) find_package(OGRE ${OGRE_VERSION} COMPONENTS OgreMain REQUIRED) + add_executable(ogre_main ogre_main.cpp) target_link_libraries(ogre_main OGRE::OgreMain) - set_target_properties(ogre_main PROPERTIES -CXX_STANDARD 11 -CXX_STANDARD_REQUIRED ON -CXX_EXTENSIONS ON) + CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_EXTENSIONS ON +) diff --git a/recipes/ogre/1.x/test_package/conanfile.py b/recipes/ogre/1.x/test_package/conanfile.py index f194e07229412..60330d1ebf45e 100644 --- a/recipes/ogre/1.x/test_package/conanfile.py +++ b/recipes/ogre/1.x/test_package/conanfile.py @@ -1,19 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - cmake.definitions["OGRE_VERSION"] = tools.Version(self.deps_cpp_info["ogre"].version) cmake.configure() cmake.build() def test(self): - if tools.cross_building(self): - return - - ogre_main_bin_path = os.path.join("bin", "ogre_main") - self.run(ogre_main_bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "ogre_main") + self.run(bin_path, env="conanrun") diff --git a/recipes/ogre/1.x/test_package/ogre_main.cpp b/recipes/ogre/1.x/test_package/ogre_main.cpp index 98f931899daa6..8472f8de00480 100644 --- a/recipes/ogre/1.x/test_package/ogre_main.cpp +++ b/recipes/ogre/1.x/test_package/ogre_main.cpp @@ -1,17 +1,15 @@ -#include -#include -#include +#include #include -int main(int argc, char **argv) { - Ogre::RenderSystemCapabilities rc; - rc.setNumTextureUnits(10); - std::cout << "Hello from OgreMain component\n"; - std::cout << "number of texture units: " << rc.getNumTextureUnits() << "\n"; +int main() { + Ogre::RenderSystemCapabilities rc; + rc.setNumTextureUnits(10); + std::cout << "Hello from OgreMain component\n"; + std::cout << "number of texture units: " << rc.getNumTextureUnits() << "\n"; - Ogre::Radian rot{0.618}; - Ogre::Particle particle; - particle.resetDimensions(); + Ogre::Radian rot{0.618}; + Ogre::Particle particle; + particle.setDimensions(0, 0); - return 0; + return 0; } diff --git a/recipes/ogre/1.x/test_v1_package/CMakeLists.txt b/recipes/ogre/1.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/ogre/1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ogre/1.x/test_v1_package/conanfile.py b/recipes/ogre/1.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..436bf8d2136d5 --- /dev/null +++ b/recipes/ogre/1.x/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["OGRE_VERSION"] = tools.Version(self.deps_cpp_info["ogre"].version) + cmake.configure() + cmake.build() + + def test(self): + if tools.cross_building(self): + return + + ogre_main_bin_path = os.path.join("bin", "ogre_main") + self.run(ogre_main_bin_path, run_environment=True) diff --git a/recipes/ogre/config.yml b/recipes/ogre/config.yml index 86746ed84e0e7..cbcc403ba6e52 100644 --- a/recipes/ogre/config.yml +++ b/recipes/ogre/config.yml @@ -1,3 +1,3 @@ versions: - "1.10.2": + "14.2.4": folder: 1.x From 31b90f85b87281706903266efb168835fb074043 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 20 Apr 2024 15:24:25 +0300 Subject: [PATCH 02/29] ogre: disable freeimage plugin for now Blocked by #23138 --- recipes/ogre/1.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 5ab1f6cd1dea1..bad852e96dd1c 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -120,7 +120,7 @@ class OgreConanFile(ConanFile): "build_plugin_cg": False, "build_plugin_dot_scene": True, "build_plugin_exrcodec": True, - "build_plugin_freeimage": True, + "build_plugin_freeimage": False, # FIXME: set to true after https://github.com/conan-io/conan-center-index/pull/23138 is merged "build_plugin_octree": True, "build_plugin_pcz": True, "build_plugin_pfx": True, From bafc00c7d0c953389c684ed57c10e958daf372cd Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 15 Jul 2024 17:43:56 +0300 Subject: [PATCH 03/29] ogre: fix rmdir lib/cmake/OGRE --- recipes/ogre/1.x/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index bad852e96dd1c..5e6226af5aec1 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -452,6 +452,7 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "share")) rmdir(self, os.path.join(self.package_folder, "lib", "OGRE", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", "OGRE")) rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path), Version(self.version) From 2b10bf9b07a1e9ce970906d7c10354a68d3c8bdc Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 9 Sep 2024 11:18:43 +0300 Subject: [PATCH 04/29] ogre: bump patch version --- recipes/ogre/1.x/conandata.yml | 6 +++--- recipes/ogre/config.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/ogre/1.x/conandata.yml b/recipes/ogre/1.x/conandata.yml index eda4c6e8ffbb5..75c2b9886d5fb 100644 --- a/recipes/ogre/1.x/conandata.yml +++ b/recipes/ogre/1.x/conandata.yml @@ -1,4 +1,4 @@ sources: - "14.2.4": - url: "https://github.com/OGRECave/ogre/archive/refs/tags/v14.2.4.tar.gz" - sha256: "320cf8eb020e8848d5b7ed2efec260dbff5ae8013812d2f3aca1655df4e2282a" + "14.2.6": + url: "https://github.com/OGRECave/ogre/archive/refs/tags/v14.2.6.tar.gz" + sha256: "32437f6a90414332afaf6ac7e45633c035d07e1760f81e6419e2cb1bb79b4c12" diff --git a/recipes/ogre/config.yml b/recipes/ogre/config.yml index cbcc403ba6e52..68089f746a515 100644 --- a/recipes/ogre/config.yml +++ b/recipes/ogre/config.yml @@ -1,3 +1,3 @@ versions: - "14.2.4": + "14.2.6": folder: 1.x From 9dcc192413bbf85cc09be0206517931cf67184dd Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 9 Sep 2024 11:21:41 +0300 Subject: [PATCH 05/29] ogre: bump deps --- recipes/ogre/1.x/conanfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 5e6226af5aec1..a65473572f24d 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -262,7 +262,7 @@ def requirements(self): self.requires("zlib/[>=1.2.11 <2]") self.requires("zziplib/0.13.72") if self.options.get_safe("build_component_bites") or self.options.get_safe("build_rendersystem_tiny"): - self.requires("sdl/2.30.2") + self.requires("sdl/2.30.7") if self._build_opengl: self.requires("opengl/system", transitive_headers=True, transitive_libs=True) if self.settings.os in ["Linux", "FreeBSD"]: @@ -272,11 +272,11 @@ def requirements(self): if self.options.build_component_overlay: self.requires("freetype/2.13.2") if self.options.build_component_overlay_imgui: - self.requires("imgui/1.90.5") + self.requires("imgui/1.91.0") if self.options.build_plugin_assimp: - self.requires("assimp/5.3.1") + self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: - self.requires("openexr/2.5.7") + self.requires("openexr/3.2.4") if self.options.build_plugin_freeimage: self.requires("freeimage/3.18.0") @@ -319,7 +319,7 @@ def _missing_dep_warning(opt, dep): def build_requirements(self): if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/2.1.0") + self.tool_requires("pkgconf/2.2.0") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) From 2d4ca40e6e0c73e256192f7cccdc9bfc1eaa306b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 9 Sep 2024 11:26:10 +0300 Subject: [PATCH 06/29] ogre: add DirectX system lib deps --- recipes/ogre/1.x/conanfile.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index a65473572f24d..3cdeb4e25194e 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -623,12 +623,14 @@ def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): if self.options.get_safe("build_rendersystem_d3d9"): _add_rendersystem_component("RenderSystem_Direct3D9") - # FIXME: add DirectX9 system libs + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX.cmake#L58-L60 + self.cpp_info.components["RenderSystem_Direct3D9"].system_libs += ["d3d9", "d3dx9", "dxguid"] if self.options.get_safe("build_rendersystem_d3d11"): _add_rendersystem_component("RenderSystem_Direct3D11") if self.settings.compiler == "gcc": self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["psapi", "d3dcompiler"] - # FIXME: add DirectX11 system libs + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX11.cmake#L95-L100 + self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["dxerr", "dxguid", "dxgi", "d3dcompiler", "d3d11", "d3dx11"] if self.options.get_safe("build_rendersystem_gl"): _add_rendersystem_component("RenderSystem_GL", requires=["libglvnd::libglvnd"]) if self.options.get_safe("build_rendersystem_gl3plus"): From 7752266040b642055a0e05b2d4756373a126c68b Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 11:21:12 +0300 Subject: [PATCH 07/29] ogre: libglvnd -> opengl --- recipes/ogre/1.x/conanfile.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 3cdeb4e25194e..481ce67965ee1 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -595,9 +595,9 @@ def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): if self._build_opengl: if not self.options.shared: - _add_core_component("GLSupport", requires=["libglvnd::libglvnd"]) + _add_core_component("GLSupport", requires=["opengl::opengl"]) else: - self.cpp_info.components["OgreMain"].requires.append("libglvnd::libglvnd") + self.cpp_info.components["OgreMain"].requires.append("opengl::opengl") if self.options.build_plugin_assimp: _add_plugin_component("Codec_Assimp", requires=["assimp::assimp"]) @@ -632,11 +632,11 @@ def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX11.cmake#L95-L100 self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["dxerr", "dxguid", "dxgi", "d3dcompiler", "d3d11", "d3dx11"] if self.options.get_safe("build_rendersystem_gl"): - _add_rendersystem_component("RenderSystem_GL", requires=["libglvnd::libglvnd"]) + _add_rendersystem_component("RenderSystem_GL", requires=["opengl::opengl"]) if self.options.get_safe("build_rendersystem_gl3plus"): - _add_rendersystem_component("RenderSystem_GL3Plus", requires=["libglvnd::libglvnd"]) + _add_rendersystem_component("RenderSystem_GL3Plus", requires=["opengl::opengl"]) if self.options.get_safe("build_rendersystem_gles2"): - _add_rendersystem_component("RenderSystem_GLES2", requires=["libglvnd::libglvnd"]) + _add_rendersystem_component("RenderSystem_GLES2", requires=["opengl::opengl"]) if self.options.get_safe("build_rendersystem_metal"): _add_rendersystem_component("RenderSystem_Metal") if self.settings.os == "iOS": From 180a44ac88f5cc83efc79794394f68ea107ffe82 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 11:21:33 +0300 Subject: [PATCH 08/29] ogre: drop some excessive options --- recipes/ogre/1.x/conanfile.py | 73 ++++++++--------------------------- 1 file changed, 16 insertions(+), 57 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 481ce67965ee1..d97da0b422f39 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -46,18 +46,13 @@ class OgreConanFile(ConanFile): "build_component_bites": [True, False], "build_component_bullet": [True, False], "bites_static_plugins": [True, False], - "build_component_python": [True, False], - "build_component_java": [True, False], - "build_component_csharp": [True, False], "build_component_rtshadersystem": [True, False], "build_rtshadersystem_shaders": [True, False], - "build_samples": [True, False], "build_tools": [True, False], "build_xsiexporter": [True, False], # "build_libs_as_frameworks": [True, False], "build_plugin_assimp": [True, False], "build_plugin_bsp": [True, False], - "build_plugin_cg": [True, False], "build_plugin_dot_scene": [True, False], "build_plugin_exrcodec": [True, False], "build_plugin_freeimage": [True, False], @@ -75,14 +70,9 @@ class OgreConanFile(ConanFile): "config_enable_astc": [True, False], "config_enable_quad_buffer_stereo": [True, False], "config_enable_viewport_orientationmode": [True, False], - "config_enable_gles2_cg_support": [True, False], "config_enable_gles2_glsl_optimiser": [True, False], "config_enable_gl_state_cache_support": [True, False], "config_filesystem_unicode": [True, False], - "install_docs": [True, False], - "install_pdb": [True, False], - "profiling": [True, False], - "install_vsprops": [True, False], "assert_mode": [0, 1, 2], } default_options = { @@ -106,18 +96,13 @@ class OgreConanFile(ConanFile): "build_component_bites": True, "build_component_bullet": True, "bites_static_plugins": False, - "build_component_python": False, - "build_component_java": False, - "build_component_csharp": False, "build_component_rtshadersystem": True, "build_rtshadersystem_shaders": True, - "build_samples": False, "build_tools": False, "build_xsiexporter": False, # "build_libs_as_frameworks": True, "build_plugin_assimp": True, "build_plugin_bsp": True, - "build_plugin_cg": False, "build_plugin_dot_scene": True, "build_plugin_exrcodec": True, "build_plugin_freeimage": False, # FIXME: set to true after https://github.com/conan-io/conan-center-index/pull/23138 is merged @@ -135,14 +120,9 @@ class OgreConanFile(ConanFile): "config_enable_astc": True, "config_enable_quad_buffer_stereo": False, "config_enable_viewport_orientationmode": False, - "config_enable_gles2_cg_support": False, "config_enable_gles2_glsl_optimiser": False, "config_enable_gl_state_cache_support": False, "config_filesystem_unicode": True, - "install_docs": False, - "install_pdb": False, - "profiling": False, - "install_vsprops": False, "assert_mode": 1, } options_description = { @@ -168,18 +148,13 @@ class OgreConanFile(ConanFile): "build_component_bites": "Build OgreBites component", "build_component_bullet": "Build Bullet physics component", "bites_static_plugins": "Skip plugins.cfg and statically load plugins via OgreBites", - "build_component_python": "Build Python bindings", - "build_component_java": "Build Java (JNI) bindings", - "build_component_csharp": "Build Csharp bindings", "build_component_rtshadersystem": "Build RTShader System component", "build_rtshadersystem_shaders": "Build RTShader System FFP shaders", - "build_samples": "Build Ogre demos", "build_tools": "Build the command-line tools", "build_xsiexporter": "Build the Softimage exporter", # "build_libs_as_frameworks": "Build frameworks for libraries on OS X.", "build_plugin_assimp": "Build Open Asset Import plugin", "build_plugin_bsp": "Build BSP SceneManager plugin", - "build_plugin_cg": "Build Cg plugin", "build_plugin_dot_scene": "Build .scene plugin", "build_plugin_exrcodec": "Build EXR Codec plugin", "build_plugin_freeimage": "Build FreeImage codec.", @@ -197,14 +172,9 @@ class OgreConanFile(ConanFile): "config_enable_astc": "Build ASTC codec.", "config_enable_quad_buffer_stereo": "Enable stereoscopic 3D support", "config_enable_viewport_orientationmode": "Include Viewport orientation mode support.", - "config_enable_gles2_cg_support": "Enable Cg support to ES 2 render system", "config_enable_gles2_glsl_optimiser": "Enable GLSL optimiser use in GLES 2 render system", "config_enable_gl_state_cache_support": "Enable OpenGL state cache management", "config_filesystem_unicode": "paths expected to be in UTF-8 and wchar_t file IO routines are used", - "install_docs": "Install documentation.", - "install_pdb": "Install debug pdb files", - "profiling": "Enable internal instrumentation.", - "install_vsprops": "Install Visual Studio Property Page.", "assert_mode": ( "Enable Ogre asserts and exceptions. Possible values:\n" "0 - Standard asserts in debug builds, nothing in release builds.\n" @@ -227,7 +197,6 @@ def config_options(self): self.options.rm_safe("build_rendersystem_gl3plus") self.options.rm_safe("build_rendersystem_gl") self.options.rm_safe("build_rendersystem_gles2") - self.options.rm_safe("build_plugin_cg") if not is_apple_os(self): self.options.rm_safe("build_rendersystem_metal") self.options.rm_safe("build_libs_as_frameworks") @@ -237,8 +206,6 @@ def config_options(self): self.options.rm_safe("build_tools") if not is_msvc(self): self.options.rm_safe("config_filesystem_unicode") - self.options.rm_safe("install_pdb") - self.options.rm_safe("install_vsprops") def configure(self): if self.options.shared: @@ -251,7 +218,6 @@ def configure(self): if not self.options.get_safe("build_component_rtshadersystem"): self.options.rm_safe("build_rtshadersystem_shaders") if not self.options.get_safe("build_rendersystem_gles2"): - self.options.rm_safe("config_enable_gles2_cg_support") self.options.rm_safe("config_enable_gles2_glsl_optimiser") def layout(self): @@ -276,15 +242,13 @@ def requirements(self): if self.options.build_plugin_assimp: self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: - self.requires("openexr/3.2.4") + # OpenEXR 3.x is not compatible + self.requires("openexr/2.5.7") if self.options.build_plugin_freeimage: self.requires("freeimage/3.18.0") # TODO: OpenMP for RenderSystem_Tiny # TODO: unvendor stb in Plugin_STBI - # TODO: add Cg recipe - # TODO: OGRE_BUILD_PLUGIN_GLSLANG - # TODO: OGRE_BUILD_PLUGIN_RSIMAGE @property def _build_opengl(self): @@ -301,9 +265,6 @@ def validate(self): if self.options.shared and is_apple_os(self) and self.settings.os != "Macos": raise ConanInvalidConfiguration(f"OGRE shared library is not available on {self.settings.os}") - if not self.options.shared and (self.options.get_safe("build_component_python") or self.options.get_safe("build_component_java") or self.options.get_safe("build_component_csharp")): - raise ConanInvalidConfiguration("OGRE static library does not support bindings for Python/Java/C#") - if self.options.config_enable_gl_state_cache_support and not self._build_opengl: raise ConanInvalidConfiguration("config_enable_gl_state_cache_support requires GL, GLES2 or GL3PLUS RenderSystem") @@ -312,14 +273,12 @@ def _missing_dep_warning(opt, dep): self.output.warning(f"{opt} requires {dep}, which is not available in Conan Center Index. " "Assuming it is provided by the system.") - _missing_dep_warning("build_plugin_cg", "Cg") - _missing_dep_warning("config_enable_gles2_cg_support", "Cg") _missing_dep_warning("config_enable_quad_buffer_stereo", "NVAPI") _missing_dep_warning("build_xsiexporter", "Softimage") def build_requirements(self): if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): - self.tool_requires("pkgconf/2.2.0") + self.tool_requires("pkgconf/[>=2.2 <3]") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -349,24 +308,26 @@ def generate(self): tc.variables["OGRE_BUILD_COMPONENT_BITES"] = self.options.get_safe("build_component_bites", False) tc.variables["OGRE_BUILD_COMPONENT_BULLET"] = self.options.build_component_bullet tc.variables["OGRE_BITES_STATIC_PLUGINS"] = self.options.get_safe("bites_static_plugins", False) - tc.variables["OGRE_BUILD_COMPONENT_PYTHON"] = self.options.build_component_python - tc.variables["OGRE_BUILD_COMPONENT_JAVA"] = self.options.build_component_java - tc.variables["OGRE_BUILD_COMPONENT_CSHARP"] = self.options.build_component_csharp + tc.variables["OGRE_BUILD_COMPONENT_PYTHON"] = False + tc.variables["OGRE_BUILD_COMPONENT_JAVA"] = False + tc.variables["OGRE_BUILD_COMPONENT_CSHARP"] = False tc.variables["OGRE_BUILD_COMPONENT_RTSHADERSYSTEM"] = self.options.build_component_rtshadersystem tc.variables["OGRE_BUILD_RTSHADERSYSTEM_SHADERS"] = self.options.get_safe("build_rtshadersystem_shaders", False) - tc.variables["OGRE_BUILD_SAMPLES"] = self.options.get_safe("build_samples", False) + tc.variables["OGRE_BUILD_SAMPLES"] = False tc.variables["OGRE_BUILD_TOOLS"] = self.options.get_safe("build_tools", False) tc.variables["OGRE_BUILD_XSIEXPORTER"] = self.options.get_safe("build_xsiexporter", False) tc.variables["OGRE_BUILD_LIBS_AS_FRAMEWORKS"] = False # TODO: requires additional package_info() logic tc.variables["OGRE_BUILD_TESTS"] = False tc.variables["OGRE_BUILD_PLUGIN_ASSIMP"] = self.options.build_plugin_assimp tc.variables["OGRE_BUILD_PLUGIN_BSP"] = self.options.build_plugin_bsp + tc.variables["OGRE_BUILD_PLUGIN_GLSLANG"] = False # TODO tc.variables["OGRE_BUILD_PLUGIN_OCTREE"] = self.options.build_plugin_octree tc.variables["OGRE_BUILD_PLUGIN_PFX"] = self.options.build_plugin_pfx tc.variables["OGRE_BUILD_PLUGIN_DOT_SCENE"] = self.options.build_plugin_dot_scene tc.variables["OGRE_BUILD_PLUGIN_PCZ"] = self.options.build_plugin_pcz - tc.variables["OGRE_BUILD_PLUGIN_CG"] = self.options.get_safe("build_plugin_cg", False) + tc.variables["OGRE_BUILD_PLUGIN_CG"] = False # Cg is legacy and not worth adding support for on CCI, most likely tc.variables["OGRE_BUILD_PLUGIN_EXRCODEC"] = self.options.build_plugin_exrcodec + tc.variables["OGRE_BUILD_PLUGIN_RSIMAGE"] = False # Requires Rust support on CCI tc.variables["OGRE_BUILD_PLUGIN_STBI"] = self.options.build_plugin_stbi tc.variables["OGRE_CONFIG_DOUBLE"] = self.options.config_double tc.variables["OGRE_CONFIG_NODE_INHERIT_TRANSFORM"] = self.options.config_node_inherit_transform @@ -379,19 +340,19 @@ def generate(self): tc.variables["OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO"] = self.options.get_safe("config_enable_quad_buffer_stereo", False) tc.variables["OGRE_CONFIG_ENABLE_ZIP"] = True tc.variables["OGRE_CONFIG_ENABLE_VIEWPORT_ORIENTATIONMODE"] = self.options.config_enable_viewport_orientationmode - tc.variables["OGRE_CONFIG_ENABLE_GLES2_CG_SUPPORT"] = self.options.get_safe("config_enable_gles2_cg_support", False) + tc.variables["OGRE_CONFIG_ENABLE_GLES2_CG_SUPPORT"] = False tc.variables["OGRE_CONFIG_ENABLE_GLES2_GLSL_OPTIMISER"] = self.options.get_safe("config_enable_gles2_glsl_optimiser", False) tc.variables["OGRE_CONFIG_ENABLE_GL_STATE_CACHE_SUPPORT"] = self.options.get_safe("config_enable_gl_state_cache_support", False) tc.variables["OGRE_CONFIG_FILESYSTEM_UNICODE"] = self.options.get_safe("config_filesystem_unicode", False) tc.variables["OGRE_CONFIG_STATIC_LINK_CRT"] = is_msvc_static_runtime(self) - tc.variables["OGRE_INSTALL_SAMPLES"] = self.options.get_safe("build_samples", False) + tc.variables["OGRE_INSTALL_SAMPLES"] = False tc.variables["OGRE_INSTALL_TOOLS"] = self.options.get_safe("build_tools", False) - tc.variables["OGRE_INSTALL_DOCS"] = self.options.get_safe("install_docs", False) - tc.variables["OGRE_INSTALL_PDB"] = self.options.get_safe("install_pdb", False) - tc.variables["OGRE_PROFILING"] = self.options.profiling + tc.variables["OGRE_INSTALL_DOCS"] = False + tc.variables["OGRE_INSTALL_PDB"] = False + tc.variables["OGRE_PROFILING"] = False tc.variables["OGRE_LIB_DIRECTORY"] = "lib" tc.variables["OGRE_BIN_DIRECTORY"] = "bin" - tc.variables["OGRE_INSTALL_VSPROPS"] = self.options.get_safe("install_vsprops", False) + tc.variables["OGRE_INSTALL_VSPROPS"] = False # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L63-L69 tc.variables["OGRE_ASSERT_MODE"] = self.options.assert_mode tc.variables["OGRE_BUILD_DEPENDENCIES"] = False @@ -603,8 +564,6 @@ def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): _add_plugin_component("Codec_Assimp", requires=["assimp::assimp"]) if self.options.build_plugin_bsp: _add_plugin_component("Plugin_BSPSceneManager") - if self.options.get_safe("build_plugin_cg"): - _add_plugin_component("Plugin_CgProgramManager") #, requires=["cg::cg"]) if self.options.build_plugin_dot_scene: _add_plugin_component("Plugin_DotScene", requires=["pugixml::pugixml"]) if self.options.build_plugin_exrcodec: From 0125d46067799b9e26a105de1fd6795adce68ebb Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 13:20:41 +0300 Subject: [PATCH 09/29] ogre: fix target names, package paths, static build, drop test_v1_package --- recipes/ogre/1.x/CMakeLists.txt | 6 +- recipes/ogre/1.x/conanfile.py | 185 +++++++++--------- recipes/ogre/1.x/test_package/CMakeLists.txt | 10 +- .../ogre/1.x/test_v1_package/CMakeLists.txt | 8 - recipes/ogre/1.x/test_v1_package/conanfile.py | 19 -- 5 files changed, 100 insertions(+), 128 deletions(-) delete mode 100644 recipes/ogre/1.x/test_v1_package/CMakeLists.txt delete mode 100644 recipes/ogre/1.x/test_v1_package/conanfile.py diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index b454e773987c8..09091ae00a1c4 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -2,11 +2,7 @@ cmake_minimum_required(VERSION 3.15) project(OGRE) macro(custom_find_package name) - find_package(${name} ${ARGN} - # Allow only Conan packages - NO_DEFAULT_PATH - PATHS ${CMAKE_PREFIX_PATH} - ) + find_package(${name} ${ARGN}) string(TOUPPER ${name} name_upper) set(${name_upper}_FOUND TRUE) set(${name_upper}_VERSION_STRING ${${name}_VERSION_STRING}) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index d97da0b422f39..590160b110bbc 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -10,7 +10,6 @@ from conan.tools.files import copy, get, rmdir, save, replace_in_file from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import is_msvc_static_runtime, is_msvc -from conan.tools.scm import Version required_conan_version = ">=1.53.0" @@ -138,6 +137,7 @@ class OgreConanFile(ConanFile): "build_rendersystem_gles2": "Build OpenGL ES 2.x RenderSystem", "build_rendersystem_metal": "Build Metal RenderSystem", "build_rendersystem_tiny": "Build Tiny RenderSystem (software-rendering)", + "build_rendersystem_vulkan": "Build Vulkan RenderSystem", "build_component_paging": "Build Paging component", "build_component_meshlodgenerator": "Build MeshLodGenerator component", "build_component_terrain": "Build Terrain component", @@ -186,6 +186,13 @@ class OgreConanFile(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + @property + def _build_opengl(self): + # https://github.com/OGRECave/ogre/blob/v14.2.6/RenderSystems/CMakeLists.txt#L32-L34 + return (self.options.get_safe("build_rendersystem_gl") or + self.options.get_safe("build_rendersystem_gles2") or + self.options.get_safe("build_rendersystem_gl3plus")) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -219,6 +226,8 @@ def configure(self): self.options.rm_safe("build_rtshadersystem_shaders") if not self.options.get_safe("build_rendersystem_gles2"): self.options.rm_safe("config_enable_gles2_glsl_optimiser") + if not self._build_opengl: + self.options.rm_safe("config_enable_gl_state_cache_support") def layout(self): cmake_layout(self, src_folder="src") @@ -247,27 +256,19 @@ def requirements(self): if self.options.build_plugin_freeimage: self.requires("freeimage/3.18.0") + # TODO: RenderSystem_Vulkan + # TODO: Plugin_GLSLangProgramManager # TODO: OpenMP for RenderSystem_Tiny # TODO: unvendor stb in Plugin_STBI - @property - def _build_opengl(self): - # https://github.com/OGRECave/ogre/blob/v14.2.4/RenderSystems/CMakeLists.txt#L32-L34 - return (self.options.get_safe("build_rendersystem_gl") or - self.options.get_safe("build_rendersystem_gles2") or - self.options.get_safe("build_rendersystem_gl3plus")) - def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, 11) - # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L21-L25 + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/ConfigureBuild.cmake#L21-L25 if self.options.shared and is_apple_os(self) and self.settings.os != "Macos": raise ConanInvalidConfiguration(f"OGRE shared library is not available on {self.settings.os}") - if self.options.config_enable_gl_state_cache_support and not self._build_opengl: - raise ConanInvalidConfiguration("config_enable_gl_state_cache_support requires GL, GLES2 or GL3PLUS RenderSystem") - def _missing_dep_warning(opt, dep): if self.options.get_safe(opt): self.output.warning(f"{opt} requires {dep}, which is not available in Conan Center Index. " @@ -283,12 +284,33 @@ def build_requirements(self): def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) + @property + def _include_dir(self): + return os.path.join("include", "OGRE") + + @property + def _plugins_dir(self): + # Match https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/InstallResources.cmake#L33-L43 + return "lib" if self.settings.os == "Windows" else os.path.join("lib", "OGRE") + + @property + def _media_dir(self): + return os.path.join("res", "Media") + + @property + def _config_dir(self): + return "res" + + @staticmethod + def _to_cmake_path(path): + return path.replace("\\", "/") + def generate(self): venv = VirtualBuildEnv(self) venv.generate() tc = CMakeToolchain(self) - # https://github.com/OGRECave/ogre/blob/v14.2.4/CMakeLists.txt#L281-L420 + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMakeLists.txt#L281-L420 tc.variables["OGRE_STATIC"] = not self.options.shared tc.variables["OGRE_RESOURCEMANAGER_STRICT"] = 2 if self.options.resourcemanager_strict == "STRICT" else 1 tc.variables["OGRE_BUILD_RENDERSYSTEM_D3D9"] = self.options.get_safe("build_rendersystem_d3d9", False) @@ -298,6 +320,7 @@ def generate(self): tc.variables["OGRE_BUILD_RENDERSYSTEM_GLES2"] = self.options.get_safe("build_rendersystem_gles2", False) tc.variables["OGRE_BUILD_RENDERSYSTEM_METAL"] = self.options.get_safe("build_rendersystem_metal", False) tc.variables["OGRE_BUILD_RENDERSYSTEM_TINY"] = self.options.get_safe("build_rendersystem_tiny", False) + tc.variables["OGRE_BUILD_RENDERSYSTEM_VULKAN"] = False # TODO tc.variables["OGRE_BUILD_COMPONENT_PAGING"] = self.options.build_component_paging tc.variables["OGRE_BUILD_COMPONENT_MESHLODGENERATOR"] = self.options.build_component_meshlodgenerator tc.variables["OGRE_BUILD_COMPONENT_TERRAIN"] = self.options.build_component_terrain @@ -327,6 +350,7 @@ def generate(self): tc.variables["OGRE_BUILD_PLUGIN_PCZ"] = self.options.build_plugin_pcz tc.variables["OGRE_BUILD_PLUGIN_CG"] = False # Cg is legacy and not worth adding support for on CCI, most likely tc.variables["OGRE_BUILD_PLUGIN_EXRCODEC"] = self.options.build_plugin_exrcodec + tc.variables["OGRE_BUILD_PLUGIN_FREEIMAGE"] = self.options.build_plugin_freeimage tc.variables["OGRE_BUILD_PLUGIN_RSIMAGE"] = False # Requires Rust support on CCI tc.variables["OGRE_BUILD_PLUGIN_STBI"] = self.options.build_plugin_stbi tc.variables["OGRE_CONFIG_DOUBLE"] = self.options.config_double @@ -353,9 +377,13 @@ def generate(self): tc.variables["OGRE_LIB_DIRECTORY"] = "lib" tc.variables["OGRE_BIN_DIRECTORY"] = "bin" tc.variables["OGRE_INSTALL_VSPROPS"] = False - # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L63-L69 + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/ConfigureBuild.cmake#L63-L69 tc.variables["OGRE_ASSERT_MODE"] = self.options.assert_mode tc.variables["OGRE_BUILD_DEPENDENCIES"] = False + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/InstallResources.cmake + tc.variables["OGRE_PLUGINS_PATH"] = self._to_cmake_path(self._plugins_dir) + tc.variables["OGRE_MEDIA_PATH"] = self._to_cmake_path(self._media_dir) + tc.variables["OGRE_CFG_INSTALL_PATH"] = self._to_cmake_path(self._config_dir) tc.generate() deps = CMakeDeps(self) @@ -379,27 +407,34 @@ def build(self): @property def _ogre_cmake_packages(self): - return ["Cg", "DirectX", "DirectX11", "Softimage", "GLSLOptimizer", "HLSL2GLSL"] + return ["DirectX", "DirectX11", "Softimage", "GLSLOptimizer", "HLSL2GLSL"] - def _create_cmake_module_variables(self, module_file, version): + def _create_cmake_module_variables(self, module_file): + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Templates/OGREConfig.cmake.in content = textwrap.dedent(f"""\ - set(OGRE_PREFIX_DIR ${{CMAKE_CURRENT_LIST_DIR}}/../..) - set(OGRE{version.major}_VERSION_MAJOR {version.major}) - set(OGRE{version.major}_VERSION_MINOR {version.minor}) - set(OGRE{version.major}_VERSION_PATCH {version.patch}) - set(OGRE{version.major}_VERSION_STRING "{version.major}.{version.minor}.{version.patch}") - - set(OGRE_MEDIA_DIR "${{OGRE_PREFIX_DIR}}/share/OGRE/Media") - set(OGRE_PLUGIN_DIR "${{OGRE_PREFIX_DIR}}/lib/OGRE") - set(OGRE_CONFIG_DIR "${{OGRE_PREFIX_DIR}}/share/OGRE") + set(OGRE_STATIC {'OFF' if self.options.shared else 'ON'}) + get_filename_component(OGRE_PREFIX_DIR "${{CMAKE_CURRENT_LIST_DIR}}/../../../" ABSOLUTE) + set(OGRE_LIBRARY_DIRS "${{OGRE_PREFIX_DIR}}/lib") + set(OGRE_INCLUDE_DIRS "${{OGRE_PREFIX_DIR}}/{self._to_cmake_path(self._include_dir)}") + set(OGRE_MEDIA_DIR "${{OGRE_PREFIX_DIR}}/{self._to_cmake_path(self._media_dir)}") + set(OGRE_PLUGIN_DIR "${{OGRE_PREFIX_DIR}}/{self._to_cmake_path(self._plugins_dir)}") + set(OGRE_CONFIG_DIR "${{OGRE_PREFIX_DIR}}/{self._to_cmake_path(self._config_dir)}") """) - # Some hacky dependency resolution for packages that are not available from Conan + + # TODO: + # - OGRE_LIBRARIES + # - OGRE_PLUGINS + # - OGRE_COMPONENTS + # - OGRE_${COMPONENT}_FOUND + # - OGRE_${COMPONENT}_LIBRARIES + + # A hacky dependency resolution for packages that are not available from Conan for pkg in self._ogre_cmake_packages: content += textwrap.dedent(f"""\ find_package({pkg} MODULE QUIET) if({pkg}_FOUND OR {pkg.upper()}_FOUND) - target_link_libraries(OGRE::OgreMain INTERFACE ${{{pkg}}}_LIBRARIES}} ${{{pkg.upper()}}}_LIBRARIES}}) - target_include_directories(OGRE::OgreMain INTERFACE ${{{pkg}}}_INCLUDE_DIRS}} ${{{pkg.upper()}}}_INCLUDE_DIRS}}) + target_link_libraries(OgreMain INTERFACE ${{{pkg}}}_LIBRARIES}} ${{{pkg.upper()}}}_LIBRARIES}}) + target_include_directories(OgreMain INTERFACE ${{{pkg}}}_INCLUDE_DIRS}} ${{{pkg.upper()}}}_INCLUDE_DIRS}}) endif() """) save(self, module_file, content) @@ -407,17 +442,11 @@ def _create_cmake_module_variables(self, module_file, version): def package(self): cmake = CMake(self) cmake.install() - copy(self, "License.md", - dst=os.path.join(self.package_folder, "licenses"), - src=os.path.join(self.source_folder, "Docs")) + copy(self, "License.md", os.path.join(self.source_folder, "Docs"), os.path.join(self.package_folder, "licenses")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - rmdir(self, os.path.join(self.package_folder, "lib", "share")) rmdir(self, os.path.join(self.package_folder, "lib", "OGRE", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake", "OGRE")) - rmdir(self, os.path.join(self.package_folder, "share")) - self._create_cmake_module_variables( - os.path.join(self.package_folder, self._module_file_rel_path), Version(self.version) - ) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_file_rel_path)) # Include modules for packages that are not available from Conan for pkg in self._ogre_cmake_packages: copy(self, f"Find{pkg}.cmake", @@ -435,14 +464,6 @@ def _module_file_rel_dir(self): def _module_file_rel_path(self): return os.path.join(self._module_file_rel_dir, f"conan-official-{self.name}-variables.cmake") - def _format_lib(self, lib): - # https://github.com/OGRECave/ogre/blob/v14.2.4/CMake/ConfigureBuild.cmake#L140-L145 - if not self.options.shared: - lib += "Static" - if self.settings.os == "Windows" and self.settings.build_type == "Debug": - lib += "_d" - return lib - @property def _shared_extension(self): if self.settings.os == "Windows": @@ -452,84 +473,76 @@ def _shared_extension(self): else: return ".so" + def _core_libname(self, lib): + # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/ConfigureBuild.cmake#L140-L145 + if not self.options.shared: + lib += "Static" + if self.settings.os == "Windows" and self.settings.build_type == "Debug": + lib += "_d" + return lib + + def _plugin_libname(self, lib): + if self.options.shared: + # Adding the extension for a full name since the plugin libs don't include a 'lib' prefix + return self._core_libname(lib) + self._shared_extension + return self._core_libname(lib) + def package_info(self): self.cpp_info.set_property("cmake_file_name", "OGRE") - self.cpp_info.set_property("cmake_target_name", "OGRE::OGRE") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) - include_prefix = os.path.join("include", "OGRE") - plugin_lib_dir = os.path.join("lib", "OGRE") - - def _add_component(comp, *, requires=None, libs=None, includedirs=None, libdirs=None, cmake_target=None, pkg_config_name=None): - self.cpp_info.components[comp].set_property("cmake_target_name", cmake_target) - self.cpp_info.components[comp].set_property("pkg_config_name", pkg_config_name) + def _add_component(comp, *, requires=None, libs=None, extra_includedirs=None, libdirs=None): + self.cpp_info.components[comp].set_property("cmake_target_name", comp) + self.cpp_info.components[comp].set_property("pkg_config_name", "OGRE" if comp == "OgreMain" else f"OGRE-{comp}") if comp != "OgreMain": self.cpp_info.components[comp].requires = ["OgreMain"] self.cpp_info.components[comp].requires += requires or [] - self.cpp_info.components[comp].libs = [self._format_lib(lib) for lib in (libs or [])] - self.cpp_info.components[comp].includedirs = includedirs or [] + self.cpp_info.components[comp].libs = libs or [] + self.cpp_info.components[comp].includedirs = ["include", self._include_dir] + (extra_includedirs or []) self.cpp_info.components[comp].libdirs = libdirs or [] + self.cpp_info.components[comp].resdirs = ["res"] self.cpp_info.components[comp].builddirs.append(self._module_file_rel_dir) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components[comp].system_libs.append("pthread") - # TODO: Legacy, to be removed on Conan 2.0 - self.cpp_info.components[comp].names["cmake_find_package"] = comp - self.cpp_info.components[comp].names["cmake_find_package_multi"] = comp - self.cpp_info.components[comp].names["cmake_paths"] = comp - self.cpp_info.components[comp].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components[comp].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.components[comp].build_modules["cmake_paths"] = [self._module_file_rel_path] - def _add_core_component(comp, *, requires=None): _add_component( comp, - cmake_target=f"OGRE::{comp}", - pkg_config_name=f"OGRE-{comp}", - libs=[f"Ogre{comp}"], + libs=[self._core_libname(f"Ogre{comp}")], libdirs=["lib"], - includedirs=["include", include_prefix, os.path.join(include_prefix, comp)], + extra_includedirs=[os.path.join(self._include_dir, comp)], requires=requires, ) - def _add_plugin_component(comp, *, requires=None, extra_libs=None): + def _add_plugin_component(comp, *, requires=None): if comp.startswith("Codec_"): dirname = f"{comp.replace('Codec_', '')}Codec" else: dirname = comp.replace("Plugin_", "") _add_component( comp, - cmake_target=None, - pkg_config_name=None, - # Adding the extension for a full name since the plugin libs don't include the standard 'lib' prefix - libs=[comp + self._shared_extension] + (extra_libs or []), - libdirs=[plugin_lib_dir], - includedirs=["include", include_prefix, os.path.join(include_prefix, "Plugins", dirname)], + libs=[self._plugin_libname(comp)], + libdirs=[self._plugins_dir], + extra_includedirs=[os.path.join(self._include_dir, "Plugins", dirname)], requires=requires, ) - def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): + def _add_rendersystem_component(comp, *, requires=None): dirname = comp.replace("RenderSystem_", "") _add_component( comp, - cmake_target=None, - pkg_config_name=None, - libs=[comp + self._shared_extension] + (extra_libs or []), - libdirs=[plugin_lib_dir], - includedirs=["include", include_prefix, os.path.join(include_prefix, "RenderSystems", dirname)], + libs=[self._plugin_libname(comp)], + libdirs=[self._plugins_dir], + extra_includedirs=[os.path.join(self._include_dir, "RenderSystems", dirname)], requires=requires, ) _add_component( "OgreMain", - cmake_target="OGRE::OgreMain", - pkg_config_name="OGRE", - libs=["OgreMain"], + libs=[self._core_libname("OgreMain")], libdirs=["lib"], - includedirs=["include", include_prefix], requires=["pugixml::pugixml", "zlib::zlib", "zziplib::zziplib"], ) - if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["OgreMain"].requires.append("xorg::xorg") @@ -604,9 +617,3 @@ def _add_rendersystem_component(comp, *, requires=None, extra_libs=None): self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "AppKit", "QuartzCore"] if self.options.get_safe("build_rendersystem_tiny"): _add_rendersystem_component("RenderSystem_Tiny", requires=["sdl::sdl"]) - - # TODO: Legacy, to be removed on Conan 2.0 - self.cpp_info.names["cmake_find_package"] = "OGRE" - self.cpp_info.names["cmake_find_package_multi"] = "OGRE" - self.cpp_info.names["cmake_paths"] = "OGRE" - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/ogre/1.x/test_package/CMakeLists.txt b/recipes/ogre/1.x/test_package/CMakeLists.txt index 6ddcae5e68d1d..a649f15681faf 100644 --- a/recipes/ogre/1.x/test_package/CMakeLists.txt +++ b/recipes/ogre/1.x/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -find_package(OGRE ${OGRE_VERSION} COMPONENTS OgreMain REQUIRED) +find_package(OGRE COMPONENTS OgreMain REQUIRED) add_executable(ogre_main ogre_main.cpp) -target_link_libraries(ogre_main OGRE::OgreMain) -set_target_properties(ogre_main PROPERTIES - CXX_STANDARD 11 - CXX_STANDARD_REQUIRED ON - CXX_EXTENSIONS ON -) +target_link_libraries(ogre_main OgreMain) +target_compile_features(ogre_main PRIVATE cxx_std_11) diff --git a/recipes/ogre/1.x/test_v1_package/CMakeLists.txt b/recipes/ogre/1.x/test_v1_package/CMakeLists.txt deleted file mode 100644 index 91630d79f4abb..0000000000000 --- a/recipes/ogre/1.x/test_v1_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ - ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ogre/1.x/test_v1_package/conanfile.py b/recipes/ogre/1.x/test_v1_package/conanfile.py deleted file mode 100644 index 436bf8d2136d5..0000000000000 --- a/recipes/ogre/1.x/test_v1_package/conanfile.py +++ /dev/null @@ -1,19 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.definitions["OGRE_VERSION"] = tools.Version(self.deps_cpp_info["ogre"].version) - cmake.configure() - cmake.build() - - def test(self): - if tools.cross_building(self): - return - - ogre_main_bin_path = os.path.join("bin", "ogre_main") - self.run(ogre_main_bin_path, run_environment=True) From 30fe00f450930eeeceb39a597f1b045a26142568 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 13:37:20 +0300 Subject: [PATCH 10/29] ogre: improve option descriptions --- recipes/ogre/1.x/conanfile.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 590160b110bbc..ab929685681d0 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -155,9 +155,10 @@ class OgreConanFile(ConanFile): # "build_libs_as_frameworks": "Build frameworks for libraries on OS X.", "build_plugin_assimp": "Build Open Asset Import plugin", "build_plugin_bsp": "Build BSP SceneManager plugin", - "build_plugin_dot_scene": "Build .scene plugin", + "build_plugin_dot_scene": "Build .scene loader plugin", "build_plugin_exrcodec": "Build EXR Codec plugin", "build_plugin_freeimage": "Build FreeImage codec.", + "build_plugin_glslang": "Build Glslang (SPIRV) ProgramManager plugin", "build_plugin_octree": "Build Octree SceneManager plugin", "build_plugin_pcz": "Build PCZ SceneManager plugin", "build_plugin_pfx": "Build ParticleFX plugin", @@ -166,15 +167,15 @@ class OgreConanFile(ConanFile): "config_node_inherit_transform": "Tells the node whether it should inherit full transform from it's parent node or derived position, orientation and scale", "config_threads": "Enable Ogre thread safety support for multithreading. DefaultWorkQueue is threaded if True.", "config_enable_meshlod": "Enable Mesh Lod.", - "config_enable_dds": "Build DDS codec.", - "config_enable_pvrtc": "Build PVRTC codec.", - "config_enable_etc": "Build ETC codec.", - "config_enable_astc": "Build ASTC codec.", + "config_enable_dds": "Build DDS image codec (.dds).", + "config_enable_pvrtc": "Build PVRTC image codec (.pvr).", + "config_enable_etc": "Build ETC image codec (.pkm, .ktx).", + "config_enable_astc": "Build ASTC image codec (.astc).", "config_enable_quad_buffer_stereo": "Enable stereoscopic 3D support", "config_enable_viewport_orientationmode": "Include Viewport orientation mode support.", "config_enable_gles2_glsl_optimiser": "Enable GLSL optimiser use in GLES 2 render system", "config_enable_gl_state_cache_support": "Enable OpenGL state cache management", - "config_filesystem_unicode": "paths expected to be in UTF-8 and wchar_t file IO routines are used", + "config_filesystem_unicode": "Paths expected to be in UTF-8 and wchar_t file IO routines are used", "assert_mode": ( "Enable Ogre asserts and exceptions. Possible values:\n" "0 - Standard asserts in debug builds, nothing in release builds.\n" From ea729c82f85e3ed25c34b7668832c5887e697f22 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 13:52:14 +0300 Subject: [PATCH 11/29] ogre: add glslang support --- recipes/ogre/1.x/CMakeLists.txt | 4 ++++ recipes/ogre/1.x/conanfile.py | 13 ++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index 09091ae00a1c4..6b86f219ce22b 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -24,6 +24,10 @@ custom_find_package(OpenEXR QUIET CONFIG) custom_find_package(assimp QUIET CONFIG) custom_find_package(pugixml REQUIRED CONFIG) +# https://github.com/OGRECave/ogre/blob/v14.2.6/PlugIns/GLSLang/CMakeLists.txt#L22-L35 +custom_find_package(glslang QUIET CONFIG) +custom_find_package(SPIRV-Tools QUIET CONFIG) + add_subdirectory(src) if(TARGET Codec_FreeImage) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index ab929685681d0..3fa0328427631 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -55,6 +55,7 @@ class OgreConanFile(ConanFile): "build_plugin_dot_scene": [True, False], "build_plugin_exrcodec": [True, False], "build_plugin_freeimage": [True, False], + "build_plugin_glslang": [True, False], "build_plugin_octree": [True, False], "build_plugin_pcz": [True, False], "build_plugin_pfx": [True, False], @@ -105,6 +106,7 @@ class OgreConanFile(ConanFile): "build_plugin_dot_scene": True, "build_plugin_exrcodec": True, "build_plugin_freeimage": False, # FIXME: set to true after https://github.com/conan-io/conan-center-index/pull/23138 is merged + "build_plugin_glslang": True, "build_plugin_octree": True, "build_plugin_pcz": True, "build_plugin_pfx": True, @@ -256,6 +258,9 @@ def requirements(self): self.requires("openexr/2.5.7") if self.options.build_plugin_freeimage: self.requires("freeimage/3.18.0") + if self.options.build_plugin_glslang: + self.requires("glslang/1.3.268.0") + self.requires("spirv-tools/1.3.268.0") # TODO: RenderSystem_Vulkan # TODO: Plugin_GLSLangProgramManager @@ -344,7 +349,7 @@ def generate(self): tc.variables["OGRE_BUILD_TESTS"] = False tc.variables["OGRE_BUILD_PLUGIN_ASSIMP"] = self.options.build_plugin_assimp tc.variables["OGRE_BUILD_PLUGIN_BSP"] = self.options.build_plugin_bsp - tc.variables["OGRE_BUILD_PLUGIN_GLSLANG"] = False # TODO + tc.variables["OGRE_BUILD_PLUGIN_GLSLANG"] = self.options.build_plugin_glslang tc.variables["OGRE_BUILD_PLUGIN_OCTREE"] = self.options.build_plugin_octree tc.variables["OGRE_BUILD_PLUGIN_PFX"] = self.options.build_plugin_pfx tc.variables["OGRE_BUILD_PLUGIN_DOT_SCENE"] = self.options.build_plugin_dot_scene @@ -399,6 +404,8 @@ def generate(self): def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "Assimp", "CMakeLists.txt"), "fix::assimp", "assimp::assimp") + replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "GLSLang", "CMakeLists.txt"), + " glslang OSDependent SPIRV ", " glslang::glslang ") def build(self): self._patch_sources() @@ -584,6 +591,10 @@ def _add_rendersystem_component(comp, *, requires=None): _add_plugin_component("Codec_EXR", requires=["openexr::openexr"]) if self.options.build_plugin_freeimage: _add_plugin_component("Codec_FreeImage", requires=["freeimage::freeimage"]) + if self.options.build_plugin_glslang: + _add_plugin_component("Plugin_GLSLangProgramManager", requires=[ + "glslang::glslang", "spirv-tools::spirv-tools-core", "spirv-tools::spirv-tools-opt" + ]) if self.options.build_plugin_octree: _add_plugin_component("Plugin_OctreeSceneManager") if self.options.build_plugin_pcz: From e6c681515d0b43fe4dc535f37d82e81023597524 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 14:20:21 +0300 Subject: [PATCH 12/29] ogre: add RenderSystem_Vulkan support --- recipes/ogre/1.x/CMakeLists.txt | 16 ++++++++++++++-- recipes/ogre/1.x/conanfile.py | 31 +++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index 6b86f219ce22b..5a5d99bc03ce4 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -24,9 +24,16 @@ custom_find_package(OpenEXR QUIET CONFIG) custom_find_package(assimp QUIET CONFIG) custom_find_package(pugixml REQUIRED CONFIG) +if(OGRE_BUILD_RENDERSYSTEM_GL OR OGRE_BUILD_RENDERSYSTEM_GL3PLUS OR OGRE_BUILD_RENDERSYSTEM_GLES2) + find_package(khrplatform REQUIRED CONFIG) + link_libraries(khrplatform::khrplatform) + find_package(glad REQUIRED CONFIG) + link_libraries(glad::glad) +endif() + # https://github.com/OGRECave/ogre/blob/v14.2.6/PlugIns/GLSLang/CMakeLists.txt#L22-L35 -custom_find_package(glslang QUIET CONFIG) -custom_find_package(SPIRV-Tools QUIET CONFIG) +find_package(glslang QUIET CONFIG) +find_package(SPIRV-Tools QUIET CONFIG) add_subdirectory(src) @@ -45,3 +52,8 @@ endif() if(TARGET OgreXMLConverter) target_link_libraries(OgreXMLConverter pugixml::pugixml) endif() +if(TARGET RenderSystem_Vulkan) + find_package(VulkanHeaders REQUIRED CONFIG) + find_package(volk REQUIRED CONFIG) + target_link_libraries(RenderSystem_Vulkan PUBLIC Vulkan::Headers volk::volk) +endif() diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 3fa0328427631..c2b5dd1e4c5b5 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -35,6 +35,7 @@ class OgreConanFile(ConanFile): "build_rendersystem_gles2": [True, False], "build_rendersystem_metal": [True, False], "build_rendersystem_tiny": [True, False], + "build_rendersystem_vulkan": [True, False], "build_component_paging": [True, False], "build_component_meshlodgenerator": [True, False], "build_component_terrain": [True, False], @@ -86,6 +87,7 @@ class OgreConanFile(ConanFile): "build_rendersystem_gles2": True, "build_rendersystem_metal": True, "build_rendersystem_tiny": False, + "build_rendersystem_vulkan": True, "build_component_paging": True, "build_component_meshlodgenerator": True, "build_component_terrain": True, @@ -242,15 +244,19 @@ def requirements(self): if self.options.get_safe("build_component_bites") or self.options.get_safe("build_rendersystem_tiny"): self.requires("sdl/2.30.7") if self._build_opengl: + # Used in the public headers of RenderSystems self.requires("opengl/system", transitive_headers=True, transitive_libs=True) + self.requires("glad/0.1.36", transitive_headers=True, transitive_libs=True) + self.requires("khrplatform/cci.20200529", transitive_headers=True) if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("xorg/system", transitive_headers=True, transitive_libs=True) + self.requires("xorg/system") if self.options.build_component_bullet: self.requires("bullet3/3.25") if self.options.build_component_overlay: self.requires("freetype/2.13.2") if self.options.build_component_overlay_imgui: - self.requires("imgui/1.91.0") + # Used in Overlay/OgreImGuiOverlay.h public heder + self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True) if self.options.build_plugin_assimp: self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: @@ -261,11 +267,13 @@ def requirements(self): if self.options.build_plugin_glslang: self.requires("glslang/1.3.268.0") self.requires("spirv-tools/1.3.268.0") + if self.options.build_rendersystem_vulkan: + self.requires("vulkan-headers/1.3.268.0") + self.requires("volk/1.3.268.0", transitive_headers=True, transitive_libs=True) - # TODO: RenderSystem_Vulkan - # TODO: Plugin_GLSLangProgramManager # TODO: OpenMP for RenderSystem_Tiny # TODO: unvendor stb in Plugin_STBI + # TODO: Qt support in OgreBites def validate(self): if self.settings.compiler.cppstd: @@ -326,7 +334,7 @@ def generate(self): tc.variables["OGRE_BUILD_RENDERSYSTEM_GLES2"] = self.options.get_safe("build_rendersystem_gles2", False) tc.variables["OGRE_BUILD_RENDERSYSTEM_METAL"] = self.options.get_safe("build_rendersystem_metal", False) tc.variables["OGRE_BUILD_RENDERSYSTEM_TINY"] = self.options.get_safe("build_rendersystem_tiny", False) - tc.variables["OGRE_BUILD_RENDERSYSTEM_VULKAN"] = False # TODO + tc.variables["OGRE_BUILD_RENDERSYSTEM_VULKAN"] = self.options.get_safe("build_rendersystem_vulkan", False) tc.variables["OGRE_BUILD_COMPONENT_PAGING"] = self.options.build_component_paging tc.variables["OGRE_BUILD_COMPONENT_MESHLODGENERATOR"] = self.options.build_component_meshlodgenerator tc.variables["OGRE_BUILD_COMPONENT_TERRAIN"] = self.options.build_component_terrain @@ -575,11 +583,12 @@ def _add_rendersystem_component(comp, *, requires=None): if self.options.build_component_volume: _add_core_component("Volume") + opengl_reqs = ["opengl::opengl", "glad::glad", "khrplatform::khrplatform"] if self._build_opengl: if not self.options.shared: - _add_core_component("GLSupport", requires=["opengl::opengl"]) + _add_core_component("GLSupport", requires=opengl_reqs) else: - self.cpp_info.components["OgreMain"].requires.append("opengl::opengl") + self.cpp_info.components["OgreMain"].requires.extend(opengl_reqs) if self.options.build_plugin_assimp: _add_plugin_component("Codec_Assimp", requires=["assimp::assimp"]) @@ -616,11 +625,11 @@ def _add_rendersystem_component(comp, *, requires=None): # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX11.cmake#L95-L100 self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["dxerr", "dxguid", "dxgi", "d3dcompiler", "d3d11", "d3dx11"] if self.options.get_safe("build_rendersystem_gl"): - _add_rendersystem_component("RenderSystem_GL", requires=["opengl::opengl"]) + _add_rendersystem_component("RenderSystem_GL", requires=opengl_reqs) if self.options.get_safe("build_rendersystem_gl3plus"): - _add_rendersystem_component("RenderSystem_GL3Plus", requires=["opengl::opengl"]) + _add_rendersystem_component("RenderSystem_GL3Plus", requires=opengl_reqs) if self.options.get_safe("build_rendersystem_gles2"): - _add_rendersystem_component("RenderSystem_GLES2", requires=["opengl::opengl"]) + _add_rendersystem_component("RenderSystem_GLES2", requires=opengl_reqs) if self.options.get_safe("build_rendersystem_metal"): _add_rendersystem_component("RenderSystem_Metal") if self.settings.os == "iOS": @@ -629,3 +638,5 @@ def _add_rendersystem_component(comp, *, requires=None): self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "AppKit", "QuartzCore"] if self.options.get_safe("build_rendersystem_tiny"): _add_rendersystem_component("RenderSystem_Tiny", requires=["sdl::sdl"]) + if self.options.get_safe("build_rendersystem_vulkan"): + _add_rendersystem_component("RenderSystem_Vulkan", requires=["vulkan-headers::vulkan-headers", "volk::volk"]) From 9d04741215b2b7f0868f00da1973b5c612ce2ee6 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 14:31:36 +0300 Subject: [PATCH 13/29] ogre: add OpenMP support to RenderSystem_Tiny --- recipes/ogre/1.x/conanfile.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index c2b5dd1e4c5b5..9e0c08bd651dd 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -75,6 +75,7 @@ class OgreConanFile(ConanFile): "config_enable_gl_state_cache_support": [True, False], "config_filesystem_unicode": [True, False], "assert_mode": [0, 1, 2], + "enable_openmp": [True, False], } default_options = { "shared": False, @@ -127,6 +128,7 @@ class OgreConanFile(ConanFile): "config_enable_gl_state_cache_support": False, "config_filesystem_unicode": True, "assert_mode": 1, + "enable_openmp": True, } options_description = { "resourcemanager_strict": ( @@ -186,6 +188,7 @@ class OgreConanFile(ConanFile): "1 - Standard asserts in debug builds, exceptions in release builds.\n" "2 - Exceptions in debug builds, exceptions in release builds." ), + "enable_openmp": "Enable OpenMP support in RenderSystem_Tiny", } def export_sources(self): @@ -233,6 +236,8 @@ def configure(self): self.options.rm_safe("config_enable_gles2_glsl_optimiser") if not self._build_opengl: self.options.rm_safe("config_enable_gl_state_cache_support") + if not self.options.get_safe("build_rendersystem_tiny"): + self.options.rm_safe("enable_openmp") def layout(self): cmake_layout(self, src_folder="src") @@ -243,6 +248,8 @@ def requirements(self): self.requires("zziplib/0.13.72") if self.options.get_safe("build_component_bites") or self.options.get_safe("build_rendersystem_tiny"): self.requires("sdl/2.30.7") + if self.options.get_safe("build_rendersystem_tiny") and self.options.enable_openmp: + self.requires("openmp/system") if self._build_opengl: # Used in the public headers of RenderSystems self.requires("opengl/system", transitive_headers=True, transitive_libs=True) @@ -271,7 +278,6 @@ def requirements(self): self.requires("vulkan-headers/1.3.268.0") self.requires("volk/1.3.268.0", transitive_headers=True, transitive_libs=True) - # TODO: OpenMP for RenderSystem_Tiny # TODO: unvendor stb in Plugin_STBI # TODO: Qt support in OgreBites @@ -414,6 +420,9 @@ def _patch_sources(self): "fix::assimp", "assimp::assimp") replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "GLSLang", "CMakeLists.txt"), " glslang OSDependent SPIRV ", " glslang::glslang ") + replace_in_file(self, os.path.join(self.source_folder, "RenderSystems", "Tiny", "CMakeLists.txt"), + "find_package(OpenMP QUIET)", + "find_package(OpenMP REQUIRED)" if self.options.get_safe("enable_openmp") else "set(OpenMP_CXX_FOUND FALSE)") def build(self): self._patch_sources() @@ -638,5 +647,7 @@ def _add_rendersystem_component(comp, *, requires=None): self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "AppKit", "QuartzCore"] if self.options.get_safe("build_rendersystem_tiny"): _add_rendersystem_component("RenderSystem_Tiny", requires=["sdl::sdl"]) + if self.options.enable_openmp: + self.cpp_info.components["RenderSystem_Tiny"].requires.append("openmp::openmp") if self.options.get_safe("build_rendersystem_vulkan"): _add_rendersystem_component("RenderSystem_Vulkan", requires=["vulkan-headers::vulkan-headers", "volk::volk"]) From a654beee1de3d488e414b2c3a3752be25b89f2d8 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 14:45:49 +0300 Subject: [PATCH 14/29] ogre: unvendor stb --- recipes/ogre/1.x/CMakeLists.txt | 12 +++++++++--- recipes/ogre/1.x/conanfile.py | 27 ++++++++++++++++++--------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index 5a5d99bc03ce4..780adf8f2b697 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -31,9 +31,11 @@ if(OGRE_BUILD_RENDERSYSTEM_GL OR OGRE_BUILD_RENDERSYSTEM_GL3PLUS OR OGRE_BUILD_R link_libraries(glad::glad) endif() -# https://github.com/OGRECave/ogre/blob/v14.2.6/PlugIns/GLSLang/CMakeLists.txt#L22-L35 -find_package(glslang QUIET CONFIG) -find_package(SPIRV-Tools QUIET CONFIG) +if(OGRE_BUILD_PLUGIN_GLSLANG) + # https://github.com/OGRECave/ogre/blob/v14.2.6/PlugIns/GLSLang/CMakeLists.txt#L22-L35 + find_package(glslang REQUIRED CONFIG) + find_package(SPIRV-Tools REQUIRED CONFIG) +endif() add_subdirectory(src) @@ -43,6 +45,10 @@ endif() if(TARGET Codec_EXR) target_link_libraries(Codec_EXR openexr::openexr) endif() +if(TARGET Codec_STBI) + find_package(stb REQUIRED CONFIG) + target_link_libraries(Codec_STBI PRIVATE stb::stb) +endif() if(TARGET OgreOverlay) target_link_libraries(OgreOverlay PUBLIC Freetype::Freetype) endif() diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 9e0c08bd651dd..ccbb46f4c1fc9 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -75,7 +75,7 @@ class OgreConanFile(ConanFile): "config_enable_gl_state_cache_support": [True, False], "config_filesystem_unicode": [True, False], "assert_mode": [0, 1, 2], - "enable_openmp": [True, False], + "with_openmp": [True, False], } default_options = { "shared": False, @@ -128,7 +128,7 @@ class OgreConanFile(ConanFile): "config_enable_gl_state_cache_support": False, "config_filesystem_unicode": True, "assert_mode": 1, - "enable_openmp": True, + "with_openmp": True, } options_description = { "resourcemanager_strict": ( @@ -188,7 +188,7 @@ class OgreConanFile(ConanFile): "1 - Standard asserts in debug builds, exceptions in release builds.\n" "2 - Exceptions in debug builds, exceptions in release builds." ), - "enable_openmp": "Enable OpenMP support in RenderSystem_Tiny", + "with_openmp": "Enable OpenMP support in RenderSystem_Tiny", } def export_sources(self): @@ -237,7 +237,7 @@ def configure(self): if not self._build_opengl: self.options.rm_safe("config_enable_gl_state_cache_support") if not self.options.get_safe("build_rendersystem_tiny"): - self.options.rm_safe("enable_openmp") + self.options.rm_safe("with_openmp") def layout(self): cmake_layout(self, src_folder="src") @@ -248,7 +248,7 @@ def requirements(self): self.requires("zziplib/0.13.72") if self.options.get_safe("build_component_bites") or self.options.get_safe("build_rendersystem_tiny"): self.requires("sdl/2.30.7") - if self.options.get_safe("build_rendersystem_tiny") and self.options.enable_openmp: + if self.options.get_safe("build_rendersystem_tiny") and self.options.with_openmp: self.requires("openmp/system") if self._build_opengl: # Used in the public headers of RenderSystems @@ -274,12 +274,14 @@ def requirements(self): if self.options.build_plugin_glslang: self.requires("glslang/1.3.268.0") self.requires("spirv-tools/1.3.268.0") + if self.options.build_plugin_stbi: + self.requires("stb/cci.20230920") if self.options.build_rendersystem_vulkan: self.requires("vulkan-headers/1.3.268.0") self.requires("volk/1.3.268.0", transitive_headers=True, transitive_libs=True) - # TODO: unvendor stb in Plugin_STBI # TODO: Qt support in OgreBites + # TODO: unvendor imgui in Overlay def validate(self): if self.settings.compiler.cppstd: @@ -416,13 +418,20 @@ def generate(self): deps.generate() def _patch_sources(self): + # Fix assimp CMake target replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "Assimp", "CMakeLists.txt"), "fix::assimp", "assimp::assimp") + # Use CMake targets instead of plain libs for glslang and SPIRV-Tools replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "GLSLang", "CMakeLists.txt"), " glslang OSDependent SPIRV ", " glslang::glslang ") + # Make sure OpenMP is enabled/disabled correctly replace_in_file(self, os.path.join(self.source_folder, "RenderSystems", "Tiny", "CMakeLists.txt"), "find_package(OpenMP QUIET)", - "find_package(OpenMP REQUIRED)" if self.options.get_safe("enable_openmp") else "set(OpenMP_CXX_FOUND FALSE)") + "find_package(OpenMP REQUIRED)" if self.options.get_safe("with_openmp") else "set(OpenMP_CXX_FOUND FALSE)") + # Unvendor stb in Plugin_STBI + rmdir(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "stbi")) + replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "OgreSTBICodec.cpp"), + '#include "stbi/', '#include "') def build(self): self._patch_sources() @@ -621,7 +630,7 @@ def _add_rendersystem_component(comp, *, requires=None): if self.options.build_plugin_pfx: _add_plugin_component("Plugin_ParticleFX") if self.options.build_plugin_stbi: - _add_plugin_component("Codec_STBI") + _add_plugin_component("Codec_STBI", requires=["stb::stb"]) if self.options.get_safe("build_rendersystem_d3d9"): _add_rendersystem_component("RenderSystem_Direct3D9") @@ -647,7 +656,7 @@ def _add_rendersystem_component(comp, *, requires=None): self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "AppKit", "QuartzCore"] if self.options.get_safe("build_rendersystem_tiny"): _add_rendersystem_component("RenderSystem_Tiny", requires=["sdl::sdl"]) - if self.options.enable_openmp: + if self.options.with_openmp: self.cpp_info.components["RenderSystem_Tiny"].requires.append("openmp::openmp") if self.options.get_safe("build_rendersystem_vulkan"): _add_rendersystem_component("RenderSystem_Vulkan", requires=["vulkan-headers::vulkan-headers", "volk::volk"]) From c74dc205401bf1d238e1a21a8592d494b16da321 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 15:06:29 +0300 Subject: [PATCH 15/29] ogre: fix build_component_bites support --- recipes/ogre/1.x/conanfile.py | 53 ++++++++++++++++------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index ccbb46f4c1fc9..63baee1c438ca 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -228,7 +228,8 @@ def configure(self): if not self.options.get_safe("build_component_overlay"): self.options.rm_safe("build_component_overlay_imgui") self.options.rm_safe("build_component_bites") - if self.options.shared or not self.options.get_safe("build_component_bites"): + if not self.options.get_safe("build_component_bites") or not self.options.shared: + # bites_static_plugins is always enabled for static builds self.options.rm_safe("bites_static_plugins") if not self.options.get_safe("build_component_rtshadersystem"): self.options.rm_safe("build_rtshadersystem_shaders") @@ -261,9 +262,10 @@ def requirements(self): self.requires("bullet3/3.25") if self.options.build_component_overlay: self.requires("freetype/2.13.2") - if self.options.build_component_overlay_imgui: - # Used in Overlay/OgreImGuiOverlay.h public heder - self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True) + # TODO: unvendor imgui + # if self.options.build_component_overlay_imgui: + # # Used in Overlay/OgreImGuiOverlay.h public heder + # self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True) if self.options.build_plugin_assimp: self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: @@ -281,7 +283,6 @@ def requirements(self): self.requires("volk/1.3.268.0", transitive_headers=True, transitive_libs=True) # TODO: Qt support in OgreBites - # TODO: unvendor imgui in Overlay def validate(self): if self.settings.compiler.cppstd: @@ -549,27 +550,21 @@ def _add_core_component(comp, *, requires=None): ) def _add_plugin_component(comp, *, requires=None): - if comp.startswith("Codec_"): - dirname = f"{comp.replace('Codec_', '')}Codec" + if comp.startswith("RenderSystem_"): + includedir = os.path.join(self._include_dir, "RenderSystems", comp.replace("RenderSystem_", "")) + elif comp.startswith("Codec_"): + includedir = os.path.join(self._include_dir, "Plugins", f"{comp.replace('Codec_', '')}Codec") else: - dirname = comp.replace("Plugin_", "") + includedir = os.path.join(self._include_dir, "Plugins", comp.replace("Plugin_", "")) _add_component( comp, libs=[self._plugin_libname(comp)], libdirs=[self._plugins_dir], - extra_includedirs=[os.path.join(self._include_dir, "Plugins", dirname)], - requires=requires, - ) - - def _add_rendersystem_component(comp, *, requires=None): - dirname = comp.replace("RenderSystem_", "") - _add_component( - comp, - libs=[self._plugin_libname(comp)], - libdirs=[self._plugins_dir], - extra_includedirs=[os.path.join(self._include_dir, "RenderSystems", dirname)], + extra_includedirs=[includedir], requires=requires, ) + if self.options.get_safe("bites_static_plugins", not self.options.shared): + self.cpp_info.components["Bites"].requires.append(comp) _add_component( "OgreMain", @@ -588,8 +583,8 @@ def _add_rendersystem_component(comp, *, requires=None): _add_core_component("MeshLodGenerator") if self.options.build_component_overlay: _add_core_component("Overlay", requires=["freetype::freetype"]) - if self.options.get_safe("build_component_overlay_imgui"): - self.cpp_info.components["Overlay"].requires.append("imgui::imgui") + # if self.options.get_safe("build_component_overlay_imgui"): + # self.cpp_info.components["Overlay"].requires.append("imgui::imgui") if self.options.build_component_paging: _add_core_component("Paging") if self.options.build_component_property: @@ -633,30 +628,30 @@ def _add_rendersystem_component(comp, *, requires=None): _add_plugin_component("Codec_STBI", requires=["stb::stb"]) if self.options.get_safe("build_rendersystem_d3d9"): - _add_rendersystem_component("RenderSystem_Direct3D9") + _add_plugin_component("RenderSystem_Direct3D9") # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX.cmake#L58-L60 self.cpp_info.components["RenderSystem_Direct3D9"].system_libs += ["d3d9", "d3dx9", "dxguid"] if self.options.get_safe("build_rendersystem_d3d11"): - _add_rendersystem_component("RenderSystem_Direct3D11") + _add_plugin_component("RenderSystem_Direct3D11") if self.settings.compiler == "gcc": self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["psapi", "d3dcompiler"] # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX11.cmake#L95-L100 self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["dxerr", "dxguid", "dxgi", "d3dcompiler", "d3d11", "d3dx11"] if self.options.get_safe("build_rendersystem_gl"): - _add_rendersystem_component("RenderSystem_GL", requires=opengl_reqs) + _add_plugin_component("RenderSystem_GL", requires=opengl_reqs) if self.options.get_safe("build_rendersystem_gl3plus"): - _add_rendersystem_component("RenderSystem_GL3Plus", requires=opengl_reqs) + _add_plugin_component("RenderSystem_GL3Plus", requires=opengl_reqs) if self.options.get_safe("build_rendersystem_gles2"): - _add_rendersystem_component("RenderSystem_GLES2", requires=opengl_reqs) + _add_plugin_component("RenderSystem_GLES2", requires=opengl_reqs) if self.options.get_safe("build_rendersystem_metal"): - _add_rendersystem_component("RenderSystem_Metal") + _add_plugin_component("RenderSystem_Metal") if self.settings.os == "iOS": self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "QuartzCore"] else: self.cpp_info.components["RenderSystem_Metal"].frameworks += ["Metal", "AppKit", "QuartzCore"] if self.options.get_safe("build_rendersystem_tiny"): - _add_rendersystem_component("RenderSystem_Tiny", requires=["sdl::sdl"]) + _add_plugin_component("RenderSystem_Tiny", requires=["sdl::sdl"]) if self.options.with_openmp: self.cpp_info.components["RenderSystem_Tiny"].requires.append("openmp::openmp") if self.options.get_safe("build_rendersystem_vulkan"): - _add_rendersystem_component("RenderSystem_Vulkan", requires=["vulkan-headers::vulkan-headers", "volk::volk"]) + _add_plugin_component("RenderSystem_Vulkan", requires=["vulkan-headers::vulkan-headers", "volk::volk"]) From f90f50e10e18ab3bdbe1f3d96dd9c9739f85ee45 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Thu, 19 Sep 2024 15:37:17 +0300 Subject: [PATCH 16/29] ogre: unvendor imgui --- recipes/ogre/1.x/CMakeLists.txt | 6 ++++++ recipes/ogre/1.x/conanfile.py | 19 +++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index 780adf8f2b697..bbf97e40eb77a 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -39,6 +39,12 @@ endif() add_subdirectory(src) +if(TARGET OgreOverlay AND OGRE_BUILD_COMPONENT_OVERLAY_IMGUI) + find_package(imgui REQUIRED CONFIG) + target_sources(OgreOverlay PRIVATE ${CONAN_IMGUI_SRC}/misc/freetype/imgui_freetype.cpp) + target_include_directories(OgreOverlay PRIVATE ${CONAN_IMGUI_SRC}/misc/freetype) + target_link_libraries(OgreOverlay PUBLIC imgui::imgui) +endif() if(TARGET Codec_FreeImage) target_link_libraries(Codec_FreeImage PUBLIC freeimage::freeimage) endif() diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 63baee1c438ca..79003e07faf5a 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -262,10 +262,9 @@ def requirements(self): self.requires("bullet3/3.25") if self.options.build_component_overlay: self.requires("freetype/2.13.2") - # TODO: unvendor imgui - # if self.options.build_component_overlay_imgui: - # # Used in Overlay/OgreImGuiOverlay.h public heder - # self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True) + if self.options.build_component_overlay_imgui: + # Used in Overlay/OgreImGuiOverlay.h public heder + self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True) if self.options.build_plugin_assimp: self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: @@ -407,6 +406,8 @@ def generate(self): tc.variables["OGRE_PLUGINS_PATH"] = self._to_cmake_path(self._plugins_dir) tc.variables["OGRE_MEDIA_PATH"] = self._to_cmake_path(self._media_dir) tc.variables["OGRE_CFG_INSTALL_PATH"] = self._to_cmake_path(self._config_dir) + if self.options.get_safe("build_component_overlay_imgui"): + tc.variables["CONAN_IMGUI_SRC"] = os.path.join(self.dependencies["imgui"].package_folder, "res") tc.generate() deps = CMakeDeps(self) @@ -433,6 +434,12 @@ def _patch_sources(self): rmdir(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "stbi")) replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "OgreSTBICodec.cpp"), '#include "stbi/', '#include "') + # Unvendor imgui in Overlay + # https://github.com/OGRECave/ogre/blob/v14.2.6/Components/Overlay/CMakeLists.txt#L21-L43 + replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), + "if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)", "if(0)") + replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), + "list(REMOVE_ITEM SOURCE_FILES", "# list(REMOVE_ITEM SOURCE_FILES") def build(self): self._patch_sources() @@ -583,8 +590,8 @@ def _add_plugin_component(comp, *, requires=None): _add_core_component("MeshLodGenerator") if self.options.build_component_overlay: _add_core_component("Overlay", requires=["freetype::freetype"]) - # if self.options.get_safe("build_component_overlay_imgui"): - # self.cpp_info.components["Overlay"].requires.append("imgui::imgui") + if self.options.get_safe("build_component_overlay_imgui"): + self.cpp_info.components["Overlay"].requires.append("imgui::imgui") if self.options.build_component_paging: _add_core_component("Paging") if self.options.build_component_property: From 23f242cbdd030059e586f2ef01d592a322fee20d Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 09:23:42 +0300 Subject: [PATCH 17/29] ogre: disable imgui for now --- recipes/ogre/1.x/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 79003e07faf5a..ac33fc6226a0f 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -95,7 +95,7 @@ class OgreConanFile(ConanFile): "build_component_volume": True, "build_component_property": True, "build_component_overlay": True, - "build_component_overlay_imgui": True, + "build_component_overlay_imgui": False, "build_component_bites": True, "build_component_bullet": True, "bites_static_plugins": False, From cf16f57297559186fd693f1124425467d03cbb41 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 09:40:32 +0300 Subject: [PATCH 18/29] ogre: disable OGRE_ENABLE_PRECOMPILED_HEADERS --- recipes/ogre/1.x/conanfile.py | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index ac33fc6226a0f..c5010d626f9dc 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -391,6 +391,7 @@ def generate(self): tc.variables["OGRE_CONFIG_ENABLE_GL_STATE_CACHE_SUPPORT"] = self.options.get_safe("config_enable_gl_state_cache_support", False) tc.variables["OGRE_CONFIG_FILESYSTEM_UNICODE"] = self.options.get_safe("config_filesystem_unicode", False) tc.variables["OGRE_CONFIG_STATIC_LINK_CRT"] = is_msvc_static_runtime(self) + tc.variables["OGRE_ENABLE_PRECOMPILED_HEADERS"] = False # Fails for GCC in C3I with 'ADD_CUSTOM_COMMAND called with OUTPUT containing a ">"' tc.variables["OGRE_INSTALL_SAMPLES"] = False tc.variables["OGRE_INSTALL_TOOLS"] = self.options.get_safe("build_tools", False) tc.variables["OGRE_INSTALL_DOCS"] = False From 27e82d526565373badcda6eaafeb9c3d48ad65b1 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 10:19:02 +0300 Subject: [PATCH 19/29] ogre: fix disabling of imgui --- recipes/ogre/1.x/conanfile.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index c5010d626f9dc..4ce70b9d382fd 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -437,10 +437,11 @@ def _patch_sources(self): '#include "stbi/', '#include "') # Unvendor imgui in Overlay # https://github.com/OGRECave/ogre/blob/v14.2.6/Components/Overlay/CMakeLists.txt#L21-L43 - replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), - "if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)", "if(0)") - replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), - "list(REMOVE_ITEM SOURCE_FILES", "# list(REMOVE_ITEM SOURCE_FILES") + if self.options.get_safe("build_component_overlay_imgui"): + replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), + "if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)", "if(0)") + replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), + "list(REMOVE_ITEM SOURCE_FILES", "# list(REMOVE_ITEM SOURCE_FILES") def build(self): self._patch_sources() From c4293da2fc3f946be1a8983b3442986dda1acd6c Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 11:34:04 +0300 Subject: [PATCH 20/29] ogre: enable GLES2 by default only on embedded systems --- recipes/ogre/1.x/conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 4ce70b9d382fd..f17b2c086845f 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -204,6 +204,9 @@ def _build_opengl(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if not (self.settings.os == "Android" or is_apple_os(self) and self.settings.os != "Macos"): + # GLES is generally not useful and not guaranteed to be available in non-embedded contexts + self.options.build_rendersystem_gles2 = False if self.settings.os != "Windows": self.options.rm_safe("build_rendersystem_d3d9") self.options.rm_safe("build_rendersystem_d3d11") From 98faa3ea5ad3669af70fba0a2a5bcf7c0ef9ca52 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 13:01:05 +0300 Subject: [PATCH 21/29] ogre: bump to v14.3.0 --- recipes/ogre/1.x/conandata.yml | 6 +++--- recipes/ogre/1.x/conanfile.py | 22 +++++++++++----------- recipes/ogre/config.yml | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/recipes/ogre/1.x/conandata.yml b/recipes/ogre/1.x/conandata.yml index 75c2b9886d5fb..41eafc89710b7 100644 --- a/recipes/ogre/1.x/conandata.yml +++ b/recipes/ogre/1.x/conandata.yml @@ -1,4 +1,4 @@ sources: - "14.2.6": - url: "https://github.com/OGRECave/ogre/archive/refs/tags/v14.2.6.tar.gz" - sha256: "32437f6a90414332afaf6ac7e45633c035d07e1760f81e6419e2cb1bb79b4c12" + "14.3.0": + url: "https://github.com/OGRECave/ogre/archive/refs/tags/v14.3.0.tar.gz" + sha256: "40c20797f4c21bae0d80df7ffd6fe92af26c0cdd666c2db4f005da02dfcc4d5b" diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index f17b2c086845f..71e458d77bab3 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -196,7 +196,7 @@ def export_sources(self): @property def _build_opengl(self): - # https://github.com/OGRECave/ogre/blob/v14.2.6/RenderSystems/CMakeLists.txt#L32-L34 + # https://github.com/OGRECave/ogre/blob/v14.3.0/RenderSystems/CMakeLists.txt#L32-L34 return (self.options.get_safe("build_rendersystem_gl") or self.options.get_safe("build_rendersystem_gles2") or self.options.get_safe("build_rendersystem_gl3plus")) @@ -290,7 +290,7 @@ def validate(self): if self.settings.compiler.cppstd: check_min_cppstd(self, 11) - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/ConfigureBuild.cmake#L21-L25 + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/ConfigureBuild.cmake#L21-L25 if self.options.shared and is_apple_os(self) and self.settings.os != "Macos": raise ConanInvalidConfiguration(f"OGRE shared library is not available on {self.settings.os}") @@ -315,7 +315,7 @@ def _include_dir(self): @property def _plugins_dir(self): - # Match https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/InstallResources.cmake#L33-L43 + # Match https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/InstallResources.cmake#L33-L43 return "lib" if self.settings.os == "Windows" else os.path.join("lib", "OGRE") @property @@ -335,7 +335,7 @@ def generate(self): venv.generate() tc = CMakeToolchain(self) - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMakeLists.txt#L281-L420 + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMakeLists.txt#L281-L420 tc.variables["OGRE_STATIC"] = not self.options.shared tc.variables["OGRE_RESOURCEMANAGER_STRICT"] = 2 if self.options.resourcemanager_strict == "STRICT" else 1 tc.variables["OGRE_BUILD_RENDERSYSTEM_D3D9"] = self.options.get_safe("build_rendersystem_d3d9", False) @@ -403,10 +403,10 @@ def generate(self): tc.variables["OGRE_LIB_DIRECTORY"] = "lib" tc.variables["OGRE_BIN_DIRECTORY"] = "bin" tc.variables["OGRE_INSTALL_VSPROPS"] = False - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/ConfigureBuild.cmake#L63-L69 + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/ConfigureBuild.cmake#L63-L69 tc.variables["OGRE_ASSERT_MODE"] = self.options.assert_mode tc.variables["OGRE_BUILD_DEPENDENCIES"] = False - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/InstallResources.cmake + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/InstallResources.cmake tc.variables["OGRE_PLUGINS_PATH"] = self._to_cmake_path(self._plugins_dir) tc.variables["OGRE_MEDIA_PATH"] = self._to_cmake_path(self._media_dir) tc.variables["OGRE_CFG_INSTALL_PATH"] = self._to_cmake_path(self._config_dir) @@ -439,7 +439,7 @@ def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "PlugIns", "STBICodec", "src", "OgreSTBICodec.cpp"), '#include "stbi/', '#include "') # Unvendor imgui in Overlay - # https://github.com/OGRECave/ogre/blob/v14.2.6/Components/Overlay/CMakeLists.txt#L21-L43 + # https://github.com/OGRECave/ogre/blob/v14.3.0/Components/Overlay/CMakeLists.txt#L21-L43 if self.options.get_safe("build_component_overlay_imgui"): replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), "if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)", "if(0)") @@ -457,7 +457,7 @@ def _ogre_cmake_packages(self): return ["DirectX", "DirectX11", "Softimage", "GLSLOptimizer", "HLSL2GLSL"] def _create_cmake_module_variables(self, module_file): - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Templates/OGREConfig.cmake.in + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/Templates/OGREConfig.cmake.in content = textwrap.dedent(f"""\ set(OGRE_STATIC {'OFF' if self.options.shared else 'ON'}) get_filename_component(OGRE_PREFIX_DIR "${{CMAKE_CURRENT_LIST_DIR}}/../../../" ABSOLUTE) @@ -521,7 +521,7 @@ def _shared_extension(self): return ".so" def _core_libname(self, lib): - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/ConfigureBuild.cmake#L140-L145 + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/ConfigureBuild.cmake#L140-L145 if not self.options.shared: lib += "Static" if self.settings.os == "Windows" and self.settings.build_type == "Debug": @@ -641,13 +641,13 @@ def _add_plugin_component(comp, *, requires=None): if self.options.get_safe("build_rendersystem_d3d9"): _add_plugin_component("RenderSystem_Direct3D9") - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX.cmake#L58-L60 + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/Packages/FindDirectX.cmake#L58-L60 self.cpp_info.components["RenderSystem_Direct3D9"].system_libs += ["d3d9", "d3dx9", "dxguid"] if self.options.get_safe("build_rendersystem_d3d11"): _add_plugin_component("RenderSystem_Direct3D11") if self.settings.compiler == "gcc": self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["psapi", "d3dcompiler"] - # https://github.com/OGRECave/ogre/blob/v14.2.6/CMake/Packages/FindDirectX11.cmake#L95-L100 + # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/Packages/FindDirectX11.cmake#L95-L100 self.cpp_info.components["RenderSystem_Direct3D11"].system_libs += ["dxerr", "dxguid", "dxgi", "d3dcompiler", "d3d11", "d3dx11"] if self.options.get_safe("build_rendersystem_gl"): _add_plugin_component("RenderSystem_GL", requires=opengl_reqs) diff --git a/recipes/ogre/config.yml b/recipes/ogre/config.yml index 68089f746a515..80ddd7abda2dc 100644 --- a/recipes/ogre/config.yml +++ b/recipes/ogre/config.yml @@ -1,3 +1,3 @@ versions: - "14.2.6": + "14.3.0": folder: 1.x From 8329249809535b40c2c232fa3180f9142e3b7962 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 13:39:11 +0300 Subject: [PATCH 22/29] ogre: add EGL and Wayland support --- recipes/ogre/1.x/conanfile.py | 38 +++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 71e458d77bab3..62f338d66f2ff 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -75,6 +75,8 @@ class OgreConanFile(ConanFile): "config_enable_gl_state_cache_support": [True, False], "config_filesystem_unicode": [True, False], "assert_mode": [0, 1, 2], + "glsupport_use_egl": [True, False], + "use_wayland": [True, False], "with_openmp": [True, False], } default_options = { @@ -128,6 +130,8 @@ class OgreConanFile(ConanFile): "config_enable_gl_state_cache_support": False, "config_filesystem_unicode": True, "assert_mode": 1, + "glsupport_use_egl": True, + "use_wayland": False, "with_openmp": True, } options_description = { @@ -188,6 +192,8 @@ class OgreConanFile(ConanFile): "1 - Standard asserts in debug builds, exceptions in release builds.\n" "2 - Exceptions in debug builds, exceptions in release builds." ), + "glsupport_use_egl": "Use EGL for GL Context Creation instead of GLX/WGL", + "use_wayland": "Use Wayland window manager", "with_openmp": "Enable OpenMP support in RenderSystem_Tiny", } @@ -204,6 +210,7 @@ def _build_opengl(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + self.options.glsupport_use_egl = False if not (self.settings.os == "Android" or is_apple_os(self) and self.settings.os != "Macos"): # GLES is generally not useful and not guaranteed to be available in non-embedded contexts self.options.build_rendersystem_gles2 = False @@ -224,6 +231,8 @@ def config_options(self): self.options.rm_safe("build_tools") if not is_msvc(self): self.options.rm_safe("config_filesystem_unicode") + if not self.settings.os in ["Linux", "FreeBSD"]: + self.options.rm_safe("use_wayland") def configure(self): if self.options.shared: @@ -260,7 +269,10 @@ def requirements(self): self.requires("glad/0.1.36", transitive_headers=True, transitive_libs=True) self.requires("khrplatform/cci.20200529", transitive_headers=True) if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("xorg/system") + if self.options.use_wayland: + self.requires("wayland/1.22.0") + else: + self.requires("xorg/system") if self.options.build_component_bullet: self.requires("bullet3/3.25") if self.options.build_component_overlay: @@ -283,6 +295,8 @@ def requirements(self): if self.options.build_rendersystem_vulkan: self.requires("vulkan-headers/1.3.268.0") self.requires("volk/1.3.268.0", transitive_headers=True, transitive_libs=True) + if self.options.glsupport_use_egl: + self.requires("egl/system") # TODO: Qt support in OgreBites @@ -302,6 +316,9 @@ def _missing_dep_warning(opt, dep): _missing_dep_warning("config_enable_quad_buffer_stereo", "NVAPI") _missing_dep_warning("build_xsiexporter", "Softimage") + if self.options.get_safe("use_wayland") and not self.options.glsupport_use_egl: + raise ConanInvalidConfiguration("-o use_wayland=True requires -o glsupport_use_egl=True") + def build_requirements(self): if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): self.tool_requires("pkgconf/[>=2.2 <3]") @@ -412,6 +429,9 @@ def generate(self): tc.variables["OGRE_CFG_INSTALL_PATH"] = self._to_cmake_path(self._config_dir) if self.options.get_safe("build_component_overlay_imgui"): tc.variables["CONAN_IMGUI_SRC"] = os.path.join(self.dependencies["imgui"].package_folder, "res") + # https://github.com/OGRECave/ogre/blob/v14.3.0/RenderSystems/GLSupport/CMakeLists.txt#L15-L16 + tc.variables["OGRE_GLSUPPORT_USE_EGL"] = self.options.get_safe("glsupport_use_egl", False) + tc.variables["OGRE_USE_WAYLAND"] = self.options.get_safe("use_wayland", False) tc.generate() deps = CMakeDeps(self) @@ -585,7 +605,19 @@ def _add_plugin_component(comp, *, requires=None): requires=["pugixml::pugixml", "zlib::zlib", "zziplib::zziplib"], ) if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["OgreMain"].requires.append("xorg::xorg") + if self.options.use_wayland: + self.cpp_info.components["OgreMain"].requires.extend([ + "wayland::wayland-client", + "wayland::wayland-egl", + ]) + else: + self.cpp_info.components["OgreMain"].requires.extend([ + "xorg::x11", + "xorg::xaw7", + "xorg::xext", + "xorg::xrandr", + "xorg::xt", + ]) if self.options.get_safe("build_component_bites"): _add_core_component("Bites", requires=["Overlay", "sdl::sdl"]) @@ -609,6 +641,8 @@ def _add_plugin_component(comp, *, requires=None): _add_core_component("Volume") opengl_reqs = ["opengl::opengl", "glad::glad", "khrplatform::khrplatform"] + if self.options.glsupport_use_egl: + opengl_reqs.append("egl::egl") if self._build_opengl: if not self.options.shared: _add_core_component("GLSupport", requires=opengl_reqs) From 7469612d26c29b8a7f06d2f05186c180f63d52e0 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Mon, 23 Sep 2024 18:48:34 +0300 Subject: [PATCH 23/29] ogre: don't package Find*.cmake modules --- recipes/ogre/1.x/conanfile.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 62f338d66f2ff..33805b05754b7 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -299,6 +299,7 @@ def requirements(self): self.requires("egl/system") # TODO: Qt support in OgreBites + # TODO: add support for DirectX, DirectX11, Softimage, GLSLOptimizer, HLSL2GLSL def validate(self): if self.settings.compiler.cppstd: @@ -472,10 +473,6 @@ def build(self): cmake.configure(build_script_folder=self.source_path.parent) cmake.build() - @property - def _ogre_cmake_packages(self): - return ["DirectX", "DirectX11", "Softimage", "GLSLOptimizer", "HLSL2GLSL"] - def _create_cmake_module_variables(self, module_file): # https://github.com/OGRECave/ogre/blob/v14.3.0/CMake/Templates/OGREConfig.cmake.in content = textwrap.dedent(f"""\ @@ -495,15 +492,6 @@ def _create_cmake_module_variables(self, module_file): # - OGRE_${COMPONENT}_FOUND # - OGRE_${COMPONENT}_LIBRARIES - # A hacky dependency resolution for packages that are not available from Conan - for pkg in self._ogre_cmake_packages: - content += textwrap.dedent(f"""\ - find_package({pkg} MODULE QUIET) - if({pkg}_FOUND OR {pkg.upper()}_FOUND) - target_link_libraries(OgreMain INTERFACE ${{{pkg}}}_LIBRARIES}} ${{{pkg.upper()}}}_LIBRARIES}}) - target_include_directories(OgreMain INTERFACE ${{{pkg}}}_INCLUDE_DIRS}} ${{{pkg.upper()}}}_INCLUDE_DIRS}}) - endif() - """) save(self, module_file, content) def package(self): @@ -514,14 +502,6 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "OGRE", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake", "OGRE")) self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_file_rel_path)) - # Include modules for packages that are not available from Conan - for pkg in self._ogre_cmake_packages: - copy(self, f"Find{pkg}.cmake", - src=os.path.join(self.source_folder, "CMake", "Packages"), - dst=os.path.join(self.package_folder, self._module_file_rel_dir)) - copy(self, "FindPkgMacros.cmake", - src=os.path.join(self.source_folder, "CMake", "Utils"), - dst=os.path.join(self.package_folder, self._module_file_rel_dir)) @property def _module_file_rel_dir(self): From ac3fd39333bc8ab7c56b2aec7ad0b6f02c1ca269 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 24 Sep 2024 10:58:30 +0300 Subject: [PATCH 24/29] ogre: bump imgui --- recipes/ogre/1.x/conanfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 33805b05754b7..34bed08dbfe1c 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -278,8 +278,8 @@ def requirements(self): if self.options.build_component_overlay: self.requires("freetype/2.13.2") if self.options.build_component_overlay_imgui: - # Used in Overlay/OgreImGuiOverlay.h public heder - self.requires("imgui/1.91.0", transitive_headers=True, transitive_libs=True) + # Used in Overlay/OgreImGuiOverlay.h public header + self.requires("imgui/1.91.2", transitive_headers=True, transitive_libs=True) if self.options.build_plugin_assimp: self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: From 3b04f8cfbb0f1aa9500104c074ea0070d5319c42 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 24 Sep 2024 12:36:51 +0300 Subject: [PATCH 25/29] ogre: handle exceptions in includedir paths --- recipes/ogre/1.x/conanfile.py | 42 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 34bed08dbfe1c..8025202847cd0 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -484,14 +484,12 @@ def _create_cmake_module_variables(self, module_file): set(OGRE_PLUGIN_DIR "${{OGRE_PREFIX_DIR}}/{self._to_cmake_path(self._plugins_dir)}") set(OGRE_CONFIG_DIR "${{OGRE_PREFIX_DIR}}/{self._to_cmake_path(self._config_dir)}") """) - # TODO: # - OGRE_LIBRARIES # - OGRE_PLUGINS # - OGRE_COMPONENTS # - OGRE_${COMPONENT}_FOUND # - OGRE_${COMPONENT}_LIBRARIES - save(self, module_file, content) def package(self): @@ -552,27 +550,31 @@ def _add_component(comp, *, requires=None, libs=None, extra_includedirs=None, li if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components[comp].system_libs.append("pthread") - def _add_core_component(comp, *, requires=None): + def _add_core_component(comp, *, requires=None, extra_includedirs=None): + if extra_includedirs is None: + extra_includedirs = [os.path.join(self._include_dir, comp)] _add_component( comp, libs=[self._core_libname(f"Ogre{comp}")], libdirs=["lib"], - extra_includedirs=[os.path.join(self._include_dir, comp)], + extra_includedirs=extra_includedirs, requires=requires, ) - def _add_plugin_component(comp, *, requires=None): - if comp.startswith("RenderSystem_"): - includedir = os.path.join(self._include_dir, "RenderSystems", comp.replace("RenderSystem_", "")) - elif comp.startswith("Codec_"): - includedir = os.path.join(self._include_dir, "Plugins", f"{comp.replace('Codec_', '')}Codec") - else: - includedir = os.path.join(self._include_dir, "Plugins", comp.replace("Plugin_", "")) + def _add_plugin_component(comp, *, requires=None, extra_includedirs=None): + if extra_includedirs is None: + if comp.startswith("RenderSystem_"): + includedir = os.path.join(self._include_dir, "RenderSystems", comp.replace("RenderSystem_", "")) + elif comp.startswith("Codec_"): + includedir = os.path.join(self._include_dir, "Plugins", f"{comp.replace('Codec_', '')}Codec") + else: + includedir = os.path.join(self._include_dir, "Plugins", comp.replace("Plugin_", "")) + extra_includedirs = [includedir] _add_component( comp, libs=[self._plugin_libname(comp)], libdirs=[self._plugins_dir], - extra_includedirs=[includedir], + extra_includedirs=extra_includedirs, requires=requires, ) if self.options.get_safe("bites_static_plugins", not self.options.shared): @@ -625,12 +627,16 @@ def _add_plugin_component(comp, *, requires=None): opengl_reqs.append("egl::egl") if self._build_opengl: if not self.options.shared: - _add_core_component("GLSupport", requires=opengl_reqs) + _add_core_component("GLSupport", requires=opengl_reqs, extra_includedirs=[]) else: self.cpp_info.components["OgreMain"].requires.extend(opengl_reqs) if self.options.build_plugin_assimp: - _add_plugin_component("Codec_Assimp", requires=["assimp::assimp"]) + _add_plugin_component( + "Codec_Assimp", + requires=["assimp::assimp"], + extra_includedirs=[os.path.join(self._include_dir, "Plugins", "Assimp")], + ) if self.options.build_plugin_bsp: _add_plugin_component("Plugin_BSPSceneManager") if self.options.build_plugin_dot_scene: @@ -640,9 +646,11 @@ def _add_plugin_component(comp, *, requires=None): if self.options.build_plugin_freeimage: _add_plugin_component("Codec_FreeImage", requires=["freeimage::freeimage"]) if self.options.build_plugin_glslang: - _add_plugin_component("Plugin_GLSLangProgramManager", requires=[ - "glslang::glslang", "spirv-tools::spirv-tools-core", "spirv-tools::spirv-tools-opt" - ]) + _add_plugin_component( + "Plugin_GLSLangProgramManager", + requires=["glslang::glslang", "spirv-tools::spirv-tools-core", "spirv-tools::spirv-tools-opt"], + extra_includedirs=[os.path.join(self._include_dir, "Plugins", "GLSLang")] + ) if self.options.build_plugin_octree: _add_plugin_component("Plugin_OctreeSceneManager") if self.options.build_plugin_pcz: From 41e0be5efea9328d6ee745cd25e664a5a1fe3570 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Tue, 24 Sep 2024 14:28:52 +0300 Subject: [PATCH 26/29] ogre: set cmake_target_name for glslang components --- recipes/ogre/1.x/conanfile.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 8025202847cd0..e5e2a30bab0a7 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -439,6 +439,15 @@ def generate(self): deps.set_property("openexr", "cmake_file_name", "OpenEXR") deps.set_property("freeimage", "cmake_file_name", "FreeImage") deps.set_property("freetype", "cmake_file_name", "Freetype") + # Ogre uses glslang libraries without a namespace prefix + deps.set_property("glslang::glslang", "cmake_target_name", "glslang::glslang") + deps.set_property("glslang::genericcodegen", "cmake_target_name", "GenericCodeGen") + deps.set_property("glslang::hlsl", "cmake_target_name", "HLSL") + deps.set_property("glslang::machineindependent", "cmake_target_name", "MachineIndependent") + deps.set_property("glslang::oglcompiler", "cmake_target_name", "OGLCompiler") + deps.set_property("glslang::osdependent", "cmake_target_name", "OSDependent") + deps.set_property("glslang::spirv", "cmake_target_name", "SPIRV") + deps.set_property("glslang::spvremapper", "cmake_target_name", "SPVRemapper") deps.generate() deps = PkgConfigDeps(self) From 98dcaa06359c481629493b1f929886a21fc58437 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 12 Oct 2024 10:19:16 +0300 Subject: [PATCH 27/29] ogre: bump deps --- recipes/ogre/1.x/conanfile.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index e5e2a30bab0a7..a5aaf497a287a 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -260,7 +260,7 @@ def requirements(self): self.requires("zlib/[>=1.2.11 <2]") self.requires("zziplib/0.13.72") if self.options.get_safe("build_component_bites") or self.options.get_safe("build_rendersystem_tiny"): - self.requires("sdl/2.30.7") + self.requires("sdl/2.30.8") if self.options.get_safe("build_rendersystem_tiny") and self.options.with_openmp: self.requires("openmp/system") if self._build_opengl: @@ -276,10 +276,10 @@ def requirements(self): if self.options.build_component_bullet: self.requires("bullet3/3.25") if self.options.build_component_overlay: - self.requires("freetype/2.13.2") + self.requires("freetype/2.13.3") if self.options.build_component_overlay_imgui: # Used in Overlay/OgreImGuiOverlay.h public header - self.requires("imgui/1.91.2", transitive_headers=True, transitive_libs=True) + self.requires("imgui/1.91.3", transitive_headers=True, transitive_libs=True) if self.options.build_plugin_assimp: self.requires("assimp/5.4.2") if self.options.build_plugin_exrcodec: From ac8d25468a89016fced2da3f1e4586e53791face Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 12 Oct 2024 10:23:02 +0300 Subject: [PATCH 28/29] ogre: DirectX 9 is not available on C3I --- recipes/ogre/1.x/conanfile.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index a5aaf497a287a..f2452afe2e9c5 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -83,7 +83,7 @@ class OgreConanFile(ConanFile): "shared": False, "fPIC": True, "resourcemanager_strict": "STRICT", - "build_rendersystem_d3d9": True, + "build_rendersystem_d3d9": False, "build_rendersystem_d3d11": True, "build_rendersystem_gl3plus": True, "build_rendersystem_gl": True, @@ -475,6 +475,14 @@ def _patch_sources(self): "if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)", "if(0)") replace_in_file(self, os.path.join(self.source_folder, "Components", "Overlay", "CMakeLists.txt"), "list(REMOVE_ITEM SOURCE_FILES", "# list(REMOVE_ITEM SOURCE_FILES") + # Require DirectX if enabled + if self.options.get_safe("build_rendersystem_d3d9"): + replace_in_file(self, os.path.join(self.source_folder, "CMake", "Dependencies.cmake"), + "find_package(DirectX)", "find_package(DirectX REQUIRED)") + if self.options.get_safe("build_rendersystem_d3d11"): + replace_in_file(self, os.path.join(self.source_folder, "CMake", "Dependencies.cmake"), + "find_package(DirectX11)", "find_package(DirectX11 REQUIRED)") + def build(self): self._patch_sources() From 15ec300387f284a9d423e91a89cbcde1c571ad41 Mon Sep 17 00:00:00 2001 From: Martin Valgur Date: Sat, 12 Oct 2024 10:23:53 +0300 Subject: [PATCH 29/29] ogre: make xorg components more specific --- recipes/ogre/1.x/conanfile.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index f2452afe2e9c5..5719a10b6c351 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -605,21 +605,14 @@ def _add_plugin_component(comp, *, requires=None, extra_includedirs=None): ) if self.settings.os in ["Linux", "FreeBSD"]: if self.options.use_wayland: - self.cpp_info.components["OgreMain"].requires.extend([ - "wayland::wayland-client", - "wayland::wayland-egl", - ]) + self.cpp_info.components["OgreMain"].requires.extend(["wayland::wayland-client", "wayland::wayland-egl"]) else: - self.cpp_info.components["OgreMain"].requires.extend([ - "xorg::x11", - "xorg::xaw7", - "xorg::xext", - "xorg::xrandr", - "xorg::xt", - ]) + self.cpp_info.components["OgreMain"].requires.extend(["xorg::x11", "xorg::xrandr"]) if self.options.get_safe("build_component_bites"): _add_core_component("Bites", requires=["Overlay", "sdl::sdl"]) + if self.settings.os in ["Linux", "FreeBSD"] and not self.options.use_wayland: + self.cpp_info.components["Bites"].requires.extend(["xorg::xaw7", "xorg::xt"]) if self.options.get_safe("build_component_bullet"): _add_core_component("Bullet", requires=["bullet3::bullet3"]) if self.options.build_component_meshlodgenerator: