Debian Codegraph @

utils/fgpanel/CMakeLists.txt

raw
1 find_package(PNG QUIET)
2 find_package(OpenGL QUIET)
3 find_package(Freetype QUIET)
4
5 find_package(GLUT QUIET)
6 find_package(GLEW QUIET)
7
8 if(NOT ${GLUT_FOUND})
9 message(WARNING "GLUT NOT found, can't build FGPanel")
10 set(WITH_FGPANEL 0)
11 return()
12 endif()
13
14 if(NOT ${GLEW_FOUND})
15 message(WARNING "GLEW NOT found, can't build FGPanel")
16 set(WITH_FGPANEL 0)
17 return()
18 endif()
19
20 if((NOT PNG_FOUND) OR (NOT OPENGL_FOUND) OR (NOT FREETYPE_FOUND))
21 message(WARNING "FGPanel enabled, but some dependencies are missing")
22 message(STATUS "libPNG: ${PNG_FOUND}")
23 message(STATUS "OpenGL: ${OPENGL_FOUND}")
24 message(STATUS "Freetype: ${FREETYPE_FOUND}")
25 return()
26 endif()
27
28 find_path(BCMHOST_INCLUDE_DIR
29 NAMES bcm_host.h
30 PATHS /opt/vc/include
31 NO_DEFAULT_PATH
32 )
33
34 set(TARGET_SOURCES
35 main.cxx
36 ApplicationProperties.hxx
37 ApplicationProperties.cxx
38 FGCroppedTexture.hxx
39 FGCroppedTexture.cxx
40 FGDummyTextureLoader.hxx
41 FGDummyTextureLoader.cxx
42 FGFontCache.cxx
43 FGFontCache.hxx
44 FGGLApplication.cxx
45 FGGLApplication.hxx
46 FGGroupLayer.cxx
47 FGGroupLayer.hxx
48 FGInstrumentLayer.cxx
49 FGInstrumentLayer.hxx
50 FGLayeredInstrument.cxx
51 FGLayeredInstrument.hxx
52 FGPanel.cxx
53 FGPanel.hxx
54 FGPanelApplication.cxx
55 FGPanelApplication.hxx
56 FGPanelInstrument.cxx
57 FGPanelInstrument.hxx
58 FGPanelProtocol.cxx
59 FGPanelProtocol.hxx
60 FGPanelTransformation.cxx
61 FGPanelTransformation.hxx
62 FGPNGTextureLoader.cxx
63 FGPNGTextureLoader.hxx
64 FGRGBTextureLoader.cxx
65 FGRGBTextureLoader.hxx
66 FGSwitchLayer.cxx
67 FGSwitchLayer.hxx
68 FGTextLayer.cxx
69 FGTextLayer.hxx
70 FGTexturedLayer.cxx
71 FGTexturedLayer.hxx
72 panel_io.cxx
73 panel_io.hxx
74 GL_utils.cxx
75 GL_utils.hxx
76 )
77
78 add_executable(fgpanel ${TARGET_SOURCES})
79
80 target_link_libraries(fgpanel
81 SimGearCore
82 ${PNG_LIBRARIES}
83 ${FREETYPE_LIBRARIES}
84 OpenGL::GL
85 ${GLUT_LIBRARIES}
86 ${GLEW_LIBRARIES}
87 )
88
89 target_include_directories(fgpanel PUBLIC
90 ${FREETYPE_INCLUDE_DIRS}
91 ${PNG_INCLUDE_DIR}
92 ${GLEW_INCLUDE_DIRS}
93 )
94
95 if(MSVC)
96 target_compile_definitions(fgpanel PUBLIC
97 -DFREEGLUT_LIB_PRAGMAS=0
98 )
99 endif(MSVC)
100
101 if(BCMHOST_INCLUDE_DIR)
102 message(STATUS "found Raspberry Pi")
103
104 add_executable(fgpanel-egl ${TARGET_SOURCES}
105 GLES_utils.cxx
106 GLES_utils.hxx
107 )
108 target_include_directories(fgpanel-egl PUBLIC
109 ${FREETYPE_INCLUDE_DIRS}
110 ${PNG_INCLUDE_DIR}
111 ${BCMHOST_INCLUDE_DIR}
112 ${BCMHOST_INCLUDE_DIR}/interface/vcos/pthreads
113 ${BCMHOST_INCLUDE_DIR}/interface/vmcs_host/linux
114 )
115
116 target_link_libraries(fgpanel-egl
117 SimGearCore
118 ${PNG_LIBRARIES}
119 ${FREETYPE_LIBRARIES}
120 -lbrcmGLESv2 -lbrcmEGL -lm -lbcm_host -L/opt/vc/lib
121 )
122
123 target_compile_definitions(fgpanel-egl PUBLIC
124 -D_GLES2 -D_RPI
125 )
126 target_compile_definitions(fgpanel PUBLIC
127 -D_RPI
128 )
129 message(STATUS "FGPanel (Raspberry Pi) : ENABLED")
130 install(TARGETS fgpanel-egl RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
131 else(BCMHOST_INCLUDE_DIR)
132 message(STATUS "FGPanel (Raspberry Pi) : DISABLED")
133 endif(BCMHOST_INCLUDE_DIR)
134
135
136
137
138 if(WITH_FGPANEL)
139 message(STATUS "FGPanel : ENABLED")
140 install(TARGETS fgpanel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
141 else(WITH_FGPANEL)
142 message(WARNING "FGPanel : DISABLED")
143 endif(WITH_FGPANEL)