2010-11-30 10:08:30 +00:00
|
|
|
|
2011-01-28 18:30:27 +00:00
|
|
|
if (MSVC)
|
2013-11-13 21:48:55 +00:00
|
|
|
set( RESOURCE_FILE flightgear.rc )
|
2011-01-28 18:30:27 +00:00
|
|
|
endif (MSVC)
|
|
|
|
|
2010-11-30 10:08:30 +00:00
|
|
|
set(SOURCES
|
|
|
|
bootstrap.cxx
|
|
|
|
fg_commands.cxx
|
2017-03-21 20:59:35 +00:00
|
|
|
fg_scene_commands.cxx
|
2010-11-30 10:08:30 +00:00
|
|
|
fg_init.cxx
|
|
|
|
fg_io.cxx
|
|
|
|
fg_os_common.cxx
|
|
|
|
fg_props.cxx
|
2013-03-16 15:43:55 +00:00
|
|
|
FGInterpolator.cxx
|
2010-11-30 10:08:30 +00:00
|
|
|
globals.cxx
|
2012-04-21 18:17:42 +00:00
|
|
|
locale.cxx
|
2010-11-30 10:08:30 +00:00
|
|
|
logger.cxx
|
|
|
|
main.cxx
|
|
|
|
options.cxx
|
|
|
|
util.cxx
|
2012-09-18 19:50:28 +00:00
|
|
|
positioninit.cxx
|
2012-09-30 15:34:51 +00:00
|
|
|
subsystemFactory.cxx
|
2013-12-09 00:13:44 +00:00
|
|
|
screensaver_control.cxx
|
2011-01-28 18:30:27 +00:00
|
|
|
${RESOURCE_FILE}
|
Integrate the EmbeddedResourceManager into FlightGear
${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
(currently empty) is automatically "compiled" into
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.[ch]xx by
fgrcc inside the build directory. These files are incorporated into the
FlightGear build (FlightGear-resources.cxx is linked into FlightGear).
When the XML embedded resource declaration file added here,
FlightGear-resources.xml, is compiled, fgrcc is passed the
--root=${CMAKE_SOURCE_DIR} option, so that files referred to in
FlightGear-resources.xml are looked up relatively to the root directory
of the FlightGear repository. One could use a second XML embedded
resource declaration file compiled with a different --root option to
grab files from FGData, for instance. I would name such a file
FGData-resources.xml to be consistent with the current naming scheme.
Note: this --root option applies to the paths of real files. Don't
confuse it with the 'prefix' attribute of <qresource> elements
inside XML resource declaration files (such as
FlightGear-resources.xml), which applies to the virtual path of
each resource defined beneath.
The commands in src/Main/CMakeLists.txt ensure that
FlightGear-resources.xml is recompiled with fgrcc whenever it is
changed, and obviously also when FlightGear-resources.cxx or
FlightGear-resources.hxx is missing. However, CMake doesn't know how to
parse fgrcc XML resource declaration files, therefore when a resource is
modified but the XML file it is declared in is not (here,
FlightGear-resources.xml), you have to trigger yourself a recompilation
of the XML resource declaration file to see the new resource contents
inside FlightGear. The easiest ways to do so are:
- either update the timestamp of the XML resource declaration file;
- or remove one or both of the generated files
(FlightGear-resources.cxx and FlightGear-resources.hxx here).
The EmbeddedResourceManager is created in fgMainInit() just after
Options::processOptions() set the language that was either requested by
the user or obtained from the system (locales). Resources from
FlightGear-resources.cxx are added to it, after which
EmbeddedResourceManager::selectLocale() is called with the user's
preferred locale (obtained with FGLocale::getPreferredLanguage()).
Upon reset (fgStartNewReset()), EmbeddedResourceManager::selectLocale()
is called in a similar way after Options::processOptions(), however in
this case the EmbeddedResourceManager instance doesn't have to be
recreated.
2017-04-27 22:09:14 +00:00
|
|
|
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx
|
2010-11-30 10:08:30 +00:00
|
|
|
)
|
2011-06-26 06:49:37 +00:00
|
|
|
|
|
|
|
set(HEADERS
|
|
|
|
fg_commands.hxx
|
|
|
|
fg_init.hxx
|
|
|
|
fg_io.hxx
|
|
|
|
fg_props.hxx
|
2013-03-16 15:43:55 +00:00
|
|
|
FGInterpolator.hxx
|
2011-06-26 06:49:37 +00:00
|
|
|
globals.hxx
|
2012-04-21 18:17:42 +00:00
|
|
|
locale.hxx
|
2011-06-26 06:49:37 +00:00
|
|
|
logger.hxx
|
|
|
|
main.hxx
|
|
|
|
options.hxx
|
|
|
|
util.hxx
|
2012-09-18 19:50:28 +00:00
|
|
|
positioninit.hxx
|
2012-09-30 15:34:51 +00:00
|
|
|
subsystemFactory.hxx
|
2013-11-16 14:22:34 +00:00
|
|
|
AircraftDirVisitorBase.hxx
|
2013-12-09 00:13:44 +00:00
|
|
|
screensaver_control.hxx
|
Integrate the EmbeddedResourceManager into FlightGear
${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
(currently empty) is automatically "compiled" into
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.[ch]xx by
fgrcc inside the build directory. These files are incorporated into the
FlightGear build (FlightGear-resources.cxx is linked into FlightGear).
When the XML embedded resource declaration file added here,
FlightGear-resources.xml, is compiled, fgrcc is passed the
--root=${CMAKE_SOURCE_DIR} option, so that files referred to in
FlightGear-resources.xml are looked up relatively to the root directory
of the FlightGear repository. One could use a second XML embedded
resource declaration file compiled with a different --root option to
grab files from FGData, for instance. I would name such a file
FGData-resources.xml to be consistent with the current naming scheme.
Note: this --root option applies to the paths of real files. Don't
confuse it with the 'prefix' attribute of <qresource> elements
inside XML resource declaration files (such as
FlightGear-resources.xml), which applies to the virtual path of
each resource defined beneath.
The commands in src/Main/CMakeLists.txt ensure that
FlightGear-resources.xml is recompiled with fgrcc whenever it is
changed, and obviously also when FlightGear-resources.cxx or
FlightGear-resources.hxx is missing. However, CMake doesn't know how to
parse fgrcc XML resource declaration files, therefore when a resource is
modified but the XML file it is declared in is not (here,
FlightGear-resources.xml), you have to trigger yourself a recompilation
of the XML resource declaration file to see the new resource contents
inside FlightGear. The easiest ways to do so are:
- either update the timestamp of the XML resource declaration file;
- or remove one or both of the generated files
(FlightGear-resources.cxx and FlightGear-resources.hxx here).
The EmbeddedResourceManager is created in fgMainInit() just after
Options::processOptions() set the language that was either requested by
the user or obtained from the system (locales). Resources from
FlightGear-resources.cxx are added to it, after which
EmbeddedResourceManager::selectLocale() is called with the user's
preferred locale (obtained with FGLocale::getPreferredLanguage()).
Upon reset (fgStartNewReset()), EmbeddedResourceManager::selectLocale()
is called in a similar way after Options::processOptions(), however in
this case the EmbeddedResourceManager instance doesn't have to be
recreated.
2017-04-27 22:09:14 +00:00
|
|
|
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx
|
2011-06-26 06:49:37 +00:00
|
|
|
)
|
|
|
|
|
2017-06-13 15:58:21 +00:00
|
|
|
# On Windows, make sure fgrcc can be run (it needs third-party libraries)
|
|
|
|
if (MSVC)
|
|
|
|
if (MSVC_3RDPARTY_ROOT AND MSVC_3RDPARTY_DIR)
|
|
|
|
set(CMAKE_MSVCIDE_RUN_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/bin)
|
|
|
|
else ()
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Either MSVC_3RDPARTY_ROOT or MSVC_3RDPARTY_DIR is empty or unset")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
|
|
|
|
Integrate the EmbeddedResourceManager into FlightGear
${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
(currently empty) is automatically "compiled" into
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.[ch]xx by
fgrcc inside the build directory. These files are incorporated into the
FlightGear build (FlightGear-resources.cxx is linked into FlightGear).
When the XML embedded resource declaration file added here,
FlightGear-resources.xml, is compiled, fgrcc is passed the
--root=${CMAKE_SOURCE_DIR} option, so that files referred to in
FlightGear-resources.xml are looked up relatively to the root directory
of the FlightGear repository. One could use a second XML embedded
resource declaration file compiled with a different --root option to
grab files from FGData, for instance. I would name such a file
FGData-resources.xml to be consistent with the current naming scheme.
Note: this --root option applies to the paths of real files. Don't
confuse it with the 'prefix' attribute of <qresource> elements
inside XML resource declaration files (such as
FlightGear-resources.xml), which applies to the virtual path of
each resource defined beneath.
The commands in src/Main/CMakeLists.txt ensure that
FlightGear-resources.xml is recompiled with fgrcc whenever it is
changed, and obviously also when FlightGear-resources.cxx or
FlightGear-resources.hxx is missing. However, CMake doesn't know how to
parse fgrcc XML resource declaration files, therefore when a resource is
modified but the XML file it is declared in is not (here,
FlightGear-resources.xml), you have to trigger yourself a recompilation
of the XML resource declaration file to see the new resource contents
inside FlightGear. The easiest ways to do so are:
- either update the timestamp of the XML resource declaration file;
- or remove one or both of the generated files
(FlightGear-resources.cxx and FlightGear-resources.hxx here).
The EmbeddedResourceManager is created in fgMainInit() just after
Options::processOptions() set the language that was either requested by
the user or obtained from the system (locales). Resources from
FlightGear-resources.cxx are added to it, after which
EmbeddedResourceManager::selectLocale() is called with the user's
preferred locale (obtained with FGLocale::getPreferredLanguage()).
Upon reset (fgStartNewReset()), EmbeddedResourceManager::selectLocale()
is called in a similar way after Options::processOptions(), however in
this case the EmbeddedResourceManager instance doesn't have to be
recreated.
2017-04-27 22:09:14 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx
|
|
|
|
${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx
|
|
|
|
COMMAND fgrcc --root=${CMAKE_SOURCE_DIR} --output-cpp-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx --init-func-name=initFlightGearEmbeddedResources --output-header-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx --output-header-identifier=_FG_FLIGHTGEAR_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
|
|
|
|
DEPENDS
|
|
|
|
fgrcc ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml
|
|
|
|
)
|
|
|
|
|
2012-03-26 12:09:39 +00:00
|
|
|
get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES)
|
|
|
|
get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS)
|
|
|
|
|
2012-04-19 18:31:53 +00:00
|
|
|
link_directories ( ${Boost_LIBRARY_DIRS} )
|
|
|
|
|
2012-09-16 17:26:12 +00:00
|
|
|
get_property(FG_GROUPS_C GLOBAL PROPERTY FG_GROUPS_C)
|
|
|
|
string(REPLACE "@" ";" groups ${FG_GROUPS_C} )
|
|
|
|
foreach(g ${groups})
|
|
|
|
string(REPLACE "#" ";" g2 ${g})
|
|
|
|
list(GET g2 0 name)
|
|
|
|
list(REMOVE_AT g2 0)
|
|
|
|
source_group("${name}\\Sources" FILES ${g2})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
get_property(FG_GROUPS_H GLOBAL PROPERTY FG_GROUPS_H)
|
|
|
|
string(REPLACE "@" ";" groups ${FG_GROUPS_H} )
|
|
|
|
foreach(g ${groups})
|
|
|
|
string(REPLACE "#" ";" g2 ${g})
|
|
|
|
list(GET g2 0 name)
|
|
|
|
list(REMOVE_AT g2 0)
|
|
|
|
source_group("${name}\\Headers" FILES ${g2})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
source_group("Main\\Headers" FILES ${HEADERS})
|
|
|
|
source_group("Main\\Sources" FILES ${SOURCES})
|
2013-10-26 20:06:03 +00:00
|
|
|
|
|
|
|
# important we pass WIN32 here so the console is optional. Other
|
|
|
|
# platforms ignore this option. If a console is needed we allocate
|
|
|
|
# it manually via AllocConsole()
|
2014-02-14 18:58:36 +00:00
|
|
|
# similarly pass MACOSX_BUNDLE so we generate a .app on Mac
|
|
|
|
add_executable(fgfs WIN32 MACOSX_BUNDLE
|
|
|
|
${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# MacOSX bundle packagaing
|
|
|
|
|
|
|
|
if(APPLE)
|
|
|
|
execute_process(COMMAND date +%Y
|
|
|
|
OUTPUT_VARIABLE CURRENT_YEAR
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
|
|
)
|
2016-01-30 01:59:16 +00:00
|
|
|
|
2014-02-14 18:58:36 +00:00
|
|
|
# in our local CMakeModules dir
|
|
|
|
set_target_properties(fgfs PROPERTIES
|
|
|
|
MACOSX_BUNDLE_INFO_PLIST FlightGearBundleInfo.plist.in
|
|
|
|
MACOSX_BUNDLE_GUI_IDENTIFIER "org.flightgear.FlightGear"
|
|
|
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${FLIGHTGEAR_VERSION}
|
|
|
|
MACOSX_BUNDLE_LONG_VERSION_STRING "FlightGear ${FLIGHTGEAR_VERSION} Nightly"
|
|
|
|
MACOSX_BUNDLE_BUNDLE_VERSION ${FLIGHTGEAR_VERSION}
|
|
|
|
MACOSX_BUNDLE_COPYRIGHT "FlightGear ${FLIGHTGEAR_VERSION} © 1997-${CURRENT_YEAR}, The FlightGear Project. Licensed under the GNU Public License version 2."
|
|
|
|
MACOSX_BUNDLE_INFO_STRING "Nightly build of FlightGear ${FLIGHTGEAR_VERSION} for testing and development"
|
|
|
|
MACOSX_BUNDLE_BUNDLE_NAME "FlightGear"
|
|
|
|
MACOSX_BUNDLE_ICON_FILE "FlightGear.icns"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
2010-11-30 10:08:30 +00:00
|
|
|
|
|
|
|
get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
|
|
|
|
#message(STATUS "fg libs ${FG_LIBS}")
|
|
|
|
#message(STATUS "OSG libs ${OPENSCENEGRAPH_LIBRARIES}")
|
|
|
|
#message(STATUS "SG libs ${SIMGEAR_LIBRARIES}")
|
|
|
|
|
2010-12-26 12:55:52 +00:00
|
|
|
if(RTI_FOUND)
|
2011-12-04 13:37:25 +00:00
|
|
|
set(HLA_LIBRARIES ${RTI_LIBRARIES})
|
2010-12-26 12:55:52 +00:00
|
|
|
else()
|
2011-12-04 13:37:25 +00:00
|
|
|
set(HLA_LIBRARIES "")
|
2010-12-26 12:55:52 +00:00
|
|
|
endif()
|
|
|
|
|
2016-07-30 12:26:45 +00:00
|
|
|
if(GDAL_FOUND)
|
|
|
|
set(GDAL_LIBRARIES ${GDAL_LIBRARY})
|
|
|
|
else()
|
|
|
|
set(GDAL_LIBRARIES "")
|
|
|
|
endif()
|
|
|
|
|
2012-03-26 12:09:39 +00:00
|
|
|
if(ENABLE_JSBSIM)
|
|
|
|
# FIXME - remove once JSBSim doesn't expose private headers
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim)
|
2016-01-30 01:59:16 +00:00
|
|
|
|
2012-03-26 12:09:39 +00:00
|
|
|
target_link_libraries(fgfs JSBSim)
|
|
|
|
endif()
|
2013-05-19 14:29:49 +00:00
|
|
|
if(ENABLE_IAX)
|
|
|
|
target_link_libraries(fgfs iaxclient_lib ${OPENAL_LIBRARY})
|
|
|
|
endif()
|
2013-12-09 00:13:44 +00:00
|
|
|
if(USE_DBUS)
|
|
|
|
target_link_libraries(fgfs ${DBUS_LIBRARIES})
|
|
|
|
endif()
|
2012-11-15 12:56:31 +00:00
|
|
|
if(FG_HAVE_GPERFTOOLS)
|
2012-11-19 12:10:38 +00:00
|
|
|
include_directories(${GooglePerfTools_INCLUDE_DIR})
|
|
|
|
target_link_libraries(fgfs ${GooglePerfTools_LIBRARIES})
|
2012-11-15 10:55:25 +00:00
|
|
|
endif()
|
|
|
|
|
2014-01-18 15:12:22 +00:00
|
|
|
if (CRASHRPT_FOUND)
|
|
|
|
target_link_libraries(fgfs ${CRASHRPT_LIBRARY})
|
|
|
|
endif()
|
2015-04-03 18:15:52 +00:00
|
|
|
if(X11_FOUND)
|
|
|
|
target_link_libraries(fgfs ${X11_LIBRARIES})
|
|
|
|
endif()
|
2011-08-30 19:51:53 +00:00
|
|
|
target_link_libraries(fgfs
|
2016-01-30 01:59:16 +00:00
|
|
|
SimGearCore SimGearScene
|
2012-09-21 20:32:07 +00:00
|
|
|
${SQLITE3_LIBRARY}
|
2010-11-30 10:08:30 +00:00
|
|
|
${SIMGEAR_LIBRARIES}
|
2011-08-30 19:51:53 +00:00
|
|
|
${OPENSCENEGRAPH_LIBRARIES}
|
2010-11-30 10:08:30 +00:00
|
|
|
${OPENGL_LIBRARIES}
|
2010-12-25 23:44:02 +00:00
|
|
|
${PLIB_LIBRARIES}
|
2011-09-11 09:22:10 +00:00
|
|
|
${HLA_LIBRARIES}
|
2016-07-30 12:26:45 +00:00
|
|
|
${GDAL_LIBRARIES}
|
2011-12-04 13:37:25 +00:00
|
|
|
${EVENT_INPUT_LIBRARIES}
|
2011-10-16 18:55:04 +00:00
|
|
|
${PLATFORM_LIBS}
|
2011-09-11 09:22:10 +00:00
|
|
|
)
|
2011-08-30 19:51:53 +00:00
|
|
|
|
2017-10-31 09:53:34 +00:00
|
|
|
|
|
|
|
|
2014-03-10 09:32:03 +00:00
|
|
|
if(ENABLE_FLITE)
|
2014-04-28 19:33:48 +00:00
|
|
|
if(SYSTEM_HTS_ENGINE)
|
|
|
|
target_link_libraries(fgfs flite_hts ${HTS_ENGINE_LIBRARIES})
|
|
|
|
else()
|
|
|
|
target_link_libraries(fgfs flite_hts hts_engine)
|
|
|
|
endif()
|
2014-03-10 09:32:03 +00:00
|
|
|
endif()
|
|
|
|
|
2014-12-26 12:20:51 +00:00
|
|
|
if (Qt5Core_FOUND)
|
2017-10-05 14:02:30 +00:00
|
|
|
target_link_libraries(fgfs Qt5::Core Qt5::Widgets fglauncher fgqmlui)
|
2016-10-15 14:45:52 +00:00
|
|
|
set_property(TARGET fgfs PROPERTY AUTOMOC ON)
|
2014-12-26 12:20:51 +00:00
|
|
|
endif()
|
|
|
|
|
2017-10-31 09:53:34 +00:00
|
|
|
if (USE_AEONWAVE)
|
|
|
|
target_link_libraries(fgfs ${AAX_LIBRARY})
|
|
|
|
endif()
|
|
|
|
|
2017-03-01 20:53:56 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
target_link_libraries(fgfs execinfo)
|
|
|
|
endif()
|
|
|
|
|
2016-01-30 01:59:16 +00:00
|
|
|
if (APPLE)
|
2014-02-14 18:58:36 +00:00
|
|
|
install(TARGETS fgfs BUNDLE DESTINATION .)
|
|
|
|
else()
|
2016-07-09 21:14:28 +00:00
|
|
|
install(TARGETS fgfs RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2014-02-14 18:58:36 +00:00
|
|
|
endif()
|
2011-10-21 11:48:42 +00:00
|
|
|
|
2013-02-12 16:38:46 +00:00
|
|
|
if(ENABLE_METAR)
|
|
|
|
add_executable(metar metar_main.cxx)
|
|
|
|
target_link_libraries(metar
|
2016-01-30 01:59:16 +00:00
|
|
|
SimGearScene SimGearCore
|
2013-02-12 16:38:46 +00:00
|
|
|
${PLATFORM_LIBS}
|
|
|
|
)
|
|
|
|
|
2016-07-09 21:14:28 +00:00
|
|
|
install(TARGETS metar RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
2013-02-12 16:38:46 +00:00
|
|
|
endif()
|
2017-03-27 14:37:54 +00:00
|
|
|
|
2017-04-05 12:34:48 +00:00
|
|
|
if (COMMAND flightgear_test)
|
2017-03-27 14:37:54 +00:00
|
|
|
flightgear_test(posinit test_posinit.cxx)
|
2017-04-10 13:38:35 +00:00
|
|
|
flightgear_test(autosaveMigration test_autosaveMigration.cxx)
|
2017-03-27 14:37:54 +00:00
|
|
|
endif()
|