diff --git a/recipes/ogre/1.x/CMakeLists.txt b/recipes/ogre/1.x/CMakeLists.txt index 4c95ca5e84716a..ba37ee873931c8 100644 --- a/recipes/ogre/1.x/CMakeLists.txt +++ b/recipes/ogre/1.x/CMakeLists.txt @@ -1,7 +1,33 @@ -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) +# 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) -add_subdirectory(source_subfolder) +find_package(pugixml REQUIRED CONFIG) +find_package(FreeImage QUIET CONFIG) +find_package(OPENEXR QUIET CONFIG) +find_package(FREETYPE QUIET CONFIG) +find_package(assimp QUIET CONFIG) + +add_library(pugixml ALIAS pugixml::pugixml) + +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 2943bef50eb127..e7a6182072139c 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" + "1.12.13": + url: "https://github.com/OGRECave/ogre/archive/refs/tags/v1.12.13.tar.gz" + sha256: "b01ec30e7866b3140fc487eb828d92968d6aadc86254ad761a6bcac0f8b8a27f" diff --git a/recipes/ogre/1.x/conanfile.py b/recipes/ogre/1.x/conanfile.py index 3a275358024c43..a945cfd4ce690e 100644 --- a/recipes/ogre/1.x/conanfile.py +++ b/recipes/ogre/1.x/conanfile.py @@ -1,368 +1,632 @@ 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_hlms": [True, False], + "build_component_bites": [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_hlms": False, + "build_component_bites": 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_hlms": "Build HLMS component", + "build_component_bites": "Build OgreBites 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.13") + self.requires("sdl/2.28.3") + self.requires("zlib/[>=1.2.11 <2]") + self.requires("zziplib/0.13.72") + if self._build_opengl: + self.requires("libglvnd/1.7.0", 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_overlay: + self.requires("freetype/2.13.0") + if self.options.build_component_overlay_imgui: + self.requires("imgui/1.89.9") + if self.options.build_plugin_assimp: + self.requires("assimp/5.2.2") + 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 @property - def _required_boost_components(self): - return ["date_time", "thread"] + def _build_opengl(self): + # https://github.com/OGRECave/ogre/blob/v1.12.13/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/v1.12.13/CMake/ConfigureBuild.cmake#L21-L26 + 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.0.3") 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/v1.12.13/CMakeLists.txt#L292-L433 + tc.cache_variables["OGRE_STATIC"] = not self.options.shared + tc.cache_variables["OGRE_RESOURCEMANAGER_STRICT"] = 2 if self.options.resourcemanager_strict == "STRICT" else 1 + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_D3D9"] = self.options.get_safe("build_rendersystem_d3d9", False) + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_D3D11"] = self.options.get_safe("build_rendersystem_d3d11", False) + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_GL3PLUS"] = self.options.get_safe("build_rendersystem_gl3plus", False) + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_GL"] = self.options.get_safe("build_rendersystem_gl", False) + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_GLES2"] = self.options.get_safe("build_rendersystem_gles2", False) + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_METAL"] = self.options.get_safe("build_rendersystem_metal", False) + tc.cache_variables["OGRE_BUILD_RENDERSYSTEM_TINY"] = self.options.get_safe("build_rendersystem_tiny", False) + tc.cache_variables["OGRE_BUILD_COMPONENT_PAGING"] = self.options.build_component_paging + tc.cache_variables["OGRE_BUILD_COMPONENT_MESHLODGENERATOR"] = self.options.build_component_meshlodgenerator + tc.cache_variables["OGRE_BUILD_COMPONENT_TERRAIN"] = self.options.build_component_terrain + tc.cache_variables["OGRE_BUILD_COMPONENT_VOLUME"] = self.options.build_component_volume + tc.cache_variables["OGRE_BUILD_COMPONENT_PROPERTY"] = self.options.build_component_property + tc.cache_variables["OGRE_BUILD_COMPONENT_OVERLAY"] = self.options.build_component_overlay + tc.cache_variables["OGRE_BUILD_COMPONENT_OVERLAY_IMGUI"] = self.options.get_safe("build_component_overlay_imgui", False) + tc.cache_variables["OGRE_BUILD_COMPONENT_HLMS"] = self.options.build_component_hlms + tc.cache_variables["OGRE_BUILD_COMPONENT_BITES"] = self.options.get_safe("build_component_bites", False) + tc.cache_variables["OGRE_BITES_STATIC_PLUGINS"] = self.options.get_safe("bites_static_plugins", False) + tc.cache_variables["OGRE_BUILD_COMPONENT_PYTHON"] = self.options.build_component_python + tc.cache_variables["OGRE_BUILD_COMPONENT_JAVA"] = self.options.build_component_java + tc.cache_variables["OGRE_BUILD_COMPONENT_CSHARP"] = self.options.build_component_csharp + tc.cache_variables["OGRE_BUILD_COMPONENT_RTSHADERSYSTEM"] = self.options.build_component_rtshadersystem + tc.cache_variables["OGRE_BUILD_RTSHADERSYSTEM_SHADERS"] = self.options.get_safe("build_rtshadersystem_shaders", False) + tc.cache_variables["OGRE_BUILD_SAMPLES"] = self.options.get_safe("build_samples", False) + tc.cache_variables["OGRE_BUILD_TOOLS"] = self.options.get_safe("build_tools", False) + tc.cache_variables["OGRE_BUILD_XSIEXPORTER"] = self.options.get_safe("build_xsiexporter", False) + tc.cache_variables["OGRE_BUILD_LIBS_AS_FRAMEWORKS"] = False # TODO: requires additional package_info() logic + tc.cache_variables["OGRE_BUILD_TESTS"] = False + tc.cache_variables["OGRE_BUILD_PLUGIN_ASSIMP"] = self.options.build_plugin_assimp + tc.cache_variables["OGRE_BUILD_PLUGIN_BSP"] = self.options.build_plugin_bsp + tc.cache_variables["OGRE_BUILD_PLUGIN_OCTREE"] = self.options.build_plugin_octree + tc.cache_variables["OGRE_BUILD_PLUGIN_PFX"] = self.options.build_plugin_pfx + tc.cache_variables["OGRE_BUILD_PLUGIN_DOT_SCENE"] = self.options.build_plugin_dot_scene + tc.cache_variables["OGRE_BUILD_PLUGIN_PCZ"] = self.options.build_plugin_pcz + tc.cache_variables["OGRE_BUILD_PLUGIN_CG"] = self.options.get_safe("build_plugin_cg", False) + tc.cache_variables["OGRE_BUILD_PLUGIN_EXRCODEC"] = self.options.build_plugin_exrcodec + tc.cache_variables["OGRE_BUILD_PLUGIN_STBI"] = self.options.build_plugin_stbi + tc.cache_variables["OGRE_CONFIG_DOUBLE"] = self.options.config_double + tc.cache_variables["OGRE_CONFIG_NODE_INHERIT_TRANSFORM"] = self.options.config_node_inherit_transform + tc.cache_variables["OGRE_CONFIG_THREADS"] = "3" if self.options.config_threads else "0" + tc.cache_variables["OGRE_CONFIG_ENABLE_MESHLOD"] = self.options.config_enable_meshlod + tc.cache_variables["OGRE_CONFIG_ENABLE_DDS"] = self.options.config_enable_dds + tc.cache_variables["OGRE_CONFIG_ENABLE_PVRTC"] = self.options.config_enable_pvrtc + tc.cache_variables["OGRE_CONFIG_ENABLE_ETC"] = self.options.config_enable_etc + tc.cache_variables["OGRE_CONFIG_ENABLE_ASTC"] = self.options.config_enable_astc + tc.cache_variables["OGRE_CONFIG_ENABLE_QUAD_BUFFER_STEREO"] = self.options.get_safe("config_enable_quad_buffer_stereo", False) + tc.cache_variables["OGRE_CONFIG_ENABLE_ZIP"] = True + tc.cache_variables["OGRE_CONFIG_ENABLE_VIEWPORT_ORIENTATIONMODE"] = self.options.config_enable_viewport_orientationmode + tc.cache_variables["OGRE_CONFIG_ENABLE_GLES2_CG_SUPPORT"] = self.options.get_safe("config_enable_gles2_cg_support", False) + tc.cache_variables["OGRE_CONFIG_ENABLE_GLES2_GLSL_OPTIMISER"] = self.options.get_safe("config_enable_gles2_glsl_optimiser", False) + tc.cache_variables["OGRE_CONFIG_ENABLE_GL_STATE_CACHE_SUPPORT"] = self.options.get_safe("config_enable_gl_state_cache_support", False) + tc.cache_variables["OGRE_CONFIG_FILESYSTEM_UNICODE"] = self.options.get_safe("config_filesystem_unicode", False) + tc.cache_variables["OGRE_CONFIG_STATIC_LINK_CRT"] = is_msvc_static_runtime(self) + tc.cache_variables["OGRE_INSTALL_CMAKE"] = False + tc.cache_variables["OGRE_INSTALL_SAMPLES"] = self.options.get_safe("build_samples", False) + tc.cache_variables["OGRE_INSTALL_TOOLS"] = self.options.get_safe("build_tools", False) + tc.cache_variables["OGRE_INSTALL_DOCS"] = self.options.get_safe("install_docs", False) + tc.cache_variables["OGRE_INSTALL_SAMPLES_SOURCE"] = False + tc.cache_variables["OGRE_INSTALL_PDB"] = self.options.get_safe("install_pdb", False) + tc.cache_variables["OGRE_PROFILING"] = self.options.profiling + tc.cache_variables["OGRE_LIB_DIRECTORY"] = "lib" + tc.cache_variables["OGRE_BIN_DIRECTORY"] = "bin" + tc.cache_variables["OGRE_INSTALL_VSPROPS"] = self.options.get_safe("install_vsprops", False) + # https://github.com/OGRECave/ogre/blob/v1.12.13/CMake/ConfigureBuild.cmake#L77 + tc.cache_variables["OGRE_ASSERT_MODE"] = self.options.assert_mode + tc.cache_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") + + include(CMakeFindDependencyMacro) + """) + # Some hacky dependency resolution for packages that are not available from Conan + for pkg in self._ogre_cmake_packages: + content += textwrap.dedent(f"""\ + find_dependency({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")) + 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=self._module_file_rel_path) @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/v1.12.13/CMake/ConfigureBuild.cmake#L151-L156 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 - - - return components + lib += "Static" + if self.settings.os == "Windows" and self.settings.build_type == "Debug": + lib += "_d" + return lib 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]) - for comp, values in self._components.items(): + 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_path) + 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].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, + libs=[comp] + (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] + (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.build_component_hlms: + _add_core_component("HLMS") + 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: + _add_core_component("GLSupport", requires=["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 7b8bebad0458f3..00000000000000 --- 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 b3d9f056daa168..99cc4096ddf055 100644 --- a/recipes/ogre/1.x/test_package/CMakeLists.txt +++ b/recipes/ogre/1.x/test_package/CMakeLists.txt @@ -1,14 +1,10 @@ -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 diff --git a/recipes/ogre/1.x/test_package/conanfile.py b/recipes/ogre/1.x/test_package/conanfile.py index f194e07229412f..60330d1ebf45e4 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 98f931899daa69..42a9577043ff6e 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.resetDimensions(); - 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 00000000000000..91630d79f4abb3 --- /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 00000000000000..436bf8d2136d5b --- /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 86746ed84e0e78..e6ea8a6ff3e5db 100644 --- a/recipes/ogre/config.yml +++ b/recipes/ogre/config.yml @@ -1,3 +1,3 @@ versions: - "1.10.2": + "1.12.13": folder: 1.x