-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ogre: migrate to Conan v2, add latest version
- Loading branch information
Showing
9 changed files
with
783 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(OGRE) | ||
|
||
macro(custom_find_package name) | ||
find_package(${name} ${ARGN} | ||
# Allow only Conan packages | ||
NO_DEFAULT_PATH | ||
PATHS ${CMAKE_PREFIX_PATH} | ||
) | ||
string(TOUPPER ${name} name_upper) | ||
set(${name_upper}_FOUND TRUE) | ||
set(${name_upper}_VERSION_STRING ${${name}_VERSION_STRING}) | ||
set(${name_upper}_INCLUDE_DIRS ${${name}_INCLUDE_DIRS}) | ||
set(${name_upper}_INCLUDE_DIR ${${name}_INCLUDE_DIR}) | ||
set(${name_upper}_LIBRARIES ${${name}_LIBRARIES}) | ||
set(${name_upper}_DEFINITIONS ${${name}_DEFINITIONS}) | ||
unset(name_upper) | ||
endmacro() | ||
|
||
# Do not allow system Qt to be used by accident | ||
set(CMAKE_DISABLE_FIND_PACKAGE_QT TRUE) | ||
set(CMAKE_DISABLE_FIND_PACKAGE_Qt5 TRUE) | ||
set(CMAKE_DISABLE_FIND_PACKAGE_Qt6 TRUE) | ||
|
||
custom_find_package(FreeImage QUIET CONFIG) | ||
custom_find_package(Freetype QUIET CONFIG) | ||
custom_find_package(OpenEXR QUIET CONFIG) | ||
custom_find_package(assimp QUIET CONFIG) | ||
custom_find_package(pugixml REQUIRED CONFIG) | ||
|
||
add_subdirectory(src) | ||
|
||
if(TARGET Codec_FreeImage) | ||
target_link_libraries(Codec_FreeImage PUBLIC freeimage::freeimage) | ||
endif() | ||
if(TARGET Codec_EXR) | ||
target_link_libraries(Codec_EXR openexr::openexr) | ||
endif() | ||
if(TARGET OgreOverlay) | ||
target_link_libraries(OgreOverlay PUBLIC Freetype::Freetype) | ||
endif() | ||
if(TARGET Plugin_DotScene) | ||
target_link_libraries(Plugin_DotScene PUBLIC pugixml::pugixml) | ||
endif() | ||
if(TARGET OgreXMLConverter) | ||
target_link_libraries(OgreXMLConverter pugixml::pugixml) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"14.1.2": | ||
url: "https://github.com/OGRECave/ogre/archive/refs/tags/v14.1.2.tar.gz" | ||
sha256: "7269d659fa74b61b5df48aa81aa9a517227cb7da9f316f04cb9093f963e6911c" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_package LANGUAGES CXX) | ||
|
||
find_package(OGRE ${OGRE_VERSION} COMPONENTS OgreMain REQUIRED) | ||
|
||
add_executable(ogre_main ogre_main.cpp) | ||
target_link_libraries(ogre_main OGRE::OgreMain) | ||
set_target_properties(ogre_main PROPERTIES | ||
CXX_STANDARD 11 | ||
CXX_STANDARD_REQUIRED ON | ||
CXX_EXTENSIONS ON | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
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", "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.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "ogre_main") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <OGRE/Ogre.h> | ||
#include <iostream> | ||
|
||
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.setDimensions(0, 0); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
versions: | ||
"14.1.2": | ||
folder: all | ||
"1.10.2": | ||
folder: 1.x |