VS2019编译OSG

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());

保存更改后,编译即可。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值