]> git.mxchange.org Git - simgear.git/commitdiff
Build system tweaks to support SIMGEAR_SHARED building two libraries. Work in progres...
authorJames Turner <zakalawe@mac.com>
Mon, 28 Nov 2011 22:43:57 +0000 (22:43 +0000)
committerJames Turner <zakalawe@mac.com>
Mon, 28 Nov 2011 22:43:57 +0000 (22:43 +0000)
12 files changed:
CMakeModules/SimGearComponent.cmake
simgear/CMakeLists.txt
simgear/environment/CMakeLists.txt
simgear/scene/bvh/CMakeLists.txt
simgear/scene/material/CMakeLists.txt
simgear/scene/model/CMakeLists.txt
simgear/scene/sky/CMakeLists.txt
simgear/scene/tgdb/CMakeLists.txt
simgear/scene/tsync/CMakeLists.txt
simgear/scene/util/CMakeLists.txt
simgear/screen/CMakeLists.txt
simgear/sound/CMakeLists.txt

index c05d3241daf5e8f0ea1d9aa6057e374ca49604cb..5628e5a183711201b9f63f8dd83b09cafdd45501 100644 (file)
@@ -1,10 +1,10 @@
 
-macro(simgear_component name includePath sources headers)
-
+macro(simgear_component_common name includePath sourcesList sources headers)
     if (SIMGEAR_SHARED)
+
         foreach(s ${sources})
             set_property(GLOBAL
-                APPEND PROPERTY ALL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
+                APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
         endforeach()
 
                foreach(h ${headers})
@@ -16,8 +16,15 @@ macro(simgear_component name includePath sources headers)
         set(libName "sg${name}")
         add_library(${libName} STATIC ${sources} ${headers})
 
-        install (TARGETS ${libName} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+        install (TARGETS ${libName} ARCHIVE DESTINATION lib${LIB_SUFFIX})
         install (FILES ${headers}  DESTINATION include/simgear/${includePath})
     endif()
-    
 endmacro()
+
+function(simgear_component name includePath sources headers)
+    simgear_component_common(${name} ${includePath} CORE_SOURCES "${sources}" "${headers}")
+endfunction()
+
+function(simgear_scene_component name includePath sources headers)
+    simgear_component_common(${name} ${includePath} SCENE_SOURCES "${sources}" "${headers}")
+endfunction()
index e3ff31ef63a21c168794974da76717b035855440..4f1de810c8835f68564c1978030e8fa5ce17709b 100644 (file)
@@ -41,21 +41,43 @@ install (FILES ${HEADERS}  DESTINATION include/simgear/)
 
 if(SIMGEAR_SHARED)
     message(STATUS "building shared library")
-    get_property(allSources GLOBAL PROPERTY ALL_SOURCES)
+    get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
+    get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
     get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
 
-    add_library(SimGear SHARED ${allSources})
-    set_property(TARGET SimGear PROPERTY FRAMEWORK 1)
-    message(STATUS "public header: ${publicHeaders}")
+    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)
-       
-    target_link_libraries(SimGear ${ZLIB_LIBRARY} 
-                       ${OPENSCENEGRAPH_LIBRARIES} 
-                       ${OPENAL_LIBRARY} ${ALUT_LIBRARY}
-                       ${OPENGL_LIBRARY})
-                       
+    
+    target_link_libraries(SimGear ${ZLIB_LIBRARY})                                     
     install(TARGETS SimGear LIBRARY DESTINATION lib${LIB_SUFFIX}
-                            PUBLIC_HEADER DESTINATION include/simgear)
+                               PUBLIC_HEADER DESTINATION include/simgear)
+                               
+       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)
+        endif(LIBSVN_FOUND)
+    
+       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})
+    endif()
+   
 endif(SIMGEAR_SHARED)
     
index ae641d181c622cf41cb60dd9dfff568d9aa5f3ec..8718f9a3c4b29ae2bbf49fd14697ea77849ba204 100644 (file)
@@ -4,15 +4,20 @@ include (SimGearComponent)
 set(HEADERS metar.hxx precipitation.hxx)
 set(SOURCES metar.cxx precipitation.cxx)
 
