[ogre] Update to version 1.12.7 and fix link error (#12210)

* [ogre] Update to version 1.12.7 and fix link error

* [ogre] Fix find imgui

* [ogre] Fix find imgui

* [ogre] Add vcpkg.json

* format manifest

Co-authored-by: Nicole Mazzuca <mazzucan@outlook.com>
This commit is contained in:
Lily 2020-07-31 13:39:26 +08:00 committed by GitHub
parent 3513e92bf9
commit 32b7ad04ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 138 additions and 57 deletions

View File

@ -134,6 +134,8 @@ if(NOT IMGUI_SKIP_HEADERS)
${CMAKE_CURRENT_SOURCE_DIR}/imconfig.h
${CMAKE_CURRENT_SOURCE_DIR}/imgui_internal.h
${CMAKE_CURRENT_SOURCE_DIR}/imstb_textedit.h
${CMAKE_CURRENT_SOURCE_DIR}/imstb_rectpack.h
${CMAKE_CURRENT_SOURCE_DIR}/imstb_truetype.h
${CMAKE_CURRENT_SOURCE_DIR}/misc/cpp/imgui_stdlib.h
DESTINATION include
)

View File

@ -1,6 +1,6 @@
Source: imgui
Version: 1.77
Port-Version: 1
Port-Version: 2
Homepage: https://github.com/ocornut/imgui
Description: Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies.

View File

@ -1,18 +0,0 @@
Source: ogre
Version: 1.12.1-1
Build-Depends: freeimage, freetype, zlib, zziplib
Homepage: https://github.com/OGRECave/ogre
Description: 3D Object-Oriented Graphics Rendering Engine
Feature: d3d9
Description: Build Direct3D9 RenderSystem
Feature: csharp
Description: Build csharp bindings
Feature: java
Description: Build Java (JNI) bindings
Feature: python
Description: Build Python bindings
Build-Depends: python3

View File

@ -0,0 +1,45 @@
diff --git a/CMake/Dependencies.cmake b/CMake/Dependencies.cmake
index 959fdf5..dcd28bb 100644
--- a/CMake/Dependencies.cmake
+++ b/CMake/Dependencies.cmake
@@ -217,7 +217,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
@@ -291,7 +291,7 @@ macro_log_feature(SWIG_FOUND "SWIG" "Language bindings (Python, Java, C#) for OG
# 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/PlugIns/DotScene/CMakeLists.txt b/PlugIns/DotScene/CMakeLists.txt
index fd285df..ab8e9c1 100644
--- a/PlugIns/DotScene/CMakeLists.txt
+++ b/PlugIns/DotScene/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(pugixml QUIET)
+find_package(pugixml CONFIG REQUIRED)
file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
list(APPEND HEADER_FILES ${PROJECT_BINARY_DIR}/include/OgreDotScenePluginExports.h)
diff --git a/Tools/XMLConverter/CMakeLists.txt b/Tools/XMLConverter/CMakeLists.txt
index 8fe9683..2a516b2 100644
--- a/Tools/XMLConverter/CMakeLists.txt
+++ b/Tools/XMLConverter/CMakeLists.txt
@@ -22,7 +22,7 @@ set(SOURCE_FILES
)
# allow override by cmake
-find_package(pugixml QUIET)
+find_package(pugixml CONFIG REQUIRED)
add_executable(OgreXMLConverter ${HEADER_FILES} ${SOURCE_FILES})
target_include_directories(OgreXMLConverter PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)

View File

@ -0,0 +1,35 @@
diff --git a/Components/Overlay/CMakeLists.txt b/Components/Overlay/CMakeLists.txt
index 1cea873..d3e756e 100644
--- a/Components/Overlay/CMakeLists.txt
+++ b/Components/Overlay/CMakeLists.txt
@@ -19,12 +19,8 @@ list(APPEND HEADER_FILES
file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
if(OGRE_BUILD_COMPONENT_OVERLAY_IMGUI)
- list(APPEND SOURCE_FILES
- ${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/imgui.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/imgui_draw.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/imgui_widgets.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/imgui_demo.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/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()
@@ -32,13 +28,13 @@ 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)
+target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE ${FREETYPE_LIBRARIES} ZLIB::ZLIB imgui::imgui)
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:${CMAKE_CURRENT_SOURCE_DIR}/src/imgui>"
PRIVATE "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/misc/freetype>")

View File

@ -9,11 +9,13 @@ endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO OGRECave/ogre
REF 8083067c1835147de5d82015347d95c710e36bc0
SHA512 0690aaff0bea74c38598894939396cab8077b84bda166deb4790fba87566114bc5267660e8efc4de9babeb1b8bddf73530e1a1dbbc63c7e24b14bc012b033bc8
REF 8ff1a4046716244fc4b3a3e44e5b6abeda755b0a #v1.12.7
SHA512 60c66118e35904cbabe881301f3e59026483507341450956f99b67220e1aaebd7035caac69c3e06cf45f08163254264da111b93d0c6b3402c3fba64858786b66
HEAD_REF master
PATCHES
toolchain_fixes.patch
fix-dependency.patch
fix-findimgui.patch
)
file(REMOVE "${SOURCE_PATH}/CMake/Packages/FindOpenEXR.cmake")

View File

