🎉 Added OGRE 2.3

This commit is contained in:
Edgar 2022-11-09 09:56:09 +01:00
parent 06c8dbc79b
commit c45516ad8e
No known key found for this signature in database
GPG Key ID: 9AA5DDFFCBDCE46A
4 changed files with 151 additions and 0 deletions

7
ogre/2.3/conandata.yml Normal file
View File

@ -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"

122
ogre/2.3/conanfile.py Normal file
View File

@ -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)

View File

@ -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} "$<$<CONFIG:Debug>:${${PREFIX}_DBG}>$<$<NOT:$<CONFIG:Debug>>:${${PREFIX}_REL}>")
elseif (${PREFIX}_REL)
set(${PREFIX} ${${PREFIX}_REL})
elseif (${PREFIX}_DBG)

View File

@ -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)