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/ConfigureChecks.cmake

476 lines
13 KiB

###########################################
# #
# Improvements and feedback are welcome #
# #
# This file is released under GPL >= 3 #
# #
###########################################
# required stuff
tde_setup_architecture_flags()
##### check for gcc visibility support
if( WITH_GCC_VISIBILITY )
tde_setup_gcc_visibility()
endif( WITH_GCC_VISIBILITY )
##### TQT gif support
if( WITH_TQTGIF )
set( BUILTIN_GIF_READER QT_BUILTIN_GIF_READER )
set( QT_BUILTIN_GIF_READER 1 )
endif( WITH_TQTGIF )
##### check for fontconfig
pkg_search_module( LIBFONTCONFIG fontconfig )
if( NOT LIBFONTCONFIG_FOUND )
tde_message_fatal( "fontconfig is required but was not found on your system" )
endif( NOT LIBFONTCONFIG_FOUND )
##### check for libpng
if( WITH_PNG )
find_package( PNG )
if( NOT PNG_FOUND )
tde_message_fatal( "libpng support has been requested but was not found on your system" )
endif()
else()
set( NO_IMAGEIO_PNG TQT_NO_IMAGEIO_PNG )
endif( WITH_PNG )
##### check for jpeg
if( WITH_JPEG )
find_package( JPEG )
if( NOT JPEG_FOUND )
tde_message_fatal( "jpeg support has been requested but was not found on your system" )
endif()
else()
set( NO_IMAGEIO_JPEG TQT_NO_IMAGEIO_JPEG )
endif( WITH_JPEG )
##### check for libmng
if( WITH_LIBMNG )
find_path( LIBMNG_HEADER libmng.h )
find_library( LIBMNG_LIBRARY mng )
if( LIBMNG_HEADER AND LIBMNG_LIBRARY )
set( LIB_MNG_INCLUDE_DIRS "${LIBMNG_HEADER}" )
set( LIB_MNG_LIBRARIES "${LIBMNG_LIBRARY}" )
else()
tde_message_fatal( "Libmng support has been requested but was not found on your system" )
endif()
if( (NOT WITH_JPEG) OR (NOT JPEG_FOUND) )
tde_message_fatal( "libmng support requires jpeg support too" )
endif()
else()
set( NO_IMAGEIO_MNG TQT_NO_IMAGEIO_MNG )
endif( WITH_LIBMNG )
##### check for X11
find_package( X11 COMPONENTS SM Xcursor Xext Xfixes Xi Xinerama Xrandr Xrender Xshape Xinput XSync Xkb )
pkg_search_module( LIBICE ice )
if( NOT LIBICE_FOUND )
tde_message_fatal( "libice is require but was not found on your system" )
endif( NOT LIBICE_FOUND )
if( WITH_XCURSOR )
check_include_file( "X11/Xcursor/Xcursor.h" HAVE_XCURSOR )
if( NOT HAVE_XCURSOR )
tde_message_fatal( "XCursor support has been requested but was not found on your system" )
endif()
else()
set( NO_XCURSOR TQT_NO_XCURSOR )
endif( WITH_XCURSOR )
if( WITH_SM )
check_include_file( "X11/SM/SMlib.h" HAVE_SM )
if( NOT HAVE_SM )
tde_message_fatal( "Session management support has been requested but was not found on your system" )
endif()
else()
set( NO_SM TQT_NO_SM_SUPPORT )
endif( WITH_SM )
if( WITH_XKB )
check_include_file( "X11/XKBlib.h" HAVE_XKB )
if( NOT HAVE_XKB )
tde_message_fatal( "X KeyBoard support has been requested but was not found on your system" )
endif()
else()
set( NO_XKB TQT_NO_XKB )
endif( WITH_XKB )
if( WITH_XSYNC )
if( NOT X11_XSync_FOUND )
tde_message_fatal( "Xsync support has been requested but was not found on your system" )
endif()
else()
set( NO_XSYNC TQT_NO_XSYNC )
endif( WITH_XSYNC )
if( WITH_XRENDER )
check_include_file( "X11/extensions/Xrender.h" HAVE_XRENDER )
if( NOT HAVE_XRENDER )
tde_message_fatal( "Xrender support has been requested but was not found on your system" )
endif()
else()
set( NO_XRENDER TQT_NO_XRENDER )
endif( WITH_XRENDER )
if( WITH_XRANDR )
check_include_file( "X11/extensions/Xrandr.h" HAVE_XRANDR )
if( NOT HAVE_XRANDR )
tde_message_fatal( "Xrandr support has been requested but was not found on your system" )
endif()
else()
set( NO_XRANDR TQT_NO_XRANDR )
endif( WITH_XRANDR )
if( WITH_XINERAMA )
check_include_file( "X11/extensions/Xinerama.h" HAVE_XINERAMA )
if( NOT HAVE_XINERAMA )
tde_message_fatal( "Xinerame support has been requested but was not found on your system" )
endif()
else()
set( NO_XINERAMA TQT_NO_XINERAMA )
endif( WITH_XINERAMA )
if( WITH_TABLET )
check_include_file( "X11/extensions/XInput.h" HAVE_XINPUT )
if( X11_Xinput_FOUND )
set( TABLET_SUPPORT QT_TABLET_SUPPORT )
else()
tde_message_fatal( "Tablet support has been requested but XInput was not found on your system" )
endif()
endif( WITH_TABLET )
if( WITH_XSHAPE )
check_include_file( "X11/extensions/shape.h" HAVE_SHAPE )
if( NOT HAVE_SHAPE )
tde_message_fatal( "X11 shape extension support has been requested but was not found on your system" )
endif()
else()
set( NO_SHAPE TQT_NO_SHAPE )
endif( WITH_XSHAPE )
if( WITH_XFT )
check_include_file( "X11/Xft/Xft2.h" HAVE_XFT2 )
if( HAVE_XFT2 )
set( USE_XFT2_HEADER QT_USE_XFT2_HEADER )
set( XFT2 QT_XFT2 )
endif()
if( NOT X11_Xft_FOUND )
tde_message_fatal( "libXft support has been requested but was not found on your system" )
endif()
else()
set( NO_XFTFREETYPE TQT_NO_XFTFREETYPE )
endif( WITH_XFT )
##### check for glib
if( WITH_GLIBMAINLOOP )
pkg_search_module( GLIB2 glib-2.0 )
if( GLIB2_FOUND )
pkg_search_module( GTHREAD2 gthread-2.0 )
if( NOT GTHREAD2_FOUND )
tde_message_fatal( "gthread-2.0 is required but was not found on your system" )
endif()
set( USE_GLIBMAINLOOP QT_USE_GLIBMAINLOOP )
else()
tde_message_fatal( "glib-2.0 support has been requested but not found on your system" )
endif()
endif( WITH_GLIBMAINLOOP )
##### check for Nas/sound
if( WITH_SOUND )
find_path( NAS_INCLUDE_DIRS "audio/audiolib.h" )
find_library( NAS_LIBRARIES audio )
if( NOT NAS_INCLUDE_DIRS AND NOT NAS_LIBRARIES )
tde_message_fatal( "Sound support has been requested but Nas was not found on your system" )
else()
set( NAS_SUPPORT QT_NAS_SUPPORT )
endif()
else()
set( NO_SOUND TQT_NO_SOUND )
endif( WITH_SOUND )
##### check for libtirpc
check_include_file( "rpcsvc/ypclnt.h" HAVE_YPCLN_H )
if( HAVE_YPCLN_H )
pkg_search_module( TIRPC libtirpc )
else()
tde_message_fatal( "libtirpc headers are required, but were not found on your system" )
endif()
##### check for Thread library
find_package( Threads )
if( Threads_FOUND )
add_definitions( -DTQT_THREAD_SUPPORT )
endif()
##### check for freetype2
find_package( Freetype )
if( NOT FREETYPE_FOUND )
tde_message_fatal( "Freetype is required, but was not found on your system" )
endif()
##### check for zlib
find_package( ZLIB )
if( NOT ZLIB_FOUND )
tde_message_fatal( "Zlib is required, but was not found on your system" )
else()
check_include_file( "zlib.h" HAVE_ZLIB_H )
endif()
##### check for cups
if( WITH_CUPS )
find_package( Cups )
if( NOT CUPS_FOUND )
tde_message_fatal( "Cups support have been requested, but was not found on your system" )
endif()
else()
set( NO_CUPS TQT_NO_CUPS )
endif()
##### check for uuid library
pkg_search_module( _UUID uuid )
if( NOT _UUID_FOUND )
tde_message_fatal( "the uuid libary is required, but was not found on your system" )
endif()
##### check headers
check_include_file( "unistd.h" Q_OS_UNIX ) #probably not needed
check_include_file( "sys/mman.h" Q_OS_LINUX ) #probably not needed
##### variables to generate <ntconfig.h> (include folder)
set( _HOST_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR} )
set( _HOST_SYSTEM_NAME ${CMAKE_CXX_PLATFORM_ID} )
set( _SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P} )
if( ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.0.0") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") )
set( _COMPILER_NAME "g++-4.*" )
else()
set( _COMPILER_NAME "g++-3.*" )
endif()
##### immodule extensions
if( WITH_IMMODULE_EXTENSIONS )
set( TQT_NO_IM_EXTENSIONS 1 )
endif()
##### set build for modules
if( BUILD_TMOC )
set( TMOC_EXECUTABLE $<TARGET_FILE:tmoc> CACHE FILEPATH "" )
set( MOC_EXECUTABLE $<TARGET_FILE:tmoc> CACHE FILEPATH "" )
endif()
if( BUILD_TOOLS )
set( UIC_EXECUTABLE $<TARGET_FILE:tquic> CACHE FILEPATH "" )
endif()
if( WITH_MODULE_STYLES )
set( TQT_MODULE_STYLES 1 )
endif()
if( WITH_MODULE_TOOLS )
set( TQT_MODULE_TOOLS 1 )
endif()
if( WITH_MODULE_KERNEL )
set( TQT_MODULE_KERNEL 1 )
endif()
if( WITH_MODULE_WIDGETS )
set( TQT_MODULE_WIDGETS 1 )
endif()
if( WITH_MODULE_DIALOGS )
set( TQT_MODULE_DIALOGS 1 )
endif()
if( WITH_MODULE_WORKSPACE )
set( TQT_MODULE_WORKSPACE 1 )
endif()
if( WITH_MODULE_INPUTMETHOD )
set( TQT_MODULE_INPUTMETHOD 1 )
endif()
if( WITH_MODULE_NETWORK )
set( TQT_MODULE_NETWORK 1 )
endif()
if( WITH_MODULE_CANVAS )
set( TQT_MODULE_CANVAS 1 )
endif()
if( WITH_MODULE_TABLE )
set( TQT_MODULE_TABLE 1 )
endif()
if( WITH_MODULE_XML )
set( TQT_MODULE_XML 1 )
endif()
if( WITH_MODULE_OPENGL )
set(OpenGL_GL_PREFERENCE LEGACY)
find_package( OpenGL )
if( OPENGL_FOUND )
set( TQT_MODULE_OPENGL 1 )
elseif( OPENGL_GLU_FOUND )
set( TQT_MODULE_OPENGL 1 )
set( DLOPEN_OPENGL QT_DLOPEN_OPENGL )
else()
tde_message_fatal( "OpenGL support is requested, but was not found on your system" )
endif()
endif()
if( WITH_MODULE_SQL )
set( TQT_MODULE_SQL 1 )
endif()
if( (BUILD_SQL_PLUGIN_PSQL OR (WITH_MODULE_SQL AND WITH_SQL_DRIVER_PSQL)) AND NOT PostgreSQL_FOUND )
find_package( PostgreSQL )
if( NOT PostgreSQL_FOUND )
tde_message_fatal( "PostgreSQL has been requested, but was not found on your system" )
endif()
endif()
if( (BUILD_SQL_PLUGIN_MYSQL OR (WITH_MODULE_SQL AND WITH_SQL_DRIVER_MYSQL)) AND NOT MYSQL_FOUND )
message( STATUS "Check for MariaDB or MySQL" )
find_program( MYSQL_CONFIG NAMES mariadb_config mysql_config )
if( NOT MYSQL_CONFIG )
tde_message_fatal( "MySql support is requested but neither MySql or Mariadb have been found on your system" )
else()
macro( _mysql_config __type __var )
execute_process(
COMMAND ${MYSQL_CONFIG} --${__type}
OUTPUT_VARIABLE ${__var}
RESULT_VARIABLE __result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( _result )
tde_message_fatal( "Unable to run ${MYSQL_CONFIG}!" )
endif()
endmacro()
_mysql_config( include MYSQL_INCLUDE_DIRS )
_mysql_config( libs MYSQL_LIBRARIES )
if( MYSQL_INCLUDE_DIRS )
string( REGEX REPLACE "(^| +)-I" ";" MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" )
endif()
if( MYSQL_LIBRARIES )
string( REGEX REPLACE "(^| +)-l" ";" MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" )
endif()
set( MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
set( MYSQL_LIBRARIES "${MYSQL_LIBRARIES}" CACHE INTERNAL "" FORCE )
set( MYSQL_FOUND 1 CACHE INTERNAL "" FORCE )
message( STATUS "MySQL includes ${MYSQL_INCLUDE_DIRS}" )
message( STATUS "MySQL libraries ${MYSQL_LIBRARIES}" )
endif( NOT MYSQL_CONFIG )
endif()
if( (BUILD_SQL_PLUGIN_ODBC OR (WITH_MODULE_SQL AND WITH_SQL_DRIVER_ODBC)) AND NOT ODBC_FOUND )
pkg_search_module( ODBC odbc;libiodbc )
if( NOT ODBC_FOUND )
tde_message_fatal( "ODBC support has been requested, but was not found on your system" )
endif()
endif()
if( (BUILD_SQL_PLUGIN_IBASE OR (WITH_MODULE_SQL AND WITH_SQL_DRIVER_IBASE)) AND NOT FBCLIENT_FOUND )
find_program( FIREBIRD_CONFIG fb_config )
if( NOT FIREBIRD_CONFIG )
tde_message_fatal( "IBASE support has been requested, but was not found on your system" )
else()
macro( _fbclient_config __type __var )
execute_process(
COMMAND ${FIREBIRD_CONFIG} --${__type}
OUTPUT_VARIABLE ${__var}
RESULT_VARIABLE __result
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if( _result )
tde_message_fatal( "Unable to run ${FIREBIRD_CONFIG}!" )
endif()
endmacro()
_fbclient_config( cflags FBCLIENT_INCLUDE_DIRS )
_fbclient_config( libs FBCLIENT_LIBRARIES )
if( FBCLIENT_INCLUDE_DIRS )
string( REGEX REPLACE "(^| +)-I" ";" FBCLIENT_INCLUDE_DIRS "${FBCLIENT_INCLUDE_DIRS}" )
endif()
if( FBCLIENT_LIBRARIES )
string( REGEX REPLACE "(^| +)-l" ";" FBCLIENT_LIBRARIES "${FBCLIENT_LIBRARIES}" )
endif()
set( FBCLIENT_INCLUDE_DIRS "${FBCLIENT_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE )
set( FBCLIENT_LIBRARIES "${FBCLIENT_LIBRARIES}" CACHE INTERNAL "" FORCE )
set( FBCLIENT_FOUND 1 CACHE INTERNAL "" FORCE )
message( STATUS "FIREBIRD includes ${FBCLIENT_INCLUDE_DIRS} ")
message( STATUS "FIREBIRD libraries ${FBCLIENT_LIBRARIES} ")
endif( NOT FIREBIRD_CONFIG )
endif()
if( (BUILD_SQL_PLUGIN_SQLITE OR (WITH_MODULE_SQL AND WITH_SQL_DRIVER_SQLITE)) AND NOT SQLITE_FOUND )
pkg_search_module( SQLITE sqlite )
if( NOT SQLITE_FOUND )
tde_message_fatal( "SQLite support has been requested, but was not found on your system" )
endif()
endif()
if( (BUILD_SQL_PLUGIN_SQLITE3 OR (WITH_MODULE_SQL AND WITH_SQL_DRIVER_SQLITE3)) AND NOT SQLITE3_FOUND )
pkg_search_module( SQLITE3 sqlite3 )
if( NOT SQLITE3_FOUND )
tde_message_fatal( "SQLite3 support has been requested, but was not found on your system" )
endif()
endif()