Debian Codegraph @

src/Main/CMakeLists.txt

raw
1 # CMake module includes.
2 include(FlightGearComponent)
3 include(SetupFGFSBundle)
4 include(SetupFGFSEmbeddedResources)
5 include(SetupFGFSIncludes)
6 include(SetupFGFSLibraries)
7 include(SetupMSVCGrouping)
8
9 # Set up the Main FG file sources and headers (excluding bootstrap.cxx and its main() function).
10 if(MSVC)
11 set(MS_RESOURCE_FILE flightgear.rc)
12 endif(MSVC)
13
14 set(SOURCES
15
16 fg_commands.cxx
17 fg_init.cxx
18 fg_io.cxx
19 fg_os_common.cxx
20 fg_scene_commands.cxx
21 fg_props.cxx
22 FGInterpolator.cxx
23 globals.cxx
24 locale.cxx
25 logger.cxx
26 main.cxx
27 MultipleInstanceLock.cxx
28 options.cxx
29 positioninit.cxx
30 screensaver_control.cxx
31 subsystemFactory.cxx
32 util.cxx
33 XLIFFParser.cxx
34 ErrorReporter.cxx
35 ${MS_RESOURCE_FILE}
36 )
37
38 set(HEADERS
39 AircraftDirVisitorBase.hxx
40 fg_commands.hxx
41 fg_init.hxx
42 fg_io.hxx
43 fg_props.hxx
44 FGInterpolator.hxx
45 globals.hxx
46 locale.hxx
47 logger.hxx
48 main.hxx
49 MultipleInstanceLock.hxx
50 options.hxx
51 positioninit.hxx
52 screensaver_control.hxx
53 subsystemFactory.hxx
54 util.hxx
55 XLIFFParser.hxx
56 ErrorReporter.hxx
57 sentryIntegration.hxx
58 )
59
60 flightgear_component(Main "${SOURCES}" "${HEADERS}" sentryIntegration.cxx)
61
62 # the main() function
63 set(MAIN_SOURCE
64 bootstrap.cxx
65 # we only want this file when building FGFS, so it can't be
66 # part of fgfsObjects
67 ${PROJECT_SOURCE_DIR}/src/Scripting/NasalUnitTesting.cxx
68 )
69
70 # Set up the embedded resources.
71 setup_fgfs_embedded_resources()
72
73 # Sort the sources and headers for MSVC.
74 setup_msvc_grouping()
75
76 # souerces which are different for fgfs vs the test-suite
77 get_property(TEST_SOURCES GLOBAL PROPERTY FG_TEST_SOURCES)
78
79
80 # important we pass WIN32 here so the console is optional. Other
81 # platforms ignore this option. If a console is needed we allocate
82 # it manually via AllocConsole()
83 # similarly pass MACOSX_BUNDLE so we generate a .app on Mac
84 add_executable(fgfs
85 WIN32
86 MACOSX_BUNDLE
87 ${MAIN_SOURCE}
88 ${TEST_SOURCES}
89 $<TARGET_OBJECTS:fgfsObjects>
90 )
91
92 add_dependencies(fgfs buildId)
93 # explicitly disable automoc for main fgfs target
94 set_property(TARGET fgfs PROPERTY AUTOMOC OFF)
95
96 # MacOSX bundle packaging
97 if(APPLE)
98 setup_fgfs_bundle(fgfs)
99 endif()
100
101 # Set up the target links.
102 setup_fgfs_libraries(fgfs)
103 export_debug_symbols(fgfs)
104 # Additional search paths for includes.
105 setup_fgfs_includes(fgfs)
106
107 add_executable(nasal
108 nasal-bin.cxx
109 ${PROJECT_SOURCE_DIR}/src/Scripting/sqlitelib.cxx
110 )
111 setup_fgfs_libraries(nasal)
112 install(TARGETS nasal RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
113
114 if(ENABLE_METAR)
115 add_executable(metar metar_main.cxx)
116 target_link_libraries(metar SimGearScene)
117 install(TARGETS metar RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
118 endif()
119
120 # ensure run/debug paths are set automatically in Visual Studio
121 if (MSVC)
122 file(TO_NATIVE_PATH "${FG_QT_BIN_DIR}" _qt_bin_dir_native)
123 file(TO_NATIVE_PATH "${FINAL_MSVC_3RDPARTY_DIR}/bin" _msvc_3rdparty_bin_dir)
124 file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}" _install_bin_dir)
125
126 set_property(TARGET fgfs PROPERTY
127 VS_GLOBAL_LocalDebuggerEnvironment "PATH=${_install_bin_dir};${_msvc_3rdparty_bin_dir};${_qt_bin_dir_native}")
128 endif()