###################### # # Meganizer - Media Organzier is a media management software # Copyright (C) 2010 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # ###################### # @TODO Desktop entry with NSIS # @TODO Schnellstartleisten-Eintrag mit NSIS cmake_minimum_required(VERSION 2.6) # Extending the Module path with the local module path of desuto SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ) PROJECT(meganizer) INCLUDE(CTest) SET(BUILD_DEBUG_WANTED ${BUILD_DEBUG}) SET(BUILD_PACKAGE_WANTED ${BUILD_PACKAGE}) SET(BUILD_DEV_WANTED ${BUILD_DEV}) SET(BINDINGS_KDE ${BINDINGS_KDE}) SET(WITH_HANDBOOK_WANTED ${WITH_HANDBOOK}) SET(WITH_ALL_PLUGINS_WANTED ${WITH_ALL_PLUGINS}) SET(WITH_BOOKS_WANTED ${WITH_BOOKS}) SET(WITH_MUSIC_WANTED ${WITH_MUSIC}) SET(WITH_AMAZON_WANTED ${WITH_AMAZON}) SET(L10N_ALL_WANTED ${L10N_ALL}) SET(L10N_DE_WANTED ${L10N_DE}) SET(L10N_EN_WANTED ${L10N_EN}) OPTION(BUILD_DEBUG "Build in debug mode" ON) OPTION(BUILD_PACKAGE "Build for packaging" OFF) # to enable library symlinks and header install turn this ON OPTION(BUILD_DEV "Build all stuff to develope based on this package" OFF) # OPTION(BUILD_TESTS "Build test cases" OFF) OPTION(WITH_HANDBOOK "Build online documentation" ON) # disable debug mode, when building package IF(BUILD_PACKAGE) IF(BUILD_DEBUG) MESSAGE("Disabling Debug mode, because Packagemode succeed over BUILD_DEBUG") SET(BUILD_DEBUG OFF) ENDIF(BUILD_DEBUG) ENDIF(BUILD_PACKAGE) # set cmake build type according the selected BUILD_DEBUG mode IF(BUILD_DEBUG) SET(CMAKE_BUILD_TYPE Debug) ELSE(BUILD_DEBUG) SET(CMAKE_BUILD_TYPE Release) ENDIF(BUILD_DEBUG) OPTION(BINDINGS_KDE "Build with KDE features" ON) SET(KDE 0) IF(BINDINGS_KDE) FIND_PACKAGE(KDE4) IF(KDE4_FOUND) SET(KDE 1) ELSE(KDE4_FOUND) MESSAGE("KDE not found --> Disable KDE-Bindings") SET(BINDINGS_KDE OFF) SET(KDE 0) ENDIF(KDE4_FOUND) ENDIF(BINDINGS_KDE) # Set the same linker and compiler flags as KDE uses, because they are much stronger IF(NOT KDE) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -DQT_NO_EXCEPTIONS -fno-check-new -fno-common") IF(NOT WIN32) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--fatal-warnings -lc") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ansi") ENDIF(NOT WIN32) ENDIF(NOT KDE) # if debug mode is enabled, we also enable coverage tests IF(BUILD_DEBUG) SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") ENDIF(BUILD_DEBUG) OPTION(WITH_ALL_PLUGINS "Build all supported plugins" ON) IF(WITH_ALL_PLUGINS) SET(WITH_BOOKS ON) SET(WITH_MUSIC ON) SET(WITH_AMAZON ON) ELSE(WITH_ALL_PLUGINS) OPTION(WITH_BOOKS "Build Books media plugin" ON) OPTION(WITH_MUSIC "Build Music media plugin" ON) OPTION(WITH_AMAZON "Build Amazon plugin" ON) ENDIF(WITH_ALL_PLUGINS) IF(WITH_AMAZON) FIND_PACKAGE(QCA2) IF(NOT QCA2_FOUND) MESSAGE("QCA2 not found --> Disable Amazon plugin") SET(WITH_AMAZON OFF) ENDIF(NOT QCA2_FOUND) ENDIF(WITH_AMAZON) # internatalization OPTION(L10N_ALL "Build with all languages" ON) OPTION(L10N_EN "Build with english language" OFF) OPTION(L10N_DE "Build with german language" OFF) IF(L10N_ALL) SET(L10N_EN ON) SET(L10N_DE ON) ENDIF(L10N_ALL) SET(TARGET_VERSION_MAJOR 0 ) SET(TARGET_VERSION_MINOR 3 ) SET(${PROJECT_NAME}_PATCH_LEVEL 0 ) SET(${PROJECT_NAME}_RELEASE_CANDIDATE 2 ) SET(${PROJECT_NAME}_SOVERSION ${TARGET_VERSION_MAJOR}) SET(${PROJECT_NAME}_VERSION "${TARGET_VERSION_MAJOR}.${TARGET_VERSION_MINOR}.${${PROJECT_NAME}_PATCH_LEVEL}-rc${${PROJECT_NAME}_RELEASE_CANDIDATE}" ) # directory to install binaries SET(bin_DIR ${CMAKE_INSTALL_PREFIX}/bin) IF(WIN32) IF(BUILD_PACKAGE) SET(bin_DIR ./) ENDIF(BUILD_PACKAGE) ENDIF(WIN32) # shared library directory ($shared_DIR) # and directory for plugins, translations, ... ($share_DIR) IF(UNIX) # SET(shared_DIR /usr/local/lib) SET(shared_DIR /usr/lib) SET(share_DIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}) SET(PLUGINDIR ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}) SET(man_DIR ${CMAKE_INSTALL_PREFIX}/share/man) SET(DOCDIR ${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}) # SET(designer_DIR "/usr/lib/qt4/plugins/designer") SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) ELSE(UNIX) SET(PLUGINDIR ${bin_DIR}/plugins) SET(shared_DIR ${bin_DIR}) SET(share_DIR ${bin_DIR}) SET(man_DIR ${bin_DIR}/man) SET(DOCDIR ${bin_DIR}/doc) SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) SET(EXECUTABLE_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) ENDIF(UNIX) SET(MINPLUGINDIR ${PLUGINDIR}/minvalidator) # since qt can be installed anywhere on windows, # we install them into our own directory # and the user must copy it itself into the # right directory on windows SET(designer_DIR ${QT_PLUGINS_DIR}/designer) IF(WIN32 AND BUILD_PACKAGE) SET(designer_DIR ${bin_DIR}/designer) ENDIF(WIN32 AND BUILD_PACKAGE) # directory to install language files SET(qm_DIR ${share_DIR}/lang) #directory to install rcc files SET(rcc_DIR ${share_DIR}/rcc) # directory to install dependency files SET(depends_DIR ${share_DIR}/depends) IF(WIN32) SET(3rd_LIBS ${CMAKE_SOURCE_DIR}/3rdPartyLibs) SET(qt_LIBS ${3rd_LIBS}/QT) # IF(BUILD_DEBUG) # SET(qt_LIBS ${qt_LIBS}/Debug) # ELSE(BUILD_DEBUG) # SET(qt_LIBS ${qt_LIBS}/Release) # ENDIF(BUILD_DEBUG) ENDIF() FIND_PACKAGE(Qt4 REQUIRED) INCLUDE(qt4_qhcp) SET(libmeganizer_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/libmeganizer) SET(libmeganizer_BINARY_DIR ${CMAKE_BINARY_DIR}/src/libmeganizer) IF(BUILD_TESTING) INCLUDE(clean_gcda) CLEAN_GCDA_FILES() SET(libmeganizertests_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/libmeganizertests) SET(libmeganizertests_BINARY_DIR ${CMAKE_BINARY_DIR}/src/libmeganizertests) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/CTestCustom.cmake) ENDIF(BUILD_TESTING) ADD_SUBDIRECTORY(src/libmeganizer) IF(BUILD_TESTING) ADD_SUBDIRECTORY(src/libmeganizertests) ENDIF(BUILD_TESTING) ADD_SUBDIRECTORY(src/meganizer) IF(WITH_BOOKS) ADD_SUBDIRECTORY(src/mediaplugins/books) ENDIF(WITH_BOOKS) IF(WITH_MUSIC) ADD_SUBDIRECTORY(src/mediaplugins/music) ENDIF(WITH_MUSIC) IF(WITH_AMAZON) ADD_SUBDIRECTORY(src/searchplugins/amazon) ENDIF(WITH_AMAZON) # Adding development stuff IF(BUILD_DEV) ADD_SUBDIRECTORY(src/searchplugins/demoshop) ENDIF(BUILD_DEV) # adding documentation stuff ADD_SUBDIRECTORY(doc) # printing choosen configuration MESSAGE("######################################################") MESSAGE("") MESSAGE("CONFIGURATION") MESSAGE("") MESSAGE("CMAKE_SHARED_LINKER_FLAGS: ${CMAKE_SHARED_LINKER_FLAGS}") MESSAGE("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") MESSAGE("") MESSAGE("OPTIONS:") MESSAGE(" Name Wanted Used") MESSAGE(" BUILD_DEBUG: ${BUILD_DEBUG_WANTED} ${BUILD_DEBUG}") MESSAGE(" BUILD_PACKAGE: ${BUILD_PACKAGE_WANTED} ${BUILD_PACKAGE}") MESSAGE(" BUILD_DEV: ${BUILD_DEV_WANTED} ${BUILD_DEV}") MESSAGE(" BINDINGS_KDE: ${BINDINGS_KDE_WANTED} ${BINDINGS_KDE}") MESSAGE(" WITH_HANDBOOK: ${WITH_HANDBOOK_WANTED} ${WITH_HANDBOOK}") MESSAGE(" WITH_ALL_PLUGINS: ${WITH_ALL_PLUGINS_WANTED} ${WITH_ALL_PLUGINS}") MESSAGE(" WITH_BOOKS: ${WITH_BOOKS_WANTED} ${WITH_BOOKS}") MESSAGE(" WITH_MUSIC: ${WITH_MUSIC_WANTED} ${WITH_MUSIC}") MESSAGE(" WITH_AMAZON: ${WITH_AMAZON_WANTED} ${WITH_AMAZON}") MESSAGE(" L10N_ALL: ${L10N_ALL_WANTED} ${L10N_ALL}") MESSAGE(" L10N_DE: ${L10N_DE_WANTED} ${L10N_DE}") MESSAGE(" L10N_EN: ${L10N_EN_WANTED} ${L10N_EN}") MESSAGE("") MESSAGE("######################################################") SET(CPACK_GENERATOR "NSIS") SET(CPACK_PACKAGE_NAME "Meganizer") SET(CPACK_PACKAGE_VENDOR "EngSaS - Engineering Solutions and Services Langenbach") SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Meganizer is a program to handle and organize medias like Books, CDs, ...") SET(CPACK_PACKAGE_VERSION ${${PROJECT_NAME}_VERSION}) SET(CPACK_PACKAGE_VERSION_MAJOR ${TARGET_MAJOR_VERSION}) SET(CPACK_PACKAGE_VERSION_MINOR ${TARGET_MINOR_VERSION}) SET(CPACK_PACKAGE_VERSION_PATCH ${${PROJECT_NAME}_PATCH_LEVEL}) #SET(CPACK_PACKAGE_INSTALL_DIRECTORY "DeSuTo/${${PROJECT_NAME}_VERSION}") SET(CPACK_PACKAGE_INSTALL_DIRECTORY "Meganizer") # add all components which should be installable via the package IF(WIN32) SET(external_DLL qtlibs mysqllibs qcalibs) ENDIF(WIN32) SET(CPACK_COMPONENTS_ALL application library # systray ${external_DLL} # modulece # modulecokit books cds amazon demoshop designer doc ) # License file SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt) # Pre selected installation profiles SET(CPACK_ALL_INSTALL_TYPES Full Application) # groups for components SET(CPACK_COMPONENT_GROUP_BASE_DISPLAY_NAME "Meganizer") SET(CPACK_COMPONENT_GROUP_BASE_DESCRIPTION "The Meganizer core application") SET(CPACK_COMPONENT_GROUP_MEDIAPLUGINS_DISPLAY_NAME "Media Plugins") SET(CPACK_COMPONENT_GROUP_MEDIAPLUGINS_DESCRIPTION "This components provides the handling of medias") SET(CPACK_COMPONENT_GROUP_SEARCHPLUGINS_DISPLAY_NAME "Search Plugins") SET(CPACK_COMPONENT_GROUP_SEARCHPLUGINS_DESCRIPTION "This components provides the search of external sources") SET(CPACK_COMPONENT_GROUP_3RDPARTYLIBS_DISPLAY_NAME "3rd Party Libraries") SET(CPACK_COMPONENT_GROUP_3RDPARTYLIBS_DESCRIPTION "3rd Party libraries which are needed to run Meganizer and or modules. They are only needed if they are not already exist in PATH") SET(CPACK_COMPONENT_GROUP_DEVELOPEMENT_DISPLAY_NAME "Developing") SET(CPACK_COMPONENT_GROUP_DEVELOPEMENT_DESCRIPTION "Stuff which helps Developers to develope Meganizer") # SET(CPACK_COMPONENT_GROUP_DOC_DISPLAY_NAME "User Manuals") # SET(CPACK_COMPONENT_GROUP_DOC_DESCRIPTION "Contains user manuals in different languages") # the scheme of the variable names are: CPACK_COMPNONENT_%COMPONENTNAMEINUPPERCASE%_DISPLAY_NAME # where %COMPONENTNAMEINUPPERCASE% must be replaced by the upper cased name of the component # see below for example SET(CPACK_COMPONENT_QTLIBS_DISPLAY_NAME "QT") SET(CPACK_COMPONENT_QTLIBS_DESCRIPTION "Libraries which are needed, but not belonging to this project. They must not be installed, if they are already installed at path") SET(CPACK_COMPONENT_QTLIBS_GROUP "3rdPartyLibs") SET(CPACK_COMPONENT_QTLIBS_INSTALL_TYPES Full Application) SET(CPACK_COMPONENT_MYSQLLIBS_DISPLAY_NAME "Mysql-QT-Plugin") SET(CPACK_COMPONENT_MYSQLLIBS_DESCRIPTION "Libraries which are needed, but not belonging to this project. This libs are needed, if you want to connect to a MySQL-Server") SET(CPACK_COMPONENT_MYSQLLIBS_GROUP "3rdPartyLibs") SET(CPACK_COMPONENT_MYSQLLIBS_INSTALL_TYPES Full Application) SET(CPACK_COMPONENT_QCALIBS_DISPLAY_NAME "QCA2 Plugin") SET(CPACK_COMPONENT_QCALIBS_DESCRIPTION "Libraries which are needed, but not belonging to this project. This libs are needed, if you want to connect to use Amazon") SET(CPACK_COMPONENT_QCALIBS_GROUP "3rdPartyLibs") SET(CPACK_COMPONENT_QCALIBS_INSTALL_TYPES Full Application) SET(CPACK_COMPONENT_APPLICATION_DISPLAY_NAME "Meganizer Application") SET(CPACK_COMPONENT_APPLICATION_DESCRIPTION "The main application.") SET(CPACK_COMPONENT_APPLICATION_GROUP "Base") SET(CPACK_COMPONENT_APPLICATION_INSTALL_TYPES Full Application) SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "MeganizerLibrary") SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION "The shared objects of Meganizer.") SET(CPACK_COMPONENT_LIBRARY_GROUP "Base") SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Full Application) IF(WITH_BOOKS) SET(CPACK_COMPONENT_BOOKS_DISPLAY_NAME "Books") SET(CPACK_COMPONENT_BOOKS_DESCRIPTION "Module to handle books") SET(CPACK_COMPONENT_BOOKS_GROUP "Media Plugins") SET(CPACK_COMPONENT_BOOKS_INSTALL_TYPES Full) ENDIF(WITH_BOOKS) IF(WITH_MUSIC) SET(CPACK_COMPONENT_MUSIC_DISPLAY_NAME "Music") SET(CPACK_COMPONENT_MUSIC_DESCRIPTION "Module to handle cds") SET(CPACK_COMPONENT_MUSIC_GROUP "Media Plugins") SET(CPACK_COMPONENT_MUSIC_INSTALL_TYPES Full) ENDIF(WITH_MUSIC) IF(WITH_AMAZON) SET(CPACK_COMPONENT_AMAZON_DISPLAY_NAME "Amazon") SET(CPACK_COMPONENT_AMAZON_DESCRIPTION "Allows to search amazon database") SET(CPACK_COMPONENT_AMAZON_GROUP "Search Plugins") SET(CPACK_COMPONENT_AMAZON_INSTALL_TYPES Full) ENDIF(WITH_AMAZON) IF(WITH_DEMOSHOP) SET(CPACK_COMPONENT_DEMOSHOP_DISPLAY_NAME "Demo Shop") SET(CPACK_COMPONENT_DEMOSHOP_DESCRIPTION "A demo shop to test features and show new features") SET(CPACK_COMPONENT_DEMOSHOP_GROUP "Search Plugins") SET(CPACK_COMPONENT_DEMOSHOP_INSTALL_TYPES Full) ENDIF(WITH_DEMOSHOP) IF(BUILD_DEV) SET(CPACK_COMPONENT_DESIGNER_PLUGINS_DISPLAY_NAME "Meganizer Designer Plugins") SET(CPACK_COMPONENT_DESIGNER_PLUGINS_DESCRIPTION "QtDesigner Plugins for Widgets provided by LibMeganizer") SET(CPACK_COMPONENT_DESIGNER_PLUGINS_GROUP "Developing") SET(CPACK_COMPONENT_DESIGNER_PLUGINS_INSTALL_TYPES Full) ENDIF(BUILD_DEV) IF(WITH_HANDBOOK) SET(CPACK_COMPONENT_DOC_DISPLAY_NAME "User Manuals") SET(CPACK_COMPONENT_DOC_DESCRIPTION "Contains user manuals in selected languages") SET(CPACK_COMPONENT_DOC_INSTALL_TYPES Full Application) ENDIF(WITH_HANDBOOK) # used by NSIS to create startmenu links to the executables # this entrys are only useful if a bin folder is used, otherwise use the empty EXECUTABLES # and fill out the NSIS_MENU_LINKS #SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "desuto" "DeSuTo") #SET(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "desutodaemon" "DeSuToDaemon") SET(CPACK_PACKAGE_EXECUTABLES "" "") SET(CPACK_NSIS_MENU_LINKS "meganizer.exe" "Meganizer - Media Organizer") IF(NOT BINDINGS_KDE) ########### Add uninstall target ############### CONFIGURE_FILE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake" IMMEDIATE @ONLY) ADD_CUSTOM_TARGET(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake") ENDIF(NOT BINDINGS_KDE) # This must always be last! INCLUDE(CPack)