OGRE 渲染引擎 Windows 平台构建及编译

0 OGRE

机器人领域常见的RvizGazebo可视化的渲染后端。

1 无数的坑

这东西真的可恶,官方教程文档以及项目构建的方式是真的繁琐,在Windows上。

  • CMake 的构建必须要使用 CMake-Gui, 否则你会遭遇到莫名奇妙的BUG。并不是说不可以用命令行,问题是出现问题,你需要花很多时间去解决。
  • 去除掉  OGRE_BUILD_COMPONENT_OVERLAY_IMGUI 的支持,否则无法构建项目。后续可以修改,入门的话,项目构建起来已经烧高香了。
  • 千万别用 Vcpkg
  • 最好别在OGRE的源代码里生成Build, 在项目外面最好,因为可能还有Android,Mac,Linux 的构建。详情见图。
  • 构建完成后,在VS里面编译使用Release x86,不要编译Debug

image

image

install之后
image

3 官方的教程配置

官方教程代码目录:F:\Git-Hub\OGRE\ogre-master\Samples\Tutorials

VS解决方案添加工作目录:F:\Git-Hub\OGRE\build-ogre-windows\sdk\bin

cmake_minimum_required (VERSION 3.10)
project(OgreTutorialsSample)

# required for Ogre 1.11+
set(CMAKE_CXX_STANDARD 11)

// 非官方的Install路径
set(OGRE_DIR "F:\\Git-Hub\\OGRE\\build-ogre-windows\\sdk\\CMake")


## [discover_ogre]
# The COMPONENTS part checks that OGRE was built the way we need it
# The CONFIG flag makes sure we get OGRE instead of OGRE-next
find_package(OGRE REQUIRED COMPONENTS Bites CONFIG)

# add the source files as usual
add_executable(0_Bootstrap Bootstrap.cpp)

# this also sets the includes and pulls third party dependencies
target_link_libraries(0_Bootstrap OgreBites)
## [discover_ogre]

add_executable(1_FirstScene BasicTutorial1.cpp)
target_link_libraries(1_FirstScene OgreBites)

add_executable(2_CamerasAndShadows BasicTutorial2.cpp)
target_link_libraries(2_CamerasAndShadows OgreBites)

X. ref

  1. Guide to building OGRE
  2. Setting up an OGRE project
  3. OGRE Forum: Build OGRE need Release and Unset OVERLAY_IMGUI
  4. OGRE Github
posted @ 2024-04-06 18:53  Dba_sys  阅读(15)  评论(0编辑  收藏  举报