VS2019编译OSG

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

VS2019编译OSG

资源准备

由于3rd依赖项很多编译耗时可以在牛人编译的版本基础上开展。
杨石兴编译博客
百度网盘
链接https://pan.baidu.com/s/101IXFgvKQhQOEbfLa-ztZg
提取码osgb

编译

1. 编译文件目录组织

在这里插入图片描述

2. 特殊3rd库编译

a. freetype
问题直接使用下载的编译库在编译osgdb_freetype.dll时候会报如下错误。
编译错误

freetype.lib(sfnt.obj) : error LNK2019: 无法解析的外部符号 png_create_read_struct函数 Load_SBit_Png
中引用了该符号 [D:\OpenSceneGraph\build22\src\osgPlugins\freetype\osgdb_freetype.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: 无法解析的外部符号 png_set_longjmp_fn函数 Load_SBit_Png 中引用
了该符号 [D:\OpenSceneGraph\build22\src\osgPlugins\freetype\osgdb_freetype.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: 无法解析的外部符号 png_create_info_struct函数 Load_SBit_Png
中引用了该符号 [D:\OpenSceneGraph\build22\src\osgPlugins\freetype\osgdb_freetype.vcxproj]
freetype.lib(sfnt.obj) : error LNK2019: 无法解析的外部符号 png_read_info函数 Load_SBit_Png 中引用了该符号
[D:\OpenSceneGraph\build22\src\osgPlugins\freetype\osgdb_freetype.vcxproj]

解决从源码编译freetype只保留zlib压缩方式cmake设置如下所示
在这里插入图片描述
b. OCCT编译

c. 其他依赖包直接使用下载的包即可牛人已经铺好路

3. cmake设置osg相关选项

其中特殊选项设置如下
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
完成所有配置后生成工程。

4. 编译

其中Plugins opencascade工程里需要改一下源码

// 214行 OCCT7.7中Nodes接口已经不存在
gp_Pnt pt = (triangulation->Nodes())(j).Transformed(transformation * location.Transformation());
// 改为
gp_Pnt pt = triangulation->Node(j).Transformed(transformation * location.Transformation());

保存更改后编译即可。

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6