X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=CMakeLists.txt;h=1e372247f312b53d3320b10a52ae696bc29c9825;hp=7b8343a9873056a0362a8ba1fe34f20923ac776e;hb=aa5df1497a6fca61d6f59be49572799b5c9d93fe;hpb=907e6c4c2f5e199600b54213f6964d2c50bdc700 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b8343a9..1e372247 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,10 @@ # -DWANT_(CORE|QTCLIENT|MONO)=(ON|OFF) # : select binaries to build # -DWITH_OPENSSL=OFF : Disable OpenSSL support -# -DWITH_DBUS=OFF : Disable D-Bus support +# -DWITH_DBUS=OFF : Disable D-Bus support (dbus notifications) +# -DWITH_WEBKIT=OFF : Disable WebKit support (link previews) +# -DWITH_PHONON=OFF : Disable Phonon support (audio notifications) +# -DWITH_KDE=ON : Enable KDE4 support # -DOXYGEN_ICONS=(Builtin|External) : If "Builtin" (the default), compile our Oxygen Icon Theme subset into the binary # : If "External", we assume Oxygen is already installed on the system # -DQUASSEL_ICONS=(Builtin|External) : If "Builtin" (the default), put our own icons into the binary @@ -16,8 +19,7 @@ project(QuasselIRC) -# Target scopes don't work in older versions -cmake_minimum_required(VERSION 2.4.7 FATAL_ERROR) +cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR) if(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) @@ -30,10 +32,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) # Various options and variables that can be set on the command line option(WANT_CORE "Build the core (server) binary" ON) option(WANT_QTCLIENT "Build the Qt4 GUI client binary" ON) -option(WANT_MONO "Build the monolithic (all-in-one) binary" OFF) +option(WANT_MONO "Build the monolithic (all-in-one) binary" ON) option(WITH_OPENSSL "Enable OpenSSL support if present on the system" ON) option(WITH_DBUS "Enable D-Bus support if present on the system" ON) +option(WITH_WEBKIT "Enable WebKit support (for link previews)" ON) +option(WITH_PHONON "Enable Phonon support (for audio notifications)" ON) +option(WITH_KDE "Enable KDE4 integration" OFF) option(STATIC "Enable static building (might not be portable)" OFF) option(DEPLOY "Mac OS X only! Adds required libs to bundle resources and create a dmg. Note: requires Qt to be built with 10.4u SDK" OFF) @@ -49,12 +54,9 @@ if(STATIC) set(CMAKE_BUILD_TYPE Release) set(OXYGEN_ICONS "Builtin") set(QUASSEL_ICONS "Builtin") + set(WITH_KDE OFF) endif(STATIC) -# RPATH needs to be set correctly -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1) -set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) - # Define install locations. Using variables will allow overriding this by the KDE macros later. set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin) set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/apps) @@ -86,23 +88,6 @@ if(EXECINFO_FOUND) link_libraries(${EXECINFO_LIBRARIES}) endif(EXECINFO_FOUND) -# Decide what to do with icons -if(WANT_QTCLIENT OR WANT_MONO) - if(QUASSEL_ICONS MATCHES "External") - message(STATUS "Install Quassel icons to ${CMAKE_INSTALL_PREFIX}/share/apps/quassel") - else(QUASSEL_ICONS MATCHES "External") - set(QUASSEL_ICONS "Builtin") - message(STATUS "Compile Quassel icons into the binary") - endif(QUASSEL_ICONS MATCHES "External") - - if(OXYGEN_ICONS MATCHES "External") - message(STATUS "Use system-installed Oxygen icon theme") - else(OXYGEN_ICONS MATCHES "External") - set(OXYGEN_ICONS "Builtin") - message(STATUS "Compile Oxygen icon theme subset into the binary") - endif(OXYGEN_ICONS MATCHES "External") -endif(WANT_QTCLIENT OR WANT_MONO) - # Select a Qt installation here, if you don't want to use system Qt if(QT) # FindQt4 will look for the qmake binary in $PATH, so we just prepend the Qt dir @@ -151,6 +136,63 @@ else(WITH_DBUS) message(STATUS "Disabling D-Bus support") endif(WITH_DBUS) +# Setup QtWebKit support +if(WITH_WEBKIT) + if(QT_QTWEBKIT_FOUND) + message(STATUS "Found QtWebKit, enabling WebKit support") + add_definitions(-DHAVE_WEBKIT) + set(LINK_WEBKIT WEBKIT) + set(HAVE_WEBKIT true) + set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_WEBKIT) + else(QT_QTWEBKIT_FOUND) + message(STATUS "QtWebKit not found, disabling WebKit support") + endif(QT_QTWEBKIT_FOUND) +else(WITH_WEBKIT) + message(STATUS "Disabling WebKit support") +endif(WITH_WEBKIT) + +# Setup KDE4 support +if(WITH_KDE) + find_package(KDE4) + if(KDE4_FOUND) + message(STATUS "Enabling KDE4 integration") + include_directories(${KDE4_INCLUDES}) + add_definitions(-DHAVE_KDE ${KDE4_DEFINITIONS}) + set(HAVE_KDE 1) + set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_KDE) + set(QUASSEL_KDE_LIBRARIES ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY} knotifyconfig) + # We always use external icons for KDE4 support, since we use its iconloader rather than our own + set(OXYGEN_ICONS "External") + set(QUASSEL_ICONS "External") + else(KDE4_FOUND) + message(STATUS "KDE4 not found, disabling KDE integration") + endif(KDE4_FOUND) +else(WITH_KDE) + message(STATUS "Disabling KDE4 integration") +endif(WITH_KDE) + +# Setup Phonon support - we only need this if we don't have or want KDE4 +if(NOT HAVE_KDE) + if(WITH_PHONON) + find_package(Phonon) + if(PHONON_FOUND) + message(STATUS "Enabling Phonon support") + add_definitions(-DHAVE_PHONON) + set(HAVE_PHONON true) + set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_PHONON) + else(PHONON_FOUND) + message(STATUS "Phonon not found, disabling audio notifications") + endif(PHONON_FOUND) + else(WITH_PHONON) + message(STATUS "Disabling Phonon support") + endif(WITH_PHONON) +endif(NOT HAVE_KDE) + +# RPATH needs to be set correctly +# Do this down here, since otherwise KDE wants to handle it itself, and fails +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1) +set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) + # Set global buildflags # This is very much non-portable, so don't use -DSTATIC until you know what # you do. @@ -162,17 +204,24 @@ if(STATIC AND CMAKE_COMPILER_IS_GNUCXX) endif(HAVE_SSL) endif(STATIC AND CMAKE_COMPILER_IS_GNUCXX) -if(STATIC AND WIN32) - link_libraries(imm32 winmm) # missing by default :/ - if(HAVE_SSL) +if(WIN32) + #if(STATIC) + link_libraries(imm32 winmm dbghelp) # missing by default :/ + #endif(STATIC) + if(HAVE_SSL) link_libraries(${OPENSSL_LIBRARIES} libeay32MD) - endif(HAVE_SSL) -endif(STATIC AND WIN32) + endif(HAVE_SSL) +endif(WIN32) if(WIN32) - set(RC_WIN32 pics/win32.rc) # for app icons on windows + set(RC_WIN32 ../pics/win32.rc) # for app icons on windows endif(WIN32) +# This is dirty, but I haven't found a cleaner way to ensure that the generated .qrc files +# (which will be removed with make clean) are regenerated :/ +set_directory_properties(PROPERTIES + ADDITIONAL_MAKE_CLEAN_FILES CMakeCache.txt) + # We need to create a version.gen # For this, we create our genversion binary and make sure it is run every time. add_executable(genversion ${CMAKE_SOURCE_DIR}/src/common/genversion.cpp) @@ -180,17 +229,29 @@ target_link_libraries(genversion ${QT_LIBRARIES} ${QT_CORE_LIB_DEPENDENCIES}) get_target_property(GENVERSION_EXECUTABLE genversion LOCATION) add_custom_target(genversion_run ALL ${GENVERSION_EXECUTABLE} - ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/common/version.gen) + ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/version.gen) add_dependencies(genversion_run genversion) -# Generate binary translation files -include(QuasselGenerateTranslations) -quassel_generate_i18n_resource(RC_I18N ${LINGUAS}) +# Decide what to do with icons +if(WANT_QTCLIENT OR WANT_MONO) + if(QUASSEL_ICONS MATCHES "External") + message(STATUS "Install Quassel icons to ${CMAKE_INSTALL_PREFIX}/share/apps/quassel") + else(QUASSEL_ICONS MATCHES "External") + set(QUASSEL_ICONS "Builtin") + message(STATUS "Compile Quassel icons into the binary") + endif(QUASSEL_ICONS MATCHES "External") + if(OXYGEN_ICONS MATCHES "External") + message(STATUS "Use system-installed icon theme") + else(OXYGEN_ICONS MATCHES "External") + set(OXYGEN_ICONS "Builtin") + message(STATUS "Compile Oxygen icon theme subset into the binary") + endif(OXYGEN_ICONS MATCHES "External") +endif(WANT_QTCLIENT OR WANT_MONO) # These variables will be added to the main targets (CORE, QTCLIENT, MONO) -set(COMMON_DEPS ${RC_I18N} ${RC_WIN32}) +set(COMMON_DEPS ${RC_WIN32}) set(CORE_DEPS ) set(CLIENT_DEPS ) set(KDE_DEPS ) @@ -199,8 +260,5 @@ set(KDE_DEPS ) add_subdirectory(data) add_subdirectory(icons) #add_subdirectory(pics) +add_subdirectory(i18n) add_subdirectory(src) - -# Make sure version.gen exists before building mod_common -# TODO: make only main.cpp depend on that! Recompiles suck... -add_dependencies(mod_common genversion_run)