Is it possible to use Orge3D 13.1.1 inside of Qt 5.15.2 Widget for static build?
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Is it possible to use Orge3D 13.1.1 inside of Qt 5.15.2 Widget for static build?
Hello,
I want to draw inside of Qt Widget with Ogre3D. But I want to have Qt GUI in the same window.
I made this simple demo in pure OpenGL 3.3 and Qt:
I found this page OgreBites::ApplicationContextQt Class Reference. But I do not understand, can I only create separate window for Ogre3D from Qt application? If I can combine Ogre3D and Qt GUI in the same window, please, give me links on examples. I cannot find any tutorials and examples.
I want to draw inside of Qt Widget with Ogre3D. But I want to have Qt GUI in the same window.
I made this simple demo in pure OpenGL 3.3 and Qt:
I found this page OgreBites::ApplicationContextQt Class Reference. But I do not understand, can I only create separate window for Ogre3D from Qt application? If I can combine Ogre3D and Qt GUI in the same window, please, give me links on examples. I cannot find any tutorials and examples.
Last edited by 8Observer8 on Fri Oct 29, 2021 4:39 pm, edited 2 times in total.
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I created the "Ogre3DWidget". I tried to build the example below but I have these errors. It seems like I need additional library for ApplicationContextQt. If it is where is it?
Ogre3DWidget.h
Ogre3DWidget.cpp
Widget.h
Widget.cpp
main.cpp
.pro
Ogre3DWidget.h
Code: Select all
#ifndef OGRE3DWIDGET_H
#define OGRE3DWIDGET_H
#include "Ogre.h"
#include <OgreApplicationContextQt.h>
#include "OgreInput.h"
#include "OgreRTShaderSystem.h"
using namespace Ogre;
using namespace OgreBites;
class Ogre3DWidget : public ApplicationContextQt, public InputListener
{
public:
Ogre3DWidget();
virtual ~Ogre3DWidget() { }
void setup();
bool keyPressed(const KeyboardEvent& evt);
};
#endif // OGRE3DWIDGET_H
Code: Select all
#include "Ogre3DWidget.h"
Ogre3DWidget::Ogre3DWidget()
: ApplicationContextQt("Ogre Widget")
{
}
void Ogre3DWidget::setup()
{
// do not forget to call the base first
ApplicationContextQt::setup();
addInputListener(this);
// get a pointer to the already created root
Root* root = getRoot();
SceneManager* scnMgr = root->createSceneManager();
ResourceGroupManager rgm;
// register our scene with the RTSS
RTShader::ShaderGenerator* shadergen = RTShader::ShaderGenerator::getSingletonPtr();
shadergen->addSceneManager(scnMgr);
// -- tutorial section start --
//! [turnlights]
scnMgr->setAmbientLight(ColourValue(0.5, 0.5, 0.5));
//! [turnlights]
//! [newlight]
Light* light = scnMgr->createLight("MainLight");
SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
lightNode->attachObject(light);
//! [newlight]
//! [lightpos]
lightNode->setPosition(20, 80, 50);
//! [lightpos]
//! [camera]
SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode();
// create the camera
Camera* cam = scnMgr->createCamera("myCam");
cam->setNearClipDistance(5); // specific to this sample
cam->setAutoAspectRatio(true);
camNode->attachObject(cam);
camNode->setPosition(0, 0, 140);
// and tell it to render into the main window
getRenderWindow()->addViewport(cam);
//! [camera]
//! [entity1]
Entity* ogreEntity = scnMgr->createEntity("ogrehead.mesh");
//! [entity1]
//! [entity1node]
SceneNode* ogreNode = scnMgr->getRootSceneNode()->createChildSceneNode();
//! [entity1node]
//! [entity1nodeattach]
ogreNode->attachObject(ogreEntity);
//! [entity1nodeattach]
//! [cameramove]
camNode->setPosition(0, 47, 222);
//! [cameramove]
//! [entity2]
Entity* ogreEntity2 = scnMgr->createEntity("ogrehead.mesh");
SceneNode* ogreNode2 = scnMgr->getRootSceneNode()->createChildSceneNode(Vector3(84, 48, 0));
ogreNode2->attachObject(ogreEntity2);
//! [entity2]
//! [entity3]
Entity* ogreEntity3 = scnMgr->createEntity("ogrehead.mesh");
SceneNode* ogreNode3 = scnMgr->getRootSceneNode()->createChildSceneNode();
ogreNode3->setPosition(0, 104, 0);
ogreNode3->setScale(2, 1.2, 1);
ogreNode3->attachObject(ogreEntity3);
//! [entity3]
//! [entity4]
Entity* ogreEntity4 = scnMgr->createEntity("ogrehead.mesh");
SceneNode* ogreNode4 = scnMgr->getRootSceneNode()->createChildSceneNode();
ogreNode4->setPosition(-84, 48, 0);
ogreNode4->roll(Degree(-90));
ogreNode4->attachObject(ogreEntity4);
//! [entity4]
// -- tutorial section end --
}
bool Ogre3DWidget::keyPressed(const KeyboardEvent &evt)
{
if (evt.keysym.sym == SDLK_ESCAPE)
{
getRoot()->queueEndRendering();
}
return true;
}
Code: Select all
#ifndef WIDGET_H
#define WIDGET_H
#include <QtWidgets/QWidget>
#include "Ogre3DWidget.h"
class Widget : public QWidget
{
Q_OBJECT
public:
Widget(QWidget *parent = nullptr);
~Widget();
private:
Ogre3DWidget _ogre3DWidget;
};
#endif // WIDGET_H
Code: Select all
#include "Widget.h"
Widget::Widget(QWidget *parent)
: QWidget(parent)
{
setWindowTitle("Qt Widget for Ogre3D");
}
Widget::~Widget()
{
}
Code: Select all
#include "Widget.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
Code: Select all
QT += core gui
INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\dist\include"
INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\OgreMain\include"
INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\Bites\include"
INCLUDEPATH += "E:\_Projects\Temp\ogre-13.1.1\Components\RTShaderSystem\include"
LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\lib"
#LIBS += -lCodec_STBIStatic -lOgreBitesStatic -lOgreMainStatic -lOgreRTShaderSystemStatic -lPlugin_ParticleFXStatic
LIBS += -lDefaultSamples -lOgreBitesStatic -lRenderSystem_GL3PlusStatic -lOgreGLSupportStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic -lOgreMainStatic -lOgreTerrainStatic -lCodec_STBIStatic -lzlibstatic
LIBS += -L"E:\_Projects\Temp\ogre-13.1.1\dist\Dependencies\lib"
LIBS += -lSDL2main -lSDL2.dll -lfreetype -lpugixml
LIBS += -lopengl32 -lgdi32
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
Ogre3DWidget.cpp \
main.cpp \
Widget.cpp
HEADERS += \
Ogre3DWidget.h \
Widget.h
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I found why I do not have a Qt library:
What I need to write there?
Is it good:
What I need to write there?
Is it good:
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I have the error:
I will try to rebuild it without samples.[ 97%] Built target DefaultSamples
[ 97%] Building CXX object Samples/Browser/CMakeFiles/SampleBrowser.dir/src/main.cpp.obj
mingw32-make[2]: *** No rule to make target 'Dependencies/lib/IrrXML.lib', needed by 'bin/SampleBrowser.exe'. Stop.
mingw32-make[1]: *** [CMakeFiles\Makefile2 Samples/Browser/CMakeFiles/SampleBrowser.dir/all] Error 2
mingw32-make: *** [Makefile:155: all] Error 2
- nuke
- Halfling
- Posts: 72
- Joined: Wed Oct 01, 2014 1:16 am
- Location: Crimea
- x 5
Re: Is it possible to use Orge3D inside of Qt Widget?
Прикольная у тебя ёлочка получилась в первом посте!
RUS -> ENG: Cool Christmas tree in the first post!
RUS -> ENG: Cool Christmas tree in the first post!
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I made two big mistakes:
CMake found paths to Qt5:
Samples installed successfully. "include" and "lib" and so on are in one folder:
I have the "libOgreBitesQtStatic.a" library now.
- I did not add Qt5 to PATH. I had Qt6 in PATH
- I did not make "mingw32-make install" after "mingw32-make".
CMake found paths to Qt5:
Samples installed successfully. "include" and "lib" and so on are in one folder:
I have the "libOgreBitesQtStatic.a" library now.
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I think ApplicationContextQt is in libOgreBitesQtStatic.a
But I have these errors:
But I have these errors:
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
How to know where _imp___ZTVN9OgreBites20ApplicationContextQtE is placed?
E:\ProgramFiles\ogre-13.1.1\include\OGRE\Bites\OgreApplicationContextQt.h:41: error: undefined reference to `_imp___ZTVN9OgreBites20ApplicationContextQtE'
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I included all (21) libraries:
This error:
in this header file:
Code: Select all
INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE"
INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE\Bites"
INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE\RTShaderSystem"
LIBS += -L"E:\ProgramFiles\ogre-13.1.1\lib"
LIBS += -L"E:\ProgramFiles\ogre-13.1.1\lib\OGRE"
LIBS += -lOgreBitesQtStatic
LIBS += -lOgreBitesStatic -lRenderSystem_GL3PlusStatic -lOgreGLSupportStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic -lOgreMainStatic -lOgreTerrainStatic -lCodec_STBIStatic -lzlibstatic
LIBS += -lSDL2main -lSDL2.dll -lfreetype -lpugixml
LIBS += -lopengl32 -lgdi32
points to this line:E:\ProgramFiles\ogre-13.1.1\include\OGRE\Bites\OgreApplicationContextQt.h:41: error: undefined reference to `_imp___ZTVN9OgreBites20ApplicationContextQtE'
Code: Select all
class _OgreBitesQtExport ApplicationContextQt : public QObject, public ApplicationContextBase
What additional information should I show you?E:\ProgramFiles\ogre-13.1.1\include\OGRE\Bites\OgreApplicationContextQt.h
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: Is it possible to use Orge3D inside of Qt Widget?
switching the bootstrap sample works for me like this:
https://github.com/paroj/ogre/commit/b2 ... 729304d346
your error seems to indicate that some Qt MOC stuff is missing. Maybe it is a separate lib when doing a static build.
https://github.com/paroj/ogre/commit/b2 ... 729304d346
your error seems to indicate that some Qt MOC stuff is missing. Maybe it is a separate lib when doing a static build.
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I tried to run the bootstrap sample but I have the same errors:
main.cpp
.pro
main.cpp
Code: Select all
#include "Ogre.h"
#include "OgreApplicationContextQt.h"
#include <QGuiApplication>
class MyTestApp : public OgreBites::ApplicationContextQt, public OgreBites::InputListener
{
public:
MyTestApp();
void setup();
bool keyPressed(const OgreBites::KeyboardEvent& evt);
};
//! [constructor]
MyTestApp::MyTestApp() : OgreBites::ApplicationContextQt("OgreTutorialApp")
{
}
//! [constructor]
//! [key_handler]
bool MyTestApp::keyPressed(const OgreBites::KeyboardEvent& evt)
{
if (evt.keysym.sym == OgreBites::SDLK_ESCAPE)
{
getRoot()->queueEndRendering();
}
return true;
}
//! [key_handler]
//! [setup]
void MyTestApp::setup(void)
{
// do not forget to call the base first
OgreBites::ApplicationContextQt::setup();
// register for input events
addInputListener(this);
// get a pointer to the already created root
Ogre::Root* root = getRoot();
Ogre::SceneManager* scnMgr = root->createSceneManager();
// register our scene with the RTSS
Ogre::RTShader::ShaderGenerator* shadergen = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
shadergen->addSceneManager(scnMgr);
// without light we would just get a black screen
Ogre::Light* light = scnMgr->createLight("MainLight");
Ogre::SceneNode* lightNode = scnMgr->getRootSceneNode()->createChildSceneNode();
lightNode->setPosition(0, 10, 15);
lightNode->attachObject(light);
// also need to tell where we are
Ogre::SceneNode* camNode = scnMgr->getRootSceneNode()->createChildSceneNode();
camNode->setPosition(0, 0, 15);
camNode->lookAt(Ogre::Vector3(0, 0, -1), Ogre::Node::TS_PARENT);
// create the camera
Ogre::Camera* cam = scnMgr->createCamera("myCam");
cam->setNearClipDistance(5); // specific to this sample
cam->setAutoAspectRatio(true);
camNode->attachObject(cam);
// and tell it to render into the main window
getRenderWindow()->addViewport(cam);
// finally something to render
Ogre::Entity* ent = scnMgr->createEntity("Sinbad.mesh");
Ogre::SceneNode* node = scnMgr->getRootSceneNode()->createChildSceneNode();
node->attachObject(ent);
}
//! [setup]
//! [main]
int main(int argc, char *argv[])
{
QGuiApplication qapp(argc, argv);
MyTestApp app;
app.initApp();
app.getRoot()->startRendering();
app.closeApp();
return qapp.exec();
}
//! [main]
Code: Select all
QT += core gui
INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE"
INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE\Bites"
INCLUDEPATH += "E:\ProgramFiles\ogre-13.1.1\include\OGRE\RTShaderSystem"
LIBS += -L"E:\ProgramFiles\ogre-13.1.1\lib"
LIBS += -L"E:\ProgramFiles\ogre-13.1.1\lib\OGRE"
LIBS += -lOgreBitesQtStatic
LIBS += -lOgreBitesStatic -lRenderSystem_GL3PlusStatic -lOgreGLSupportStatic -lOgreMeshLodGeneratorStatic -lOgreOverlayStatic -lOgrePagingStatic -lOgrePropertyStatic -lOgreRTShaderSystemStatic -lOgreVolumeStatic -lPlugin_BSPSceneManagerStatic -lPlugin_DotSceneStatic -lPlugin_OctreeSceneManagerStatic -lPlugin_OctreeZoneStatic -lPlugin_ParticleFXStatic -lPlugin_PCZSceneManagerStatic -lRenderSystem_GLES2Static -lRenderSystem_GLStatic -lOgreMainStatic -lOgreTerrainStatic -lCodec_STBIStatic -lzlibstatic
LIBS += -lSDL2main -lSDL2.dll -lfreetype -lpugixml
LIBS += -lopengl32 -lgdi32
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp
HEADERS +=
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I use Qt Dynamic for debugging and Qt Static for Releases.your error seems to indicate that some Qt MOC stuff is missing. Maybe it is a separate lib when doing a static build.
I tried to build the Bootstrap sample to static release. I have another errors:
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I think that Ogre cannot work with qmake and I should use CMake instead of qmake::
- Attachments
-
- QtCMake.png (5.45 KiB) Viewed 8793 times
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I look at this instruction but I do not understand it: https://ogrecave.github.io/ogre/api/lat ... html#cmake
Where should I copy this line:
Should I copy it to CMakeLists.txt? I added OGRE_DIR:
But when I copy the find_package I have the error:
Where should I copy this line:
I have these project files:find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem CONFIG)
Should I copy it to CMakeLists.txt? I added OGRE_DIR:
But when I copy the find_package I have the error:
E:\_Projects\Ogre3D\BootstrapCMakeQt5Cpp\CMakeLists.txt:5: error: Could not find a package configuration file provided by "OGRE" with any of the following names: OGREConfig.cmake ogre-config.cmake Add the installation prefix of "OGRE" to CMAKE_PREFIX_PATH or set "OGRE_DIR" to a directory containing one of the above files. If "OGRE" provides a separate development package or SDK, be sure it has been installed.
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I solve the problem in the message above! I just reopened Qt Creator:
-- Found OGRE
-- static : ON
-- components : Bites;MeshLodGenerator;Overlay;Paging;Property;RTShaderSystem;Terrain;Volume
-- plugins : Plugin_BSPSceneManager;Plugin_OctreeSceneManager;Plugin_PCZSceneManager;Plugin_ParticleFX;RenderSystem_GL;RenderSystem_GLES2;RenderSystem_GL3Plus;Codec_STBI
-- media : E:/ProgramFiles/ogre-13.1.1/Media
-- Configuring done
-- Generating done
-- Build files have been written to: E:/_Projects/Ogre3D/build-BootstrapCMakeQt5Cpp-Desktop_Qt_5_15_2_MinGW_32_bit-Debug
Elapsed time: 00:02.
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
How to add "libOgreBitesQtStatic.a" to my project?
I see that "libOgreBitesStatic.a" called like Bites, "libOgreRTShaderSystemStatic.a" called like RTShaderSystem. But how called "libOgreBitesQtStatic.a"? I tried to make this:find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem CONFIG)
But "Component 'BitesQt' is required but not found".find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem BitesQt CONFIG)
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
Please, send me what I should to copy in CMakeLists.txt instead of:
to run this example with "OgreApplicationContextQt": https://github.com/paroj/ogre/commit/b2 ... 729304d346# specify which components you need.
# The CONFIG flag makes sure you get OGRE instead of OGRE-next
find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem 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 OgreRTShaderSystem)
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I have default CMakeLists.txt from Qt and I edited two last lines:
But I have error here:
Code: Select all
find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem CONFIG)
target_link_libraries(BootstrapCMakeQt5Cpp PRIVATE Qt${QT_VERSION_MAJOR}::Widgets OgreBites OgreRTShaderSystem)
Code: Select all
cmake_minimum_required(VERSION 3.5)
project(BootstrapCMakeQt5Cpp LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# QtCreator supports the following variables for Android, which are identical to qmake Android variables.
# Check https://doc.qt.io/qt/deployment-android.html for more information.
# They need to be set before the find_package( ...) calls below.
#if(ANDROID)
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
# if (ANDROID_ABI STREQUAL "armeabi-v7a")
# set(ANDROID_EXTRA_LIBS
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libcrypto.so
# ${CMAKE_CURRENT_SOURCE_DIR}/path/to/libssl.so)
# endif()
#endif()
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
set(PROJECT_SOURCES
main.cpp
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
else()
if(ANDROID)
add_library(BootstrapCMakeQt5Cpp SHARED
${PROJECT_SOURCES}
)
else()
add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
endif()
endif()
find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem CONFIG)
target_link_libraries(BootstrapCMakeQt5Cpp PRIVATE Qt${QT_VERSION_MAJOR}::Widgets OgreBites OgreRTShaderSystem)
Code: Select all
else()
add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
endif()
Why? I read here: https://ogrecave.github.io/ogre/api/lat ... html#cmake that:CMake Error at CMakeLists.txt:44 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "ZLIB::ZLIB" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:44 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "SDL2::SDL2" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
These settings already include any third party libraries the Components depends on (e.g. SDL) - nothing more to do.
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: Is it possible to use Orge3D inside of Qt Widget?
https://github.com/paroj/ogre/commit/b2 ... b3c8edcR178Observer8 wrote: ↑Wed Oct 27, 2021 10:59 pm Please, send me what I should to copy in CMakeLists.txt instead of:
to run this example with "OgreApplicationContextQt": https://github.com/paroj/ogre/commit/b2 ... 729304d346# specify which components you need.
# The CONFIG flag makes sure you get OGRE instead of OGRE-next
find_package(OGRE REQUIRED COMPONENTS Bites RTShaderSystem 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 OgreRTShaderSystem)
-
- OGRE Team Member
- Posts: 1995
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1075
- Contact:
Re: Is it possible to use Orge3D inside of Qt Widget?
this likely only works for shared libs - for static libs you might have to do what cmake tells you8Observer8 wrote: ↑Wed Oct 27, 2021 11:12 pmWhy? I read here: https://ogrecave.github.io/ogre/api/lat ... html#cmake that:CMake Error at CMakeLists.txt:44 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "ZLIB::ZLIB" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:44 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "SDL2::SDL2" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
These settings already include any third party libraries the Components depends on (e.g. SDL) - nothing more to do.
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I added SDL2::SDL2 and ZLIB::ZLIB here:
But why do I see this message:
Code: Select all
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
else()
if(ANDROID)
add_library(BootstrapCMakeQt5Cpp SHARED
${PROJECT_SOURCES}
)
else()
find_package(OGRE REQUIRED COMPONENTS CONFIG)
add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
endif()
endif()
target_link_libraries(BootstrapCMakeQt5Cpp PRIVATE Qt${QT_VERSION_MAJOR}::Widgets OgreBitesQt OgreRTShaderSystem SDL2::SDL2 ZLIB::ZLIB)
CMake Error at CMakeLists.txt:46 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "SDL2::SDL2" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
CMake Error at CMakeLists.txt:46 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "ZLIB::ZLIB" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
How to add zlib and SDL2 to CMakeLists.txt?
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
Can I use SDL2 from Ogre installation or I must write my own "sdl2-config.cmake" for static build?
-
- Halfling
- Posts: 78
- Joined: Sat Feb 29, 2020 12:29 am
- x 2
Re: Is it possible to use Orge3D inside of Qt Widget?
I set everything. Why is it not work?
Why do I see this message:
Code: Select all
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
else()
if(ANDROID)
add_library(BootstrapCMakeQt5Cpp SHARED
${PROJECT_SOURCES}
)
else()
add_executable(BootstrapCMakeQt5Cpp
${PROJECT_SOURCES}
)
endif()
endif()
set(SDL2_LIBRARIES "${OGRE_DIR}/lib/libSDL2.dll.a;${OGRE_DIR}/lib/libSDL2main.a")
string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
find_package(OGRE SDL2 REQUIRED COMPONENTS CONFIG)
target_link_libraries(BootstrapCMakeQt5Cpp PRIVATE Qt${QT_VERSION_MAJOR}::Widgets OgreBitesQt OgreRTShaderSystem SDL2::SDL2 ZLIB::ZLIB)
CMake Error at CMakeLists.txt:44 (add_executable):
Target "BootstrapCMakeQt5Cpp" links to target "SDL2::SDL2" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?