-simgear_component(environment environment "${SOURCES}" "${HEADERS}")
+simgear_scene_component(environment environment "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
 add_executable(test_metar test_metar.cxx)
-target_link_libraries(test_metar
-    sgenvironment sgstructure sgmisc sgdebug
-    ${CMAKE_THREAD_LIBS_INIT}
-    ${ZLIB_LIBRARY}
-    ${RT_LIBRARY}) 
-    
+
+if (SIMGEAR_SHARED)
+    target_link_libraries(test_metar SimGearScene) 
+else()
+    target_link_libraries(test_metar
+        sgenvironment sgstructure sgmisc sgdebug
+        ${CMAKE_THREAD_LIBS_INIT}
+        ${ZLIB_LIBRARY}
+        ${RT_LIBRARY})
+endif()
+
 add_test(metar ${EXECUTABLE_OUTPUT_PATH}/test_metar)
 endif(ENABLE_TESTS)
index ba0cfd7316766d4a57ca65ef475ba24e02111e42..230a6bc63c5a7b288928fb4e6409d4489fb99b45 100644 (file)
@@ -36,4 +36,4 @@ set(SOURCES
     BVHTransform.cxx    
     )
 
-simgear_component(bvh scene/bvh "${SOURCES}" "${HEADERS}")
+simgear_scene_component(bvh scene/bvh "${SOURCES}" "${HEADERS}")
index 787202a5f74a99bab92a7f45273dbcae136170bd..3527a1420c28d51cc5d699d0c48041e1d5ea75c6 100644 (file)
@@ -31,5 +31,5 @@ set(SOURCES
     mipmap.cxx
     )
 
-simgear_component(material scene/material "${SOURCES}" "${HEADERS}")
+simgear_scene_component(material scene/material "${SOURCES}" "${HEADERS}")
 
index 8977a7f9427073b084a331854a1137b60e249f61..333f7f46a500304dde4d0eeba873e798b29da36a 100644 (file)
@@ -44,4 +44,4 @@ set(SOURCES
     shadanim.cxx
     )
 
-simgear_component(model scene/model "${SOURCES}" "${HEADERS}")
+simgear_scene_component(model scene/model "${SOURCES}" "${HEADERS}")
index 7ed001d10bc7a394c6e0dffbc94323ac42e67b2b..b71c5cbacd572b7682ba5715f4c793f02ef699f5 100644 (file)
@@ -26,4 +26,4 @@ set(SOURCES
     stars.cxx
     )
 
-simgear_component(sky scene/sky "${SOURCES}" "${HEADERS}")
+simgear_scene_component(sky scene/sky "${SOURCES}" "${HEADERS}")
index 635eb9549e2c4b6675bc7a4beca85b02ce251a7c..59d096ce5dc353f6aed212af45d47f9a183e1225 100644 (file)
@@ -38,4 +38,4 @@ set(SOURCES
     userdata.cxx
     )
 
-simgear_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
+simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
index 5c0be4297e7a5ab53de9c642d71bf361cdbb7601..bc6b62a5f12fcce0026e47ee12b6ad13092d3496 100644 (file)
@@ -19,4 +19,4 @@ if(LIBSVN_FOUND)
 
 endif()
 
-simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
+simgear_scene_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
index 6f9193a5ec641b081e1d2c6bef094d7b5172b17c..d312dfae04302a58d6b9eb59ac73243bddea5608 100644 (file)
@@ -37,4 +37,4 @@ set(SOURCES
     UpdateOnceCallback.cxx
     )
 
-simgear_component(util scene/util "${SOURCES}" "${HEADERS}")
+simgear_scene_component(util scene/util "${SOURCES}" "${HEADERS}")
index 17780af736a4556c8c85d11595072a3eea7c9915..029fcf3bb216c4db9edce1ec9710f1f1d9e9c9dc 100644 (file)
@@ -20,4 +20,4 @@ if(JPEG_FACTORY)
 endif()
 
 
-simgear_component(screen screen "${SOURCES}" "${HEADERS}")
\ No newline at end of file
+simgear_scene_component(screen screen "${SOURCES}" "${HEADERS}")
\ No newline at end of file
index 69e1acd20c171217baac0238c15b6d7f1e969c12..6290f60fce0f654ffb5dfd7ced20062f33f4487a 100644 (file)
@@ -16,14 +16,19 @@ set(SOURCES
     xmlsound.cxx
     )
 
-simgear_component(sound sound "${SOURCES}" "${HEADERS}")
+simgear_scene_component(sound sound "${SOURCES}" "${HEADERS}")
 
 if(ENABLE_TESTS)
-set(SOUND_TEST_LIBS
-    sgsound sgio sgmath sgstructure sgthreads sgtiming sgmisc sgdebug
-    ${CMAKE_THREAD_LIBS_INIT}
-    ${RT_LIBRARY}
-    ${ALUT_LIBRARY} ${OPENAL_LIBRARY})
+
+if (SIMGEAR_SHARED)
+    set(SOUND_TEST_LIBS SimGearScene)
+else()
+    set(SOUND_TEST_LIBS
+        sgsound sgio sgmath sgstructure sgthreads sgtiming sgmisc sgdebug
+        ${CMAKE_THREAD_LIBS_INIT}
+        ${RT_LIBRARY}
+        ${ALUT_LIBRARY} ${OPENAL_LIBRARY})
+endif()
 
 function(create_test TEST_NAME)
     add_executable(${TEST_NAME} ${TEST_NAME}.cxx)