I have been working with the SuperBuild on windows wiki, trying to get FlightGear to compile. I have been successful up to a point. I am a new at FlightGear compiling.
1. I followed the instruction on the SuperBuild for Windows.
2. I am using VS 2015 community edition and CMake-gui 3.7. Windows 10 uptodate.
3. I clone the repos as described there and update the cmakelists.txt
4. I am using an updated CMakeLists.txt file from another thread and added the msvc 140/1900 if else
see https://forum.flightgear.org/viewtopic.php?f=45&t=28486 - from hamzaalloush
5. I set cmake to the folders in Superbuild for windows wiki. My case E:/projects/fgmeta with fginstall and fgbuild also.
6. The first thing I had to deal with is CMAKE 3.7 and the missing Compiler - following error:
The C compiler identification is unknown
The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:5 (project):
No CMAKE_C_COMPILER could be found.
CMake Error at CMakeLists.txt:5 (project):
No CMAKE_CXX_COMPILER could be found.
To fix this you have to run MSBUILD cmd (dos) window, and then run cmake-gui.exe in that cmd window. You need to do this only once. This has to be done due to the missing environment variables for cl location. see http://stackoverflow.com/questions/31619296/cmake-does-not-find-visual-c-compiler
7. Open the solution FlightGear-Meta.sln and compile.
8. OSG does not compile due to some missing and bad cmake args.
fixed the following:
"E:\Projects\fgbuild\osgbuild\ALL_BUILD.vcxproj" (default target) (1) ->
2> "E:\Projects\fgbuild\osgbuild\src\osgPlugins\curl\osgdb_curl.vcxproj" (default target) (33) ->
2> (Link target) ->
2>LINK : fatal error LNK1104: cannot open file 'E:\Projects\fgmeta\windows-3rd-party\msvc140\3rdParty.x64\lib\libcurl_imp.lib' [E:\Projects\fgbuild\osgbuild\src\osgPlugins\curl\osgdb_curl.vcxproj]
2>
2>
2> "E:\Projects\fgbuild\osgbuild\ALL_BUILD.vcxproj" (default target) (1) ->
2> "E:\Projects\fgbuild\osgbuild\src\osgPlugins\ktx\osgdb_ktx.vcxproj" (default target) (56) ->
2> (ClCompile target) ->
2>e:\projects\fgbuild\src\osg\src\osgplugins\ktx\ReaderWriterKTX.h(17): error C2371: 'int8_t': redefinition; different basic types [E:\Projects\fgbuild\osgbuild\src\osgPlugins\ktx\osgdb_ktx.vcxproj]
Had to change cmake libcurl_imp.lib to libcurl.lib
Had to comment out error int8_t in fgbuild - go to osgbuild folder open sln - don't like this but would not compile otherwise.
open osgdb_ktx project
comment out in ktx h file line 17
#ifdef _MSC_VER
//typedef __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
#include <stdint.h>
#endif
9. recompile and get the following error in simgear compile.
3> CMake Error at CMakeLists.txt:217 (message):
3> Please rebuild OSG with OSG_USE_UTF8_FILENAME set to ON
3>
Tried adding -DOSG_USE_UTF8_FILENAME:BOOL=ON
to the osg cmake args and did a force rebuild on osg. Still getting the same errors. ( i had this fixed in previous tries, but now still there.)
10. After I got past simgear I had an issue with missing gdal files cpp and .h. in the 3rdparty include folder Is there a step I am missing?
Edit 2016-11-27
11. getting up to flightgear compile and being stopped by this error:
4> CMake Error at CMakeLists.txt:308 (find_package):
4> Could not find a package configuration file provided by "SimGear"
4> (requested version 2017.1.0) with any of the following names:
4>
4> SimGearConfig.cmake
4> simgear-config.cmake
4>
4> Add the installation prefix of "SimGear" to CMAKE_PREFIX_PATH or set
4> "SimGear_DIR" to a directory containing one of the above files. If
4> "SimGear" provides a separate development package or SDK, be sure it has
4> been installed.
4>
I can see the config files in fgbuild/sgbuild/simgear folder but if I set
-DSimGear_DIR=${FGMETA_DIR}/fgbuild/sgbuild/SimGear
I get the same error
edit:
fix error with -DSimGear_DIR=${SG_INSTALL_PREFIX}/lib/cmake/SimGear
updated cmakelists.txt
12. flightgear compile now errors on
4>E:\Projects\fgmeta\flightgear\3rdparty\iaxclient\lib\audio_openal.c(10): fatal error C1083: Cannot open include file: 'AL/al.h': No such file or directory [E:\Projects\fgbuild\fgbuild\3rdparty\iaxclient\lib\iaxclient_lib.vcxproj]
4>
4> 242 Warning(s)
4> 1 Error(s)
the is a folder AL with al.h in the 3rparty folder
Here is the new updated CmakeList.txt file I am using. Would appreciate any help in fixing this.
Ron
- Code: Select all
cmake_minimum_required (VERSION 2.8.0)
include (ExternalProject)
project(FlightGear-Meta)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
message(STATUS "Default install dir set to ${CMAKE_INSTALL_PREFIX}")
endif()
set(SG_DEPS OSG)
set(FG_DEPS SimGear)
set(SG_CMAKE_ARGS "")
set(FG_CMAKE_ARGS "")
set(OSG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(SG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(FG_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(PLIB_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(RTI_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
set(FGMETA_DIR ${CMAKE_CURRENT_LIST_DIR})
# OpenSceneGraph configuration
#set(OSG_SOURCE http://www.openscenegraph.org/downloads/developer_releases/OpenSceneGraph-3.2.0.zip)
set(OSG_SOURCE https://github.com/openscenegraph/osg.git)
set(OSG_TAG OpenSceneGraph-3.2)
if (APPLE)
# force disable Qt and Jasper
set(OSG_CMAKE_ARGS
-DOSG_USE_QT=0
-DJASPER_LIBRARY=
)
# OSG with some patches applied for Mac
set(OSG_SOURCE https://github.com/zakalawe/osg.git)
set(OSG_TAG fgfs-osg-32)
elseif(MSVC)
set(OSG_MSVC "msvc")
if (${MSVC_VERSION} EQUAL 1900)
set(OSG_MSVC ${OSG_MSVC}140)
elseif (${MSVC_VERSION} EQUAL 1700)
set(OSG_MSVC ${OSG_MSVC}110)
elseif (${MSVC_VERSION} EQUAL 1600)
set(OSG_MSVC ${OSG_MSVC}100)
else (${MSVC_VERSION} EQUAL 1700)
set(OSG_MSVC ${OSG_MSVC}90)
endif (${MSVC_VERSION} EQUAL 1900)
set(WinDeps "windows-3rd-party")
set(MSVC_DIR ${OSG_MSVC})
if (CMAKE_CL_64)
set(OSG_MSVC ${OSG_MSVC}-64)
set(RDPARTY_PREFIX 3rdParty.x64)
list(APPEND FG_CMAKE_ARGS -DWITH_FGPANEL=OFF)
else ()
set(RDPARTY_PREFIX 3rdParty)
endif (CMAKE_CL_64)
SET(OSG_CMAKE_ARGS
-DOSG_USE_QT:BOOL=OFF
-DBUILD_OSG_APPLICATIONS:BOOL=ON
-DOSG_USE_UTF8_FILENAME:BOOL=ON
-DOSG_PLUGIN_SEARCH_INSTALL_DIR_FOR_PLUGINS:BOOL=OFF
-DACTUAL_3RDPARTY_PREFIX:PATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}
-DCMAKE_LIBRARY_PATH:STRING=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib
-DCMAKE_INCLUDE_PATH:STRING=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include;${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include/freetype
-DCURL_INCLUDE_DIR:PATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include
-DTIFF_INCLUDE_DIR:PATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include
-DGDAL_INCLUDE_DIR:PATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include
-DGDAL_LIBRARY:FILEPATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/gdal_i.lib
-DTIFF_LIBRARY:FILEPATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/libtiff.lib
-DCURL_LIBRARY:FILEPATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/libcurl.lib
-DFREETYPE_LIBRARY:FILEPATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/freetype.lib
-DFREETYPE_INCLUDE_DIR:PATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include;${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include/freetype
)
# for compatability with MSVC directory layout
set(OSG_INSTALL_PREFIX ${OSG_INSTALL_PREFIX}/${OSG_MSVC}/OpenSceneGraph)
set(FGRUN_INSTALL_PREFIX ${FGRUN_INSTALL_PREFIX}/${OSG_MSVC}/FGRun)
set(FG_INSTALL_PREFIX ${FG_INSTALL_PREFIX}/${OSG_MSVC}/FlightGear)
set(SG_INSTALL_PREFIX ${SG_INSTALL_PREFIX}/${OSG_MSVC}/SimGear)
#list(APPEND OSG_DEPS WinDeps)
else()
# normal OSG
endif()
ExternalProject_Add(OSG
DEPENDS ${OSG_DEPS}
PREFIX ${CMAKE_BINARY_DIR}
GIT_REPOSITORY ${OSG_SOURCE}
GIT_TAG ${OSG_TAG}
BINARY_DIR osgbuild
CMAKE_ARGS ${OSG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${OSG_INSTALL_PREFIX}
)
# Because OSG install the libraries in lib64/ instead of lib/
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
ExternalProject_Add_Step(OSG after_install
COMMAND ${CMAKE_COMMAND} -E create_symlink ${OSG_INSTALL_PREFIX}/lib64 ${OSG_INSTALL_PREFIX}/lib
DEPENDEES install
)
endif()
# FIXME install of OpenRTI is failing on Windows, files in PREFIX/share which
# are ending up in C:/Program Files/OpenRTI
if (FALSE)
ExternalProject_Add(OpenRTI
PREFIX ${CMAKE_BINARY_DIR}
DOWNLOAD_COMMAND GIT_REPOSITORY git://git.code.sf.net/p/openrti/OpenRTI
BINARY_DIR rtibuild
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${RTI_INSTALL_PREFIX}
)
list(APPEND SG_DEPS OpenRTI)
list(APPEND SG_CMAKE_ARGS -DENABLE_RTI=1)
list(APPEND FG_CMAKE_ARGS -DENABLE_RTI=1)
endif()
ExternalProject_Add(SimGear
PREFIX ${CMAKE_BINARY_DIR}
DEPENDS ${SG_DEPS}
DOWNLOAD_COMMAND "" # no need to download
UPDATE_COMMAND "" # or update.
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/simgear
BINARY_DIR sgbuild
CMAKE_ARGS ${SG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${SG_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${OSG_INSTALL_PREFIX} -DMSVC_3RDPARTY_ROOT=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX} -DBOOST_ROOT=${FGMETA_DIR}/${WinDeps} -DBoost_INCLUDE_DIR=${FGMETA_DIR}/${WinDeps} -DOPENAL_LIBRARY=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/OpenAL32.lib -DOSGTEXT_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgText.lib -DOSGSIM_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgSim.lib -DOSGDB_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgDB.lib -DOSGPARTICLE_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgParticle.lib -DOSGGA_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgGA.lib -DOSGVIEWER_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgViewer.lib -DOSGUTIL_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osgUtil.lib -DOSG_LIBRARY=${OSG_INSTALL_PREFIX}/lib/osg.lib -DOPENTHREADS_LIBRARY=${OSG_INSTALL_PREFIX}/lib/OpenThreads.lib -DZLIB_LIBRARY=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/zlib.lib -DZLIB_INCLUDE_DIR=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include -DCURL_INCLUDE_DIR:PATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include -DCURL_LIBRARY:FILEPATH=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/libcurl.lib -DENABLE_TESTS=OFF -DBUILD_TESTING=OFF
)
# because we download SimGear externally (via Git submodules),
# the change-detection doesn't work. Ensure we always change
# for changes
ExternalProject_Add_Step(SimGear forcebuild
ALWAYS 1
COMMAND ${CMAKE_COMMAND} -E echo foo
DEPENDERS build
)
# on Windows, PLIB is in the 3rd-party dependencies zip
if (NOT WIN32)
set(PLIB_ARGS --disable-pw --disable-sl --disable-psl --disable-ssg --disable-ssgaux)
ExternalProject_Add(PLIB
PREFIX ${CMAKE_BINARY_DIR}
URL http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz
URL_HASH MD5=47a6fbf63668c1eed631024038b2ea90
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=${PLIB_INSTALL_PREFIX} ${PLIB_ARGS}
BUILD_IN_SOURCE 1
)
list(APPEND FG_DEPS PLIB)
endif()
ExternalProject_Add(FlightGear
PREFIX ${CMAKE_BINARY_DIR}
DEPENDS ${FG_DEPS}
DOWNLOAD_COMMAND "" # no need to download
UPDATE_COMMAND "" # or update.
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/flightgear
BINARY_DIR fgbuild
CMAKE_ARGS ${FG_CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${FG_INSTALL_PREFIX} -DCMAKE_PREFIX_PATH=${OSG_INSTALL_PREFIX} -DADDITIONAL_LIBRARY_PATHS=${SG_INSTALL_PREFIX} -DMSVC_3RDPARTY_ROOT=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX} -DBOOST_ROOT=${FGMETA_DIR}/${WinDeps} -DBoost_INCLUDE_DIR=${FGMETA_DIR}/${WinDeps} -DZLIB_LIBRARY=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/zlib.lib -DZLIB_INCLUDE_DIR=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/include -DOPENAL_LIBRARY=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/OpenAL32.lib -DPLIB_INCLUDE_DIR=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/plib/include -DPLIB_UL_LIBRARY_RELEASE=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/ul.lib -DPLIB_PUI_LIBRARY_RELEASE=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/pui.lib -DPLIB_SG_LIBRARY_RELEASE=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/sg.lib -DPLIB_PUAUX_LIBRARY_RELEASE=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/puAux.lib -DPLIB_JS_LIBRARY_RELEASE=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/js.lib -DPLIB_FNT_LIBRARY_RELEASE=${FGMETA_DIR}/${WinDeps}/${MSVC_DIR}/${RDPARTY_PREFIX}/lib/fnt.lib -DOSGTEXT_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGSIM_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGDB_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGPARTICLE_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGFX_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGUTIL_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGVIEWER_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSGGA_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOSG_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DOPENTHREADS_LIBRARY=${OSG_INSTALL_PREFIX}/lib -DSimGear_DIR=${SG_INSTALL_PREFIX}/lib/cmake/SimGear -DENABLE_QT=OFF
)
# because we download FlightGear externally (via Git submodules),
# the change-detection doesn't work. Ensure we always change
# for changes
ExternalProject_Add_Step(FlightGear forcebuild
ALWAYS 1
COMMAND ${CMAKE_COMMAND} -E echo foo
DEPENDERS build
)