1
0
Fork 0

Cmake: Split simgear libraries into core and scene (only scene uses OSG). Fix linkage issues, and make helper binaries (yasim, terrasync) link against less stuff.

This commit is contained in:
James Turner 2011-09-08 13:59:40 +01:00
parent d09575e646
commit a5a8090d52
7 changed files with 34 additions and 41 deletions

View file

@ -18,6 +18,12 @@ file(READ version versionFile)
string(STRIP ${versionFile} FLIGHTGEAR_VERSION) string(STRIP ${versionFile} FLIGHTGEAR_VERSION)
#packaging #packaging
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${FLIGHTGEAR_VERSION} )
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
set(CPACK_PACKAGE_VERSION_PATCH ${CMAKE_MATCH_3})
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING") SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README") SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")

View file

@ -105,29 +105,19 @@ endmacro()
if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND") if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
set(SIMGEAR_LIBRARIES "") # clear value set(SIMGEAR_LIBRARIES "") # clear value
set(SIMGEAR_CORE_LIBRARIES "") # clear value
if(NOT MSVC)
# Olaf indicates that linking the threads libs causes failures
# on MSVC builds
set(thread_lib threads)
endif(NOT MSVC)
# note the order here affects the order Simgear libraries are # note the order here affects the order Simgear libraries are
# linked in, and hence ability to link when using a traditional # linked in, and hence ability to link when using a traditional
# linker such as GNU ld on Linux # linker such as GNU ld on Linux
set(comps set(comps
ephem
tsync tsync
environment environment
nasal nasal
sky
material
tgdb
model
screen
bucket bucket
bvh bvh
util route util
route
timing timing
io io
serial serial
@ -136,14 +126,29 @@ if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
props props
xml xml
misc misc
${thread_lib} threads
debug debug
magvar magvar
math) math)
set(scene_comps
ephem
sky
material
tgdb
model
screen)
foreach(component ${comps}) foreach(component ${comps})
find_sg_component(${component} SIMGEAR_CORE_LIBRARIES)
endforeach()
foreach(component ${scene_comps})
find_sg_component(${component} SIMGEAR_LIBRARIES) find_sg_component(${component} SIMGEAR_LIBRARIES)
endforeach() endforeach()
# again link order matters - scene libraires depend on core ones
list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES})
endif() endif()
# now we've found SimGear, check its version # now we've found SimGear, check its version

View file

@ -37,7 +37,7 @@ add_executable(yasim yasim-test.cpp)
target_link_libraries(yasim target_link_libraries(yasim
fgYASim fgYASim
${SIMGEAR_LIBRARIES} ${SIMGEAR_CORE_LIBRARIES}
${ZLIB_LIBRARIES}) ${ZLIB_LIBRARIES})
install(TARGETS yasim RUNTIME DESTINATION bin) install(TARGETS yasim RUNTIME DESTINATION bin)

View file

@ -36,15 +36,15 @@ if(WIN32)
endif(WIN32) endif(WIN32)
target_link_libraries(fgjs target_link_libraries(fgjs
${SIMGEAR_CORE_LIBRARIES}
${SOCKETS_LIBRARY} ${SOCKETS_LIBRARY}
${SIMGEAR_LIBRARIES}
${PLIB_LIBRARIES} ${PLIB_LIBRARIES}
${ZLIB_LIBRARY}) ${ZLIB_LIBRARY})
add_executable(js_demo js_demo.cxx) add_executable(js_demo js_demo.cxx)
target_link_libraries(js_demo target_link_libraries(js_demo
${SIMGEAR_LIBRARIES} ${SIMGEAR_CORE_LIBRARIES}
${PLIB_LIBRARIES} ${PLIB_LIBRARIES}
${ZLIB_LIBRARY}) ${ZLIB_LIBRARY})

View file

@ -4,12 +4,7 @@ add_executable(MIDGsmooth MIDG-II.cxx MIDG_main.cxx)
add_executable(UGsmooth UGear.cxx UGear_command.cxx UGear_main.cxx UGear_telnet.cxx) add_executable(UGsmooth UGear.cxx UGear_command.cxx UGear_main.cxx UGear_telnet.cxx)
target_link_libraries(GPSsmooth target_link_libraries(GPSsmooth
${SIMGEAR_IO_LIBRARY} ${SIMGEAR_CORE_LIBRARIES}
${SIMGEAR_MISC_LIBRARY}
${SIMGEAR_STRUCTURE_LIBRARY}
${SIMGEAR_THREADS_LIBRARY}
${SIMGEAR_TIMING_LIBRARY}
${SIMGEAR_DEBUG_LIBRARY}
${PLIB_SG_LIBRARY} ${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY} ${PLIB_UL_LIBRARY}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
@ -20,13 +15,7 @@ target_link_libraries(GPSsmooth
) )
target_link_libraries(MIDGsmooth target_link_libraries(MIDGsmooth
${SIMGEAR_IO_LIBRARY} ${SIMGEAR_CORE_LIBRARIES}
${SIMGEAR_MATH_LIBRARY}
${SIMGEAR_SERIAL_LIBRARY}
${SIMGEAR_STRUCTURE_LIBRARY}
${SIMGEAR_THREADS_LIBRARY}
${SIMGEAR_TIMING_LIBRARY}
${SIMGEAR_DEBUG_LIBRARY}
${PLIB_SG_LIBRARY} ${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY} ${PLIB_UL_LIBRARY}
${WINMM_LIBRARY} ${WINMM_LIBRARY}
@ -35,14 +24,7 @@ target_link_libraries(MIDGsmooth
) )
target_link_libraries(UGsmooth target_link_libraries(UGsmooth
${SIMGEAR_DEBUG_LIBRARY} ${SIMGEAR_CORE_LIBRARIES}
${SIMGEAR_IO_LIBRARY}
${SIMGEAR_MATH_LIBRARY}
${SIMGEAR_MISC_LIBRARY}
${SIMGEAR_SERIAL_LIBRARY}
${SIMGEAR_STRUCTURE_LIBRARY}
${SIMGEAR_THREADS_LIBRARY}
${SIMGEAR_TIMING_LIBRARY}
${PLIB_SG_LIBRARY} ${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY} ${PLIB_UL_LIBRARY}
${WINMM_LIBRARY} ${WINMM_LIBRARY}

View file

@ -3,7 +3,7 @@
add_executable(terrasync terrasync.cxx) add_executable(terrasync terrasync.cxx)
target_link_libraries(terrasync target_link_libraries(terrasync
${SIMGEAR_LIBRARIES} ${SIMGEAR_CORE_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${WINSOCK_LIBRARY} ${WINSOCK_LIBRARY}
${RT_LIBRARY}) ${RT_LIBRARY})

View file

@ -18,7 +18,7 @@ if(GLUT_FOUND)
target_link_libraries(fgpanel target_link_libraries(fgpanel
${PNG_LIBRARIES} ${PNG_LIBRARIES}
${GLUT_LIBRARIES} ${GLUT_LIBRARIES}
${SIMGEAR_LIBRARIES} ${SIMGEAR_CORE_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
${PLIB_LIBRARIES} ${PLIB_LIBRARIES}