遇到的 问题

官网首页提供的ceed工程缺少文件无法编译,就只能使用的主线版本的库 cegui-master 编译的

编译cegui-master库过程中遇到很多坑

###代码里用到了很多c++17的特性,而设置里默认是14,找到 cegui-master/cmake/CEGUIMacros.cmake 将CXX_STANDARD 改为17

CEGUIMacros.cmake

###########################################################################
# SHARED LIBRARY SET UP
###########################################################################
if (CEGUI_BUILD_DYNAMIC_CONFIGURATION)
add_library(${_LIB_NAME} ${_LIB_TYPE} ${${_SOURCE_FILES_VAR}} ${${_HEADER_FILES_VAR}})
set_target_properties(${_LIB_NAME} PROPERTIES DEFINE_SYMBOL ${_CEGUI_EXPORT_DEFINE})
set_target_properties(${_LIB_NAME} PROPERTIES
C_STANDARD 14
C_STANDARD_REQUIRED ON
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF)

cegui-master/application_templates/CMakeLists.txt 也需要添加c++17

在CMakeLists.txt  前面添加
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

###删除noexcept,c++17 默认为noexcept

/home/cegui-master/cegui/src/text/RenderedText.cpp:49:1: error: function ‘CEGUI::RenderedText::RenderedText(CEGUI::RenderedText&&)’ defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification ‘’
将 RenderedText::RenderedText(RenderedText&&) noexcept = default

改为 

RenderedText::RenderedText(RenderedText&&) default 

搜索cegui中所有用到 noexcept 全部删掉

zxd@zxd-pc:~/Tools/zip/ceguizip/cegui-master/cegui/include/CEGUI$ grep -r “noexcept” .

./String.h: String(CEGUI::String&& other) noexcept
./String.h: String& operator=(String&& str) noexcept
./falagard/ImagerySection.h: ImagerySection(ImagerySection&& obj) noexcept = default;
./falagard/ImagerySection.h: ImagerySection& operator =(ImagerySection&& other) noexcept = default;
./falagard/WidgetLookFeel.h: WidgetLookFeel(WidgetLookFeel&& other) noexcept = default;
./falagard/WidgetLookFeel.h: WidgetLookFeel& operator =(WidgetLookFeel&& other) noexcept = default;
./Event.h: ScopedConnection(ScopedConnection&& other) noexcept : d_connection(std::move(other.d_connection)) {}
./Event.h: ScopedConnection(Event::Connection&& connection) noexcept : d_connection(std::move(connection)) {}
./Event.h: ScopedConnection& operator =(ScopedConnection&& other) noexcept
./text/RenderedText.h: //RenderedText(RenderedText&&) noexcept;
./text/RenderedText.h: //RenderedText& operator =(RenderedText&&) noexcept;
./Rectf.h: Rectf(Rectf&&) noexcept = default;
./Rectf.h: Rectf& operator =(Rectf&&) noexcept = default;
./Exceptions.h: virtual ~Exception() noexcept;
./Exceptions.h: const char* what() const noexcept override;

###然后又遇到缺少InputAggregator,查了一下发现使用inputAggregator的地方还不少,全是应用程序模板里面的,在Build里面找到CMakeCache.txt 把不用的模板全部关掉

反正编译master是为了编译ceed编辑器,用不了这些功能

