From ae3f718fe397fea61161f8489f9c6777d3469d57 Mon Sep 17 00:00:00 2001 From: James Turner Date: Mon, 28 Nov 2011 23:05:05 +0000 Subject: [PATCH] Fix naming of core library, get IO tests linking shared, and exclude OSG symbols from the core lib by setting headless mode. --- simgear/CMakeLists.txt | 54 +++++++++++++++++++++++---------------- simgear/io/CMakeLists.txt | 43 ++++++++++++------------------- 2 files changed, 49 insertions(+), 48 deletions(-) diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 4f1de810..cde6efa4 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -45,38 +45,48 @@ if(SIMGEAR_SHARED) get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES) get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS) - add_library(SimGear SHARED ${coreSources}) - # set_property(TARGET SimGear PROPERTY FRAMEWORK 1) - # message(STATUS "public header: ${publicHeaders}") - set_property(TARGET SimGear PROPERTY PUBLIC_HEADER "${publicHeaders}") - set_property(TARGET SimGear PROPERTY LINKER_LANGUAGE CXX) + add_library(SimGearCore SHARED ${coreSources}) + set_property(TARGET SimGearCore PROPERTY COMPILE_FLAGS "-DNO_OPENSCENEGRAPH_INTERFACE=1") - target_link_libraries(SimGear ${ZLIB_LIBRARY}) - install(TARGETS SimGear LIBRARY DESTINATION lib${LIB_SUFFIX} + + # set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1) + # message(STATUS "public header: ${publicHeaders}") + set_property(TARGET SimGearCore PROPERTY PUBLIC_HEADER "${publicHeaders}") + set_property(TARGET SimGearCore PROPERTY LINKER_LANGUAGE CXX) + + target_link_libraries(SimGearCore ${ZLIB_LIBRARY} ${RT_LIBRARY}) + install(TARGETS SimGearCore LIBRARY DESTINATION lib${LIB_SUFFIX} PUBLIC_HEADER DESTINATION include/simgear) - if(NOT SIMGEAR_HEADLESS) - if(LIBSVN_FOUND) - add_definitions(${APR_CFLAGS}) + if(NOT SIMGEAR_HEADLESS) + if(LIBSVN_FOUND) + add_definitions(${APR_CFLAGS}) - IF(APPLE) - set_property(SOURCE scene/tsync/terrasync.cxx PROPERTY COMPILE_FLAGS "-iwithsysroot ${LIBSVN_INCLUDE_DIR}") - ELSE() - include_directories(${LIBSVN_INCLUDE_DIR}) - ENDIF(APPLE) + IF(APPLE) + set_property(SOURCE scene/tsync/terrasync.cxx PROPERTY COMPILE_FLAGS "-iwithsysroot ${LIBSVN_INCLUDE_DIR}") + ELSE() + include_directories(${LIBSVN_INCLUDE_DIR}) + ENDIF(APPLE) endif(LIBSVN_FOUND) + - add_library(SimGearScene SHARED ${sceneSources}) + add_library(SimGearScene SHARED ${sceneSources}) # set_property(TARGET SimGearScene PROPERTY FRAMEWORK 1) # set_property(TARGET SimGearScene PROPERTY PUBLIC_HEADER "${publicHeaders}") set_property(TARGET SimGearScene PROPERTY LINKER_LANGUAGE CXX) - target_link_libraries(SimGearScene ${ZLIB_LIBRARY} - ${OPENSCENEGRAPH_LIBRARIES} - ${OPENAL_LIBRARY} ${ALUT_LIBRARY} - ${OPENGL_LIBRARY}) - - install(TARGETS SimGearScene LIBRARY DESTINATION lib${LIB_SUFFIX}) + target_link_libraries(SimGearScene + SimGearCore + ${ZLIB_LIBRARY} + ${OPENSCENEGRAPH_LIBRARIES} + ${OPENAL_LIBRARY} ${ALUT_LIBRARY} + ${OPENGL_LIBRARY}) + + if(LIBSVN_FOUND) + target_link_libraries(SimGearScene ${LIBSVN_LIBRARIES}) + endif(LIBSVN_FOUND) + + install(TARGETS SimGearScene LIBRARY DESTINATION lib${LIB_SUFFIX}) endif() endif(SIMGEAR_SHARED) diff --git a/simgear/io/CMakeLists.txt b/simgear/io/CMakeLists.txt index dd39d2ea..f665ebe9 100644 --- a/simgear/io/CMakeLists.txt +++ b/simgear/io/CMakeLists.txt @@ -37,43 +37,34 @@ set(SOURCES simgear_component(io io "${SOURCES}" "${HEADERS}") if(ENABLE_TESTS) + +if (SIMGEAR_SHARED) + set(TEST_LIBS SimGearCore) +else() + set(TEST_LIBS + sgio sgbucket sgstructure sgthreads sgtiming sgmisc sgdebug + ${CMAKE_THREAD_LIBS_INIT} + ${WINSOCK_LIBRARY} + ${ZLIB_LIBRARY} + ${RT_LIBRARY}) +endif() + add_executable(test_sock socktest.cxx) -target_link_libraries(test_sock sgio sgstructure sgthreads sgdebug - ${CMAKE_THREAD_LIBS_INIT} - ${WINSOCK_LIBRARY} - ${RT_LIBRARY}) +target_link_libraries(test_sock ${TEST_LIBS}) add_executable(test_http test_HTTP.cxx) -target_link_libraries(test_http - sgio sgstructure sgthreads sgtiming sgmisc sgdebug - ${CMAKE_THREAD_LIBS_INIT} - ${WINSOCK_LIBRARY} - ${RT_LIBRARY}) +target_link_libraries(test_http ${TEST_LIBS}) add_test(http ${EXECUTABLE_OUTPUT_PATH}/test_http) add_executable(httpget httpget.cxx) -target_link_libraries(httpget - sgio sgstructure sgthreads sgtiming sgmisc sgdebug - ${CMAKE_THREAD_LIBS_INIT} - ${WINSOCK_LIBRARY} - ${RT_LIBRARY}) +target_link_libraries(httpget ${TEST_LIBS}) add_executable(decode_binobj decode_binobj.cxx) -target_link_libraries(decode_binobj - sgio sgbucket sgstructure sgthreads sgtiming sgmisc sgdebug - ${CMAKE_THREAD_LIBS_INIT} - ${WINSOCK_LIBRARY} - ${ZLIB_LIBRARY} - ${RT_LIBRARY}) +target_link_libraries(decode_binobj ${TEST_LIBS}) add_executable(test_binobj test_binobj.cxx) -target_link_libraries(test_binobj - sgio sgbucket sgstructure sgthreads sgtiming sgmisc sgdebug - ${CMAKE_THREAD_LIBS_INIT} - ${WINSOCK_LIBRARY} - ${ZLIB_LIBRARY} - ${RT_LIBRARY}) +target_link_libraries(test_binobj ${TEST_LIBS}) add_test(binobj ${EXECUTABLE_OUTPUT_PATH}/test_binobj) endif(ENABLE_TESTS)