From 92a0e0704a76c68c78d782a1823e3fb858f1501d Mon Sep 17 00:00:00 2001 From: Edgar Date: Sat, 14 Aug 2021 17:18:14 +0000 Subject: [PATCH] :tada: Added OGRE 13.0.0 --- ogre/13/Findpugixml.cmake | 173 ++++++++++++++++++ ogre/13/conandata.yml | 16 ++ ogre/13/conanfile.py | 72 ++++++++ ogre/13/patches/13.0.0/AddLibPNG.patch | 33 ++++ ogre/13/patches/13.0.0/CMakeLists.txt.patch | 19 ++ .../patches/13.0.0/Dependencies.cmake.patch | 20 ++ ogre/13/patches/13.0.0/pugixml-fix.patch | 15 ++ ogre/config.yml | 4 +- 8 files changed, 351 insertions(+), 1 deletion(-) create mode 100644 ogre/13/Findpugixml.cmake create mode 100644 ogre/13/conandata.yml create mode 100644 ogre/13/conanfile.py create mode 100644 ogre/13/patches/13.0.0/AddLibPNG.patch create mode 100644 ogre/13/patches/13.0.0/CMakeLists.txt.patch create mode 100644 ogre/13/patches/13.0.0/Dependencies.cmake.patch create mode 100644 ogre/13/patches/13.0.0/pugixml-fix.patch diff --git a/ogre/13/Findpugixml.cmake b/ogre/13/Findpugixml.cmake new file mode 100644 index 0000000..8fa3549 --- /dev/null +++ b/ogre/13/Findpugixml.cmake @@ -0,0 +1,173 @@ + + +function(conan_message MESSAGE_OUTPUT) + if(NOT CONAN_CMAKE_SILENT_OUTPUT) + message(${ARGV${0}}) + endif() +endfunction() + + +macro(conan_find_apple_frameworks FRAMEWORKS_FOUND FRAMEWORKS FRAMEWORKS_DIRS) + if(APPLE) + foreach(_FRAMEWORK ${FRAMEWORKS}) + # https://cmake.org/pipermail/cmake-developers/2017-August/030199.html + find_library(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND NAME ${_FRAMEWORK} PATHS ${FRAMEWORKS_DIRS} CMAKE_FIND_ROOT_PATH_BOTH) + if(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND) + list(APPEND ${FRAMEWORKS_FOUND} ${CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND}) + else() + message(FATAL_ERROR "Framework library ${_FRAMEWORK} not found in paths: ${FRAMEWORKS_DIRS}") + endif() + endforeach() + endif() +endmacro() + + +function(conan_package_library_targets libraries package_libdir deps out_libraries out_libraries_target build_type package_name) + unset(_CONAN_ACTUAL_TARGETS CACHE) + unset(_CONAN_FOUND_SYSTEM_LIBS CACHE) + foreach(_LIBRARY_NAME ${libraries}) + find_library(CONAN_FOUND_LIBRARY NAME ${_LIBRARY_NAME} PATHS ${package_libdir} + NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) + if(CONAN_FOUND_LIBRARY) + conan_message(STATUS "Library ${_LIBRARY_NAME} found ${CONAN_FOUND_LIBRARY}") + list(APPEND _out_libraries ${CONAN_FOUND_LIBRARY}) + if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0") + # Create a micro-target for each lib/a found + string(REGEX REPLACE "[^A-Za-z0-9.+_-]" "_" _LIBRARY_NAME ${_LIBRARY_NAME}) + set(_LIB_NAME CONAN_LIB::${package_name}_${_LIBRARY_NAME}${build_type}) + if(NOT TARGET ${_LIB_NAME}) + # Create a micro-target for each lib/a found + add_library(${_LIB_NAME} UNKNOWN IMPORTED) + set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION ${CONAN_FOUND_LIBRARY}) + set(_CONAN_ACTUAL_TARGETS ${_CONAN_ACTUAL_TARGETS} ${_LIB_NAME}) + else() + conan_message(STATUS "Skipping already existing target: ${_LIB_NAME}") + endif() + list(APPEND _out_libraries_target ${_LIB_NAME}) + endif() + conan_message(STATUS "Found: ${CONAN_FOUND_LIBRARY}") + else() + conan_message(STATUS "Library ${_LIBRARY_NAME} not found in package, might be system one") + list(APPEND _out_libraries_target ${_LIBRARY_NAME}) + list(APPEND _out_libraries ${_LIBRARY_NAME}) + set(_CONAN_FOUND_SYSTEM_LIBS "${_CONAN_FOUND_SYSTEM_LIBS};${_LIBRARY_NAME}") + endif() + unset(CONAN_FOUND_LIBRARY CACHE) + endforeach() + + if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0") + # Add all dependencies to all targets + string(REPLACE " " ";" deps_list "${deps}") + foreach(_CONAN_ACTUAL_TARGET ${_CONAN_ACTUAL_TARGETS}) + set_property(TARGET ${_CONAN_ACTUAL_TARGET} PROPERTY INTERFACE_LINK_LIBRARIES "${_CONAN_FOUND_SYSTEM_LIBS};${deps_list}") + endforeach() + endif() + + set(${out_libraries} ${_out_libraries} PARENT_SCOPE) + set(${out_libraries_target} ${_out_libraries_target} PARENT_SCOPE) +endfunction() + + +include(FindPackageHandleStandardArgs) + +conan_message(STATUS "Conan: Using autogenerated Findpugixml.cmake") +# Global approach +set(pugixml_FOUND 1) +set(pugixml_VERSION "1.11") + +find_package_handle_standard_args(pugixml REQUIRED_VARS + pugixml_VERSION VERSION_VAR pugixml_VERSION) +mark_as_advanced(pugixml_FOUND pugixml_VERSION) + + +set(pugixml_INCLUDE_DIRS "/home/codespace/.conan/data/pugixml/1.11/_/_/package/b911f48570f9bb2902d9e83b2b9ebf9d376c8c56/include") +set(pugixml_INCLUDE_DIR "/home/codespace/.conan/data/pugixml/1.11/_/_/package/b911f48570f9bb2902d9e83b2b9ebf9d376c8c56/include") +set(pugixml_INCLUDES "/home/codespace/.conan/data/pugixml/1.11/_/_/package/b911f48570f9bb2902d9e83b2b9ebf9d376c8c56/include") +set(pugixml_RES_DIRS ) +set(pugixml_DEFINITIONS ) +set(pugixml_LINKER_FLAGS_LIST + "$<$,SHARED_LIBRARY>:>" + "$<$,MODULE_LIBRARY>:>" + "$<$,EXECUTABLE>:>" +) +set(pugixml_COMPILE_DEFINITIONS ) +set(pugixml_COMPILE_OPTIONS_LIST "" "") +set(pugixml_COMPILE_OPTIONS_C "") +set(pugixml_COMPILE_OPTIONS_CXX "") +set(pugixml_LIBRARIES_TARGETS "") # Will be filled later, if CMake 3 +set(pugixml_LIBRARIES "") # Will be filled later +set(pugixml_LIBS "") # Same as pugixml_LIBRARIES +set(pugixml_SYSTEM_LIBS ) +set(pugixml_FRAMEWORK_DIRS ) +set(pugixml_FRAMEWORKS ) +set(pugixml_FRAMEWORKS_FOUND "") # Will be filled later +set(pugixml_BUILD_MODULES_PATHS ) + +conan_find_apple_frameworks(pugixml_FRAMEWORKS_FOUND "${pugixml_FRAMEWORKS}" "${pugixml_FRAMEWORK_DIRS}") + +mark_as_advanced(pugixml_INCLUDE_DIRS + pugixml_INCLUDE_DIR + pugixml_INCLUDES + pugixml_DEFINITIONS + pugixml_LINKER_FLAGS_LIST + pugixml_COMPILE_DEFINITIONS + pugixml_COMPILE_OPTIONS_LIST + pugixml_LIBRARIES + pugixml_LIBS + pugixml_LIBRARIES_TARGETS) + +# Find the real .lib/.a and add them to pugixml_LIBS and pugixml_LIBRARY_LIST +set(pugixml_LIBRARY_LIST pugixml) +set(pugixml_LIB_DIRS "/home/codespace/.conan/data/pugixml/1.11/_/_/package/b911f48570f9bb2902d9e83b2b9ebf9d376c8c56/lib") + +# Gather all the libraries that should be linked to the targets (do not touch existing variables): +set(_pugixml_DEPENDENCIES "${pugixml_FRAMEWORKS_FOUND} ${pugixml_SYSTEM_LIBS} ") + +conan_package_library_targets("${pugixml_LIBRARY_LIST}" # libraries + "${pugixml_LIB_DIRS}" # package_libdir + "${_pugixml_DEPENDENCIES}" # deps + pugixml_LIBRARIES # out_libraries + pugixml_LIBRARIES_TARGETS # out_libraries_targets + "" # build_type + "pugixml") # package_name + +set(pugixml_LIBS ${pugixml_LIBRARIES}) + +foreach(_FRAMEWORK ${pugixml_FRAMEWORKS_FOUND}) + list(APPEND pugixml_LIBRARIES_TARGETS ${_FRAMEWORK}) + list(APPEND pugixml_LIBRARIES ${_FRAMEWORK}) +endforeach() + +foreach(_SYSTEM_LIB ${pugixml_SYSTEM_LIBS}) + list(APPEND pugixml_LIBRARIES_TARGETS ${_SYSTEM_LIB}) + list(APPEND pugixml_LIBRARIES ${_SYSTEM_LIB}) +endforeach() + +# We need to add our requirements too +set(pugixml_LIBRARIES_TARGETS "${pugixml_LIBRARIES_TARGETS};") +set(pugixml_LIBRARIES "${pugixml_LIBRARIES};") + +set(CMAKE_MODULE_PATH "/home/codespace/.conan/data/pugixml/1.11/_/_/package/b911f48570f9bb2902d9e83b2b9ebf9d376c8c56/" ${CMAKE_MODULE_PATH}) +set(CMAKE_PREFIX_PATH "/home/codespace/.conan/data/pugixml/1.11/_/_/package/b911f48570f9bb2902d9e83b2b9ebf9d376c8c56/" ${CMAKE_PREFIX_PATH}) + +if(NOT ${CMAKE_VERSION} VERSION_LESS "3.0") + # Target approach + if(NOT TARGET pugixml::pugixml) + add_library(pugixml::pugixml INTERFACE IMPORTED) + if(pugixml_INCLUDE_DIRS) + set_target_properties(pugixml::pugixml PROPERTIES INTERFACE_INCLUDE_DIRECTORIES + "${pugixml_INCLUDE_DIRS}") + endif() + set_property(TARGET pugixml::pugixml PROPERTY INTERFACE_LINK_LIBRARIES + "${pugixml_LIBRARIES_TARGETS};${pugixml_LINKER_FLAGS_LIST}") + set_property(TARGET pugixml::pugixml PROPERTY INTERFACE_COMPILE_DEFINITIONS + ${pugixml_COMPILE_DEFINITIONS}) + set_property(TARGET pugixml::pugixml PROPERTY INTERFACE_COMPILE_OPTIONS + "${pugixml_COMPILE_OPTIONS_LIST}") + + endif() +endif() + +foreach(_BUILD_MODULE_PATH ${pugixml_BUILD_MODULES_PATHS}) + include(${_BUILD_MODULE_PATH}) +endforeach() diff --git a/ogre/13/conandata.yml b/ogre/13/conandata.yml new file mode 100644 index 0000000..b9d5516 --- /dev/null +++ b/ogre/13/conandata.yml @@ -0,0 +1,16 @@ +sources: + "13.0.0": + url: "https://github.com/OGRECave/ogre/archive/refs/tags/v13.0.0.tar.gz" + sha256: "404c91b0ab27edb45a643bc268143589c8f5160125d531cbf5d958fa55136063" +patches: + "13.0.0": + - patch_file: "patches/13.0.0/CMakeLists.txt.patch" + - patch_file: "patches/13.0.0/AddLibPNG.patch" + - patch_file: "patches/13.0.0/pugixml-fix.patch" +requirements: + - "zlib/[1.x]" + - "zziplib/[0.13.x]" + - "freetype/[2.x]" + - "freeimage/[3.x]@anotherfoxguy/stable" + - "cg-toolkit/3.1@anotherfoxguy/stable" + - "pugixml/[1.x]" \ No newline at end of file diff --git a/ogre/13/conanfile.py b/ogre/13/conanfile.py new file mode 100644 index 0000000..0ee6b9b --- /dev/null +++ b/ogre/13/conanfile.py @@ -0,0 +1,72 @@ +from conans import ConanFile, CMake, tools +from conans.tools import os_info, SystemPackageTool + + +class OGREConan(ConanFile): + name = "ogre3d" + license = "MIT" + url = "https://github.com/AnotherFoxGuy/conan-OGRE" + description = "scene-oriented, flexible 3D engine written in C++" + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_paths", "cmake_find_package" + exports_sources = "patches/**" + + def requirements(self): + for req in self.conan_data["requirements"]: + self.requires(req) + + def system_requirements(self): + if os_info.is_linux: + if os_info.with_apt: + installer = SystemPackageTool() + installer.install("libx11-dev") + installer.install("libxaw7-dev") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True) + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + + def build(self): + cmake = CMake(self) + cmake.definitions["OGRE_BUILD_DEPENDENCIES"] = "OFF" + cmake.definitions["OGRE_BUILD_COMPONENT_OVERLAY_IMGUI"] = "ON" + cmake.definitions["OGRE_BUILD_COMPONENT_CSHARP"] = "OFF" + cmake.definitions["OGRE_BUILD_COMPONENT_JAVA"] = "OFF" + cmake.definitions["OGRE_BUILD_COMPONENT_PYTHON"] = "OFF" + cmake.definitions["OGRE_BUILD_PLUGIN_STBI"] = "OFF" + cmake.definitions["OGRE_BUILD_COMPONENT_BITES"] = "ON" + cmake.definitions["OGRE_BUILD_SAMPLES"] = "OFF" + cmake.definitions["OGRE_BUILD_RENDERSYSTEM_D3D9"] = "ON" + cmake.definitions["OGRE_BUILD_RENDERSYSTEM_D3D11"] = "ON" + cmake.definitions["OGRE_BUILD_RENDERSYSTEM_GL3PLUS"] = "OFF" + cmake.definitions["OGRE_RESOURCEMANAGER_STRICT"] = 0 + cmake.definitions["OGRE_INSTALL_SAMPLES"] = "OFF" + cmake.definitions["OGRE_BUILD_PLUGIN_DOT_SCENE"] = "OFF" + if os_info.is_windows: + cmake.definitions["CMAKE_CXX_FLAGS"] = "-D_OGRE_FILESYSTEM_ARCHIVE_UNICODE" + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + 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 = tools.collect_libs(self) diff --git a/ogre/13/patches/13.0.0/AddLibPNG.patch b/ogre/13/patches/13.0.0/AddLibPNG.patch new file mode 100644 index 0000000..d6c757b --- /dev/null +++ b/ogre/13/patches/13.0.0/AddLibPNG.patch @@ -0,0 +1,33 @@ +--- Components/Overlay/CMakeLists.txt ++++ Components/Overlay/CMakeLists.txt +@@ -7,6 +7,21 @@ + # free to make use of it in any way you like. + #------------------------------------------------------------------- + ++ ++# FreeType from conan has seperate libraries ++find_package(PNG) ++find_package(BZip2) ++ ++find_library(BROTLICOMMON_LIBRARY NAMES brotlicommon brotlicommon-static) ++find_library(BROTLIDEC_LIBRARY NAMES brotlidec brotlidec-static) ++ ++if(NOT ${BROTLIDEC_LIBRARY} STREQUAL "BROTLICOMMON_LIBRARY-NOTFOUND" AND NOT ${BROTLIDEC_LIBRARY} STREQUAL "BROTLIDEC_LIBRARY-NOTFOUND") ++ set(BROTLI_LIBRARIES ${BROTLICOMMON_LIBRARY} ${BROTLIDEC_LIBRARY}) ++ message(STATUS "Brotli libraries found: ${BROTLI_LIBRARIES}") ++else() ++ message(WARNING "Brotli library not found: ${BROTLICOMMON_LIBRARY} ${BROTLIDEC_LIBRARY}") ++endif() ++ + ############################################################ + # Overlay optional component + ############################################################ +@@ -52,7 +67,7 @@ + + if(FREETYPE_FOUND) + target_compile_definitions(OgreOverlay PRIVATE HAVE_FREETYPE) +- target_link_libraries(OgreOverlay PRIVATE ${FREETYPE_LIBRARIES}) ++ target_link_libraries(OgreOverlay PRIVATE ${FREETYPE_LIBRARIES} ${PNG_LIBRARIES} ${BZIP2_LIBRARIES} ${BROTLI_LIBRARIES} ZLIB::ZLIB) + target_include_directories(OgreOverlay PRIVATE ${FREETYPE_INCLUDE_DIRS}) + elseif(UNIX) + set_source_files_properties(src/OgreFont.cpp PROPERTIES diff --git a/ogre/13/patches/13.0.0/CMakeLists.txt.patch b/ogre/13/patches/13.0.0/CMakeLists.txt.patch new file mode 100644 index 0000000..aa3d8e2 --- /dev/null +++ b/ogre/13/patches/13.0.0/CMakeLists.txt.patch @@ -0,0 +1,19 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -20,6 +20,8 @@ + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + ++include(${CMAKE_BINARY_DIR}/conan_paths.cmake) ++ + if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android") + set(CMAKE_LINK_LIBRARY_FLAG "") + endif() +@@ -74,6 +76,7 @@ + "${PROJECT_SOURCE_DIR}/CMake" + "${PROJECT_SOURCE_DIR}/CMake/Utils" + "${PROJECT_SOURCE_DIR}/CMake/Packages" ++ "${CMAKE_BINARY_DIR}" + ) + + include(CMakeDependentOption) diff --git a/ogre/13/patches/13.0.0/Dependencies.cmake.patch b/ogre/13/patches/13.0.0/Dependencies.cmake.patch new file mode 100644 index 0000000..1c928e8 --- /dev/null +++ b/ogre/13/patches/13.0.0/Dependencies.cmake.patch @@ -0,0 +1,20 @@ +--- CMake/Dependencies.cmake ++++ CMake/Dependencies.cmake +@@ -13,7 +13,7 @@ + + # OGRE_DEPENDENCIES_DIR can be used to specify a single base + # folder where the required dependencies may be found. +-set(OGRE_DEPENDENCIES_DIR "${PROJECT_BINARY_DIR}/Dependencies" CACHE PATH "Path to prebuilt OGRE dependencies") ++set(OGRE_DEPENDENCIES_DIR ${CMAKE_PREFIX_PATH}) + option(OGRE_BUILD_DEPENDENCIES "automatically build Ogre Dependencies (SDL2, pugixml)" TRUE) + + message(STATUS "DEPENDENCIES_DIR: ${OGRE_DEPENDENCIES_DIR}") +@@ -68,7 +68,7 @@ + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${OGRE_DEP_SEARCH_PATH}) + set(CMAKE_FRAMEWORK_PATH ${CMAKE_FRAMEWORK_PATH} ${OGRE_DEP_SEARCH_PATH}) + +-if(OGRE_BUILD_DEPENDENCIES AND NOT EXISTS ${OGREDEPS_PATH}) ++if(0) + message(STATUS "Building pugixml") + file(DOWNLOAD + https://github.com/zeux/pugixml/releases/download/v1.10/pugixml-1.10.tar.gz \ No newline at end of file diff --git a/ogre/13/patches/13.0.0/pugixml-fix.patch b/ogre/13/patches/13.0.0/pugixml-fix.patch new file mode 100644 index 0000000..b132061 --- /dev/null +++ b/ogre/13/patches/13.0.0/pugixml-fix.patch @@ -0,0 +1,15 @@ +--- Tools/XMLConverter/CMakeLists.txt ++++ Tools/XMLConverter/CMakeLists.txt +@@ -21,9 +21,10 @@ + src/OgreXMLSkeletonSerializer.cpp + ) + ++message("Fixing OgreXMLConverter") + add_executable(OgreXMLConverter ${HEADER_FILES} ${SOURCE_FILES}) +-target_include_directories(OgreXMLConverter PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) +-target_link_libraries(OgreXMLConverter OgreMain pugixml) ++target_include_directories(OgreXMLConverter PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include ${pugixml_INCLUDE_DIRS}) ++target_link_libraries(OgreXMLConverter OgreMain pugixml::pugixml) + + if (OGRE_PROJECT_FOLDERS) + set_property(TARGET OgreXMLConverter PROPERTY FOLDER Tools) diff --git a/ogre/config.yml b/ogre/config.yml index 0efc922..d7cfb53 100644 --- a/ogre/config.yml +++ b/ogre/config.yml @@ -1,3 +1,5 @@ versions: "1.11.6.1": - folder: "1.11" \ No newline at end of file + folder: "1.11" + "13.0.0": + folder: "13" \ No newline at end of file