当前位置:网站首页>【osg】osg开发(02)—基于MinGW编译构建osgQt库
【osg】osg开发(02)—基于MinGW编译构建osgQt库
2022-06-21 06:55:00 【iriczhao】
在osg构建完成后,开发中我们需要在Qt中集成,以使用Qt很多的功能开发软件,那么我们还需要单独编译一个在Qt中使用的Widget。
一、使用Cmake生成osgQt的编译构建工程
(1-1)获取osgQt源码
1、《GitHub - mathieu/osgQt》
https://github.com/mathieu/osgQt
2、《GitHub - openscenegraph/osgQt》
https://github.com/openscenegraph/osgQt
以上有两个osgQt版本,第一个生成osgQt.dll,第二个是osg156-osgQOpenGL.dll,osgQOpenGL是更新后osg的Qt部件方案,本文使用osgQOpenGL版本。
(1-2)生成Cmake环境配置参数


在CMake图形界面软件中,点击“Generate”生成osgQt的构建环境和Makefile
二、编译osgQt
编译时,需要使用构件好的OSG,需要将库文件、头文件、动态链接库的文件路径加入到系统环境变量中,以便cmake在构建osgQt工程目录时使用,否则cmkae生成makefile时会出错。

以管理员方式打开Qt 5.13.0(MinGW 7.3.0 32-bit)命令行,切换到生成的构建目录下,键入:
Mingw32-make -j12
进行编译。
编译完成后,使用:
Mingw32-make install
将构建好的osgQt安装到指定的目录下,完成后,将生成如下的目录:

接着就可以在QtCreator中使用osgQt啦!
三、问题记录
(3-1)需要将构建出的软件库集成在一起
在前文中,我们已经完成了osg的构建,这时候我们还需要最后一步:将编译构建生成好的osg和osgQt的库目录(bin、include、lib)组合在一起。在程序运行时,可能会出现找不到zlib.dll动态链接库的情况,这时候,需要下载zlib.dll的源码库以MinGW编译套件进行构建,生成相关的.dll即可。这个过程与osgQt的构建操作一样。
zlib是一个跨平台的无损数据压缩库,如下图所示:

(选择一种文件格式下载即可)
(3-2)后续开发
因osg对msvc编译套件的支持生态要比mingw好,网上有许多已经构建好的osg-msvc版的运行环境和库资源(特别是osg国内网站),我们可以直接拿过来使用。
那么为什么文本还要自己编译MinGW的osg版,研学下osg环境的构建过程,自己动手,丰衣足食,哈哈哈!
边栏推荐
- 什么是Eureka?Eureka能干什么?Eureka怎么用?
- Matplotlib subgraph beautification
- 缺失数据填补数据集介绍(1)——多种数据集介绍及数据集预处理(breast、covertype、credit、eeg、iris和letter)
- [mapbox] 基础
- 海明码校验【简单详细】
- [GNN] Application of GNN neural network toolbox and MATLAB simulation
- [mapbox] Basics
- Markdown数学语法【详细总结】
- MySQL使用什么作为主键比较好
- Candy tunnel JS special effect code
猜你喜欢
随机推荐
Tweenmax oscilloscope 3D animation
Do you know all the extension racks of ThinkPHP?
Analyse des données: indicateurs communs pour différentes industries
Quantitative analysis of single cell transcriptome using cell Ranger
【基于栈的二叉树中序遍历】二叉树的中序遍历+栈,O(h)的空间复杂度
152 Solana getting started (16) - create a metaplexnft
什么是Eureka?Eureka能干什么?Eureka怎么用?
Work
缺失数据填补数据集介绍(1)——多种数据集介绍及数据集预处理(breast、covertype、credit、eeg、iris和letter)
Construction methods of file class and various common methods
Scaler in scikit learn
How to solve the problem of MySQL?
[JS] intercepting string
Ztmao theme cat WordPress Theme classic lost version /wp website template download station source code + global SEO function setting
Two ideas of I2C driver implementation (I2C dev.c and I2C core.c)
@nonnull annotation of Lombok
Argo CD usage
Data analysis part: common indicators of different industries
Excel_submit
Pyg tutorial (4): Customizing datasets








