cmake: rework styles building

- fix several styles-related FTBFS when disabling a style
- use separated flags for BUILD_STULE and WITH_STYLE_ALL
- add several convenience macros

Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
feat/cmakeConv-r1
Alexander Golubev 3 months ago
parent cca829fd03
commit 19b0bae5b2

@ -123,18 +123,19 @@ option( WITH_MODULE_SQL "Build the SQL module" ${WITH_MODULE_AL
##### user requested styles: ##### user requested styles:
## Motif style is mandatory for CDE, MotifPlus and SGI builds option( WITH_STYLE_ALL "Build all style" ${WITH_MODULE_STYLES} )
## Windows style is mandatory for Platinum and Interlace (experimental, OFF by default) builds option( WITH_STYLE_MOTIF "Build Motif style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_WINDOWS "Build Windows style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_ALL "Build tqt3 styles" ${WITH_MODULE_STYLES} ) ## Depend upon WITH_MOTIF_STYLE
option( WITH_STYLE_MOTIF "Build Motif style" ${WITH_STYLE_ALL} ) option( WITH_STYLE_CDE "Build CDE style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_CDE "Build CDE style" ${WITH_STYLE_ALL} ) option( WITH_STYLE_MOTIFPLUS "Build Motif plus style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_MOTIFPLUS "Build Motif plus style" ${WITH_STYLE_ALL} ) option( WITH_STYLE_SGI "Build SGI style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_SGI "Build SGI style" ${WITH_STYLE_ALL} ) ## Depend upon WITH_WINDOWS_STYLE
option( WITH_STYLE_WINDOWS "Build Windows style" ${WITH_STYLE_ALL} ) option( WITH_STYLE_COMPACT "Build compact style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_PLATINIUM "Build platinium style" ${WITH_STYLE_ALL} ) option( WITH_STYLE_PLATINUM "Build platinium style" ${WITH_STYLES_ALL} )
option( WITH_STYLE_INTERLACE "Build interlace style" OFF ) option( WITH_STYLE_INTERLACE "Build interlace style" OFF )
## NOTE: Interlace is OFF by default due to it being experimental
##### user requested sql modules ##### user requested sql modules

@ -6,6 +6,21 @@
include( TDEMacros ) include( TDEMacros )
#################################################
#####
##### tqt_requires
#####
##### Asserts that if opt1 is set opt2 is set also
#####
##### Syntax:
##### tqt_requires( opt1 opt2 )
macro( tqt_requires _opt1 _opt2 )
if( ${_opt1} AND NOT ${_opt2} )
tde_message_fatal( "${_opt1}=ON requires ${_opt2}=ON to build" )
endif( )
endmacro( tqt_requires )
################################################# #################################################
##### #####
@ -113,6 +128,7 @@ endmacro( tqt_install_includes )
##### #####
##### Syntax: ##### Syntax:
##### tqt_header_for_source ( header_list source [source ...] ) ##### tqt_header_for_source ( header_list source [source ...] )
macro( tqt_header_for_source _include_out ) macro( tqt_header_for_source _include_out )
foreach( _src ${ARGN} ) foreach( _src ${ARGN} )
# As for now tqt has an "nt" prefix before filenames, so in order to handle all the casses # As for now tqt has an "nt" prefix before filenames, so in order to handle all the casses

@ -13,52 +13,43 @@ link_directories()
##### styles (static) ##### styles (static)
set( target styles ) set( target styles )
set( _SRC_ qcdestyle.cpp set( _SRC_ qcommonstyle.cpp
qcommonstyle.cpp
qcompactstyle.cpp
qinterlacestyle.cpp
qmotifplusstyle.cpp
qmotifstyle.cpp
qplatinumstyle.cpp
qsgistyle.cpp
qstylefactory.cpp
qstyleplugin.cpp qstyleplugin.cpp
qwindowsstyle.cpp qstylefactory.cpp
) )
set( _disabled_styles "" ) set( _STYLE_MOTIF_SRC_ qmotifstyle.cpp )
list( APPEND _disabled_styles set( _STYLE_WINDOWS_SRC_ qwindowsstyle.cpp )
set( _STYLE_CDE_SRC_ qcdestyle.cpp )
set( _STYLE_MOTIFPLUS_SRC_ qmotifplusstyle.cpp )
set( _STYLE_SGI_SRC_ qsgistyle.cpp )
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 )
# styles unsupported on X11
set ( _disabled_styles
TQT_NO_STYLE_WINDOWSXP TQT_NO_STYLE_WINDOWSXP
TQT_NO_STYLE_AQUA TQT_NO_STYLE_AQUA
TQT_NO_STYLE_POCKETPC TQT_NO_STYLE_POCKETPC
TQT_NO_STYLE_MAC TQT_NO_STYLE_MAC
) )
if( WITH_STYLE_WINDOWS ) foreach( _style MOTIF WINDOWS CDE MOTIFPLUS SGI COMPACT INTERLACE PLATINUM )
if( NOT WITH_STYLE_INTERLACE ) if( WITH_STYLE_${_style} )
list( APPEND _disabled_styles TQT_NO_STYLE_INTERLACE ) list( APPEND _SRC_ "${_STYLE_${_style}_SRC_}" )
endif() else( )
if( NOT WITH_STYLE_PLATINIUM ) list( APPEND _disabled_styles "TQT_NO_STYLE_${_style}" )
list( APPEND _disabled_styles TQT_NO_STYLE_PLATINUM ) endif( )
endif() endforeach( )
else()
tde_message_fatal( "Windows style is required for this build" )
endif( WITH_STYLE_WINDOWS )
if( WITH_STYLE_MOTIF )
if( NOT WITH_STYLE_SGI )
list( APPEND _disabled_styles TQT_NO_STYLE_SGI )
endif()
if( NOT WITH_STYLE_MOTIFPLUS)
list( APPEND _disabled_styles TQT_NO_STYLE_MOTIFPLUS )
endif()
if( NOT WITH_STYLE_CDE )
list( APPEND _disabled_styles TQT_NO_STYLE_CDE )
endif()
else()
tde_message_fatal( "Motif style is required for this build" )
endif( WITH_STYLE_MOTIF )
tde_add_library( ${target} STATIC_PIC tde_add_library( ${target} STATIC_PIC

Loading…
Cancel
Save