############################################ # # # 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" ON ) option( WITH_STL "Enable c++ stl support" ON ) # breaks ABI option( WITH_IPV6 "Enable IPv6 support" ${WITH_ALL_OPTIONS} ) option( WITH_CUPS "Enable cups support" ${WITH_ALL_OPTIONS} ) option( WITH_GLIBMAINLOOP "Enable Glib support" ${WITH_ALL_OPTIONS} ) option( WITH_SOUND "Enable sound support with Nas" ${WITH_ALL_OPTIONS} ) ##### X11-related options option( WITH_SM "Enable Session management support" ${WITH_ALL_OPTIONS} ) option( WITH_TABLET "Enable tablet support" ${WITH_ALL_OPTIONS} ) option( WITH_XCURSOR "Enable XCursor support" ${WITH_ALL_OPTIONS} ) option( WITH_XFT "Enable Xft support" ${WITH_ALL_OPTIONS} ) option( WITH_XINERAMA "Enable Xinerame support" ${WITH_ALL_OPTIONS} ) option( WITH_XKB "Enable X KeyBoard support" ${WITH_ALL_OPTIONS} ) option( WITH_XRANDR "Enable Xrandr support" ${WITH_ALL_OPTIONS} ) option( WITH_XRENDER "Enable XRender support" ${WITH_ALL_OPTIONS} ) option( WITH_XSHAPE "Enable XShape support" ${WITH_ALL_OPTIONS} ) option( WITH_XSYNC "Enable Xsync support" ${WITH_ALL_OPTIONS} ) option( WITH_IMMODULE_EXTENSIONS "Enable immodule extensions support" OFF ) # breaks ABI ##### user requested build 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 ) # Essential modules; build without them isn't viable at the moment option( WITH_MODULE_STYLES "Build the styles module" ON ) option( WITH_MODULE_TOOLS "Build the tools module" ON ) option( WITH_MODULE_KERNEL "Build the kernel module" ON ) option( WITH_MODULE_WIDGETS "Build the widgets module" ON ) option( WITH_MODULE_DIALOGS "Build the dialog module" ON ) # Optional modules 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_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 ) 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_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_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 ##### user requested sql modules option( BUILD_SQL_PLUGIN_ALL "Build all sql plugins" OFF ) 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" ${WITH_ALL_OPTIONS} ) 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} ) ##### Advanced options set( TQT_CONFIG "full" CACHE STRING "Predefined set of tqt interanl options, one of: minimal|small|medium|large|full" ) set( WITH_UNSUPORTED_CONFIG OFF CACHE BOOL "Build TQt regardles some unsupported option configuration" ) mark_as_advanced( TQT_CONFIG WITH_UNSUPORTED_CONFIG ) set( TQT_PLATFORM "local" CACHE STRING "Use qplatformdefs.h from \"mkspec/\${TQT_PLATFORM}\"" ) # NOTE: a special TQT_PLATFORM=value of "local" will cause generation of a `qplatformdefs.h` based # on current cmake build settings. If the generated file is not fit for your platform, please # fill in a bug. You may still workaround it specifying concrete TQT_PLATFORM value. ##### 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 files include( config.tests/unix/stl/ConfigureChecks.cmake ) # test: stl supported include( config.tests/unix/ipv6/ConfigureChecks.cmake ) # test: IPv6 network ###### global compiler settings 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 ) if( TQT_PLATFORM STREQUAL "local" ) add_subdirectory( mkspecs/local ) endif() ##### write configure files 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 ) ##### install mkspecs if( BUILD_TQMAKE ) install( DIRECTORY ${CMAKE_SOURCE_DIR}/mkspecs DESTINATION "${QT_INSTALL_DATA}" PATTERN "mkspecs/local/*" EXCLUDE ) tde_install_symlink( "${TQT_PLATFORM}" "${QT_INSTALL_DATA}/mkspecs/default" ) endif( BUILD_TQMAKE )