You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tqt3/CMakeLists.txt

231 lines
12 KiB

############################################
# #
# Improvements and feedbacks are welcome #
# #
# This file is released under GPL >= 3 #
# #
############################################
cmake_minimum_required( VERSION 3.5 )
#### general package setup
project( tqt3 )
set( PACKAGE ${PROJECT_NAME} )
set( PACKAGE_VERSION 3.5.0 )
#### include essential cmake modules
include( FindPkgConfig )
include( CheckFunctionExists )
include( CheckIncludeFile )
include( CheckLibraryExists )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( GNUInstallDirs OPTIONAL )
#### include our cmake modules
include( TDEMacros )
include( TQtMacros.cmake )
##### set version number ########################
tde_set_project_version()
##### setup install paths
include( TDESetupPaths )
tde_setup_paths( )
if( CMAKE_INSTALL_LIBDIR )
set( SYSTEM_LIBDIR "${CMAKE_INSTALL_LIBDIR}" )
else()
set( SYSTEM_LIBDIR "lib${LIB_SUFFIX}" )
endif()
set( QT_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" CACHE PATH "install path" )
set( QT_INSTALL_BINS "${QT_INSTALL_PREFIX}/bin" CACHE PATH "executables path (bin)" )
set( QT_INSTALL_LIBS "${QT_INSTALL_PREFIX}/${SYSTEM_LIBDIR}" CACHE PATH "libraries path (lib)" )
set( QT_INSTALL_PLUGINS "${QT_INSTALL_LIBS}/${PROJECT_NAME}/plugins" CACHE PATH "plugins path" )
set( QT_INSTALL_HEADERS "${QT_INSTALL_PREFIX}/include/${PROJECT_NAME}" CACHE PATH "headers path" )
set( QT_INSTALL_SHARE "${QT_INSTALL_PREFIX}/share" CACHE PATH "data root path" )
set( QT_INSTALL_DATA "${QT_INSTALL_SHARE}/${PROJECT_NAME}" CACHE PATH "data path" )
set( QT_INSTALL_DOCS "${QT_INSTALL_DATA}/doc" CACHE PATH "documentation path" )
set( QT_INSTALL_TRANSLATIONS "${QT_INSTALL_DATA}/translations" CACHE PATH "translations path" )
set( QT_INSTALL_SYSCONF "/etc/${PROJECT_NAME}" CACHE PATH "config path" )
##### optional stuff
option( WITH_ALL_OPTIONS "Enable all optional support" ON )
option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" OFF )
option( WITH_IMMODULE_EXTENSIONS "Enable immodule extensions support" OFF ) # break ABI
option( WITH_STL "Enable c++ stl support" ${WITH_ALL_OPTIONS} )
option( WITH_IPV6 "Enable IPv6 support" ${WITH_ALL_OPTIONS} )
option( WITH_CUPS "Enable cups support" ${WITH_ALL_OPTIONS} )
option( WITH_SOUND "Enable sound support with Nas" ${WITH_ALL_OPTIONS} )
option( WITH_GLIBMAINLOOP "Enable Glib support" ${WITH_ALL_OPTIONS} )
option( WITH_XFT "Enable Xft support" ${WITH_ALL_OPTIONS} )
option( WITH_XSHAPE "Enable XShape support" ${WITH_ALL_OPTIONS} )
option( WITH_TABLET "Enable tablet support" ${WITH_ALL_OPTIONS} )
option( WITH_XINERAMA "Enable Xinerame support" ${WITH_ALL_OPTIONS} )
option( WITH_XRANDR "Enable Xrandr support" ${WITH_ALL_OPTIONS} )
option( WITH_XRENDER "Enable XRender support" ${WITH_ALL_OPTIONS} )
option( WITH_XSYNC "Enable Xsync support" ${WITH_ALL_OPTIONS} )
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
set( TQT_CONFIG "full-config" CACHE STRING "Enable tqt fonctionalities" ) #choices: minimal-config|small-config|medium-config|large-config|full-config
option( BUILD_ALL "Build all" ON )
option( BUILD_LIB "Build the tqt library itself" ${BUILD_ALL} )
option( BUILD_TQMAKE "Build the tqmake executable" ${BUILD_ALL} )
option( BUILD_TMOC "Build the tmoc executable" ${BUILD_ALL} )
option( BUILD_TOOLS "Build various other tools" ${BUILD_ALL} )
option( BUILD_TUTORIAL "Build the tutorials" ${BUILD_ALL} )
option( BUILD_EXAMPLE "Build the examples" ${BUILD_ALL} )
option( BUILD_TRANSLATIONS "Build translations" ${BUILD_ALL} )
##### user requested tqt modules
option( WITH_MODULE_ALL "Build all modules" ON )
option( WITH_MODULE_TOOLS "Build the tools module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_KERNEL "Build the kernel module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_WIDGETS "Build the widgets module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_DIALOGS "Build the dialog module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_WORKSPACE "Build the worspace module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_INPUTMETHOD "Build the inputmethode module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_NETWORK "Build the network module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_CANVAS "Build the canvas module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_TABLE "Build the table module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_XML "Build the xml module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_OPENGL "Build the OpenGL module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_STYLES "Build the styles module" ${WITH_MODULE_ALL} )
option( WITH_MODULE_SQL "Build the SQL module" ${WITH_MODULE_ALL} )
##### user requested styles:
## Motif style is mandatory for CDE, MotifPlus and SGI builds
## Windows style is mandatory for Platinum and Interlace (experimental, OFF by default) builds
option( WITH_STYLE_ALL "Build tqt3 styles" ${WITH_MODULE_STYLES} )
option( WITH_STYLE_MOTIF "Build Motif style" ${WITH_STYLE_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} )
option( WITH_STYLE_WINDOWS "Build Windows style" ${WITH_STYLE_ALL} )
option( WITH_STYLE_PLATINIUM "Build platinium style" ${WITH_STYLE_ALL} )
option( WITH_STYLE_INTERLACE "Build interlace style" OFF )
##### user requested sql modules
option( BUILD_SQL_PLUGIN_ALL "Build all sql plugins" ${WITH_MODULE_SQL} )
option( BUILD_SQL_PLUGIN_PSQL "Build plugin for PostgreSQL" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_MYSQL "Build plugin for MySQL" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_ODBC "Build plugin for ODBC" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_IBASE "Build plugin for Firebird" ${BUILD_SQL_PLUGIN_ALL} )
#option( BUILD_SQL_PLUGIN_SQLITE "Build plugin for SQLite" ${BUILD_SQL_PLUGIN_ALL} )
option( BUILD_SQL_PLUGIN_SQLITE3 "Build plugin for SQLite3" ${BUILD_SQL_PLUGIN_ALL} )
option( WITH_SQL_DRIVER_ALL "Build all sql drivers" OFF )
option( WITH_SQL_DRIVER_PSQL "Build support for PostgreSQL" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_MYSQL "Build support for MySQL" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_ODBC "Build support for ODBC" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_IBASE "Build support for Firebird" ${WITH_SQL_DRIVER_ALL} )
#option( WITH_SQL_DRIVER_SQLITE "Build support for SQLite" ${WITH_SQL_DRIVER_ALL} )
option( WITH_SQL_DRIVER_SQLITE3 "Build support for SQLite3" ${WITH_SQL_DRIVER_ALL} )
##### tutorials
option( BUILD_TUTORIAL_ALL "Build all tutorials" ${BUILD_TUTORIAL} )
option( BUILD_TUTORIAL_1 "Build tutorial t1" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_2 "Build tutorial t2" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_3 "Build tutorial t3" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_4 "Build tutorial t4" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_5 "Build tutorial t5" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_6 "Build tutorial t6" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_7 "Build tutorial t7" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_8 "Build tutorial t8" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_9 "Build tutorial t9" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_10 "Build tutorial t10" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_11 "Build tutorial t11" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_12 "Build tutorial t12" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_13 "Build tutorial t13" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_14 "Build tutorial t14" ${BUILD_TUTORIAL_ALL} )
option( BUILD_TUTORIAL_15 "Build tutorial t15" ${BUILD_TUTORIAL_ALL} )
###### examples
option( BUILD_EXAMPLE_ALL "Build the examples" ${BUILD_EXAMPLE} )
option( BUILD_EXAMPLE_ACLOCK "Build example aclock" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_ACTION "Build example action" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_ADDRESSBOOK "Build example addressbook" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_APPLICATION "Build example application" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_BIFF "Build example biff" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_BUTTONGROUPS "Build example buttongroups" ${BUILD_EXAMPLE_ALL} )
#option( BUILD_EXAMPLE_CANVAS "Build example canvas" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_CHECKLISTS "Build example checklists" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_CURSOR "Build example cursor" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_CUSTOMLAYOUT "Build example customlayout" ${BUILD_EXAMPLE_ALL} )
option( BUILD_EXAMPLE_DCLOCK "Build example dclock" ${BUILD_EXAMPLE_ALL} )
#option( BUILD_EXAMPLE_DEMO "Build example demo" ${BUILD_EXAMPLE_ALL} )
##### configure checks
include( ConfigureChecks.cmake )
include( config.tests/unix/endian/ConfigureChecks.cmake ) # test: little/big endian
include( config.tests/unix/largefile/ConfigureChecks.cmake ) # test: large lifes
include( config.tests/unix/stl/ConfigureChecks.cmake ) # test: stl supported
include( config.tests/unix/ipv6/ConfigureChecks.cmake ) # test: IPv6 network
###### global compiler settings
add_definitions( -DHAVE_CONFIG_H )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )
##### directories
add_subdirectory( src )
tde_conditional_add_subdirectory( BUILD_TQMAKE qmake )
tde_conditional_add_subdirectory( BUILD_TMOC src/moc )
tde_conditional_add_subdirectory( BUILD_TOOLS tools )
tde_conditional_add_subdirectory( BUILD_TUTORIAL tutorial )
tde_conditional_add_subdirectory( BUILD_EXAMPLE examples )
tde_conditional_add_subdirectory( BUILD_TRANSLATIONS translations )
##### write configure files
configure_file( config.h.cmake config.h @ONLY )
configure_file( src/tools/qconfig.cpp.cmake src/tools/qconfig.cpp @ONLY )
configure_file( include/ntqconfig.h.cmake include/ntqconfig.h @ONLY )
configure_file( include/ntqmodules.h.cmake include/ntqmodules.h @ONLY )