为什么osgEarth没有用Qt构建?

时间:2018-04-25 09:14:52

标签: c++ qt osgearth

我试图用Quarts构建osgEarth。官方网站上的说明如下:

  

将QT_QMAKE_EXECUTABLE CMake变量指向您想要的qmake.exe   使用和CMake将填充所有其他QT变量。

好。我做了以下事情:

cmake -D QT_QMAKE_EXECUTABLE=/Users/garbart/Qt/5.10.0/clang_64/bin/qmake CMakeLists.txt 
make

并收到以下错误:

[ 19%] Built target osgEarth
[ 25%] Built target osgEarthSymbology
[ 32%] Built target osgEarthFeatures
[ 35%] Built target osgEarthAnnotation
[ 44%] Built target osgEarthUtil
[ 44%] Building CXX object src/osgEarthQt/CMakeFiles/osgEarthQt5.dir/ViewerWidget.cpp.o
In file included from /Users/garbart/Desktop/osgearth-master/src/osgEarthQt/ViewerWidget.cpp:31:
In file included from /Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/QtGui:45:
In file included from /Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglcontext.h:61:
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglversionfunctions.h:1089:23: error: 
      unknown type name 'GLDEBUGPROC'
    QT_OPENGL_DECLARE(QT_OPENGL_4_3_FUNCTIONS);
                      ^
In file included from /Users/garbart/Desktop/osgearth-master/src/osgEarthQt/ViewerWidget.cpp:31:
In file included from /Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/QtGui:47:
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglextrafunctions.h:472:33: error: 
      unknown type name 'GLDEBUGPROC'
    void glDebugMessageCallback(GLDEBUGPROC callback, const void *userParam);
                                ^
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglextrafunctions.h:758:23: error: 
      unknown type name 'GLDEBUGPROC'
    QT_OPENGL_DECLARE(QT_OPENGL_EXTRA_FUNCTIONS)
                      ^
/Users/garbart/Qt/5.10.0/clang_64/lib/QtGui.framework/Headers/qopenglextrafunctions.h:2213:59: error: 
      unknown type name 'GLDEBUGPROC'
inline void QOpenGLExtraFunctions::glDebugMessageCallback(GLDEBUGPROC ca...
                                                          ^
4 errors generated.
make[2]: *** [src/osgEarthQt/CMakeFiles/osgEarthQt5.dir/ViewerWidget.cpp.o] Error 1
make[1]: *** [src/osgEarthQt/CMakeFiles/osgEarthQt5.dir/all] Error 2
make: *** [all] Error 2

QT 5.10.0 osgEarth 2.10

1 个答案:

答案 0 :(得分:1)

这就是我构建OSG,osgQt和osgEarth的方式。

获取OSG,进行配置和构建:

git clone --branch OpenSceneGraph-3.6.2 https://github.com/openscenegraph/OpenSceneGraph.git

mkdir osg-build
cd osg-build
cmake ../OpenSceneGraph
make
sudo make install

获取osgQt,进行配置和构建:

git clone https://github.com/openscenegraph/osgQt.git
mkdir osgqt-build
cd osgqt-build
cmake ../osgQt -DCMAKE_PREFIX_PATH=/opt/Qt/5.6.3/gcc_64/lib/cmake
make
sudo make install

由于osgQt跟不上OSG,所以最后一步可能无法建立。

您将需要编辑CMakeLists.txt并设置用于查找Qt和OSG的目录路径。 CMakeLists.txt还硬引用了特定版本的OSG,这需要进行修改。关于这些问题的清单上已经进行了很多讨论,因此在您阅读本文时可能已经对此进行了分类。

git clone https://github.com/gwaldron/osgearth.git
mkdir osgearth-build
cd osgearth-build
cmake ../osgearth -DCMAKE_PREFIX_PATH=/opt/Qt/5.6.3/gcc_64/lib/cmake

使用ccmake .通过以下设置配置构建:

OSGEARTH_QT_BUILD                ON  
OSGEARTH_QT_BUILD_LEGACY_WIDGE   ON

构建并安装:

make
sudo make install

注意:Qt 5.11也应该起作用。