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

219 lines
10 KiB

############################################
# #
# Improvements and feedbacks are welcome #
# #
# This file is released under GPL >= 3 #
# #
############################################
cmake_minimum_required( VERSION 2.8.12 )
#### general package setup
project( tqt3 )
set( VERSION R14.1.0 )
#### include essential cmake modules
include( FindPkgConfig )
include( CheckFunctionExists )
include( CheckIncludeFile )
include( CheckLibraryExists )
include( CheckCSourceCompiles )
include( CheckCXXSourceCompiles )
include( GNUInstallDirs OPTIONAL )
#### include our cmake modules
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules;${CMAKE_SOURCE_DIR}" )
include( TDEMacros )
include( TQtMacros )
##### 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 STRING "install path" )
set( QT_INSTALL_BINS "${CMAKE_INSTALL_PREFIX}/bin" CACHE STRING "executables path (bin)" )
set( QT_INSTALL_LIBS "${CMAKE_INSTALL_PREFIX}/${SYSTEM_LIBDIR}" CACHE STRING "libraries path (lib)" )
set( QT_INSTALL_PLUGINS "${CMAKE_INSTALL_PREFIX}/${SYSTEM_LIBDIR}/${PROJECT_NAME}/plugins" CACHE STRING "plugins path" )
set( QT_INSTALL_HEADERS "${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}" CACHE STRING "headers path" )
set( QT_INSTALL_SHARE "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "data root path" )
set( QT_INSTALL_DATA "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}" CACHE STRING "data path" )
set( QT_INSTALL_DOCS "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/doc" CACHE STRING "documentation path" )
set( QT_INSTALL_TRANSLATIONS "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/translations" CACHE STRING "translations path" )
set( QT_INSTALL_SYSCONF "/etc/${PROJECT_NAME}" CACHE STRING "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_TQMAKE "Build the tqmake executable" ${BUILD_ALL} )
option( BUILD_TMOC "Build the tmoc executable" ON )
option( BUILD_ACCESSIBILITY "Build with Accessibility support" ${BUILD_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( BUILD_STYLES "Build tqt3 styles" ON )
option( WITH_MOTIF_STYLE "Build Motif style" ${BUILD_STYLES} )
option( WITH_CDE_STYLE "Build CDE style" ${BUILD_STYLES} )
option( WITH_MOTIFPLUS_STYLE "Build Motif plus style" ${BUILD_STYLES} )
option( WITH_SGI_STYLE "Build SGI style" ${BUILD_STYLES} )
option( WITH_WINDOWS_STYLE "Build Windows style" ${BUILD_STYLES} )
option( WITH_PLATINIUM_STYLE "Build platinium style" ${BUILD_STYLES} )
option( WITH_INTERLACE_STYLE "Build interlace style" OFF )
##### user requested tqt modules
option( BUILD_MODULES "Build all modules" ON )
option( BUILD_TOOLS "Build the tools module" ${BUILD_MODULES} )
option( BUILD_KERNEL "Build the kernel module" ${BUILD_MODULES} )
option( BUILD_WIDGETS "Build the widgets module" ${BUILD_MODULES} )
option( BUILD_DIALOGS "Build the dialog module" ${BUILD_MODULES} )
option( BUILD_WORKSPACE "Build the worspace module" ${BUILD_MODULES} )
option( BUILD_INPUTMETHOD "Build the inputmethode module" ${BUILD_MODULES} )
option( BUILD_NETWORK "Build the network module" ${BUILD_MODULES} )
option( BUILD_CANVAS "Build the canvas module" ${BUILD_MODULES} )
option( BUILD_TABLE "Build the tablet module" ${BUILD_MODULES} )
option( BUILD_XML "Build the xml module" ${BUILD_MODULES} )
option( BUILD_OPENGL "Build the OpenGL module" ${BUILD_MODULES} )
##### user requested sql modules
option( BUILD_SQL "Build the sql module" ON )
option( WITH_PSQL "Build support for PostgreSQL" ${BUILD_SQL} )
option( WITH_MYSQL "Build support for MySQL" ${BUILD_SQL} )
option( WITH_ODBC "Build support for ODBC" ${BUILD_SQL} )
option( WITH_IBASE "Build support for Firebird" ${BUILD_SQL} )
option( WITH_SQL3 "Build support for SQLite3" ${BUILD_SQL} )
##### tutorials
option( BUILD_TUTO "Build the tutorials" ON )
option( BUILD_T1 "Build tutorial t1" ${BUILD_TUTO} )
option( BUILD_T2 "Build tutorial t2" ${BUILD_TUTO} )
option( BUILD_T3 "Build tutorial t3" ${BUILD_TUTO} )
option( BUILD_T4 "Build tutorial t4" ${BUILD_TUTO} )
option( BUILD_T5 "Build tutorial t5" ${BUILD_TUTO} )
option( BUILD_T6 "Build tutorial t6" ${BUILD_TUTO} )
option( BUILD_T7 "Build tutorial t7" ${BUILD_TUTO} )
option( BUILD_T8 "Build tutorial t8" ${BUILD_TUTO} )
option( BUILD_T9 "Build tutorial t9" ${BUILD_TUTO} )
option( BUILD_T10 "Build tutorial t10" ${BUILD_TUTO} )
option( BUILD_T11 "Build tutorial t11" ${BUILD_TUTO} )
option( BUILD_T12 "Build tutorial t12" ${BUILD_TUTO} )
option( BUILD_T13 "Build tutorial t13" ${BUILD_TUTO} )
option( BUILD_T14 "Build tutorial t14" ${BUILD_TUTO} )
option( BUILD_T15 "Build tutorial t15" ${BUILD_TUTO} )
###### examples
option( BUILD_EXAMPLE "Build the examples" ON )
option( BUILD_ACLOCK "Build example aclock" ${BUILD_EXAMPLE} )
option( BUILD_ACTION "Build example action" ${BUILD_EXAMPLE} )
option( BUILD_ADDRESSBOOK "Build example addressbook" ${BUILD_EXAMPLE} )
option( BUILD_APPLICATION "Build example application" ${BUILD_EXAMPLE} )
option( BUILD_BIFF "Build example biff" ${BUILD_EXAMPLE} )
option( BUILD_BUTTONGROUPS "Build example buttongroups" ${BUILD_EXAMPLE} )
#option( BUILD_CANVAS "Build example canvas" ${BUILD_EXAMPLE} )
option( BUILD_CHECKLISTS "Build example checklists" ${BUILD_EXAMPLE} )
option( BUILD_CURSOR "Build example cursor" ${BUILD_EXAMPLE} )
option( BUILD_CUSTOMLAYOUT "Build example customlayout" ${BUILD_EXAMPLE} )
option( BUILD_DCLOCK "Build example dclock" ${BUILD_EXAMPLE} )
#option( BUILD_DEMO "Build example demo" ${BUILD_EXAMPLE} )
##### 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_TOOLS tools )
tde_conditional_add_subdirectory( BUILD_TUTO tutorial )
tde_conditional_add_subdirectory( BUILD_EXAMPLE examples )
##### 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 )
##### install configuration includes
install(
FILES
${CMAKE_BINARY_DIR}/include/ntqconfig.h
${CMAKE_BINARY_DIR}/include/ntqmodules.h
DESTINATION
${QT_INSTALL_HEADERS}
)