f61293a935
1. The variables SIMGEAR_CORE_LIBRARIES and SIMGEAR_CORE_LIBRARY_DEPENDENCIES are no longer set... hence the need to hard-code 'SimGearCore' in the target_link_libraries() 2. And -lfreetype means the linker must know the specific link path to it, while the variable FREETYPE_LIBRARIES contains the fully qualified path to the library. 3. Improved the 'found glut' message to show exactly what was found, and being used... This is due to the user possibly also have the near binary compatible glut32.lib found, which will fail in the link due to some freeglut extensions have been used. 4. Adding the define -DFREEGLUT_LIB_PRAGMAS=0 is necessary to stop the freeglut headers from using a MSVC pragma to declare the library, which will /not/ not be found... 5. In Windows the glew library is not -lGLEW, and even if it was, it would not be found, without adding a link_directories( path/to/library ), while the GLEW_LIBRARIES variable has the fully qualified path.
118 lines
2.7 KiB
CMake
118 lines
2.7 KiB
CMake
find_package(PNG)
|
|
find_package(OpenGL)
|
|
find_package(GLEW )
|
|
find_package(Freetype)
|
|
|
|
if ((NOT PNG_FOUND) OR (NOT OPENGL_FOUND) OR (NOT GLEW_FOUND) OR (NOT FREETYPE_FOUND))
|
|
message(WARNING "FGPanel enabled, but some dependencies are missing")
|
|
message(STATUS "libPNG: ${PNG_FOUND}")
|
|
message(STATUS "OpenGL: ${OPENGL_FOUND}")
|
|
message(STATUS "GLEW: ${GLEW_FOUND}")
|
|
message(STATUS "Freetype: ${FREETYPE_FOUND}")
|
|
return()
|
|
endif()
|
|
|
|
find_path(BCMHOST_INCLUDE_DIR
|
|
NAMES bcm_host.h
|
|
PATHS /opt/vc/include
|
|
NO_DEFAULT_PATH
|
|
)
|
|
|
|
include_directories(
|
|
/usr/include/freetype2
|
|
${PNG_INCLUDE_DIR}
|
|
)
|
|
|
|
if(${BCMHOST_INCLUDE_DIR} STREQUAL "BCMHOST_INCLUDE_DIR-NOTFOUND")
|
|
else()
|
|
# CMAKE > 3.1 : target_sources(fgpanel
|
|
set(TARGET_SOURCES
|
|
GLES_utils.cxx
|
|
GLES_utils.hxx
|
|
)
|
|
endif()
|
|
|
|
add_executable(fgpanel
|
|
main.cxx
|
|
ApplicationProperties.hxx
|
|
ApplicationProperties.cxx
|
|
FGCroppedTexture.hxx
|
|
FGCroppedTexture.cxx
|
|
FGDummyTextureLoader.hxx
|
|
FGDummyTextureLoader.cxx
|
|
FGFontCache.cxx
|
|
FGFontCache.hxx
|
|
FGGLApplication.cxx
|
|
FGGLApplication.hxx
|
|
FGGroupLayer.cxx
|
|
FGGroupLayer.hxx
|
|
FGInstrumentLayer.cxx
|
|
FGInstrumentLayer.hxx
|
|
FGLayeredInstrument.cxx
|
|
FGLayeredInstrument.hxx
|
|
FGPanel.cxx
|
|
FGPanel.hxx
|
|
FGPanelApplication.cxx
|
|
FGPanelApplication.hxx
|
|
FGPanelInstrument.cxx
|
|
FGPanelInstrument.hxx
|
|
FGPanelProtocol.cxx
|
|
FGPanelProtocol.hxx
|
|
FGPanelTransformation.cxx
|
|
FGPanelTransformation.hxx
|
|
FGPNGTextureLoader.cxx
|
|
FGPNGTextureLoader.hxx
|
|
FGRGBTextureLoader.cxx
|
|
FGRGBTextureLoader.hxx
|
|
FGSwitchLayer.cxx
|
|
FGSwitchLayer.hxx
|
|
FGTextLayer.cxx
|
|
FGTextLayer.hxx
|
|
FGTexturedLayer.cxx
|
|
FGTexturedLayer.hxx
|
|
panel_io.cxx
|
|
panel_io.hxx
|
|
GL_utils.cxx
|
|
GL_utils.hxx
|
|
${TARGET_SOURCES}
|
|
)
|
|
|
|
target_link_libraries(fgpanel
|
|
SimGearCore
|
|
${PNG_LIBRARIES}
|
|
${FREETYPE_LIBRARIES}
|
|
)
|
|
|
|
if(${BCMHOST_INCLUDE_DIR} STREQUAL "BCMHOST_INCLUDE_DIR-NOTFOUND")
|
|
find_package(GLUT REQUIRED)
|
|
if(GLUT_FOUND)
|
|
message(STATUS "found GLUT inc ${GLUT_INCLUDE_DIR}, lib ${GLUT_LIBRARIES} ")
|
|
if (MSVC)
|
|
add_definitions( -DFREEGLUT_LIB_PRAGMAS=0 )
|
|
endif ()
|
|
|
|
target_link_libraries(fgpanel
|
|
${OPENGL_LIBRARIES}
|
|
${GLUT_LIBRARIES}
|
|
${GLEW_LIBRARIES}
|
|
)
|
|
else(GLUT_FOUND)
|
|
message(STATUS "glut NOT found, can't build fgpanel")
|
|
endif(GLUT_FOUND)
|
|
else()
|
|
message(STATUS "found Raspberry Pi")
|
|
|
|
target_link_libraries(fgpanel
|
|
-lGLESv2 -lEGL -lm -lbcm_host -L/opt/vc/lib
|
|
)
|
|
|
|
include_directories(
|
|
${BCMHOST_INCLUDE_DIR}
|
|
${BCMHOST_INCLUDE_DIR}/interface/vcos/pthreads
|
|
${BCMHOST_INCLUDE_DIR}/interface/vmcs_host/linux
|
|
)
|
|
|
|
add_definitions(-D_GLES2 -D_RPI)
|
|
endif()
|
|
|
|
install(TARGETS fgpanel RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|