]> git.mxchange.org Git - flightgear.git/blob - src/Main/CMakeLists.txt
Make compiling of all utils/tools optional
[flightgear.git] / src / Main / CMakeLists.txt
1
2 if (MSVC)
3         if (CMAKE_CL_64)
4                 set( RESOURCE_FILE flightgear64.rc )
5         else (CMAKE_CL_64)
6                 set( RESOURCE_FILE flightgear.rc )
7         endif (CMAKE_CL_64)
8 endif (MSVC)
9
10 set(SOURCES
11         bootstrap.cxx
12         fg_commands.cxx
13         fg_init.cxx
14         fg_io.cxx
15         fg_os_common.cxx
16         fg_props.cxx
17         globals.cxx
18         locale.cxx
19         logger.cxx
20         main.cxx
21         options.cxx
22         util.cxx
23     positioninit.cxx
24     subsystemFactory.cxx
25         ${RESOURCE_FILE}
26         )
27
28 set(HEADERS
29         fg_commands.hxx
30         fg_init.hxx
31         fg_io.hxx
32         fg_props.hxx
33         globals.hxx
34         locale.hxx
35         logger.hxx
36         main.hxx
37         options.hxx
38         util.hxx
39     positioninit.hxx
40     subsystemFactory.hxx
41         )
42
43 get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES)
44 get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS)
45
46 link_directories ( ${Boost_LIBRARY_DIRS} )
47
48 get_property(FG_GROUPS_C GLOBAL PROPERTY FG_GROUPS_C)
49 string(REPLACE "@" ";" groups ${FG_GROUPS_C} )
50 foreach(g ${groups})
51         string(REPLACE "#" ";" g2 ${g})
52         list(GET g2 0 name)
53         list(REMOVE_AT g2 0)
54         source_group("${name}\\Sources" FILES ${g2})
55 endforeach()
56
57 get_property(FG_GROUPS_H GLOBAL PROPERTY FG_GROUPS_H)
58 string(REPLACE "@" ";" groups ${FG_GROUPS_H} )
59 foreach(g ${groups})
60         string(REPLACE "#" ";" g2 ${g})
61         list(GET g2 0 name)
62         list(REMOVE_AT g2 0)
63         source_group("${name}\\Headers" FILES ${g2})
64 endforeach()
65
66 source_group("Main\\Headers" FILES ${HEADERS})
67 source_group("Main\\Sources" FILES ${SOURCES})
68 add_executable(fgfs ${SOURCES} ${FG_SOURCES} ${FG_HEADERS} ${HEADERS})
69
70 # disable sqlite3 dynamic lib support
71 # this should really be a SOURCE property, but the way we handle
72 # Fcomponent sources is making that tricky
73 add_definitions(-DSQLITE_OMIT_LOAD_EXTENSION)
74
75 get_property(FG_LIBS GLOBAL PROPERTY FG_LIBS)
76 #message(STATUS "fg libs ${FG_LIBS}")
77 #message(STATUS "OSG libs ${OPENSCENEGRAPH_LIBRARIES}")
78 #message(STATUS "SG libs ${SIMGEAR_LIBRARIES}")
79
80 if(RTI_FOUND)
81         set(HLA_LIBRARIES ${RTI_LIBRARIES})
82 else()
83         set(HLA_LIBRARIES "")
84 endif()
85
86 if(ENABLE_JSBSIM)
87     # FIXME - remove once JSBSim doesn't expose private headers
88     include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim)
89     
90     target_link_libraries(fgfs JSBSim)
91 endif()
92
93 if(FG_HAVE_GPERFTOOLS)
94     include_directories(${GooglePerfTools_INCLUDE_DIR})
95     target_link_libraries(fgfs ${GooglePerfTools_LIBRARIES})
96 endif()
97
98 target_link_libraries(fgfs
99         ${SQLITE3_LIBRARY}
100         ${SIMGEAR_LIBRARIES}
101         ${OPENSCENEGRAPH_LIBRARIES}
102         ${OPENGL_LIBRARIES}
103         ${PLIB_LIBRARIES}
104         ${JPEG_LIBRARY}
105         ${HLA_LIBRARIES}
106         ${EVENT_INPUT_LIBRARIES}
107         ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
108         ${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
109         ${PLATFORM_LIBS}
110 )
111
112 install(TARGETS fgfs RUNTIME DESTINATION bin)
113
114 if(ENABLE_METAR)
115     add_executable(metar metar_main.cxx)
116     target_link_libraries(metar
117         ${SIMGEAR_LIBRARIES}
118         ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
119         ${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
120         ${PLATFORM_LIBS}
121     )
122
123     install(TARGETS metar RUNTIME DESTINATION bin)
124 endif()