From c45516ad8ef51bc58f639a955af8a48213089e1b Mon Sep 17 00:00:00 2001 From: Edgar Date: Wed, 9 Nov 2022 09:56:09 +0100 Subject: [PATCH] :tada: Added OGRE 2.3 --- ogre/2.3/conandata.yml | 7 + ogre/2.3/conanfile.py | 122 ++++++++++++++++++ .../patches/2.3.1/FindPkgMacros.cmake.patch | 11 ++ ogre/2.3/patches/2.3.1/RapidJSON-fix.patch | 11 ++ 4 files changed, 151 insertions(+) create mode 100644 ogre/2.3/conandata.yml create mode 100644 ogre/2.3/conanfile.py create mode 100644 ogre/2.3/patches/2.3.1/FindPkgMacros.cmake.patch create mode 100644 ogre/2.3/patches/2.3.1/RapidJSON-fix.patch diff --git a/ogre/2.3/conandata.yml b/ogre/2.3/conandata.yml new file mode 100644 index 0000000..d50d073 --- /dev/null +++ b/ogre/2.3/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.3.1": + url: "https://github.com/OGRECave/ogre-next/archive/refs/tags/v2.3.1.tar.gz" + sha256: "38dd0d5ba5759ee47c71552c5dacf44dad5fe61868025dcbd5ea6a6bdb6bc8e4" +patches: + "2.3.1": + - patch_file: "patches/2.3.1/RapidJSON-fix.patch" \ No newline at end of file diff --git a/ogre/2.3/conanfile.py b/ogre/2.3/conanfile.py new file mode 100644 index 0000000..3b18ba4 --- /dev/null +++ b/ogre/2.3/conanfile.py @@ -0,0 +1,122 @@ +from conan import ConanFile +from conan.tools.files import get, collect_libs, rmdir, replace_in_file, apply_conandata_patches, export_conandata_patches +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.system.package_manager import Apt +import os + +class OGRENextConan(ConanFile): + name = "ogre3d-next" + license = "MIT" + url = "https://github.com/AnotherFoxGuy/conan-OGRE" + description = "scene-oriented, flexible 3D engine written in C++" + settings = "os", "compiler", "build_type", "arch" + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires("zlib/[1.x]") + self.requires("zziplib/[0.13.x]") + self.requires("freetype/[2.x]") + self.requires("freeimage/[3.x]") + self.requires("rapidjson/cci.20220822") + self.requires("libpng/1.6.38") + self.requires("sdl/[2.x]") + self.requires("tinyxml/[2.x]") + + def system_requirements(self): + Apt(self).install([ + "libx11-dev", + "libxaw7-dev", + "libxrandr-dev", + "libgles2-mesa-dev", + "libvulkan-dev", + "glslang-dev" + ], check=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OGRE_BUILD_COMPONENT_BITES"] = "ON" + tc.variables["OGRE_BUILD_COMPONENT_CSHARP"] = "OFF" + tc.variables["OGRE_BUILD_COMPONENT_JAVA"] = "OFF" + tc.variables["OGRE_BUILD_COMPONENT_OVERLAY_IMGUI"] = "ON" + tc.variables["OGRE_BUILD_COMPONENT_PYTHON"] = "OFF" + tc.variables["OGRE_BUILD_COMPONENT_TERRAIN"] = "OFF"# This is borked + tc.variables["OGRE_BUILD_DEPENDENCIES"] = "OFF" + tc.variables["OGRE_BUILD_PLUGIN_DOT_SCENE"] = "OFF" + tc.variables["OGRE_BUILD_PLUGIN_EXRCODEC"] = "OFF" + tc.variables["OGRE_BUILD_RENDERSYSTEM_D3D11"] = "ON" + tc.variables["OGRE_BUILD_RENDERSYSTEM_GL3PLUS"] = "OFF" + tc.variables["OGRE_BUILD_SAMPLES"] = "OFF" + tc.variables["OGRE_BUILD_SAMPLES2"] = "OFF" + tc.variables["OGRE_CONFIG_ENABLE_JSON"] = "ON" + tc.variables["OGRE_COPY_DEPENDENCIES"] = "OFF" + tc.variables["OGRE_INSTALL_DEPENDENCIES"] = "OFF" + tc.variables["OGRE_INSTALL_SAMPLES"] = "OFF" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, + os.path.join(self.source_folder, "CMake/Dependencies.cmake"), + "find_package(Rapidjson)", + """ + find_package(RapidJSON) + set(Rapidjson_FOUND TRUE) + add_library(RapidJSON::RapidJSON ALIAS rapidjson) + """, + ) + replace_in_file(self, + os.path.join(self.source_folder, "Components/Overlay/CMakeLists.txt"), + "${FREETYPE_LIBRARIES}", + "freetype", + ) + replace_in_file(self, + os.path.join(self.source_folder, "CMake/InstallDependencies.cmake"), + "# Install dependencies", + "return()", + ) + + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "Docs")) + + def package_info(self): + self.cpp_info.set_property("cmake_module_file_name", "OGRE") + self.cpp_info.set_property("cmake_module_target_name", "OGRE::OGRE") + self.cpp_info.set_property("cmake_file_name", "OGRE") + self.cpp_info.set_property("cmake_target_name", "OGRE::OGRE") + self.cpp_info.includedirs = [ + "include", + "include/OGRE", + "include/OGRE/Bites", + "include/OGRE/HLMS", + "include/OGRE/MeshLodGenerator", + "include/OGRE/Overlay", + "include/OGRE/Paging", + "include/OGRE/Plugins", + "include/OGRE/Property", + "include/OGRE/RenderSystems", + "include/OGRE/RTShaderSystem", + "include/OGRE/Terrain", + "include/OGRE/Threading", + "include/OGRE/Volume", + ] + self.cpp_info.libs = collect_libs(self) diff --git a/ogre/2.3/patches/2.3.1/FindPkgMacros.cmake.patch b/ogre/2.3/patches/2.3.1/FindPkgMacros.cmake.patch new file mode 100644 index 0000000..6d62fc4 --- /dev/null +++ b/ogre/2.3/patches/2.3.1/FindPkgMacros.cmake.patch @@ -0,0 +1,11 @@ +--- CMake/Utils/FindPkgMacros.cmake ++++ CMake/Utils/FindPkgMacros.cmake +@@ -82,7 +82,7 @@ + if (${PREFIX}_FWK) + set(${PREFIX} ${${PREFIX}_FWK}) + elseif (${PREFIX}_REL AND ${PREFIX}_DBG) +- set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG}) ++ set(${PREFIX} "$<$:${${PREFIX}_DBG}>$<$>:${${PREFIX}_REL}>") + elseif (${PREFIX}_REL) + set(${PREFIX} ${${PREFIX}_REL}) + elseif (${PREFIX}_DBG) diff --git a/ogre/2.3/patches/2.3.1/RapidJSON-fix.patch b/ogre/2.3/patches/2.3.1/RapidJSON-fix.patch new file mode 100644 index 0000000..eb42f4a --- /dev/null +++ b/ogre/2.3/patches/2.3.1/RapidJSON-fix.patch @@ -0,0 +1,11 @@ +--- OgreMain/CMakeLists.txt ++++ OgreMain/CMakeLists.txt +@@ -475,7 +475,7 @@ + set_target_properties(OgreMain PROPERTIES OUTPUT_NAME Ogre) + endif () + endif () +-target_link_libraries(OgreMain ${LIBRARIES}) ++target_link_libraries(OgreMain ${LIBRARIES} RapidJSON::RapidJSON freeimage::FreeImage) + if (MINGW) + # may need winsock htons functions for FreeImage + target_link_libraries(OgreMain ws2_32)