Don't build static archives

1) We don't need them
2) There are issues with MinGW as CMake adds *.a together with *.so to
linker, so it's unable to resolve proper source of exported functions
pull/797/head
Hleb Valoshka 2020-07-10 20:46:27 +03:00
parent 0eda63121c
commit a0f6a2c1ff
9 changed files with 26 additions and 88 deletions

View File

@ -4,7 +4,7 @@ macro(test_case)
list(REMOVE_AT libs 0 0)
add_executable(${trgt} "${trgt}_test.cpp")
target_link_libraries(${trgt} PRIVATE ${libs})
target_link_libraries(${trgt} PRIVATE celestia ${libs})
add_test(${trgt} ${trgt})
set_target_properties(${trgt} PROPERTIES FOLDER test/unit)
endmacro()

View File

@ -6,19 +6,5 @@ set(CEL3DS_SOURCES
3dsread.h
)
add_library(cel3ds STATIC ${CEL3DS_SOURCES})
#[[
add_library(cel3ds SHARED ${CEL3DS_SOURCES})
set_target_properties(cel3ds PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_dependencies(cel3ds celutil)
target_link_libraries(cel3ds celutil)
add_library(cel3ds OBJECT ${CEL3DS_SOURCES})
cotire(cel3ds)
#install(TARGETS cel3ds LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -171,25 +171,5 @@ set(CELENGINE_SOURCES
visibleregion.h
)
# The object files in the celephem directory are merged in the celengine library
add_library(celengine STATIC ${CELENGINE_SOURCES} $<TARGET_OBJECTS:celephem>)
#[[
add_library(celengine SHARED ${CELENGINE_SOURCES})
set_target_properties(celengine PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_dependencies(celengine cel3ds celmath celmodel celutil celttf)
target_link_libraries(celengine cel3ds celmath celmodel celutil celttf)
# Some celephem objects depend on Spice
if(ENABLE_SPICE)
target_link_libraries(celengine CSPICE::CSPICE)
endif()
add_library(celengine OBJECT ${CELENGINE_SOURCES})
cotire(celengine)
#install(TARGETS celengine LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -44,15 +44,27 @@ list(GET PROJECT_VERSION_LIST 0 PROJECT_VERSION_MAJOR)
list(GET PROJECT_VERSION_LIST 1 PROJECT_VERSION_MINOR)
set(CELSO "celestia-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
add_library(celestia SHARED ${CELESTIA_SOURCES} ${SCRIPT_LIBS})
add_library(celestia SHARED ${CELESTIA_SOURCES}
${SCRIPT_LIBS}
$<TARGET_OBJECTS:cel3ds>
$<TARGET_OBJECTS:celcompat>
$<TARGET_OBJECTS:celengine>
$<TARGET_OBJECTS:celephem>
$<TARGET_OBJECTS:celmath>
$<TARGET_OBJECTS:celmodel>
$<TARGET_OBJECTS:celttf>
$<TARGET_OBJECTS:celutil>
)
set_target_properties(celestia PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
WINDOWS_EXPORT_ALL_SYMBOLS TRUE
)
add_dependencies(celestia celengine celmath celutil)
target_link_libraries(celestia celengine celmath celutil)
if(ENABLE_SPICE)
target_link_libraries(celestia CSPICE::CSPICE)
endif()
cotire(celestia)

View File

@ -13,16 +13,5 @@ set(CELMATH_SOURCES
sphere.h
)
add_library(celmath STATIC ${CELMATH_SOURCES})
#[[
add_library(celmath SHARED ${CELMATH_SOURCES})
set_target_properties(celmath PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_library(celmath OBJECT ${CELMATH_SOURCES})
cotire(celmath)
#install(TARGETS celmath LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -9,20 +9,5 @@ set(CELMODEL_SOURCES
model.h
)
add_library(celmodel STATIC ${CELMODEL_SOURCES})
#[[
add_library(celmodel SHARED ${CELMODEL_SOURCES})
set_target_properties(celmodel PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_dependencies(celmodel celutil)
target_link_libraries(celmodel celutil)
add_library(celmodel OBJECT ${CELMODEL_SOURCES})
cotire(celmodel)
#install(TARGETS celmodel LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
#install(TARGETS celmodel ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -3,4 +3,4 @@ set(CELTTF_SOURCES
truetypefont.h
)
add_library(celttf STATIC ${CELTTF_SOURCES})
add_library(celttf OBJECT ${CELTTF_SOURCES})

View File

@ -31,19 +31,5 @@ if (WIN32)
)
endif()
add_library(celutil STATIC ${CELUTIL_SOURCES} $<TARGET_OBJECTS:celcompat>)
#[[
add_library(celutil SHARED ${CELUTIL_SOURCES})
set_target_properties(celutil PROPERTIES
VERSION ${VERSION}
SOVERSION ${VERSION}
)
]]#
add_dependencies(celutil celmath)
target_link_libraries(celutil celmath)
add_library(celutil OBJECT ${CELUTIL_SOURCES})
cotire(celutil)
#install(TARGETS celutil LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -1,8 +1,8 @@
include(TestCase)
test_case(hash celengine)
test_case(fs celengine)
test_case(stellarclass celengine)
test_case(hash)
test_case(fs)
test_case(stellarclass)
if(WIN32)
test_case(winutil celutil)
test_case(winutil)
endif()