zxd@zxd-pc:~/Tools/zip/ceguizip/cegui-master$ grep -r “CEGUI::InputAggregator” .
./application_templates/SFML2.cpp:static CEGUI::InputAggregator* G_inputAggregator;
./application_templates/SFML2.cpp: G_inputAggregator = new CEGUI::InputAggregator(G_context);
./application_templates/glfw3.cpp:static CEGUI::InputAggregator* G_inputAggregator;
./application_templates/SDL2.cpp:static CEGUI::InputAggregator* G_inputAggregator;
./application_templates/Ogre.cpp: CEGUI::InputAggregator* inputAggregator;
./application_templates/Ogre.cpp: app_pak.inputAggregator = new CEGUI::InputAggregator(app_pak.context);
./cegui/src/ScriptModules/SWIG/CEGUI.i:%feature(“notabstract”) CEGUI::InputAggregator;
./cegui/src/ScriptModules/SWIG/CEGUI.i:%extend CEGUI::InputAggregator {
zxd@zxd-pc:~/Tools/zip/ceguizip/cegui-master$ grep -r “InputAggregator”
application_templates/python-swig.py:inputAggregator = CEGUI.InputAggregator(context)
application_templates/SFML2.cpp:static CEGUI::InputAggregator* G_inputAggregator;
application_templates/SFML2.cpp: G_inputAggregator = new CEGUI::InputAggregator(G_context);
application_templates/glfw3.cpp:static CEGUI::InputAggregator* G_inputAggregator;
application_templates/glfw3.cpp: G_inputAggregator = new InputAggregator(G_ctx);
application_templates/SDL2.cpp:static CEGUI::InputAggregator* G_inputAggregator;
application_templates/SDL2.cpp: G_inputAggregator = new InputAggregator(G_context);
application_templates/Ogre.cpp: CEGUI::InputAggregator* inputAggregator;
application_templates/Ogre.cpp: app_pak.inputAggregator = new CEGUI::InputAggregator(app_pak.context);
cegui/src/ScriptModules/SWIG/CEGUI.i:%feature(“notabstract”) CEGUI::InputAggregator;
cegui/src/ScriptModules/SWIG/CEGUI.i:%include “CEGUI/InputAggregator.h”
cegui/src/ScriptModules/SWIG/CEGUI.i:%extend CEGUI::InputAggregator {
zxd@zxd-pc:~/Tools/zip/ceguizip/cegui-master$

//Specifies whether to build the application templates.
CEGUI_BUILD_APPLICATION_TEMPLATES:BOOL=ON

//Specifies whether to build the application template for GLFW3
CEGUI_BUILD_APPLICATION_TEMPLATE_GLFW3:BOOL=OFF

//Specifies whether to build the application template for OGRE
CEGUI_BUILD_APPLICATION_TEMPLATE_OGRE:BOOL=OFF

//Specifies whether to build the application template for SDL2
CEGUI_BUILD_APPLICATION_TEMPLATE_SDL2:BOOL=OFF

//Specifies whether to build the application template for SFML2
CEGUI_BUILD_APPLICATION_TEMPLATE_SFML2:BOOL=OFF

###设置debug标记,后面ceed工程要用到,将编译出来的so库文件Debug和Relesase区分开,后面加后缀_d
CMakeLists.txt 搜索CEGUI_BUILD_SUFFIX
if (WIN32 OR APPLE)
set (CEGUI_BUILD_SUFFIX “_d” CACHE STRING “String holding a suffix appended to the name of output binaries (under CMake build, only used for debug).”)
else()
set (CEGUI_BUILD_SUFFIX “_d” CACHE STRING “String holding a suffix appended to the name of output binaries (under CMake build, only used for debug).”)
endif()

不同版本库的存放位置
CMakeLists.txt 搜索 CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG

# set build output locations

if (WIN32)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY “${PROJECT_BINARY_DIR}/bin”)
else()
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY “${PROJECT_BINARY_DIR}/lib”)
endif()
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG “${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/debug”)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE “${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/release”)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

CMakeCache.txt

//Sets the configuration to build (Release, Debug, etc…)
CMAKE_BUILD_TYPE:STRING=Debug

//String holding a suffix appended to the name of output binaries
// (under CMake build, only used for debug).
CEGUI_BUILD_SUFFIX:STRING=_d

这样编译出来的debug 就存放在 build/bin/debug release存放在 build/bin/release

 

###编译完成后 sudo make install ,把so库文件安装在系统目录/usr/local/lib/cegui-9999.0/中

 

###然后是编译ceed项目,由于官网主页下载的1.1.2版本因为缺少文件,没有编译成功,只有使用github的 ceed-cpp-master 主线版

qt creator 打开项目工程

###也需要 c++17

打开 ceed-cpp.pro 设置 CONFIG

CONFIG += c++17

再添加这条,这样找依赖库就可以在ceed程序当前目录下找
unix:!macx:!liunx: QMAKE_RPATHDIR += $$PWD/

 

###提示找不到std::squrt ,添加头文件 #include<math.h>,然后把std::去掉

然后下面有两个地方可能需要改

bool toActualValue(ValueTypeStore& actualValue, BaseValueType baseValue) const override
{
// Z axis goes through the screen, 2D objects are rotated around it
#ifdef GLM_FORCE_RADIANS
actualValue = glm::angleAxis(glm::radians(normalizeAngle(baseValue)), 0.f, 0.f, 1.f);
#else
actualValue = glm::angleAxis(normalizeAngle(baseValue), glm::vec3(0.f, 0.f, 1.f));
#endif
return true;
}

// if resort is True the children are sorted according to their order in CEGUI::Window
void WidgetHierarchyItem::refreshOrderingData(bool resort, bool recursive)
{
// resort=True with recursive=False makes no sense and is a bug
assert(!resort || recursive);

if (!_manipulator || !_manipulator->getWidget()) return;

QVariant var;
var.setValue(_manipulator->getWidgetIndexInParent())
setData(var, Qt::UserRole + 1);

 

然后就可以执行调试了看到编辑器主界面了,但是还不能用

将cegui-master/build/lib/debug目录下这些文件复制到 build-ceed-cpp-gcc-Debug/bin

然后新建一个空工程文件夹 testpro

然后在把文件夹 /usr/local/share/cegui-9999 复制到工程  testpro 改名字为resource

 然后qt启动调试,打开软件,新建一个工程,选择使用 匹配 cegui 0.8.0
在project_setting中设置 Resource directory 为 上面新建的resource,然后点先点应用 Apply再点ok

 

 

 

这个时候应该就能够正常使用了

 

 

 

 

 

 

 

 

 

 

 

 

原文地址:http://www.cnblogs.com/zxdplay/p/16845377.html

1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长! 2. 分享目的仅供大家学习和交流,请务用于商业用途! 3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入! 4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解! 5. 如有链接无法下载、失效或广告,请联系管理员处理! 6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需! 7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员! 8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载 声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性