cmake: enable image formats to be build as plugins

Renamed cmake options:
- WITH_TQTGIF -> WITH_IMGFMT_GIF
- WITH_JPEG -> WITH_IMGFMT_JPEG
- WITH_PNG -> WITH_IMGFMT_PNG
- WITH_LIBMNG -> WITH_IMGFMT_MNG

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
feat/cmakeConv-r1
Alexander Golubev 2 months ago
parent 7801f68701
commit a0f0d4b609

@ -83,10 +83,6 @@ option( WITH_XSYNC "Enable Xsync support" ${WITH_ALL
option( WITH_XKB "Enable X KeyBoard support" ${WITH_ALL_OPTIONS} )
option( WITH_SM "Enable Session management support" ${WITH_ALL_OPTIONS} )
option( WITH_XCURSOR "Enable XCursor support" ${WITH_ALL_OPTIONS} )
option( WITH_LIBMNG "Enable libmng support" ${WITH_ALL_OPTIONS} )
option( WITH_JPEG "Enable jpeg support" ${WITH_ALL_OPTIONS} )
option( WITH_PNG "Enable libpng support" ${WITH_ALL_OPTIONS} )
option( WITH_TQTGIF "Enable TQT gif support" ${WITH_ALL_OPTIONS} )
##### user requested build
@ -121,6 +117,22 @@ option( WITH_MODULE_STYLES "Build the styles module" ${WITH_MODULE_AL
option( WITH_MODULE_SQL "Build the SQL module" ${WITH_MODULE_ALL} )
##### user requested image formats
option( BUILD_IMGFMT_PLUGIN_ALL "Build all sql plugins" OFF )
option( BUILD_IMGFMT_PLUGIN_MNG "Build support for mng as a plugin" ${BUILD_IMGFMT_PLUGIN_ALL} )
option( BUILD_IMGFMT_PLUGIN_JPEG "Build support for jpeg as a plugin" ${BUILD_IMGFMT_PLUGIN_ALL} )
option( BUILD_IMGFMT_PLUGIN_PNG "Build support for png as a plugin" ${BUILD_IMGFMT_PLUGIN_ALL} )
# NOTE: gif has no support of being built as a plugin due to it has no external dependencies and is
# optional only due to historical legal reasons
option( WITH_IMGFMT_ALL "Enable support for all image formats" ${WITH_ALL_OPTIONS} )
option( WITH_IMGFMT_MNG "Enable support for mng images" ${WITH_IMGFMT_ALL} )
option( WITH_IMGFMT_JPEG "Enable support for jpeg images" ${WITH_IMGFMT_ALL} )
option( WITH_IMGFMT_PNG "Enable support for png images" ${WITH_IMGFMT_ALL} )
option( WITH_IMGFMT_GIF "Enable support for gif images" ON )
##### user requested styles
option( BUILD_STYLE_PLUGIN_ALL "Build all styles as plugins" OFF )

@ -18,14 +18,6 @@ if( WITH_GCC_VISIBILITY )
endif( WITH_GCC_VISIBILITY )
##### TQT gif support
if( WITH_TQTGIF )
set( BUILTIN_GIF_READER QT_BUILTIN_GIF_READER )
set( QT_BUILTIN_GIF_READER 1 )
endif( WITH_TQTGIF )
##### check for fontconfig
pkg_search_module( LIBFONTCONFIG fontconfig )
@ -37,41 +29,36 @@ endif( NOT LIBFONTCONFIG_FOUND )
##### check for libpng
if( WITH_PNG )
if( (WITH_IMGFMT_PNG AND BUILD_LIB) OR BUILD_IMGFMT_PLUGIN_PNG )
find_package( PNG )
if( NOT PNG_FOUND )
tde_message_fatal( "libpng support has been requested but was not found on your system" )
endif()
else()
set( NO_IMAGEIO_PNG TQT_NO_IMAGEIO_PNG )
endif( WITH_PNG )
endif()
##### check for jpeg
if( WITH_JPEG )
if( (WITH_IMGFMT_JPEG AND BUILD_LIB) OR BUILD_IMGFMT_PLUGIN_JPEG )
find_package( JPEG )
if( NOT JPEG_FOUND )
tde_message_fatal( "jpeg support has been requested but was not found on your system" )
endif()
else()
set( NO_IMAGEIO_JPEG TQT_NO_IMAGEIO_JPEG )
endif( WITH_JPEG )
endif()
##### check for libmng
if( WITH_LIBMNG )
if( NOT WITH_JPEG )
tde_message_fatal( "libmng support requires jpeg support too" )
if( (WITH_IMGFMT_MNG AND BUILD_LIB) OR BUILD_IMGFMT_PLUGIN_MNG )
pkg_search_module( MNG libmng )
if( NOT MNG_FOUND )
tde_message_fatal( "mng support has been requested but was not found on your system" )
endif()
pkg_search_module( LIB_MNG libmng )
if( NOT LIB_MNG_FOUND )
tde_message_fatal( "Libmng support has been requested but was not found on your system" )
endif()
else()
set( NO_IMAGEIO_MNG TQT_NO_IMAGEIO_MNG )
endif( WITH_LIBMNG )
find_package( JPEG )
if( NOT JPEG_FOUND )
tde_message_fatal( "mng support has been requested but it also requires libjpeg" )
endif()
endif()
##### check for X11

@ -126,9 +126,6 @@ set( _SRC_ qtaddons_x11.cpp
qscriptengine.cpp
qtextlayout.cpp
qtextengine.cpp
qmngio.cpp
qjpegio.cpp
qpngio.cpp
qaccessible.cpp
)
@ -151,6 +148,39 @@ set( _EXTRA_HEADERS_
ntqsessionmanager.h
)
# Setup optional image formats support
set( _PNG_libraries ${PNG_LIBRARIES} )
set( _JPEG_libraries ${JPEG_LIBRARIES} )
set( _MNG_libraries ${MNG_LIBRARIES} ${JPEG_LIBRARIES} )
unset( _img_flags )
unset( _img_libraries )
foreach( _imgfmt PNG JPEG MNG )
if( BUILD_IMGFMT_PLUGIN_${_imgfmt} )
string( TOLOWER "plugins/src/imageformats/${_imgfmt}/main.cpp" _plugin_main_src )
set( _plugin_main_src ${CMAKE_SOURCE_DIR}/${_plugin_main_src} )
string( TOLOWER "q${_imgfmt}" _plugin_lib )
tde_add_library( ${_plugin_lib} SHARED
SOURCES ${_plugin_main_src}
LINK tqt-mt-shared ${_${_imgfmt}_libraries}
DESTINATION "${QT_INSTALL_PLUGINS}/imageformats"
)
tqt_automoc( ${_plugin_lib}-shared )
elseif( WITH_IMGFMT_${_imgfmt} )
string( TOLOWER "q${_imgfmt}io.cpp" _imgfmt_io_src )
list( APPEND _SRC_ ${_imgfmt_io_src} )
list( APPEND _img_libraries ${_${_imgfmt}_libraries} )
endif()
if( NOT WITH_IMGFMT_${_imgfmt} OR BUILD_IMGFMT_PLUGIN_${_imgfmt} )
list( APPEND _img_flags TQT_NO_IMAGEIO_${_imgfmt} )
endif()
endforeach()
if( WITH_IMGFMT_GIF )
list( APPEND _img_flags QT_BUILTIN_GIF_READER=1 )
endif()
tde_add_library( ${target} STATIC_PIC
SOURCES
@ -167,12 +197,10 @@ tde_add_library( ${target} STATIC_PIC
${X11_Xrender_LIB}
${X11_SM_LIB}
${X11_Xcursor_LIB}
${LIB_MNG_LIBRARIES}
${JPEG_LIBRARIES}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
${LIBFONTCONFIG_LIBRARIES}
${GLIB2_LIBRARIES}
${_img_libraries}
DEPENDENCIES
tqt-includes
@ -189,7 +217,6 @@ set_property( TARGET ${target}-static
${NO_SOUND} ${NAS_SUPPORT} ${USE_GLIBMAINLOOP}
${NO_XFTFREETYPE} ${USE_XFT2_HEADER} ${NO_SHAPE} ${TABLET_SUPPORT}
${NO_XINERAMA} ${NO_XRANDR} ${NO_XRENDER} ${NO_XSYNC}
${NO_XKB} ${NO_SM} ${NO_XCURSOR} ${NO_IMAGEIO_MNG}
${NO_IMAGEIO_JPEG} ${NO_IMAGEIO_PNG} ${BUILTIN_GIF_READER}
${QT_ACCESSIBILITY_SUPPORT}
${NO_XKB} ${NO_SM} ${NO_XCURSOR} ${BUILTIN_GIF_READER}
${QT_ACCESSIBILITY_SUPPORT} ${_img_flags}
)

Loading…
Cancel
Save