vcpkg/ports/ogre/fix-dependency.patch

124 lines
4.9 KiB
Diff
Raw Normal View History

diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake
index 14c9290..ee8dab3 100644
--- a/CMake/Dependencies.cmake
+++ b/CMake/Dependencies.cmake
@@ -242,7 +242,7 @@ find_package(FreeImage)
macro_log_feature(FreeImage_FOUND "freeimage" "Support for commonly used graphics image formats" "http://freeimage.sourceforge.net" FALSE "" "")
# Find FreeType
-find_package(Freetype)
+find_package(freetype CONFIG REQUIRED)
macro_log_feature(FREETYPE_FOUND "freetype" "Portable font engine" "http://www.freetype.org" FALSE "" "")
# Find X11
@@ -310,11 +310,11 @@ find_package(SWIG 3.0.8 QUIET)
macro_log_feature(SWIG_FOUND "SWIG" "Language bindings (Python, Java, C#) for OGRE" "http://www.swig.org/" FALSE "" "")
# pugixml
-find_package(pugixml QUIET)
+find_package(pugixml CONFIG REQUIRED)
macro_log_feature(pugixml_FOUND "pugixml" "Needed for XMLConverter and DotScene Plugin" "https://pugixml.org/" FALSE "" "")
# Assimp
-find_package(ASSIMP QUIET)
+find_package(assimp CONFIG REQUIRED)
macro_log_feature(ASSIMP_FOUND "Assimp" "Needed for the AssimpLoader Plugin" "https://www.assimp.org/" FALSE "" "")
if(ASSIMP_FOUND)
@@ -336,7 +336,7 @@ endif()
# Find sdl2
if(NOT ANDROID AND NOT EMSCRIPTEN)
# find script does not work in cross compilation environment
- find_package(SDL2 QUIET)
+ find_package(SDL2 CONFIG REQUIRED)
macro_log_feature(SDL2_FOUND "SDL2" "Simple DirectMedia Library needed for input handling in samples" "https://www.libsdl.org/" FALSE "" "")
if(SDL2_FOUND AND NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 INTERFACE IMPORTED)
diff --git a/CMake/Templates/OGREConfig.cmake.in b/CMake/Templates/OGREConfig.cmake.in
index 392c89c..a79ff8d 100644
--- a/CMake/Templates/OGREConfig.cmake.in
+++ b/CMake/Templates/OGREConfig.cmake.in
@@ -32,6 +32,18 @@ get_filename_component(OGRE_LIBRARY_DIRS "${OGRE_PREFIX_DIR}/lib" ABSOLUTE)
get_filename_component(OGRE_INCLUDE_DIRS "${OGRE_PREFIX_DIR}/include/OGRE" ABSOLUTE)
set(OGRE_LIBRARIES)
+include(CMakeFindDependencyMacro)
+
+find_dependency(pugixml CONFIG)
+find_dependency(SDL2 CONFIG)
+find_dependency(ZLIB)
+find_dependency(assimp CONFIG)
+find_dependency(freetype CONFIG)
+
+if (@OGRE_BUILD_COMPONENT_OVERLAY_IMGUI@)
+ find_dependency(imgui CONFIG)
+endif()
+
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
diff --git a/Components/Bites/CMakeLists.txt b/Components/Bites/CMakeLists.txt
index 5d58a8d..fe41e4a 100644
--- a/Components/Bites/CMakeLists.txt
+++ b/Components/Bites/CMakeLists.txt
@@ -152,6 +152,11 @@ elseif(NOT EMSCRIPTEN)
message(WARNING "SDL2 not found - no input handling and reduced window creation capabilites")
endif()
+if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
+ find_package(imgui CONFIG REQUIRED)
+ target_link_libraries(OgreBites PRIVATE imgui::imgui)
+endif()
+
generate_export_header(OgreBites
EXPORT_MACRO_NAME _OgreBitesExport
EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/include/OgreBitesPrerequisites.h)
diff --git a/Components/Overlay/CMakeLists.txt b/Components/Overlay/CMakeLists.txt
index df8f32a..42be1e8 100644
--- a/Components/Overlay/CMakeLists.txt
+++ b/Components/Overlay/CMakeLists.txt
@@ -19,21 +19,8 @@ list(APPEND HEADER_FILES
file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
- set(IMGUI_DIR "${PROJECT_BINARY_DIR}/imgui-1.77" CACHE PATH "")
- if(NOT EXISTS ${IMGUI_DIR})
- message(STATUS "Dowloading imgui")
- file(DOWNLOAD
- https://github.com/ocornut/imgui/archive/v1.77.tar.gz
- ${PROJECT_BINARY_DIR}/imgui.tar.gz)
- execute_process(COMMAND ${CMAKE_COMMAND}
- -E tar xf imgui.tar.gz WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
- endif()
- list(APPEND SOURCE_FILES
- ${IMGUI_DIR}/imgui.cpp
- ${IMGUI_DIR}/imgui_draw.cpp
- ${IMGUI_DIR}/imgui_widgets.cpp
- ${IMGUI_DIR}/imgui_demo.cpp
- ${IMGUI_DIR}/misc/freetype/imgui_freetype.cpp)
+ find_package(imgui CONFIG REQUIRED)
+ find_path(IMGUI_INCLUDE_DIR imgui.h)
else()
list(REMOVE_ITEM SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/OgreImGuiOverlay.cpp")
endif()
@@ -41,13 +28,17 @@ endif()
# setup target
add_library(OgreOverlay ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES})
set_target_properties(OgreOverlay PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
-target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE ${FREETYPE_LIBRARIES} ZLIB::ZLIB)
+if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
+ target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE freetype ZLIB::ZLIB imgui::imgui)
+else()
+ target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE freetype ZLIB::ZLIB)
+endif()
target_include_directories(OgreOverlay PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/Overlay>
PRIVATE ${FREETYPE_INCLUDE_DIRS})
-if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
+if(0)
target_include_directories(OgreOverlay PUBLIC
PUBLIC "$<BUILD_INTERFACE:${IMGUI_DIR}>"
PRIVATE "$<BUILD_INTERFACE:${IMGUI_DIR}/misc/freetype>")