@ -20,10 +20,10 @@ index a7a3796..2e21403 100644
set(INST_FILES Utils/FindPkgMacros.cmake)
diff --git a/CMake/InstallResources.cmake b/CMake/InstallResources.cmake
index 783755e..79f7514 100644
index 06a055b..09d10bd 100644
--- a/CMake/InstallResources.cmake
+++ b/CMake/InstallResources.cmake
@@ -208,10 +208,12 @@ endif ()
@@ -201,10 +201,12 @@ endif ()
# Create the CMake package files
include(CMakePackageConfigHelpers)
@ -38,8 +38,8 @@ index 783755e..79f7514 100644
+ set(OGRE_CMAKE_DIR "${OGRE_LIB_DIRECTORY}/OGRE/cmake")
+ endif()
endif()
configure_package_config_file(${OGRE_TEMPLATES_DIR}/OGREConfig.cmake.in ${PROJECT_BINARY_DIR}/cmake/OGREConfig.cmake
INSTALL_DESTINATION ${OGRE_CMAKE_DIR}
if(WIN32)
set(OGRE_PLUGIN_DIR_CMAKE "bin")
diff --git a/CMake/Packages/FindCg.cmake b/CMake/Packages/FindCg.cmake
index 4501cf9..7eb57c3 100644
--- a/CMake/Packages/FindCg.cmake
@ -93,7 +93,7 @@ index 7125895..13a306f 100644
findpkg_finish(HLSL2GLSL)
add_parent_dir(HLSL2GLSL_INCLUDE_DIRS HLSL2GLSL_INCLUDE_DIR)
diff --git a/CMake/Packages/FindNVAPI.cmake b/CMake/Packages/FindNVAPI.cmake
index 2b9deba..f33a298 100644
index 95c70cd..893ce01 100644
--- a/CMake/Packages/FindNVAPI.cmake
+++ b/CMake/Packages/FindNVAPI.cmake
@@ -44,7 +44,7 @@ findpkg_framework(NVAPI)
@ -238,10 +238,10 @@ index 374f84b..dc7066d 100644
# Generate debug names from given release names
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e09d2d..58968f0 100644
index 1602572..9fddbe7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -274,7 +274,7 @@ elseif(EMSCRIPTEN)
@@ -269,7 +269,7 @@ elseif(EMSCRIPTEN)
elseif (APPLE AND NOT APPLE_IOS)
set(XCODE_ATTRIBUTE_SDKROOT macosx)
@ -250,32 +250,6 @@ index 3e09d2d..58968f0 100644
execute_process(COMMAND xcodebuild -version -sdk "${XCODE_ATTRIBUTE_SDKROOT}" Path | head -n 1 OUTPUT_VARIABLE CMAKE_OSX_SYSROOT)
string(REGEX REPLACE "(\r?\n)+$" "" CMAKE_OSX_SYSROOT "${CMAKE_OSX_SYSROOT}")
else()
diff --git a/Components/Overlay/CMakeLists.txt b/Components/Overlay/CMakeLists.txt
index bdb303d..d9cc221 100644
--- a/Components/Overlay/CMakeLists.txt
+++ b/Components/Overlay/CMakeLists.txt
@@ -21,7 +21,7 @@ file(GLOB SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
# setup target
add_library(OgreOverlay ${OGRE_COMP_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES} ${PLATFORM_HEADER_FILES} ${PLATFORM_SOURCE_FILES})
set_target_properties(OgreOverlay PROPERTIES VERSION ${OGRE_SOVERSION} SOVERSION ${OGRE_SOVERSION})
-target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE "${FREETYPE_LIBRARIES}" ZLIB::ZLIB)
+target_link_libraries(OgreOverlay PUBLIC OgreMain PRIVATE ${FREETYPE_LIBRARIES} ZLIB::ZLIB)
target_include_directories(OgreOverlay PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
$<INSTALL_INTERFACE:include/OGRE/Overlay>
diff --git a/OgreMain/CMakeLists.txt b/OgreMain/CMakeLists.txt
index 6ec4e34..cc9cb9d 100644
--- a/OgreMain/CMakeLists.txt
+++ b/OgreMain/CMakeLists.txt
@@ -225,8 +225,6 @@ if (APPLE)
set_target_properties(OgreMain PROPERTIES
LINK_FLAGS "-framework IOKit -framework Cocoa -framework Carbon -framework OpenGL -framework CoreVideo"
)
-
- set(OGRE_OSX_BUILD_CONFIGURATION "$(PLATFORM_NAME)/$(CONFIGURATION)")
if(OGRE_BUILD_LIBS_AS_FRAMEWORKS)
add_custom_command(TARGET OgreMain POST_BUILD
diff --git a/PlugIns/EXRCodec/CMakeLists.txt b/PlugIns/EXRCodec/CMakeLists.txt
index e9c936a..bb8747e 100644
--- a/PlugIns/EXRCodec/CMakeLists.txt

41
ports/ogre/vcpkg.json Normal file
View File

@ -0,0 +1,41 @@
{
"name": "ogre",
"version-string": "1.12.7",
"description": "3D Object-Oriented Graphics Rendering Engine",
"homepage": "https://github.com/OGRECave/ogre",
"dependencies": [
"freeimage",
"freetype",
"zlib",
"zziplib",
"sdl2",
"pugixml",
{
"name": "imgui",
"features": [
"freetype"
]
}
],
"features": [
{
"name": "d3d9",
"description": "Build Direct3D9 RenderSystem"
},
{
"name": "csharp",
"description": "Build csharp bindings"
},
{
"name": "java",
"description": "Build Java (JNI) bindings"
},
{
"name": "python",
"description": "Build Python bindings",
"dependencies": [
"python3"
]
}
]
}