Build system tweaks to support SIMGEAR_SHARED building two libraries. Work in progress, does not link yet.
This commit is contained in:
parent
7a52c2fa71
commit
4b02335637
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
macro(simgear_component name includePath sources headers)
|
macro(simgear_component_common name includePath sourcesList sources headers)
|
||||||
|
|
||||||
if (SIMGEAR_SHARED)
|
if (SIMGEAR_SHARED)
|
||||||
|
|
||||||
foreach(s ${sources})
|
foreach(s ${sources})
|
||||||
set_property(GLOBAL
|
set_property(GLOBAL
|
||||||
APPEND PROPERTY ALL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
|
APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
foreach(h ${headers})
|
foreach(h ${headers})
|
||||||
@ -16,8 +16,15 @@ macro(simgear_component name includePath sources headers)
|
|||||||
set(libName "sg${name}")
|
set(libName "sg${name}")
|
||||||
add_library(${libName} STATIC ${sources} ${headers})
|
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})
|
install (FILES ${headers} DESTINATION include/simgear/${includePath})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endmacro()
|
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()
|
||||||
|
@ -41,21 +41,43 @@ install (FILES ${HEADERS} DESTINATION include/simgear/)
|
|||||||
|
|
||||||
if(SIMGEAR_SHARED)
|
if(SIMGEAR_SHARED)
|
||||||
message(STATUS "building shared library")
|
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)
|
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
|
||||||
|
|
||||||
add_library(SimGear SHARED ${allSources})
|
add_library(SimGear SHARED ${coreSources})
|
||||||
set_property(TARGET SimGear PROPERTY FRAMEWORK 1)
|
# set_property(TARGET SimGear PROPERTY FRAMEWORK 1)
|
||||||
message(STATUS "public header: ${publicHeaders}")
|
# message(STATUS "public header: ${publicHeaders}")
|
||||||
set_property(TARGET SimGear PROPERTY PUBLIC_HEADER "${publicHeaders}")
|
set_property(TARGET SimGear PROPERTY PUBLIC_HEADER "${publicHeaders}")
|
||||||
set_property(TARGET SimGear PROPERTY LINKER_LANGUAGE CXX)
|
set_property(TARGET SimGear PROPERTY LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
target_link_libraries(SimGear ${ZLIB_LIBRARY}
|
target_link_libraries(SimGear ${ZLIB_LIBRARY})
|
||||||
${OPENSCENEGRAPH_LIBRARIES}
|
|
||||||
${OPENAL_LIBRARY} ${ALUT_LIBRARY}
|
|
||||||
${OPENGL_LIBRARY})
|
|
||||||
|
|
||||||
install(TARGETS SimGear LIBRARY DESTINATION lib${LIB_SUFFIX}
|
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)
|
endif(SIMGEAR_SHARED)
|
||||||
|
|
||||||
|
@ -4,15 +4,20 @@ include (SimGearComponent)
|
|||||||
set(HEADERS metar.hxx precipitation.hxx)
|
set(HEADERS metar.hxx precipitation.hxx)
|
||||||
set(SOURCES metar.cxx precipitation.cxx)
|
set(SOURCES metar.cxx precipitation.cxx)
|
||||||
|
|
||||||
simgear_component(environment environment "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(environment environment "${SOURCES}" "${HEADERS}")
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
add_executable(test_metar test_metar.cxx)
|
add_executable(test_metar test_metar.cxx)
|
||||||
target_link_libraries(test_metar
|
|
||||||
sgenvironment sgstructure sgmisc sgdebug
|
if (SIMGEAR_SHARED)
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
target_link_libraries(test_metar SimGearScene)
|
||||||
${ZLIB_LIBRARY}
|
else()
|
||||||
${RT_LIBRARY})
|
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)
|
add_test(metar ${EXECUTABLE_OUTPUT_PATH}/test_metar)
|
||||||
endif(ENABLE_TESTS)
|
endif(ENABLE_TESTS)
|
||||||
|
@ -36,4 +36,4 @@ set(SOURCES
|
|||||||
BVHTransform.cxx
|
BVHTransform.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(bvh scene/bvh "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(bvh scene/bvh "${SOURCES}" "${HEADERS}")
|
||||||
|
@ -31,5 +31,5 @@ set(SOURCES
|
|||||||
mipmap.cxx
|
mipmap.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(material scene/material "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(material scene/material "${SOURCES}" "${HEADERS}")
|
||||||
|
|
||||||
|
@ -44,4 +44,4 @@ set(SOURCES
|
|||||||
shadanim.cxx
|
shadanim.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(model scene/model "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(model scene/model "${SOURCES}" "${HEADERS}")
|
||||||
|
@ -26,4 +26,4 @@ set(SOURCES
|
|||||||
stars.cxx
|
stars.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(sky scene/sky "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(sky scene/sky "${SOURCES}" "${HEADERS}")
|
||||||
|
@ -38,4 +38,4 @@ set(SOURCES
|
|||||||
userdata.cxx
|
userdata.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
|
||||||
|
@ -19,4 +19,4 @@ if(LIBSVN_FOUND)
|
|||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
|
||||||
|
@ -37,4 +37,4 @@ set(SOURCES
|
|||||||
UpdateOnceCallback.cxx
|
UpdateOnceCallback.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(util scene/util "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(util scene/util "${SOURCES}" "${HEADERS}")
|
||||||
|
@ -20,4 +20,4 @@ if(JPEG_FACTORY)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
simgear_component(screen screen "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(screen screen "${SOURCES}" "${HEADERS}")
|
@ -16,14 +16,19 @@ set(SOURCES
|
|||||||
xmlsound.cxx
|
xmlsound.cxx
|
||||||
)
|
)
|
||||||
|
|
||||||
simgear_component(sound sound "${SOURCES}" "${HEADERS}")
|
simgear_scene_component(sound sound "${SOURCES}" "${HEADERS}")
|
||||||
|
|
||||||
if(ENABLE_TESTS)
|
if(ENABLE_TESTS)
|
||||||
set(SOUND_TEST_LIBS
|
|
||||||
sgsound sgio sgmath sgstructure sgthreads sgtiming sgmisc sgdebug
|
if (SIMGEAR_SHARED)
|
||||||
${CMAKE_THREAD_LIBS_INIT}
|
set(SOUND_TEST_LIBS SimGearScene)
|
||||||
${RT_LIBRARY}
|
else()
|
||||||
${ALUT_LIBRARY} ${OPENAL_LIBRARY})
|
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)
|
function(create_test TEST_NAME)
|
||||||
add_executable(${TEST_NAME} ${TEST_NAME}.cxx)
|
add_executable(${TEST_NAME} ${TEST_NAME}.cxx)
|
||||||
|
Loading…
Reference in New Issue
Block a user