简体   繁体   English

在Linux上静态编译osgconv并支持obj文件

[英]Compiling osgconv on Linux statically with support for obj files

I've compiled OpenSceneGraph 3.4.0 on Linux (32-bit) setting OFF DYNAMIC_OPENSCENEGRAPH and DYNAMIC_OPENTHREADS flags and enabling apps and examples on CMake. 我已经在Linux(32位)上编译了OpenSceneGraph 3.4.0,设置了DYNAMIC_OPENSCENEGRAPH和DYNAMIC_OPENTHREADS标志为OFF,并在CMake上启用了应用程序和示例。

Build was successful and I have static libraries and also the example osgstaticviewer working correctly. 构建成功,并且我有静态库,示例osgstaticviewer也能正常工作。

Then I have tried compiling osgconv using only static libraries using a CMakeLists.txt copied from osgstaticviewer and modified adding obj support and osgconv original source files. 然后,我尝试仅使用静态库来编译osgconv,并使用从osgstaticviewer复制的CMakeLists.txt进行修改,并添加obj支持和osgconv原始源文件进行修改。 Compilation works and resulting executable works but I'm not able to convert an obj file to an osg file. 编译有效且生成的可执行文件有效,但是我无法将obj文件转换为osg文件。 In particular, if I try the command: 特别是,如果我尝试命令:

./osgconv myModel.obj myModel.osg

I obtain the following warning: 我收到以下警告:

Warning: Could not find plugin to read objects from file "myModel.obj".
Error no data loaded.

What's the procedure for linking statically osg plugins? 静态链接osg插件的过程是什么?

Below the CMakeLists.txt used to compile osgconv: 在用于编译osgconv的CMakeLists.txt下面:

#this file is automatically generated 

SET(TARGET_ADDED_LIBRARIES osgdb_obj osgdb_ive osgdb_openflight osgdb_osg osgdb_rgb osgdb_osg )
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
    osgdb_deprecated_osg osgdb_deprecated_osgparticle osgdb_deprecated_osganimation
    osgdb_deprecated_osgfx osgdb_deprecated_osgsim osgdb_deprecated_osgtext
    osgdb_deprecated_osgviewer osgdb_deprecated_osgshadow osgdb_deprecated_osgterrain
    osgdb_deprecated_osgvolume osgdb_deprecated_osgwidget
)
SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES}
    osgdb_serializers_osg osgdb_serializers_osgparticle osgdb_serializers_osgtext
    osgdb_serializers_osgterrain osgdb_serializers_osganimation osgdb_serializers_osgfx
    osgdb_serializers_osgshadow osgdb_serializers_osgmanipulator osgdb_serializers_osgsim
    osgdb_serializers_osgvolume
)

IF(FREETYPE_FOUND)
    ADD_DEFINITIONS(-DUSE_FREETYPE)
    SET(TARGET_ADDED_LIBRARIES ${TARGET_ADDED_LIBRARIES} osgdb_freetype)
ENDIF(FREETYPE_FOUND)

SET(TARGET_SRC
    OrientationConverter.cpp 
    osgconv.cpp
)
SET(TARGET_H
    OrientationConverter.h
)

SETUP_APPLICATION(osgconv)

您需要修改osgconv的源,以使USE_OSGPLUGIN宏在此处具有对各种插件的绑定支持: http ://trac.openscenegraph.org/projects/osg//browser/OpenSceneGraph/trunk/examples/osgstaticviewer/osgstaticviewer.cpp# L40

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM