]> git.mxchange.org Git - simgear.git/commitdiff
Standardise SimGear libraries, for static vs shared.
authorJames Turner <zakalawe@mac.com>
Sun, 16 Sep 2012 15:04:08 +0000 (16:04 +0100)
committerJames Turner <zakalawe@mac.com>
Sun, 16 Sep 2012 15:04:08 +0000 (16:04 +0100)
Always create only two SimGear libraries: SimGearCore and SimGearStatic, regardless of whether we're building static or shared. This requires an updated to FindSimGear.cmake module, for the static configuration.

12 files changed:
CMakeModules/SimGearComponent.cmake
simgear/CMakeLists.txt
simgear/bvh/CMakeLists.txt
simgear/environment/CMakeLists.txt
simgear/io/CMakeLists.txt
simgear/magvar/CMakeLists.txt
simgear/math/CMakeLists.txt
simgear/misc/CMakeLists.txt
simgear/props/CMakeLists.txt
simgear/scene/tgdb/CMakeLists.txt
simgear/scene/tsync/CMakeLists.txt
simgear/sound/CMakeLists.txt

index 1c11b855b9d61ccca8a86b813d5bbc568860459d..294a53a21e1c86df8fac45dcf0ba01127e5798db 100644 (file)
@@ -1,23 +1,14 @@
 
 macro(simgear_component_common name includePath sourcesList sources headers)
-    if (SIMGEAR_SHARED)
+    foreach(s ${sources})
+        set_property(GLOBAL
+            APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
+    endforeach()
 
-        foreach(s ${sources})
-            set_property(GLOBAL
-                APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
-        endforeach()
-
-               foreach(h ${headers})
-                       set_property(GLOBAL
-                               APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
-               endforeach()
-        
-    else()
-        set(libName "sg${name}")
-        add_library(${libName} STATIC ${sources} ${headers})
-
-        install (TARGETS ${libName} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
-    endif()
+       foreach(h ${headers})
+               set_property(GLOBAL
+                       APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
+       endforeach()
     
     install (FILES ${headers}  DESTINATION include/simgear/${includePath})
 endmacro()
index 84c1d22b2f3a60b8e0c6c7712f423b4af23cdbf5..2ec11752178ea36b861275ac362bb1b5c23bbab4 100644 (file)
@@ -39,12 +39,17 @@ endif(ENABLE_RTI)
 set(HEADERS compiler.h constants.h sg_inlines.h ${PROJECT_BINARY_DIR}/simgear/version.h)
 install (FILES ${HEADERS}  DESTINATION include/simgear/)
 
+get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
+get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
+get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
+
+if(LIBSVN_FOUND)
+       add_definitions(${APR_CFLAGS})
+       include_directories(${LIBSVN_INCLUDE_DIR})
+endif()
+
 if(SIMGEAR_SHARED)
     message(STATUS "Library building mode: SHARED LIBRARIES")
-    get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
-    get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
-    get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
-
     add_library(SimGearCore SHARED ${coreSources})
 
   # set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1)
@@ -56,11 +61,8 @@ if(SIMGEAR_SHARED)
     set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
 
     target_link_libraries(SimGearCore ${ZLIB_LIBRARY} ${RT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
-    install(TARGETS SimGearCore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
     if(LIBSVN_FOUND)
-        add_definitions(${APR_CFLAGS})
-        include_directories(${LIBSVN_INCLUDE_DIR})
         target_link_libraries(SimGearCore ${LIBSVN_LIBRARIES})
     endif(LIBSVN_FOUND)
 
@@ -82,8 +84,19 @@ if(SIMGEAR_SHARED)
     
         install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
     endif()
-
+    
+    install(TARGETS SimGearCore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
 else()
     message(STATUS "Library building mode: STATIC LIBRARIES")
+    
+    add_library(SimGearCore STATIC ${coreSources})
+    install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    
+    if(NOT SIMGEAR_HEADLESS)
+        add_library(SimGearScene STATIC ${sceneSources})
+        install(TARGETS SimGearScene ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endif(NOT SIMGEAR_HEADLESS)
 endif(SIMGEAR_SHARED)
 
+
+
index b5b477087e15c2b77f88e4dce0ff0b29e1c0bd17..6bb3c551fbb52f746f35d2b7a8bdac16308651dc 100644 (file)
@@ -46,13 +46,7 @@ set(SOURCES
 simgear_component(bvh bvh "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-  if (SIMGEAR_SHARED)
-    set(TEST_LIBS SimGearCore)
-  else()
-    set(TEST_LIBS sgbvh sgmath sgstructure sgdebug)
-  endif()
-
   add_executable(bvhtest bvhtest.cxx)
-  target_link_libraries(bvhtest ${TEST_LIBS})
+  target_link_libraries(bvhtest SimGearCore)
   add_test(bvhtest ${EXECUTABLE_OUTPUT_PATH}/bvhtest)
 endif(ENABLE_TESTS)
index 8718f9a3c4b29ae2bbf49fd14697ea77849ba204..d5255b041b8cfcbdebcf537aa6f294ba4ac1a146 100644 (file)
@@ -13,7 +13,7 @@ if (SIMGEAR_SHARED)
     target_link_libraries(test_metar SimGearScene) 
 else()
     target_link_libraries(test_metar
-        sgenvironment sgstructure sgmisc sgdebug
+        SimGearScene SimGearCore
         ${CMAKE_THREAD_LIBS_INIT}
         ${ZLIB_LIBRARY}
         ${RT_LIBRARY})
index f665ebe96bf84305aab4edb52bf3cb94ec4b5914..17483d63923f29fd5a770d14c4b130dab077e7b8 100644 (file)
@@ -41,8 +41,7 @@ if(ENABLE_TESTS)
 if (SIMGEAR_SHARED)
     set(TEST_LIBS SimGearCore)
 else()
-    set(TEST_LIBS
-            sgio sgbucket sgstructure sgthreads sgtiming sgmisc sgdebug
+    set(TEST_LIBS SimGearCore
             ${CMAKE_THREAD_LIBS_INIT}
             ${WINSOCK_LIBRARY}
             ${ZLIB_LIBRARY}
index 2e6cd342bca0710cd6ee41e398565368783399cf..4c26eb8df1920eb3bf9cd562176f0a093475b1dd 100644 (file)
@@ -7,12 +7,6 @@ set(SOURCES magvar.cxx coremag.cxx)
 simgear_component(magvar magvar "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-add_executable(test_magvar testmagvar.cxx )
-
-if (SIMGEAR_SHARED)
+    add_executable(test_magvar testmagvar.cxx )
     target_link_libraries(test_magvar SimGearCore)
-else()
-    target_link_libraries(test_magvar sgmagvar)
-endif()
-
 endif(ENABLE_TESTS)
index f66ec15a8ee78cf3ff8a8bf38911a4c9062d5c2e..e0d3e627c07b68b25472280d8be92b510a7dbaa6 100644 (file)
@@ -42,19 +42,11 @@ set(SOURCES
 simgear_component(math math "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-
-if (SIMGEAR_SHARED)
-    set(TEST_LIBS SimGearCore)
-else()
-    set(TEST_LIBS sgmath sgstructure sgdebug)
-endif()
-
-
 add_executable(math_test SGMathTest.cxx)
-target_link_libraries(math_test ${TEST_LIBS})
+target_link_libraries(math_test SimGearCore)
 add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test)
 
 add_executable(geometry_test SGGeometryTest.cxx)
-target_link_libraries(geometry_test ${TEST_LIBS})
+target_link_libraries(geometry_test SimGearCore)
 add_test(geometry ${EXECUTABLE_OUTPUT_PATH}/geometry_test)
 endif(ENABLE_TESTS)
index c4ae64df15de88952a56fb35cdd0752df8e75a89..d07b6718b714f2e18a793b532fde310a3cf54d02 100644 (file)
@@ -31,22 +31,15 @@ set(SOURCES
 simgear_component(misc misc "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-
-if (SIMGEAR_SHARED)
-    set(TEST_LIBS SimGearCore)
-else()
-    set(TEST_LIBS sgmisc sgdebug)
-endif()
-
 add_executable(test_tabbed_values tabbed_values_test.cxx)
 add_test(tabbed_values ${EXECUTABLE_OUTPUT_PATH}/test_tabbed_values)
-target_link_libraries(test_tabbed_values ${TEST_LIBS})
+target_link_libraries(test_tabbed_values SimGearCore)
 
 add_executable(test_strings strutils_test.cxx )
 add_test(test_strings ${EXECUTABLE_OUTPUT_PATH}/test_strings)
-target_link_libraries(test_strings ${TEST_LIBS})
+target_link_libraries(test_strings SimGearCore)
 
 add_executable(test_path path_test.cxx )
 add_test(test_path ${EXECUTABLE_OUTPUT_PATH}/test_path)
-target_link_libraries(test_path ${TEST_LIBS})
+target_link_libraries(test_path SimGearCore)
 endif(ENABLE_TESTS)
index a11e703e7911f8527982329d0c11f0cef5ba7d06..7657b4451f2ab805206790bc78b6a03f0720f2a9 100644 (file)
@@ -24,19 +24,11 @@ set(SOURCES
 simgear_component(props props "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-
-if (SIMGEAR_SHARED)
-    set(TEST_LIBS SimGearCore)
-else()
-    set(TEST_LIBS sgprops sgxml sgstructure sgmisc sgdebug)
-endif()
-
-
 add_executable(test_props props_test.cxx)
-target_link_libraries(test_props ${TEST_LIBS})
+target_link_libraries(test_props SimGearCore)
 add_test(test_props ${EXECUTABLE_OUTPUT_PATH}/test_props)
 
 add_executable(test_propertyObject propertyObject_test.cxx)
-target_link_libraries(test_propertyObject ${TEST_LIBS})
+target_link_libraries(test_propertyObject SimGearCore)
 add_test(test_propertyObject ${EXECUTABLE_OUTPUT_PATH}/test_propertyObject)
 endif(ENABLE_TESTS)
index ff9dd97f2a93075393ee8a6a9c43dd5bc0591752..caec45ac202d136bec73ec24093656945bdad124 100644 (file)
@@ -41,16 +41,8 @@ set(SOURCES
 simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-
-  if (SIMGEAR_SHARED)
-    set(TEST_LIBS SimGearCore)
-  else()
-    set(TEST_LIBS sgbucket sgmisc sgmath sgdebug)
-  endif()
-  
-
   add_executable(BucketBoxTest BucketBoxTest.cxx)
-  target_link_libraries(BucketBoxTest ${TEST_LIBS})
+  target_link_libraries(BucketBoxTest SimGearCore)
   add_test(BucketBoxTest ${EXECUTABLE_OUTPUT_PATH}/BucketBoxTest)
 
 endif(ENABLE_TESTS)
index fceba2de023ff9eb514a322377e43574fc5fbce2..238e0b90e7bc187e5e147b04dbd89aedef2b7eb1 100644 (file)
@@ -8,9 +8,4 @@ set(SOURCES
     terrasync.cxx
     )
 
-if(LIBSVN_FOUND)
-       add_definitions(${APR_CFLAGS})
-       include_directories(${LIBSVN_INCLUDE_DIR})
-endif()
-
 simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
index 6161b33b965a88fc58b8b622cf6f3b9db3f03f1d..51d365e3dfd6b771d7a6d2c83d10bd21d98556b1 100644 (file)
@@ -26,7 +26,7 @@ if (SIMGEAR_SHARED)
     set(SOUND_TEST_LIBS SimGearScene)
 else()
     set(SOUND_TEST_LIBS
-        sgsound sgio sgmath sgstructure sgthreads sgtiming sgmisc sgdebug
+        SimGearScene SimGearCore
         ${CMAKE_THREAD_LIBS_INIT}
         ${RT_LIBRARY}
         ${OPENAL_LIBRARY}