diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index f8654d336..de17e1eec 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -12,16 +12,8 @@ add_subdirectory(cjson) add_subdirectory(flite_hts_engine) -if (SYSTEM_HTS_ENGINE) - set(HTS_Engine_FIND_REQUIRED TRUE) - find_package(HtsEngine) - - include_directories(${HTS_ENGINE_INCLUDE_DIR}) - message(STATUS "Using HTS engine includes at: ${HTS_ENGINE_INCLUDE_DIR}") - message(STATUS "Using HTS engine libraries: ${HTS_ENGINE_LIBRARIES}") -else() +if (NOT SYSTEM_HTS_ENGINE) add_subdirectory(hts_engine_API) - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include ) endif() if (ENABLE_HID_INPUT) diff --git a/3rdparty/flite_hts_engine/CMakeLists.txt b/3rdparty/flite_hts_engine/CMakeLists.txt index eb34c7c58..ab312f6fb 100644 --- a/3rdparty/flite_hts_engine/CMakeLists.txt +++ b/3rdparty/flite_hts_engine/CMakeLists.txt @@ -2,14 +2,9 @@ if (SYSTEM_FLITE) set(Flite_FIND_REQUIRED TRUE) find_package(Flite) - include_directories(${FLITE_INCLUDE_DIR}) message(STATUS "Using Flite includes at: ${FLITE_INCLUDE_DIR}") message(STATUS "Using Flite libraries: ${FLITE_LIBRARIES}") else() - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/include) - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/cmulex) - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/usenglish) - set(FLITE_SOURCES flite/src/hrg/cst_ffeature.c flite/src/hrg/cst_item.c @@ -65,33 +60,26 @@ else() flite/lang/usenglish/usenglish.c ) - if (MSVC) - add_definitions( -DNO_UNION_INITIALIZATION ) - endif () endif() -if (SYSTEM_HTS_ENGINE) - set(HTS_Engine_FIND_REQUIRED TRUE) - find_package(HtsEngine) - - include_directories(${HTS_ENGINE_INCLUDE_DIR}) - message(STATUS "Using HTS engine includes for Flite/HTS Engine at: ${HTS_ENGINE_INCLUDE_DIR}") -else() - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include) -endif() - - -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/include) - -add_definitions(-DFLITE_PLUS_HTS_ENGINE) - -add_library(flite_hts STATIC +add_library(flightgear_flite_hts STATIC ${FLITE_SOURCES} ${FLITE_LANG_SOURCES} lib/flite_hts_engine.c ) +target_include_directories(flightgear_flite_hts PUBLIC ${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/include) +target_compile_definitions(flightgear_flite_hts PRIVATE -DNO_UNION_INITIALIZATION -DFLITE_PLUS_HTS_ENGINE) + +# link against HTSEngine: either our own one, or the system one +target_link_libraries(flightgear_flite_hts PUBLIC Flightgear::HTSEngine) + if (SYSTEM_FLITE) - target_link_libraries(flite_hts ${FLITE_LIBRARIES}) + target_link_libraries(flightgear_flite_hts Flightgear::Flite) +else() + target_include_directories(flightgear_flite_hts PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/include) + target_include_directories(flightgear_flite_hts PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/cmulex) + target_include_directories(flightgear_flite_hts PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/flite/lang/usenglish) endif() + diff --git a/3rdparty/hts_engine_API/CMakeLists.txt b/3rdparty/hts_engine_API/CMakeLists.txt index da17894ad..8a6c704b8 100644 --- a/3rdparty/hts_engine_API/CMakeLists.txt +++ b/3rdparty/hts_engine_API/CMakeLists.txt @@ -1,6 +1,4 @@ -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include) - set(HTS_ENGINE_SOURCES lib/HTS_audio.c lib/HTS_engine.c @@ -17,3 +15,7 @@ set(HTS_ENGINE_SOURCES add_library(hts_engine STATIC ${HTS_ENGINE_SOURCES} ) + +target_include_directories(hts_engine PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + +add_library(Flightgear::HTSEngine ALIAS hts_engine) diff --git a/3rdparty/iaxclient/lib/CMakeLists.txt b/3rdparty/iaxclient/lib/CMakeLists.txt index 1a667a4e7..8bbc18b8d 100644 --- a/3rdparty/iaxclient/lib/CMakeLists.txt +++ b/3rdparty/iaxclient/lib/CMakeLists.txt @@ -1,6 +1,3 @@ -# CMakeLists.txt, for utils/iaxclient/lib - 20130925 -# even if we don't select the codec, speex is used for pre-processing audio -set(ENABLE_SPEEX 1) set(IAXCLIENT_BASE_SOURCES audio_encode.c @@ -9,7 +6,9 @@ set(IAXCLIENT_BASE_SOURCES codec_alaw.c codec_gsm.c codec_ulaw.c + codec_speex.c iaxclient_lib.c + spandsp/plc.c ) set(LIBIAX2_SOURCES @@ -19,17 +18,51 @@ set(LIBIAX2_SOURCES libiax2/src/md5.c ) +find_package(OpenAL REQUIRED) + +add_library(iaxclient_lib STATIC + ${IAXCLIENT_BASE_SOURCES} ${LIBIAX2_SOURCES} +) + +target_link_libraries(iaxclient_lib PRIVATE Threads::Threads ${OPENAL_LIBRARY}) +target_include_directories(iaxclient_lib PUBLIC ${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib) +target_include_directories(iaxclient_lib PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/libiax2/src ${OPENAL_INCLUDE_DIR}) + +target_compile_definitions(iaxclient_lib PRIVATE AUDIO_OPENAL=1 LIBIAX LIBVER="SVN 261") + +if (APPLE) + target_compile_definitions(iaxclient_lib PRIVATE MACOSX) +endif(APPLE) + +if (WIN32) + target_sources(iaxclient_lib PRIVATE winfuncs.c) +else() + target_sources(iaxclient_lib PRIVATE unixfuncs.c) +endif(WIN32) + + +if (MSVC) + # turn off various warnings + set(WFLAGS) + foreach(warning 4244 4305 4996) + list(APPEND WFLAGS "/wd${warning}") + endforeach() + target_compile_definitions(iaxclient_lib PRIVATE ${WFLAGS}) +endif () + if (SYSTEM_GSM) set(Gsm_FIND_REQUIRED TRUE) find_package(Gsm) endif(SYSTEM_GSM) if (GSM_FOUND) - include_directories(${GSM_INCLUDE_DIR}) message(STATUS "Using GSM includes at: ${GSM_INCLUDE_DIR}") message(STATUS "Using GSM libraries: ${GSM_LIBRARIES}") -else(GSM_FOUND) - set(GSM_SOURCES + target_include_directories(iaxclient_lib PRIVATE ${GSM_INCLUDE_DIR}) + target_link_libraries(iaxclient_lib PRIVATE ${GSM_LIBRARIES}) +else() + # add local GSM files + target_sources(iaxclient_lib PRIVATE gsm/src/add.c gsm/src/code.c gsm/src/debug.c @@ -49,117 +82,79 @@ else(GSM_FOUND) gsm/src/short_term.c gsm/src/table.c ) -endif(GSM_FOUND) -if (WIN32) - list(APPEND IAXCLIENT_BASE_SOURCES winfuncs.c) -else() - list(APPEND IAXCLIENT_BASE_SOURCES unixfuncs.c) -endif(WIN32) + target_include_directories(iaxclient_lib PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/gsm/inc) + target_compile_definitions(iaxclient_lib PRIVATE HAS_STRING_H HAS_STDLIB_H) +endif() -if (ENABLE_SPEEX) - list(APPEND IAXCLIENT_BASE_SOURCES codec_speex.c) +target_compile_definitions(iaxclient_lib PRIVATE CODEC_GSM) - if (SYSTEM_SPEEX) - set(Speex_FIND_REQUIRED TRUE) - set(Speexdsp_FIND_REQUIRED TRUE) - find_package(Speex) - find_package(Speexdsp) - endif(SYSTEM_SPEEX) +if (SYSTEM_SPEEX) + set(Speex_FIND_REQUIRED TRUE) + set(Speexdsp_FIND_REQUIRED TRUE) + find_package(Speex) + find_package(Speexdsp) +endif() - if (SPEEX_FOUND AND SPEEXDSP_FOUND) - include_directories(${SPEEX_INCLUDE_DIR} ${SPEEXDSP_INCLUDE_DIR}) - message(STATUS "Using speex includes at: ${SPEEX_INCLUDE_DIR}") - message(STATUS "Using speex libraries: ${SPEEX_LIBRARIES}") - message(STATUS "Using speex extended library includes at: ${SPEEXDSP_INCLUDE_DIR}") - message(STATUS "Using speex extended library libraries: ${SPEEXDSP_LIBRARIES}") - else(SPEEX_FOUND AND SPEEXDSP_FOUND) - set(SPEEX_SOURCES - libspeex/bits.c - libspeex/cb_search.c - libspeex/exc_10_16_table.c - libspeex/exc_10_32_table.c - libspeex/exc_20_32_table.c - libspeex/exc_5_256_table.c - libspeex/exc_5_64_table.c - libspeex/exc_8_128_table.c - libspeex/filters.c - libspeex/gain_table.c - libspeex/gain_table_lbr.c - libspeex/hexc_10_32_table.c - libspeex/hexc_table.c - libspeex/high_lsp_tables.c - libspeex/jitter.c - libspeex/lbr_48k_tables.c - libspeex/lpc.c - libspeex/lsp.c - libspeex/lsp_tables_nb.c - libspeex/ltp.c - libspeex/math_approx.c - libspeex/mdf.c - libspeex/medfilter.c - libspeex/misc.c - libspeex/modes.c - libspeex/nb_celp.c - libspeex/preprocess.c - libspeex/quant_lsp.c - libspeex/sb_celp.c - libspeex/smallft.c - libspeex/speex.c - libspeex/speex_callbacks.c - libspeex/speex_header.c - libspeex/stereo.c - libspeex/vbr.c - libspeex/vq.c - ) +if (SPEEX_FOUND AND SPEEXDSP_FOUND) - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/libspeex/include) - endif(SPEEX_FOUND AND SPEEXDSP_FOUND) -endif(ENABLE_SPEEX) + message(STATUS "Using speex includes at: ${SPEEX_INCLUDE_DIR}") + message(STATUS "Using speex libraries: ${SPEEX_LIBRARIES}") + message(STATUS "Using speex extended library includes at: ${SPEEXDSP_INCLUDE_DIR}") + message(STATUS "Using speex extended library libraries: ${SPEEXDSP_LIBRARIES}") -if (ENABLE_ALSA) - list(APPEND IAXCLIENT_BASE_SOURCES audio_alsa.c) -endif(ENABLE_ALSA) + target_include_directories(iaxclient_lib PRIVATE ${SPEEX_INCLUDE_DIR} ${SPEEXDSP_INCLUDE_DIR}) + target_link_libraries(iaxclient_lin PRIVATE ${SPEEX_LIBRARIES} ${SPEEXDSP_LIBRARIES}) +else() + target_sources(iaxclient_lib PRIVATE + libspeex/bits.c + libspeex/cb_search.c + libspeex/exc_10_16_table.c + libspeex/exc_10_32_table.c + libspeex/exc_20_32_table.c + libspeex/exc_5_256_table.c + libspeex/exc_5_64_table.c + libspeex/exc_8_128_table.c + libspeex/filters.c + libspeex/gain_table.c + libspeex/gain_table_lbr.c + libspeex/hexc_10_32_table.c + libspeex/hexc_table.c + libspeex/high_lsp_tables.c + libspeex/jitter.c + libspeex/lbr_48k_tables.c + libspeex/lpc.c + libspeex/lsp.c + libspeex/lsp_tables_nb.c + libspeex/ltp.c + libspeex/math_approx.c + libspeex/mdf.c + libspeex/medfilter.c + libspeex/misc.c + libspeex/modes.c + libspeex/nb_celp.c + libspeex/preprocess.c + libspeex/quant_lsp.c + libspeex/sb_celp.c + libspeex/smallft.c + libspeex/speex.c + libspeex/speex_callbacks.c + libspeex/speex_header.c + libspeex/stereo.c + libspeex/vbr.c + libspeex/vq.c + ) -if (ENABLE_PORTAUDIO) - list(APPEND IAXCLIENT_BASE_SOURCES audio_portaudio.c) -endif(ENABLE_PORTAUDIO) + target_include_directories(iaxclient_lib PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/libspeex/include) +endif() -if (APPLE) - add_definitions(-DMACOSX) -endif(APPLE) +# never used for the moment +# if (ENABLE_ALSA) +# target_sources(iaxclient_lib PRIVATE audio_alsa.c) +# endif(ENABLE_ALSA) -list(APPEND IAXCLIENT_BASE_SOURCES spandsp/plc.c) - -add_definitions(-DAUDIO_OPENAL=1) -add_definitions(-DLIBIAX) - -# for GSM -add_definitions(-DHAS_STRING_H -DHAS_STDLIB_H) -add_definitions(-DCODEC_GSM) - -if (MSVC) - # turn off various warnings - set(WFLAGS) - foreach(warning 4244 4305 4996) - set(WFLAGS "${WFLAGS} /wd${warning}") - endforeach() - add_definitions(${WFLAGS}) -endif () - -add_definitions( -DHAVE_CONFIG_H ) # to use fgfs config.h to get FG version, if needed -add_definitions( -DLIBVER="SVN 261" ) # add an iaxclient_lib version string - -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib) -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/libiax2/src) -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/gsm/inc) - -add_library(iaxclient_lib STATIC - ${IAXCLIENT_BASE_SOURCES} - ${GSM_SOURCES} - ${SPEEX_SOURCES} - ${LIBIAX2_SOURCES}) - -target_link_libraries(iaxclient_lib ${CMAKE_THREAD_LIBS_INIT} ${SPEEX_LIBRARIES} ${SPEEXDSP_LIBRARIES} ${GSM_LIBRARIES}) +# if (ENABLE_PORTAUDIO) +# target_sources(iaxclient_lib PRIVATE audio_portaudio.c) +# endif(ENABLE_PORTAUDIO) # eof diff --git a/3rdparty/iaxclient/lib/libiax2/src/jitterbuf.c b/3rdparty/iaxclient/lib/libiax2/src/jitterbuf.c index 0d450240c..675351d4a 100644 --- a/3rdparty/iaxclient/lib/libiax2/src/jitterbuf.c +++ b/3rdparty/iaxclient/lib/libiax2/src/jitterbuf.c @@ -138,7 +138,7 @@ static int history_put(jitterbuf *jb, long ts, long now, long ms) /* check for drastic change in delay */ if (jb->info.conf.resync_threshold != -1) { - if (abs(delay - jb->info.last_delay) > threshold) { + if (labs(delay - jb->info.last_delay) > threshold) { jb->info.cnt_delay_discont++; if (jb->info.cnt_delay_discont > 3) { /* resync the jitterbuffer */ diff --git a/3rdparty/sqlite3/CMakeLists.txt b/3rdparty/sqlite3/CMakeLists.txt index 747511f22..5aaf981b3 100644 --- a/3rdparty/sqlite3/CMakeLists.txt +++ b/3rdparty/sqlite3/CMakeLists.txt @@ -3,3 +3,4 @@ add_library(fgsqlite3 STATIC sqlite3.c) target_compile_definitions(fgsqlite3 PRIVATE SQLITE_OMIT_LOAD_EXTENSION NDEBUG) set_target_properties(fgsqlite3 PROPERTIES COMPILE_FLAGS "-fPIC -fno-fast-math") +target_include_directories(fgsqlite3 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b6f6fc40..90f9d326c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ include(GNUInstallDirs) include( DetectDistro ) include( DetectBrowser ) include( ExportDebugSymbols ) + set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") @@ -100,17 +101,12 @@ else() message(STATUS "Using default data directory for base package: ${FG_DATA_DIR}") endif() -# Change the default build type to something fast -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release CACHE STRING - "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." - FORCE) -endif(NOT CMAKE_BUILD_TYPE) - ##################################################################################### # Configure library search paths ##################################################################################### +find_package(Threads REQUIRED) + IF(APPLE) set(EVENT_INPUT_DEFAULT 1) @@ -124,12 +120,11 @@ elseif(WIN32) set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION "bin") set(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) include(InstallRequiredSystemLibraries) - MESSAGE("Installing: ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}") + message(STATUS "Installing: ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS}") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") - find_package(Threads REQUIRED) find_package(X11 REQUIRED) set(USE_DBUS_DEFAULT 1) @@ -171,7 +166,6 @@ option(ENABLE_YASIM "Set to ON to build FlightGear with YASIM FDM (default) option(ENABLE_JSBSIM "Set to ON to build FlightGear with JSBSim FDM (default)" ON) option(EVENT_INPUT "Set to ON to build FlightGear with event-based Input support" ${EVENT_INPUT_DEFAULT}) option(ENABLE_RTI "Set to ON to build FlightGear with RTI support" OFF) -option(ENABLE_PROFILE "Set to ON to build FlightGear with gperftools profiling support" OFF) option(SYSTEM_SQLITE "Set to ON to build FlightGear with the system's SQLite3 library" OFF) option(ENABLE_IAX "Set to ON to build FlightGear with IAXClient/fgcom built-in (default)" ON) option(USE_DBUS "Set to ON to build FlightGear with DBus screensaver interaction (default on Linux)" ${USE_DBUS_DEFAULT}) @@ -183,10 +177,9 @@ option(SYSTEM_CPPUNIT "Set to ON to build Flightgear with the system's CppUni # additional utilities option(ENABLE_FGELEV "Set to ON to build the fgelev application (default)" ON) -option(WITH_FGPANEL "Set to ON to build the fgpanel application (default)" ON) +option(WITH_FGPANEL "Set to ON to build the fgpanel application" OFF) option(ENABLE_FGVIEWER "Set to ON to build the fgviewer application (default)" ON) option(ENABLE_GPSSMOOTH "Set to ON to build the GPSsmooth application (default)" ON) -option(ENABLE_TERRASYNC "Set to ON to build the terrasync application (default)" ON) option(ENABLE_FGJS "Set to ON to build the fgjs application (default)" ON) option(ENABLE_JS_DEMO "Set to ON to build the js_demo application (default)" ON) option(ENABLE_METAR "Set to ON to build the metar application (default)" ON) @@ -225,13 +218,8 @@ if(SP_FDMS) set(ENABLE_SP_FDM 1) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib/libspeex/include) -endif() - if(ENABLE_FGCOM) set(ENABLE_IAX 1) - include_directories(${PROJECT_SOURCE_DIR}/3rdparty/iaxclient/lib ) # for iaxclient.h endif() # Setup MSVC 3rd party directories @@ -265,31 +253,7 @@ if(EVENT_INPUT) endif() endif(EVENT_INPUT) -if (ENABLE_SWIFT) -# DBUS - - # our local FindDBus.cmake file uses pkg-config on non-Windows - # we want to ensure our local prefixes are searched, so set this - set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1) - - # unfortunately CMAKE_INSTALL_PREFIX is not searched, so add that manually - list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) - - find_package(DBus) - - #libevent - find_package(LibEvent) - - if (DBUS_FOUND AND LIBEVENT_FOUND) - message(STATUS "SWIFT support enabled") - list(APPEND PLATFORM_LIBS ${LIBEVENT_LIB}) - # FIXME, make this target specific, not a global include setting - include_directories(${LIBEVENT_INCLUDE_DIR}) - else() - message(WARNING "SWIFT support disabled, dbus and/or LibEvent not found") - set(ENABLE_SWIFT 0) - endif() -endif() +include(SetupSwiftLibraries) if (SYSTEM_CPPUNIT) find_package(CppUnit REQUIRED) @@ -321,50 +285,25 @@ if (TARGET sentry::sentry) endif() endif() -#if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD") -# include_directories("${CMAKE_SOURCE_DIR}/3rdparty/iaxclient/lib/libspeex/include") -#endif() - ############################################################################## ## Sqlite3 setup if (SYSTEM_SQLITE) find_package(SQLite3 REQUIRED) message(STATUS "Using system SQLite3 library") -else() - set(SQLITE3_INCLUDED_DIR "${CMAKE_SOURCE_DIR}/3rdparty/sqlite3") - # this target is defined in src/Navaids/CMakeLists.txt - list(APPEND SQLITE3_LIBRARY fgsqlite3) endif (SYSTEM_SQLITE) -# Sqlite always depends on the threading lib -list(APPEND SQLITE3_LIBRARY ${CMAKE_THREAD_LIBS_INIT}) - ############################################################################## ## DBus setup - if (USE_DBUS) - include(FindPkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules(DBUS dbus-1) - endif (PKG_CONFIG_FOUND) #if we don't have pkg-config, assume we don't have libdbus-1-dev either http://packages.debian.org/sid/libdbus-1-dev - if (DBUS_FOUND) - set(HAVE_DBUS 1) - message(STATUS "Using DBus") - include_directories( ${DBUS_INCLUDE_DIRS}) - else() - message(STATUS "DBus not found, screensaver control disabled") - endif (DBUS_FOUND) -else() + find_package(DBus) endif (USE_DBUS) ############################################################################## ## Qt5 setup setup if (ENABLE_QT) - message(STATUS "Qt launcher enabled, checking for Qt >= 5.9 / qmake") find_package(Qt5 5.9 COMPONENTS Widgets Gui Network Qml Quick Svg) if (Qt5Widgets_FOUND) - message(STATUS "Will enable Qt launcher GUI") set(HAVE_QT 1) include (Translations) @@ -375,7 +314,9 @@ if (ENABLE_QT) get_filename_component(FG_QT_ROOT_DIR ${FG_QT_BIN_DIR} DIRECTORY) endif() + message(STATUS "Qt GUI enabled, found Qt at: ${FG_QT_ROOT_DIR}") else() + message(STATUS "Qt GUI disabled, Qt/qmake not found in PATH/CMAKE_PREFIX_PATH") # don't try to build FGQCanvas if Qt wasn't found correctly set(ENABLE_FGQCANVAS OFF) endif() @@ -387,13 +328,11 @@ if (ENABLE_QT) check_include_file_cxx("private/qopenglcontext_p.h" REALLY_HAVE_QGUIPRIVATE) if (REALLY_HAVE_QGUIPRIVATE) - message(STATUS "Have QtGUI private headers") set(ENABLE_QQ_UI 1) else() message(STATUS "QtGui private headers not available.") endif() else() - message(STATUS "Qt support disabled") set(ENABLE_FGQCANVAS OFF) endif (ENABLE_QT) ############################################################################## @@ -414,50 +353,13 @@ find_package(SimGear ${MIN_SIMGEAR_VERSION} CONFIG REQUIRED) ############################################################################## -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file(sys/time.h HAVE_SYS_TIME_H) -check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H) -check_include_file(windows.h HAVE_WINDOWS_H) -check_function_exists(timegm HAVE_TIMEGM) -check_variable_exists(daylight HAVE_DAYLIGHT) -check_function_exists(ftime HAVE_FTIME) -check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) - -if(ENABLE_PROFILE) - find_package(GooglePerfTools REQUIRED) - set(FG_HAVE_GPERFTOOLS 1) - message(STATUS "Built-in profiler using gperftools available") -endif() - if(ENABLE_RTI) message(STATUS "RTI: ENABLED") set(FG_HAVE_HLA 1) -else() - message(STATUS "RTI: DISABLED") endif(ENABLE_RTI) -if(ENABLE_GDAL) - find_package(GDAL 2.0.0 REQUIRED) -endif(ENABLE_GDAL) -include_directories(${GDAL_INCLUDE_DIR}) - -if (ENABLE_OPENMP) - find_package(OpenMP) - if(OPENMP_FOUND) - message(STATUS "OpenMP: ENABLED") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") - else() - message(STATUS "OpenMP: NOT FOUND") - endif() -else() - message(STATUS "OpenMP: DISABLED") -endif() - if (ENABLE_SIMD) message(STATUS "SSE/SSE2 support: ENABLED") -else() - message(STATUS "SSE/SSE2 support: DISABLED") endif() if(CMAKE_COMPILER_IS_GNUCXX) @@ -475,17 +377,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Ap -Wno-inconsistent-missing-override \ -Wno-unused-local-typedef") - # disabled by James - these cause weridness for multi-config generators - # since they set thge flags for all configurations - # need to find a better way to adjust these - - # if (CMAKE_BUILD_TYPE STREQUAL "Debug") - # set(CMAKE_C_FLAGS - # "${CMAKE_C_FLAGS} -O0 -fno-omit-frame-pointer -fno-inline-functions") - # set(CMAKE_CXX_FLAGS - # "${CMAKE_CXX_FLAGS} -O0 -fno-omit-frame-pointer -fno-inline-functions") - # endif() - # override CMake default RelWithDebInfo flags. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG") @@ -551,40 +442,11 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS_C} ${MSVC_FLAGS} -D_REENTRAN set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS_CXX} ${MSVC_FLAGS} -D_REENTRANT ${BOOST_CXX_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MSVC_LD_FLAGS}") -include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} - ${Boost_INCLUDE_DIRS} - ${OPENGL_INCLUDE_DIR} - ${SIMGEAR_INCLUDE_DIRS} - ${PLIB_INCLUDE_DIR} - ${SQLITE3_INCLUDED_DIR} ) - -if (USE_AEONWAVE) - find_package(AAX REQUIRED) - include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} - ${AAX_INCLUDE_DIR} - ) -else() - include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS} - ${OPENAL_INCLUDE_DIR} - ) -endif() - -include_directories(${PROJECT_SOURCE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}/src) -# following is needed, because config.h is include 'bare', whereas -# version.h is included as - this should be cleaned up -include_directories(${PROJECT_BINARY_DIR}/src) -include_directories(${PROJECT_BINARY_DIR}/src/Include) - -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/hts_engine_API/include ) -include_directories(${PROJECT_SOURCE_DIR}/3rdparty/flite_hts_engine/include ) - add_definitions(-DHAVE_CONFIG_H) +include (CheckPOSIXFeatures) set(FG_TEST_SUITE_DATA "${CMAKE_SOURCE_DIR}/test_suite/test_data") -check_function_exists(mkfifo HAVE_MKFIFO) - # configure a header file to pass some of the CMake settings # to the source code configure_file ( @@ -601,6 +463,12 @@ configure_file ( # Setup build.h header, each build include( GenerateBuildInfo ) +# global includes: these are used by every singl target, so we do set them globally +# even though that's not stricly best practice +include_directories(${PROJECT_BINARY_DIR}/src/Include) +include_directories(${PROJECT_BINARY_DIR}/src) # for version.h +include_directories(${PROJECT_SOURCE_DIR}/src) + add_subdirectory(3rdparty) add_subdirectory(utils) diff --git a/CMakeModules/CheckPOSIXFeatures.cmake b/CMakeModules/CheckPOSIXFeatures.cmake new file mode 100644 index 000000000..d19bc2b9b --- /dev/null +++ b/CMakeModules/CheckPOSIXFeatures.cmake @@ -0,0 +1,9 @@ +check_function_exists(mkfifo HAVE_MKFIFO) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H) +check_include_file(windows.h HAVE_WINDOWS_H) +check_function_exists(timegm HAVE_TIMEGM) +check_variable_exists(daylight HAVE_DAYLIGHT) +check_function_exists(ftime HAVE_FTIME) +check_function_exists(gettimeofday HAVE_GETTIMEOFDAY) diff --git a/CMakeModules/ConfigureCPack.cmake b/CMakeModules/ConfigureCPack.cmake index c21f914a3..f10b7241f 100644 --- a/CMakeModules/ConfigureCPack.cmake +++ b/CMakeModules/ConfigureCPack.cmake @@ -22,3 +22,4 @@ set(CPACK_SOURCE_GENERATOR TBZ2) set(CPACK_SOURCE_PACKAGE_FILE_NAME "flightgear-${FLIGHTGEAR_VERSION}" CACHE INTERNAL "tarball basename") include (CPack) + diff --git a/CMakeModules/ConfigureMsvc3rdParty.cmake b/CMakeModules/ConfigureMsvc3rdParty.cmake index 5cfdc9dcd..ced078814 100644 --- a/CMakeModules/ConfigureMsvc3rdParty.cmake +++ b/CMakeModules/ConfigureMsvc3rdParty.cmake @@ -61,10 +61,4 @@ if (MSVC AND MSVC_3RDPARTY_ROOT) message(STATUS "BOOST_INCLUDEDIR is ${BOOST_INCLUDEDIR}") endif() - if (USE_AEONWAVE) - find_package(AAX COMPONENTS aax REQUIRED) - else() - set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include) - set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib) - endif() endif (MSVC AND MSVC_3RDPARTY_ROOT) diff --git a/CMakeModules/FindCrashRpt.cmake b/CMakeModules/FindCrashRpt.cmake deleted file mode 100644 index 89383fd52..000000000 --- a/CMakeModules/FindCrashRpt.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# Find CrashRpt -# ~~~~~~~~~~~~ -# Copyright (c) 2014, James Turner -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# -# CMake module to search for CrashRpt library -# -# If it's found it sets CRASHRPT_FOUND to TRUE -# and following variables are set: -# CRASHRPT_FOUND_INCLUDE_DIR -# CRASHRPT_FOUND_LIBRARY - -FIND_PATH(CRASHRPT_INCLUDE_DIR CrashRpt.h - PATH_SUFFIXES include - HINTS $ENV{CRASHRPTDIR} - PATHS - ${ADDITIONAL_LIBRARY_PATHS} - ) - -set(CRASHRPPT_LIBRARIES "") - -FIND_LIBRARY(CRASHRPT_LIBRARY NAMES CrashRpt1402 CrashRpt1403 - HINTS $ENV{CRASHRPTDIR} - PATH_SUFFIXES lib - PATHS ${ADDITIONAL_LIBRARY_PATHS} - ) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CRASHRPT DEFAULT_MSG - CRASHRPT_LIBRARY CRASHRPT_INCLUDE_DIR) diff --git a/CMakeModules/FindDBus.cmake b/CMakeModules/FindDBus.cmake index 389c3a90f..2df20f869 100644 --- a/CMakeModules/FindDBus.cmake +++ b/CMakeModules/FindDBus.cmake @@ -19,19 +19,14 @@ else() find_package(PkgConfig QUIET) if(PKG_CONFIG_FOUND) - # FIXME : clean this up once we requrie CMake 3.6 - if(CMAKE_VERSION VERSION_LESS 3.6) - pkg_check_modules(DBUS dbus-1) - else() - pkg_check_modules(DBUS IMPORTED_TARGET dbus-1) - endif() + pkg_check_modules(DBUS IMPORTED_TARGET dbus-1) endif (PKG_CONFIG_FOUND) if(DBUS_FOUND) + set_target_properties(PkgConfig::DBUS PROPERTIES IMPORTED_GLOBAL TRUE) + set(HAVE_DBUS 1) + # alias the PkgConfig name to standard one + add_library(DBus ALIAS PkgConfig::DBUS) endif(DBUS_FOUND) endif(WIN32) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBus DEFAULT_MSG - DBUS_INCLUDE_DIRS DBUS_LIBRARIES) \ No newline at end of file diff --git a/CMakeModules/FindFlite.cmake b/CMakeModules/FindFlite.cmake index 7a54708d0..2a38c6c8d 100644 --- a/CMakeModules/FindFlite.cmake +++ b/CMakeModules/FindFlite.cmake @@ -117,3 +117,12 @@ else (FLITE_LIBRARIES AND FLITE_INCLUDE_DIRS) mark_as_advanced(FLITE_INCLUDE_DIRS FLITE_LIBRARIES) endif (FLITE_LIBRARIES AND FLITE_INCLUDE_DIRS) + +if(NOT TARGET Flightgear::Flite) + add_library(Flightgear::Flite UNKNOWN IMPORTED) + set_target_properties(Flightgear::Flite PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${FLITE_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${FLITE_LIBRARY}" + INTERFACE_LINK_LIBRARIES ${FLITE_USENGLISH_LIBRARY} ${FLITE_CMU_US_KAL_LIBRARY} ${FLITE_CMULEX_LIBRARY}) +endif() diff --git a/CMakeModules/FindGooglePerfTools.cmake b/CMakeModules/FindGooglePerfTools.cmake deleted file mode 100644 index c787e87e1..000000000 --- a/CMakeModules/FindGooglePerfTools.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# - Try to find GooglePerfTools headers and libraries -# -# Usage of this module as follows: -# -# find_package(GooglePerfTools) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# GooglePerfTools_ROOT_DIR Set this variable to the root installation of -# GooglePerfTools if the module has problems finding -# the proper installation path. -# -# Variables defined by this module: -# -# GooglePerfTools_FOUND System has GooglePerfTools libs/headers -# GooglePerfTools_LIBRARIES The GooglePerfTools libraries -# GooglePerfTools_INCLUDE_DIR The location of GooglePerfTools headers - -find_path(GooglePerfTools_ROOT_DIR - NAMES include/google/profiler.h -) - -find_path(GooglePerfTools_INCLUDE_DIR - NAMES google/profiler.h - HINTS ${GooglePerfTools_ROOT_DIR} -) - -find_library(GooglePerfTools_PROFILER_LIBRARY - NAMES profiler - HINTS ${GooglePerfTools_ROOT_DIR} -) - -set(GooglePerfTools_LIBRARIES ${GooglePerfTools_PROFILER_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GooglePerfTools - "Try setting GooglePerfTools_ROOT_DIR to root of your gperftools installation" - GooglePerfTools_LIBRARIES - GooglePerfTools_INCLUDE_DIR -) - -mark_as_advanced( - GooglePerfTools_ROOT_DIR - GooglePerfTools_LIBRARIES - GooglePerfTools_PROFILER_LIBRARY - GooglePerfTools_INCLUDE_DIR -) \ No newline at end of file diff --git a/CMakeModules/FindHtsEngine.cmake b/CMakeModules/FindHtsEngine.cmake index ebd15c0c4..5abbe4c67 100644 --- a/CMakeModules/FindHtsEngine.cmake +++ b/CMakeModules/FindHtsEngine.cmake @@ -76,3 +76,11 @@ else (HTS_ENGINE_LIBRARIES AND HTS_ENGINE_INCLUDE_DIRS) mark_as_advanced(HTS_ENGINE_INCLUDE_DIRS HTS_ENGINE_LIBRARIES) endif (HTS_ENGINE_LIBRARIES AND HTS_ENGINE_INCLUDE_DIRS) + +if(NOT TARGET Flightgear::HTSEngine) + add_library(Flightgear::HTSEngine UNKNOWN IMPORTED) + set_target_properties(Flightgear::HTSEngine PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${HTS_ENGINE_INCLUDE_DIRS}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${HTS_ENGINE_LIBRARY}") +endif() diff --git a/CMakeModules/FindLibEvent.cmake b/CMakeModules/FindLibEvent.cmake index fe376edfb..b483bd007 100644 --- a/CMakeModules/FindLibEvent.cmake +++ b/CMakeModules/FindLibEvent.cmake @@ -3,10 +3,28 @@ # LIBEVENT_LIB # LIBEVENT_INCLUDE_DIR -FIND_PATH(LIBEVENT_INCLUDE_DIR event2/event.h PATH_SUFFIXES include HINTS ${ADDITIONAL_LIBRARY_PATHS}) +if(WIN32) + FIND_PATH(LIBEVENT_INCLUDE_DIR event2/event.h PATH_SUFFIXES include HINTS ${ADDITIONAL_LIBRARY_PATHS}) + FIND_LIBRARY(LIBEVENT_LIB NAMES event_core PATH_SUFFIXES lib HINTS ${ADDITIONAL_LIBRARY_PATHS}) -FIND_LIBRARY(LIBEVENT_LIB NAMES event_core PATH_SUFFIXES lib HINTS ${ADDITIONAL_LIBRARY_PATHS}) + if (LIBEVENT_INCLUDE_DIR AND LIBEVENT_LIB) + add_library(libEvent UNKNOWN IMPORTED) + set_target_properties(libEvent PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${LIBEVENT_INCLUDE_DIR}" + IMPORTED_LOCATION "${LIBEVENT_LIB}" + ) + endif() +else() + find_package(PkgConfig QUIET) -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibEvent DEFAULT_MSG - LIBEVENT_INCLUDE_DIR LIBEVENT_LIB) \ No newline at end of file + if(PKG_CONFIG_FOUND) + pkg_check_modules(libEvent QUIET IMPORTED_TARGET libevent) + endif() + + if(LIBEVENT_FOUND) + set_target_properties(PkgConfig::libEvent PROPERTIES IMPORTED_GLOBAL TRUE) + + # alias the PkgConfig name to standard one + add_library(libEvent ALIAS PkgConfig::libEvent) + endif() +endif(WIN32) diff --git a/CMakeModules/FindPLIB.cmake b/CMakeModules/FindPLIB.cmake index 297718f2b..6e0e81c5c 100644 --- a/CMakeModules/FindPLIB.cmake +++ b/CMakeModules/FindPLIB.cmake @@ -25,29 +25,9 @@ include(SelectLibraryConfigurations) -set(save_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) -set(CMAKE_FIND_FRAMEWORK ONLY) -FIND_PATH(PLIB_INCLUDE_DIR ul.h - PATH_SUFFIXES include/plib include - PATHS ${ADDITIONAL_LIBRARY_PATHS} -) -set(CMAKE_FIND_FRAMEWORK ${save_FIND_FRAMEWORK}) - -if(NOT PLIB_INCLUDE_DIR) - FIND_PATH(PLIB_INCLUDE_DIR plib/ul.h - PATH_SUFFIXES include - HINTS $ENV{PLIBDIR} - PATHS ${ADDITIONAL_LIBRARY_PATHS} - ) -endif() - -message(STATUS ${PLIB_INCLUDE_DIR}) - -# check for dynamic framework on Mac () -FIND_LIBRARY(PLIB_LIBRARIES - NAMES plib PLIB - HINTS - $ENV{PLIBDIR} +FIND_PATH(PLIB_INCLUDE_DIR plib/ul.h + PATH_SUFFIXES include + HINTS $ENV{PLIBDIR} PATHS ${ADDITIONAL_LIBRARY_PATHS} ) @@ -97,35 +77,31 @@ macro(find_static_component comp libs) endif() endmacro() -if(${PLIB_LIBRARIES} STREQUAL "PLIB_LIBRARIES-NOTFOUND") - set(PLIB_LIBRARIES "") # clear value - # based on the contents of deps, add other required PLIB # static library dependencies. Eg PUI requires FNT - set(outDeps ${PLIB_FIND_COMPONENTS}) + set(outDeps ${PLIB_FIND_COMPONENTS}) - foreach(c ${PLIB_FIND_COMPONENTS}) - if (${c} STREQUAL "pu") - # handle MSVC confusion over pu/pui naming, by removing - # 'pu' and then adding it back - list(REMOVE_ITEM outDeps "pu" "fnt" "sg") - list(APPEND outDeps ${PUNAME} "sg") - elseif (${c} STREQUAL "puaux") - list(APPEND outDeps ${PUNAME} "sg") - elseif (${c} STREQUAL "ssg") - list(APPEND outDeps "sg") - endif() - endforeach() + foreach(c ${PLIB_FIND_COMPONENTS}) + if (${c} STREQUAL "pu") + # handle MSVC confusion over pu/pui naming, by removing + # 'pu' and then adding it back + list(REMOVE_ITEM outDeps "pu" "fnt" "sg") + list(APPEND outDeps ${PUNAME} "sg") + elseif (${c} STREQUAL "puaux") + list(APPEND outDeps ${PUNAME} "sg") + elseif (${c} STREQUAL "ssg") + list(APPEND outDeps "sg") + endif() + endforeach() - list(APPEND outDeps "ul") # everything needs ul - list(REMOVE_DUPLICATES outDeps) # clean up + list(APPEND outDeps "ul") # everything needs ul + list(REMOVE_DUPLICATES outDeps) # clean up - # look for traditional static libraries - foreach(component ${outDeps}) - find_static_component(${component} PLIB_LIBRARIES) - endforeach() -endif() + # look for traditional static libraries + foreach(component ${outDeps}) + find_static_component(${component} PLIB_LIBRARIES) + endforeach() include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PLIB DEFAULT_MSG PLIB_LIBRARIES PLIB_INCLUDE_DIR) diff --git a/CMakeModules/FindSQLite3.cmake b/CMakeModules/FindSQLite3.cmake index 5210c8b69..397a00e92 100644 --- a/CMakeModules/FindSQLite3.cmake +++ b/CMakeModules/FindSQLite3.cmake @@ -32,5 +32,16 @@ FIND_LIBRARY(SQLITE3_LIBRARY NAMES sqlite3 sqlite3 PATHS ${ADDITIONAL_LIBRARY_PATHS} ) +find_package(Threads) + include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(SQLITE3 DEFAULT_MSG SQLITE3_LIBRARY SQLITE3_INCLUDE_DIR) + +if(NOT TARGET fgsqlite3) + add_library(fgsqlite3 UNKNOWN IMPORTED) + set_target_properties(fgsqlite3 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SQLITE3_INCLUDE_DIR}" + IMPORTED_LINK_INTERFACE_LANGUAGES "C" + IMPORTED_LOCATION "${SQLITE3_LIBRARY}" + INTERFACE_LINK_LIBRARIES Threads::Threads) +endif() diff --git a/CMakeModules/Installation.cmake b/CMakeModules/Installation.cmake new file mode 100644 index 000000000..3b0539a13 --- /dev/null +++ b/CMakeModules/Installation.cmake @@ -0,0 +1,16 @@ + +if (APPLE) + install(TARGETS fgfs BUNDLE DESTINATION .) +else() + install(TARGETS fgfs RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() + +if (TARGET sentry_crashpad::handler) + if (APPLE) + # install inside the bundle + install(FILES $ DESTINATION fgfs.app/Contents/MacOS OPTIONAL) + else() + # install in the bin-dir, next to the application binary + install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) + endif() +endif() diff --git a/CMakeModules/SetupFGFSIncludes.cmake b/CMakeModules/SetupFGFSIncludes.cmake index d9035ffad..7faec5bcd 100644 --- a/CMakeModules/SetupFGFSIncludes.cmake +++ b/CMakeModules/SetupFGFSIncludes.cmake @@ -1,10 +1,12 @@ -function(setup_fgfs_includes) +function(setup_fgfs_includes target) if(ENABLE_JSBSIM) # FIXME - remove once JSBSim doesn't expose private headers - include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) + target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) endif() - if(FG_HAVE_GPERFTOOLS) - include_directories(${GooglePerfTools_INCLUDE_DIR}) - endif() + target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/cjson) + + # only actually needed for httpd.cxx + target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/3rdparty/mongoose) + endfunction() diff --git a/CMakeModules/SetupFGFSLibraries.cmake b/CMakeModules/SetupFGFSLibraries.cmake index d47fa7d94..cca00d6f4 100644 --- a/CMakeModules/SetupFGFSLibraries.cmake +++ b/CMakeModules/SetupFGFSLibraries.cmake @@ -1,6 +1,4 @@ function(setup_fgfs_libraries target) - link_directories ( ${Boost_LIBRARY_DIRS} ) - get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS) #message(STATUS "fg libs ${FG_LIBS}") #message(STATUS "OSG libs ${OPENSCENEGRAPH_LIBRARIES}") @@ -12,58 +10,34 @@ function(setup_fgfs_libraries target) set(HLA_LIBRARIES "") endif() - if(GDAL_FOUND) - set(GDAL_LIBRARIES ${GDAL_LIBRARY}) - else() - set(GDAL_LIBRARIES "") - endif() - if(ENABLE_JSBSIM) target_link_libraries(${target} JSBSim) endif() if(ENABLE_IAX) - target_link_libraries(${target} iaxclient_lib ${OPENAL_LIBRARY}) + target_link_libraries(${target} iaxclient_lib) endif() - # manually created DBus target if(TARGET DBus) target_link_libraries(${target} DBus) endif() - # PkgConfig::DBUS target - - if(CMAKE_VERSION VERSION_LESS 3.6) - if(DBUS_FOUND) - target_link_libraries(${target} ${DBUS_LDFLAGS}) - endif() - else() - # PkgConfig::DBUS target - if(TARGET PkgConfig::DBUS) - target_link_libraries(${target} PkgConfig::DBUS) - endif() - endif() - - if(FG_HAVE_GPERFTOOLS) - target_link_libraries(${target} ${GooglePerfTools_LIBRARIES}) - endif() - if(X11_FOUND) target_link_libraries(${target} ${X11_LIBRARIES}) endif() + target_link_libraries(${target} fgsqlite3 fgvoicesynth) + target_link_libraries(${target} SimGearCore SimGearScene + Boost::boost ${EVENT_INPUT_LIBRARIES} - ${GDAL_LIBRARIES} ${HLA_LIBRARIES} ${OPENGL_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES} ${PLATFORM_LIBS} ${PLIB_LIBRARIES} - ${SQLITE3_LIBRARY} - ${SIMGEAR_LIBRARIES} ) if (ENABLE_PLIB_JOYSTICK) @@ -72,21 +46,11 @@ function(setup_fgfs_libraries target) target_link_libraries(${target} PLIBFont) - if(SYSTEM_HTS_ENGINE) - target_link_libraries(${target} flite_hts ${HTS_ENGINE_LIBRARIES}) - else() - target_link_libraries(${target} flite_hts hts_engine) - endif() - - if(Qt5Core_FOUND) + if (TARGET fglauncher) target_link_libraries(${target} Qt5::Core Qt5::Widgets fglauncher fgqmlui) set_property(TARGET ${target} PROPERTY AUTOMOC ON) endif() - if(USE_AEONWAVE) - target_link_libraries(${target} ${AAX_LIBRARY}) - endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") target_link_libraries(${target} execinfo) endif() diff --git a/CMakeModules/SetupSwiftLibraries.cmake b/CMakeModules/SetupSwiftLibraries.cmake new file mode 100644 index 000000000..a3d271d5e --- /dev/null +++ b/CMakeModules/SetupSwiftLibraries.cmake @@ -0,0 +1,19 @@ +if (ENABLE_SWIFT) + # DBUS + # our local FindDBus.cmake file uses pkg-config on non-Windows + # we want to ensure our local prefixes are searched, so set this + set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH 1) + + # unfortunately CMAKE_INSTALL_PREFIX is not searched, so add that manually + list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) + + find_package(DBus) + find_package(LibEvent) + + if (TARGET DBus AND TARGET libEvent) + message(STATUS "SWIFT support enabled") + else() + message(STATUS "SWIFT support disabled, dbus and/or LibEvent not found") + set(ENABLE_SWIFT 0) + endif() +endif() diff --git a/src/AIModel/AIBaseAircraft.cxx b/src/AIModel/AIBaseAircraft.cxx index 8e4cc97b2..b769bc874 100644 --- a/src/AIModel/AIBaseAircraft.cxx +++ b/src/AIModel/AIBaseAircraft.cxx @@ -16,7 +16,8 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "AIBaseAircraft.hxx" -#include + +#include
FGAIBaseAircraft::FGAIBaseAircraft() : FGAIBase(otStatic, false) { diff --git a/src/AIModel/AIBaseAircraft.hxx b/src/AIModel/AIBaseAircraft.hxx index e791ca895..b4cef514b 100644 --- a/src/AIModel/AIBaseAircraft.hxx +++ b/src/AIModel/AIBaseAircraft.hxx @@ -27,7 +27,7 @@ class FGAIBaseAircraft : public FGAIBase { public: FGAIBaseAircraft(); - void bind(); + void bind() override; // Note that this is mapped to all 6 gear indices gear/gear[0..5] void setGearPos(double pos) { m_gearPos = pos; }; diff --git a/src/AIModel/CMakeLists.txt b/src/AIModel/CMakeLists.txt index e6b684818..179e1c30b 100644 --- a/src/AIModel/CMakeLists.txt +++ b/src/AIModel/CMakeLists.txt @@ -49,14 +49,8 @@ set(HEADERS # Add sources if swift support is enabled if(ENABLE_SWIFT) - set(HEADERS - ${HEADERS} - AISwiftAircraft.h - ) - set(SOURCES - ${SOURCES} - AISwiftAircraft.cpp - ) + list(APPEND HEADERS AISwiftAircraft.h) + list(APPEND SOURCES AISwiftAircraft.cpp) endif() flightgear_component(AIModel "${SOURCES}" "${HEADERS}") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 206597440..d6d20797e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,4 @@ -include_directories(${PROJECT_SOURCE_DIR}) - # note order here affects link order, and hence linking correctness # on systems with a traditional ld (eg, GNU ld on Linux) foreach( mylibfolder diff --git a/src/EmbeddedResources/CMakeLists.txt b/src/EmbeddedResources/CMakeLists.txt index d49df99bf..05eaab1cf 100644 --- a/src/EmbeddedResources/CMakeLists.txt +++ b/src/EmbeddedResources/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable(fgrcc fgrcc.cxx fgrcc.hxx) -target_link_libraries(fgrcc SimGearCore ${PLATFORM_LIBS}) +target_link_libraries(fgrcc SimGearCore) # On Windows, make sure fgrcc can be run (it needs third-party libraries) in add_custom_target if(MSVC) diff --git a/src/FDM/CMakeLists.txt b/src/FDM/CMakeLists.txt index 5fc959671..7eacad6f5 100644 --- a/src/FDM/CMakeLists.txt +++ b/src/FDM/CMakeLists.txt @@ -182,8 +182,5 @@ endif() if(ENABLE_JSBSIM) add_subdirectory(JSBSim) - - # FIXME - push this down once JSBSim doesn't expose private headers - include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) endif() diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 18b1a8a41..546d6a241 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -66,8 +66,7 @@ setup_fgfs_embedded_resources() # Sort the sources and headers for MSVC. setup_msvc_grouping() -# Additional search paths for includes. -setup_fgfs_includes() + # All sources and headers to be built into fgfs. get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES) @@ -104,34 +103,16 @@ endif() # Set up the target links. setup_fgfs_libraries(fgfs) export_debug_symbols(fgfs) - -if (APPLE) - install(TARGETS fgfs BUNDLE DESTINATION .) -else() - install(TARGETS fgfs RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) -endif() +# Additional search paths for includes. +setup_fgfs_includes(fgfs) if (TARGET sentry::sentry) target_link_libraries(fgfs sentry::sentry) endif() -if (TARGET sentry_crashpad::handler) - if (APPLE) - # install inside the bundle - install(FILES $ DESTINATION fgfs.app/Contents/MacOS OPTIONAL) - else() - # install in the bin-dir, next to the application binary - install(FILES $ DESTINATION ${CMAKE_INSTALL_BINDIR} OPTIONAL) - endif() -endif() - if(ENABLE_METAR) add_executable(metar metar_main.cxx) - target_link_libraries(metar - SimGearScene SimGearCore - ${PLATFORM_LIBS} - ) - + target_link_libraries(metar SimGearScene) install(TARGETS metar RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() diff --git a/src/Main/options.cxx b/src/Main/options.cxx index eba937993..fc6b07f35 100644 --- a/src/Main/options.cxx +++ b/src/Main/options.cxx @@ -29,7 +29,7 @@ #include #include -#include <3rdparty/cjson/cJSON.h> +#include #include // rint() #include diff --git a/src/MultiPlayer/MPServerResolver.cxx b/src/MultiPlayer/MPServerResolver.cxx index c2b459df8..38c699003 100644 --- a/src/MultiPlayer/MPServerResolver.cxx +++ b/src/MultiPlayer/MPServerResolver.cxx @@ -23,7 +23,7 @@ #include #include
-#include <3rdparty/cjson/cJSON.h> +#include #include #include "MPServerResolver.hxx" diff --git a/src/Network/fgcom.cxx b/src/Network/fgcom.cxx index a5eb46469..e9358e12d 100644 --- a/src/Network/fgcom.cxx +++ b/src/Network/fgcom.cxx @@ -16,9 +16,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -#ifdef HAVE_CONFIG_H -# include -#endif +# include #include "fgcom.hxx" @@ -39,7 +37,7 @@ #include #include -#include <3rdparty/iaxclient/lib/iaxclient.h> +#include #define NUM_CALLS 4 diff --git a/src/Network/http/FlightHistoryUriHandler.cxx b/src/Network/http/FlightHistoryUriHandler.cxx index 329cd425b..ee8ea43d6 100644 --- a/src/Network/http/FlightHistoryUriHandler.cxx +++ b/src/Network/http/FlightHistoryUriHandler.cxx @@ -20,7 +20,7 @@ #include "FlightHistoryUriHandler.hxx" #include "SimpleDOM.hxx" -#include <3rdparty/cjson/cJSON.h> +#include #include #include
diff --git a/src/Network/http/MirrorPropertyTreeWebsocket.cxx b/src/Network/http/MirrorPropertyTreeWebsocket.cxx index 60a0e85e0..d20db1324 100644 --- a/src/Network/http/MirrorPropertyTreeWebsocket.cxx +++ b/src/Network/http/MirrorPropertyTreeWebsocket.cxx @@ -33,7 +33,7 @@ #include
#include
-#include <3rdparty/cjson/cJSON.h> +#include //#define MIRROR_DEBUG 1 diff --git a/src/Network/http/NavdbUriHandler.cxx b/src/Network/http/NavdbUriHandler.cxx index dcfe2a1e9..cac1302ed 100644 --- a/src/Network/http/NavdbUriHandler.cxx +++ b/src/Network/http/NavdbUriHandler.cxx @@ -23,7 +23,7 @@ #include #include #include -#include <3rdparty/cjson/cJSON.h> +#include using std::string; diff --git a/src/Network/http/PkgUriHandler.cxx b/src/Network/http/PkgUriHandler.cxx index b079f3c6c..74743f505 100644 --- a/src/Network/http/PkgUriHandler.cxx +++ b/src/Network/http/PkgUriHandler.cxx @@ -20,7 +20,7 @@ #include "PkgUriHandler.hxx" -#include <3rdparty/cjson/cJSON.h> +#include #include #include diff --git a/src/Network/http/PropertyChangeWebsocket.cxx b/src/Network/http/PropertyChangeWebsocket.cxx index 81f3ab501..f6185e743 100644 --- a/src/Network/http/PropertyChangeWebsocket.cxx +++ b/src/Network/http/PropertyChangeWebsocket.cxx @@ -30,7 +30,7 @@ #include
#include
-#include <3rdparty/cjson/cJSON.h> +#include namespace flightgear { namespace http { diff --git a/src/Network/http/RunUriHandler.cxx b/src/Network/http/RunUriHandler.cxx index 963760834..0dc635b3e 100644 --- a/src/Network/http/RunUriHandler.cxx +++ b/src/Network/http/RunUriHandler.cxx @@ -24,7 +24,7 @@ #include #include #include
-#include <3rdparty/cjson/cJSON.h> +#include using std::string; diff --git a/src/Network/http/httpd.cxx b/src/Network/http/httpd.cxx index 4cad46892..9884aabf4 100644 --- a/src/Network/http/httpd.cxx +++ b/src/Network/http/httpd.cxx @@ -32,8 +32,9 @@ #include "PropertyChangeObserver.hxx" #include
#include -#include <3rdparty/mongoose/mongoose.h> -#include <3rdparty/cjson/cJSON.h> + +#include +#include #include #include diff --git a/src/Network/http/jsonprops.hxx b/src/Network/http/jsonprops.hxx index dfabd1fad..088bf4fd3 100644 --- a/src/Network/http/jsonprops.hxx +++ b/src/Network/http/jsonprops.hxx @@ -22,7 +22,7 @@ #define JSONPROPS_HXX_ #include -#include <3rdparty/cjson/cJSON.h> +#include #include namespace flightgear { diff --git a/src/Sound/CMakeLists.txt b/src/Sound/CMakeLists.txt index e021d0515..c4f352d53 100644 --- a/src/Sound/CMakeLists.txt +++ b/src/Sound/CMakeLists.txt @@ -10,8 +10,7 @@ set(SOURCES voice.cxx voiceplayer.cxx soundmanager.cxx - VoiceSynthesizer.cxx - flitevoice.cxx + ) set(HEADERS @@ -29,3 +28,6 @@ set(HEADERS ) flightgear_component(Sound "${SOURCES}" "${HEADERS}") + +add_library(fgvoicesynth OBJECT VoiceSynthesizer.cxx flitevoice.cxx) +target_link_libraries(fgvoicesynth PRIVATE flightgear_flite_hts SimGearScene) diff --git a/test_suite/CMakeLists.txt b/test_suite/CMakeLists.txt index 77e0ba2cb..45d02e4fe 100644 --- a/test_suite/CMakeLists.txt +++ b/test_suite/CMakeLists.txt @@ -111,8 +111,7 @@ setup_fgfs_embedded_resources() # Sort the sources and headers for MSVC. setup_msvc_grouping() -# Additional search paths for includes. -setup_fgfs_includes() + # All sources and headers to be built into the test suite. get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES) @@ -147,6 +146,8 @@ endif(ENABLE_AUTOTESTING) # Set up the target links. setup_fgfs_libraries(fgfs_test_suite) +# Additional search paths for includes. +setup_fgfs_includes(fgfs_test_suite) target_compile_definitions(fgfs_test_suite PUBLIC BUILDING_TESTSUITE) diff --git a/utils/demconvert/CMakeLists.txt b/utils/demconvert/CMakeLists.txt index ad89bbf8e..e63d08a5b 100644 --- a/utils/demconvert/CMakeLists.txt +++ b/utils/demconvert/CMakeLists.txt @@ -1,8 +1,5 @@ add_executable(demconvert demconvert.cxx ) -target_link_libraries(demconvert - SimGearScene SimGearCore - ${GDAL_LIBRARY} -) +target_link_libraries(demconvert SimGearScene SimGearCore) install(TARGETS demconvert RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/utils/fgcom/CMakeLists.txt b/utils/fgcom/CMakeLists.txt index 273c2d256..8948647a1 100644 --- a/utils/fgcom/CMakeLists.txt +++ b/utils/fgcom/CMakeLists.txt @@ -5,20 +5,21 @@ find_package(OpenAL REQUIRED) # Copy positions.txt content in const char* _positionsData[]; file(READ utils/positions.txt POSITIONS_DATA) string(REGEX REPLACE "\n" "\"% - \"" POSITIONS_DATA ${POSITIONS_DATA}) +\"" POSITIONS_DATA ${POSITIONS_DATA}) string(REGEX REPLACE "%" "," POSITIONS_DATA ${POSITIONS_DATA}) -file(WRITE positions.hxx "const char* _positionsData[] = { - \"") -file(APPEND positions.hxx ${POSITIONS_DATA}) -file(APPEND positions.hxx "\" -};") + +set(out_file ${CMAKE_BINARY_DIR}/positions.hxx) + +file(WRITE ${out_file} "const char* _positionsData[] = {\n\"") +file(APPEND ${out_file} ${POSITIONS_DATA}) +file(APPEND ${out_file} "\"\n};") if(MSVC) set(RESOURCE_FILE fgcom.rc) endif(MSVC) -set(SOURCES fgcom.cxx) -set(HEADERS fgcom.hxx positions.hxx) +set(SOURCES fgcom_external.cxx) +set(HEADERS fgcom_external.hxx ${out_file}) add_executable(${name} ${SOURCES} @@ -28,8 +29,6 @@ add_executable(${name} target_link_Libraries(${name} iaxclient_lib - ${OPENAL_LIBRARY} - SimGearCore -) + SimGearCore) install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/utils/fgcom/fgcom.cxx b/utils/fgcom/fgcom_external.cxx similarity index 99% rename from utils/fgcom/fgcom.cxx rename to utils/fgcom/fgcom_external.cxx index 0a8f46d24..5a9537a47 100644 --- a/utils/fgcom/fgcom.cxx +++ b/utils/fgcom/fgcom_external.cxx @@ -25,9 +25,7 @@ * */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include #include @@ -36,9 +34,9 @@ #include #include -#include <3rdparty/iaxclient/lib/iaxclient.h> +#include -#include "fgcom.hxx" +#include "fgcom_external.hxx" #include "positions.hxx" // provides _positionsData[]; int _port = 16661; diff --git a/utils/fgcom/fgcom.hxx b/utils/fgcom/fgcom_external.hxx similarity index 100% rename from utils/fgcom/fgcom.hxx rename to utils/fgcom/fgcom_external.hxx diff --git a/utils/fgelev/CMakeLists.txt b/utils/fgelev/CMakeLists.txt index 9e729ef4c..a27f733f7 100644 --- a/utils/fgelev/CMakeLists.txt +++ b/utils/fgelev/CMakeLists.txt @@ -1,8 +1,5 @@ add_executable(fgelev fgelev.cxx) -target_link_libraries(fgelev - SimGearScene SimGearCore - ${GDAL_LIBRARY} -) +target_link_libraries(fgelev SimGearScene SimGearCore) install(TARGETS fgelev RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/utils/fgpanel/CMakeLists.txt b/utils/fgpanel/CMakeLists.txt index 13a4b4433..a115b9b44 100644 --- a/utils/fgpanel/CMakeLists.txt +++ b/utils/fgpanel/CMakeLists.txt @@ -81,7 +81,7 @@ target_link_libraries(fgpanel SimGearCore ${PNG_LIBRARIES} ${FREETYPE_LIBRARIES} - ${OPENGL_LIBRARIES} + OpenGL::GL ${GLUT_LIBRARIES} ${GLEW_LIBRARIES} ) diff --git a/utils/fgviewer/CMakeLists.txt b/utils/fgviewer/CMakeLists.txt index dd690cecd..dd10d6e4b 100644 --- a/utils/fgviewer/CMakeLists.txt +++ b/utils/fgviewer/CMakeLists.txt @@ -47,9 +47,7 @@ if(X11_FOUND) endif() target_link_libraries(fgviewer - SimGearScene SimGearCore - ${OPENGL_LIBRARIES} + SimGearScene SimGearCore OpenGL::GL ${FGVIEWER_RTI_LIBRARIES} - ${GDAL_LIBRARY} ) install(TARGETS fgviewer RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})