summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2024-03-05 14:14:43 +0300
committerAlexander Golubev <fatzer2@gmail.com>2024-03-08 14:50:56 +0300
commitbdacb0d141053484cd70d90434c48fd4fee15af5 (patch)
tree286c696cb3d31380c61f0d500a8c6d0467e7f756
parentbf48334d3d4845b15775d39ba05f4a85293c1d5d (diff)
downloadtqt-bdacb0d141053484cd70d90434c48fd4fee15af5.tar.gz
tqt-bdacb0d141053484cd70d90434c48fd4fee15af5.zip
cmake: add options to build styles as plugins
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--CMakeLists.txt27
-rw-r--r--src/styles/CMakeLists.txt50
2 files changed, 60 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c8e8cfdbd..0c4c76062 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,16 +123,27 @@ option( WITH_MODULE_SQL "Build the SQL module" ${WITH_MODULE_AL
##### user requested styles:
-option( WITH_STYLE_ALL "Build all style" ${WITH_MODULE_STYLES} )
-option( WITH_STYLE_MOTIF "Build Motif style" ${WITH_STYLES_ALL} )
-option( WITH_STYLE_WINDOWS "Build Windows style" ${WITH_STYLES_ALL} )
+option( BUILD_STYLE_PLUGIN_ALL "Build all styles as plugins" OFF )
+option( BUILD_STYLE_PLUGIN_MOTIF "Build Motif style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_WINDOWS "Build Windows style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_CDE "Build CDE style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_MOTIFPLUS "Build Motif plus style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_SGI "Build SGI style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_COMPACT "Build compact style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_PLATINUM "Build platinium style as plugin" ${BUILD_STYLE_PLUGIN_ALL} )
+option( BUILD_STYLE_PLUGIN_INTERLACE "Build interlace style as plugin" OFF )
+
+
+option( WITH_STYLE_ALL "Build all style" ${WITH_ALL_OPTIONS} )
+option( WITH_STYLE_MOTIF "Build Motif style" ${WITH_STYLE_ALL} )
+option( WITH_STYLE_WINDOWS "Build Windows style" ${WITH_STYLE_ALL} )
## Depend upon WITH_MOTIF_STYLE
-option( WITH_STYLE_CDE "Build CDE style" ${WITH_STYLES_ALL} )
-option( WITH_STYLE_MOTIFPLUS "Build Motif plus style" ${WITH_STYLES_ALL} )
-option( WITH_STYLE_SGI "Build SGI style" ${WITH_STYLES_ALL} )
+option( WITH_STYLE_CDE "Build CDE style" ${WITH_STYLE_ALL} )
+option( WITH_STYLE_MOTIFPLUS "Build Motif plus style" ${WITH_STYLE_ALL} )
+option( WITH_STYLE_SGI "Build SGI style" ${WITH_STYLE_ALL} )
## Depend upon WITH_WINDOWS_STYLE
-option( WITH_STYLE_COMPACT "Build compact style" ${WITH_STYLES_ALL} )
-option( WITH_STYLE_PLATINUM "Build platinium style" ${WITH_STYLES_ALL} )
+option( WITH_STYLE_COMPACT "Build compact style" ${WITH_STYLE_ALL} )
+option( WITH_STYLE_PLATINUM "Build platinium style" ${WITH_STYLE_ALL} )
option( WITH_STYLE_INTERLACE "Build interlace style" OFF )
## NOTE: Interlace is OFF by default due to it being experimental
diff --git a/src/styles/CMakeLists.txt b/src/styles/CMakeLists.txt
index 2b5f7fec2..e4efa3d10 100644
--- a/src/styles/CMakeLists.txt
+++ b/src/styles/CMakeLists.txt
@@ -27,13 +27,13 @@ set( _STYLE_COMPACT_SRC_ qcompactstyle.cpp )
set( _STYLE_INTERLACE_SRC_ qinterlacestyle.cpp )
set( _STYLE_PLATINUM_SRC_ qplatinumstyle.cpp )
-# check style dependencies
-tqt_requires( WITH_STYLE_CDE WITH_STYLE_MOTIF )
-tqt_requires( WITH_STYLE_MOTIFPLUS WITH_STYLE_MOTIF )
-tqt_requires( WITH_STYLE_SGI WITH_STYLE_MOTIF )
-tqt_requires( WITH_STYLE_INTERLACE WITH_STYLE_WINDOWS )
-tqt_requires( WITH_STYLE_PLATINUM WITH_STYLE_WINDOWS )
-tqt_requires( WITH_STYLE_COMPACT WITH_STYLE_WINDOWS )
+# setup style dependencies
+set( _STYLE_CDE_DEPEND_ MOTIF )
+set( _STYLE_MOTIFPLUS_DEPEND_ MOTIF )
+set( _STYLE_SGI_DEPEND_ MOTIF )
+set( _STYLE_INTERLACE_DEPEND_ WINDOWS )
+set( _STYLE_PLATINUM_DEPEND_ WINDOWS )
+set( _STYLE_COMPACT_DEPEND_ WINDOWS )
# styles unsupported on X11
set ( _disabled_styles
@@ -43,12 +43,44 @@ set ( _disabled_styles
TQT_NO_STYLE_MAC
)
+# process the style options
foreach( _style MOTIF WINDOWS CDE MOTIFPLUS SGI COMPACT INTERLACE PLATINUM )
- if( WITH_STYLE_${_style} )
- list( APPEND _SRC_ "${_STYLE_${_style}_SRC_}" )
+
+ if( WITH_STYLE_${_style} AND NOT BUILD_STYLE_PLUGIN_${_style} )
+ if( DEFINED _STYLE_${_style}_DEPEND_ )
+ set( _depend ${_STYLE_${_style}_DEPEND_} )
+ if( NOT WITH_STYLE_${_depend} )
+ tde_message_fatal( "style ${_style} requires ${_depend} to build" )
+ endif( )
+ endif( )
+ list( APPEND _SRC_ ${_STYLE_${_style}_SRC_} )
else( )
list( APPEND _disabled_styles "TQT_NO_STYLE_${_style}" )
endif( )
+
+ if( BUILD_STYLE_PLUGIN_${_style} )
+
+ unset( _style_depend_lib )
+
+ if( DEFINED _STYLE_${_style}_DEPEND_ )
+ set( _depend ${_STYLE_${_style}_DEPEND_} )
+ if( BUILD_STYLE_PLUGIN_${_depend} )
+ string( TOLOWER "q${_depend}style-shared" _style_depend_lib )
+ elseif( NOT WITH_STYLE_${_depend} )
+ tde_message_fatal( "style ${_style} requires ${_depend} to build" )
+ endif( )
+ endif( )
+
+ string( TOLOWER "q${_style}style" _style_lib )
+ tde_add_library( ${_style_lib} SHARED
+ SOURCES ${_STYLE_${_style}_SRC_}
+ LINK tqt-mt-shared ${_style_depend_lib}
+ DESTINATION "${QT_INSTALL_PLUGINS}/styles"
+ )
+ tqt_automoc( ${_style_lib}-shared )
+
+ endif( )
+
endforeach( )
tde_add_library( ${target} STATIC_PIC