2016-11-07 125 views
0

那麼,我是CMake的新手,並且想要在eclipse中編輯飛行模擬代碼而不是Visual Studio。爲此,我下載了Simgear,CMake,Boost庫,open scene graph和openalsoft的源代碼。CMake的Openscenegraph庫的鏈接

現在我有所有可用的數據,但我不知道在哪裏放置這些庫的一些。因此,當我運行CMake並參考我的飛行代碼時,它抱怨說openscenegraph庫沒有安裝。

請幫助我在哪裏需要把所有這些文件,以便使用CMake將我的代碼轉換爲eclipse。我已經安裝了boost和openal庫。只有問題是openscenegraph庫,我把程序文件放在以下路徑「C:\ Program Files \ OpenSceneGraph-3.4.0」,但CMake無法訪問它。錯誤代碼是

Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong. 
 
version is 2016 dot 3 dot 1 
 
ignoring: ^C:/Media/Project/study material/flight gear/simgear-2016.3.1/.git;\\.gitignore;Makefile.am;~$; 
 
Library installation directory: lib 
 
Boost version: 1.62.0 
 
SimGear mode: NORMAL 
 
Found OpenAL: C:/Program Files/OpenAL/OpenAL32.lib 
 
Sound support: ENABLED 
 
Could NOT find osgText (missing: OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR) 
 
Could NOT find osgSim (missing: OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR) 
 
Could NOT find osgDB (missing: OSGDB_LIBRARY OSGDB_INCLUDE_DIR) 
 
Could NOT find osgParticle (missing: OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR) 
 
Could NOT find osgGA (missing: OSGGA_LIBRARY OSGGA_INCLUDE_DIR) 
 
Could NOT find osgViewer (missing: OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR) 
 
Could NOT find osgUtil (missing: OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR) 
 
Could NOT find osg (missing: OSG_LIBRARY OSG_INCLUDE_DIR) 
 
Could NOT find OpenThreads (missing: OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR) 
 
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message): 
 
    Could NOT find OpenSceneGraph (missing: OPENSCENEGRAPH_LIBRARIES 
 
    OPENSCENEGRAPH_INCLUDE_DIR OSGTEXT_FOUND OSGSIM_FOUND OSGDB_FOUND 
 
    OSGPARTICLE_FOUND OSGGA_FOUND OSGVIEWER_FOUND OSGUTIL_FOUND OSG_FOUND 
 
    OPENTHREADS_FOUND) (Required is at least version "3.2.0") 
 
Call Stack (most recent call first): 
 
    C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) 
 
    C:/Program Files/CMake/share/cmake-3.7/Modules/FindOpenSceneGraph.cmake:223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) 
 
    CMakeLists.txt:243 (find_package) 
 

 

 
Configuring incomplete, errors occurred! 
 
See also "C:/Users/shajeeh/Documents/CMake/CMakeFiles/CMakeOutput.log".

+0

複製[在eclipse中使用cmake編譯飛行代碼](http://stackoverflow.com/questions/40373379/compilation-of-使用cmake代碼) – wasthishelpful

+0

什麼**方法**你用來找到OpenAL庫[在那個問題](http://stackoverflow.com/questions/40373379/compilation-of-flightgear-code-in-eclipse-using-cmake)碼功能於使用-cmake的Eclipse的)?你是否嘗試過(以及如何)這種OSG庫的方法?在CMake下有很多用於開發的庫,並且對每個**庫有不同的問題......它不是Stack Overflow的目的。 – Tsyvarev

+0

我在Findopenal.cmake中輸入了一個代碼片段來解決我的庫的位置,並且確實有效。我試圖對findopenscenegraph.cmake做同樣的事情,但它給出了錯誤......無法找到由「C:/ Program Files/OpenSceneGraph-3.4.0/build」提供的軟件包配置文件以下名稱: C:/ Program Files/OpenSceneGraph-3.4.0/buildConfig.cmake c:/ program files/openscenegraph-3.4.0/build-config.cmake –

回答

0

我不是一個專家的CMake,這裏有些東西我爲了在Linux中創建ROS & OSG項目所做的:

添加一個環境變量(如果它現在還沒有)的.bashrc文件:

出口PATH = $ {PATH}:.../OpenSceneGraph的-3.4.0/bin中(你的絕對路徑)

然後在CMake的文件中加入:

FIND_PACKAGE(OpenSceneGraph的成分osgSim osgUtil osgDB osgFX osgGA osgTerrain osgViewer osgText osgWidget osgManipulator OSG osgShadow)

target_link_libraries(name_of_your_executable $ {PROJECT_NAME} $ {OPENSCENEGRAPH_LIBRARIES})

對於更多信息查看CMake文檔herehere