Commit 3cfb6b59 authored by Volker Krause's avatar Volker Krause
Browse files

Allow to build the Tirex tile generator statically

parent be335b78
......@@ -263,7 +263,10 @@ endif()
####################################################
# Options for static build
if(STATIC_BUILD)
set(BUILD_SHARED_LIBS FALSE)
add_definitions(-DSTATIC_BUILD=1)
else()
set(BUILD_SHARED_LIBS TRUE)
endif(STATIC_BUILD)
#############################################################
......
......@@ -35,7 +35,12 @@ endmacro()
# this is needed to minimize the amount of errors to do
macro( marble_add_plugin _target_name )
set( _src ${ARGN} )
add_library( ${_target_name} MODULE ${_src} )
if (STATIC_BUILD)
add_library(${_target_name} ${_src})
target_compile_definitions(${_target_name} PRIVATE -DQT_STATICPLUGIN)
else()
add_library(${_target_name} MODULE ${_src})
endif()
target_link_libraries( ${_target_name} ${${_target_name}_LIBS}
marblewidget )
install( TARGETS ${_target_name} DESTINATION ${MARBLE_PLUGIN_INSTALL_PATH} )
......
......@@ -68,7 +68,7 @@ target_link_libraries (
)
## this works for win32 only because FindQt does not handle this correct
if(STATIC_BUILD)
if(STATIC_BUILD AND WIN32)
target_link_libraries(marble ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marble ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
endif(STATIC_BUILD)
......
......@@ -42,9 +42,9 @@ if(WIN32)
endif(WIN32)
## this works for win32 only because FindQt does not handle this correct
if(STATIC_BUILD)
target_link_libraries(marble ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marble ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
if(STATIC_BUILD AND WIN32)
target_link_libraries(marble-qt ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marble-qt ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
endif(STATIC_BUILD)
if(WIN32)
......
......@@ -42,8 +42,8 @@ if(WIN32)
endif(WIN32)
## this works for win32 only because FindQt does not handle this correct
if(STATIC_BUILD)
if(STATIC_BUILD AND WIN32)
# TODO: PUBLIC or can be PRIVATE?
target_link_libraries(marble LINK_PUBLIC ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marble LINK_PUBLIC ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
target_link_libraries(marbleui LINK_PUBLIC ${QT_PLUGINS_DIR}/imageformats/qjpeg.lib)
target_link_libraries(marbleui LINK_PUBLIC ${QT_PLUGINS_DIR}/imageformats/qsvg.lib)
endif(STATIC_BUILD)
......@@ -19,7 +19,7 @@ SET(astrolib_SRCS
solarsystem.cpp
)
ADD_LIBRARY(astro SHARED ${astrolib_SRCS})
ADD_LIBRARY(astro ${astrolib_SRCS})
generate_export_header(astro BASE_NAME astrolib)
target_include_directories(astro PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
......@@ -57,6 +57,7 @@ else()
install(TARGETS astro
EXPORT AstroTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
endif()
......
......@@ -365,7 +365,7 @@ qt_add_resources(marblewidget_SRCS libmarble.qrc ../../apps/marble-ui/marble.qrc
qt_wrap_ui(marblewidget_SRCS ${marblewidget_UI})
add_library(marblewidget SHARED ${marblewidget_SRCS} ${SOURCES_UI_HDRS})
add_library(marblewidget ${marblewidget_SRCS} ${SOURCES_UI_HDRS})
generate_export_header(marblewidget BASE_NAME marble)
......@@ -454,7 +454,8 @@ elseif(APPLE)
else()
install(TARGETS marblewidget
EXPORT MarbleTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
......
......@@ -49,3 +49,6 @@ add_executable(marble-vectorosm-tirex-backend
TirexBackend.cpp
)
target_link_libraries(marble-vectorosm-tirex-backend vectorosm-toolchain)
if (STATIC_BUILD)
target_link_libraries(marble-vectorosm-tirex-backend OsmPlugin ShpPlugin)
endif()
......@@ -22,6 +22,12 @@
#include <QDebug>
#include <QFile>
#include <QSaveFile>
#include <QtPlugin>
#ifdef STATIC_BUILD
Q_IMPORT_PLUGIN(OsmPlugin)
Q_IMPORT_PLUGIN(ShpPlugin)
#endif
using namespace Marble;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment