2010-02-28 18:28:56 +01:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
|
|
|
include(FindPkgConfig)
|
2010-06-09 00:39:31 +02:00
|
|
|
include(cmake/Version.cmake)
|
2010-02-28 18:28:56 +01:00
|
|
|
|
2010-03-02 21:46:46 +01:00
|
|
|
if (CMAKE_FIND_ROOT_PATH)
|
|
|
|
# Help find the Qt headers if we're cross compiling (since we can't run qmake.exe)
|
|
|
|
# CMAKE_FIND_ROOT_PATH should get set by your cmake toolchain file
|
|
|
|
set(QT_HEADERS_DIR ${CMAKE_FIND_ROOT_PATH}/include)
|
|
|
|
set(QT_LIBRARY_DIR ${CMAKE_FIND_ROOT_PATH}/lib)
|
|
|
|
endif (CMAKE_FIND_ROOT_PATH)
|
|
|
|
|
2010-04-15 14:39:34 +02:00
|
|
|
find_package(Qt4 REQUIRED QtCore QtGui QtOpenGL QtSql QtNetwork QtXml)
|
2010-03-22 15:27:54 +01:00
|
|
|
if(UNIX AND NOT APPLE)
|
2010-04-15 14:39:34 +02:00
|
|
|
find_package(Qt4 REQUIRED QtDbus)
|
2010-03-22 15:27:54 +01:00
|
|
|
endif(UNIX AND NOT APPLE)
|
2010-04-15 14:39:34 +02:00
|
|
|
find_package(Qt4 COMPONENTS Phonon)
|
2010-02-28 18:28:56 +01:00
|
|
|
|
2010-04-21 13:03:30 +02:00
|
|
|
# Find Qt's lconvert binary. Try qt's binary dir first, fall back to looking in PATH
|
|
|
|
find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4 PATHS ${QT_BINARY_DIR} NO_DEFAULT_PATH)
|
|
|
|
find_program(QT_LCONVERT_EXECUTABLE NAMES lconvert lconvert-qt4)
|
|
|
|
|
2010-04-19 11:42:30 +02:00
|
|
|
if(APPLE)
|
|
|
|
if(NOT QT_MAC_USE_COCOA)
|
|
|
|
message(FATAL_ERROR "Cocoa support is required")
|
|
|
|
endif(NOT QT_MAC_USE_COCOA)
|
|
|
|
endif(APPLE)
|
|
|
|
|
2010-02-28 18:28:56 +01:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
find_package(Boost REQUIRED)
|
2010-04-06 21:18:14 +02:00
|
|
|
find_package(Gettext REQUIRED)
|
2010-02-28 18:28:56 +01:00
|
|
|
|
2010-03-02 21:46:46 +01:00
|
|
|
if(WIN32)
|
|
|
|
find_library(TAGLIB_LIBRARIES tag)
|
2010-04-06 18:57:02 +02:00
|
|
|
find_path(GLIB_INCLUDE_DIRS glib.h
|
|
|
|
PATH_SUFFIXES glib glib-2.0)
|
|
|
|
find_path(GLIBCONFIG_INCLUDE_DIRS glibconfig.h
|
|
|
|
PATH_SUFFIXES ../lib/glib/include ../lib/glib-2.0/include)
|
|
|
|
find_path(LIBXML_INCLUDE_DIRS libxml/parser.h
|
|
|
|
PATH_SUFFIXES libxml libxml2)
|
2010-04-19 22:37:21 +02:00
|
|
|
find_path(GSTREAMER_INCLUDE_DIRS gst/gst.h
|
|
|
|
PATH_SUFFIXES gstreamer-0.10)
|
2010-04-06 18:57:02 +02:00
|
|
|
find_library(GSTREAMER_LIBRARIES gstreamer-0.10)
|
2010-04-07 18:26:04 +02:00
|
|
|
find_library(GSTREAMER_BASE_LIBRARIES gstbase-0.10)
|
2010-04-06 18:57:02 +02:00
|
|
|
find_library(GLIB_LIBRARIES glib-2.0)
|
|
|
|
find_library(GOBJECT_LIBRARIES gobject-2.0)
|
2010-03-02 21:46:46 +01:00
|
|
|
else(WIN32)
|
2010-04-15 14:39:34 +02:00
|
|
|
pkg_check_modules(TAGLIB REQUIRED taglib>=1.6)
|
2010-04-06 18:57:02 +02:00
|
|
|
pkg_check_modules(GSTREAMER gstreamer-0.10)
|
2010-04-07 18:26:04 +02:00
|
|
|
pkg_check_modules(GSTREAMER_BASE gstreamer-base-0.10)
|
2010-04-16 16:39:55 +02:00
|
|
|
pkg_check_modules(LIBVLC libvlc)
|
|
|
|
pkg_check_modules(LIBXINE libxine)
|
2010-06-17 16:45:31 +02:00
|
|
|
pkg_check_modules(GLIB glib-2.0)
|
|
|
|
pkg_check_modules(LIBXML libxml-2.0)
|
|
|
|
pkg_check_modules(GOBJECT gobject-2.0)
|
2010-03-02 21:46:46 +01:00
|
|
|
endif(WIN32)
|
2010-02-28 18:28:56 +01:00
|
|
|
|
2010-06-06 23:08:52 +02:00
|
|
|
find_library(LASTFM_LIBRARIES lastfm)
|
2010-02-28 18:28:56 +01:00
|
|
|
find_path(LASTFM_INCLUDE_DIRS lastfm/ws.h)
|
|
|
|
|
2010-03-01 13:13:11 +01:00
|
|
|
if (APPLE)
|
|
|
|
find_library(GROWL Growl)
|
2010-04-15 17:23:12 +02:00
|
|
|
find_library(SPARKLE Sparkle)
|
2010-03-01 13:13:11 +01:00
|
|
|
endif (APPLE)
|
|
|
|
|
2010-02-28 18:28:56 +01:00
|
|
|
if(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
|
|
|
add_definitions(-DNDEBUG)
|
|
|
|
add_definitions(-DQT_NO_DEBUG_OUTPUT)
|
|
|
|
endif(${CMAKE_BUILD_TYPE} MATCHES "Release")
|
|
|
|
|
|
|
|
# Set up definitions and paths
|
|
|
|
add_definitions(${QT_DEFINITIONS})
|
|
|
|
link_directories(${TAGLIB_LIBRARY_DIRS})
|
2010-04-06 18:57:02 +02:00
|
|
|
link_directories(${GSTREAMER_LIBRARY_DIRS})
|
2010-02-28 18:28:56 +01:00
|
|
|
|
2010-04-30 13:27:27 +02:00
|
|
|
# Don't try to use Phonon if its include directory couldn't be found.
|
|
|
|
# For some reason this works differently to the rest of Qt...
|
|
|
|
if (NOT ${QT_PHONON_INCLUDE_DIR})
|
|
|
|
set (QT_USE_PHONON 0)
|
|
|
|
endif (NOT ${QT_PHONON_INCLUDE_DIR})
|
|
|
|
|
2010-02-28 18:28:56 +01:00
|
|
|
include(${QT_USE_FILE})
|
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
include_directories(${TAGLIB_INCLUDE_DIRS})
|
2010-04-06 18:57:02 +02:00
|
|
|
include_directories(${GSTREAMER_INCLUDE_DIRS})
|
|
|
|
include_directories(${GLIB_INCLUDE_DIRS})
|
|
|
|
include_directories(${GLIBCONFIG_INCLUDE_DIRS})
|
|
|
|
include_directories(${LIBXML_INCLUDE_DIRS})
|
2010-02-28 18:28:56 +01:00
|
|
|
include_directories(${LASTFM_INCLUDE_DIRS})
|
2010-03-23 14:54:17 +01:00
|
|
|
include_directories("3rdparty/qsqlite")
|
2010-04-29 15:16:46 +02:00
|
|
|
include_directories("3rdparty/universalchardet")
|
2010-02-28 18:28:56 +01:00
|
|
|
|
2010-03-02 21:46:46 +01:00
|
|
|
# Remove GLU and GL from the link line - they're not really required
|
|
|
|
# and don't exist on my mingw toolchain
|
|
|
|
list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL")
|
|
|
|
|
2010-03-02 23:02:43 +01:00
|
|
|
if (WIN32)
|
|
|
|
# RC compiler
|
|
|
|
string(REPLACE "gcc" "windres" CMAKE_RC_COMPILER_INIT ${CMAKE_C_COMPILER})
|
2010-03-04 17:50:27 +01:00
|
|
|
enable_language(RC)
|
2010-03-31 04:55:05 +02:00
|
|
|
SET(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -o <OBJECT> <SOURCE> -I../../dist/windows")
|
2010-03-02 23:02:43 +01:00
|
|
|
endif(WIN32)
|
|
|
|
|
2010-03-25 23:37:00 +01:00
|
|
|
add_definitions(-DQXT_STATIC -DBUILD_QXT_GUI -DBUILD_QXT_CORE)
|
2010-05-23 17:35:28 +02:00
|
|
|
add_definitions(-DQT_NO_CAST_TO_ASCII)
|
2010-03-25 23:37:00 +01:00
|
|
|
|
2010-04-06 21:18:14 +02:00
|
|
|
# Translations stuff
|
|
|
|
find_program(GETTEXT_XGETTEXT_EXECUTABLE xgettext)
|
2010-05-07 15:10:21 +02:00
|
|
|
if(NOT GETTEXT_XGETTEXT_EXECUTABLE)
|
|
|
|
message(FATAL_ERROR "Could not find xgettext executable")
|
|
|
|
endif(NOT GETTEXT_XGETTEXT_EXECUTABLE)
|
2010-04-06 21:18:14 +02:00
|
|
|
|
2010-06-11 00:48:23 +02:00
|
|
|
# Optional bits
|
|
|
|
option(ENABLE_VISUALISATIONS "Use libprojectm visualisations" ON)
|
2010-06-11 01:01:22 +02:00
|
|
|
option(BUNDLE_PROJECTM_PRESETS "Install Clementine's own copies of libprojectm presets - disable this if you want to use a system package instead" ON)
|
2010-06-11 00:48:23 +02:00
|
|
|
if(ENABLE_VISUALISATIONS)
|
|
|
|
add_subdirectory(3rdparty/libprojectm)
|
|
|
|
endif(ENABLE_VISUALISATIONS)
|
|
|
|
|
2010-02-28 18:28:56 +01:00
|
|
|
# Subdirectories
|
|
|
|
add_subdirectory(3rdparty/qtsingleapplication)
|
2010-05-08 22:56:39 +02:00
|
|
|
add_subdirectory(3rdparty/qtiocompressor)
|
2010-02-28 18:28:56 +01:00
|
|
|
add_subdirectory(src)
|
2010-04-13 21:43:08 +02:00
|
|
|
if (NOT APPLE)
|
|
|
|
add_subdirectory(3rdparty/qxt)
|
|
|
|
endif (NOT APPLE)
|
2010-04-29 15:16:46 +02:00
|
|
|
add_subdirectory(3rdparty/universalchardet)
|
2010-03-01 02:47:50 +01:00
|
|
|
add_subdirectory(tests)
|
2010-05-03 15:58:41 +02:00
|
|
|
add_subdirectory(dist)
|
2010-03-04 17:41:14 +01:00
|
|
|
|
2010-04-13 21:43:08 +02:00
|
|
|
if (WIN32 OR APPLE)
|
2010-04-22 18:53:41 +02:00
|
|
|
message(STATUS "Building static qsqlite plugin")
|
2010-03-22 19:35:31 +01:00
|
|
|
add_definitions(-DQT_STATICPLUGIN)
|
|
|
|
add_subdirectory(3rdparty/qsqlite)
|
2010-04-13 21:43:08 +02:00
|
|
|
endif(WIN32 OR APPLE)
|
2010-03-22 19:35:31 +01:00
|
|
|
|
2010-03-04 17:41:14 +01:00
|
|
|
# Uninstall support
|
2010-03-04 17:50:27 +01:00
|
|
|
configure_file(
|
2010-03-04 17:41:14 +01:00
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
2010-03-04 17:50:27 +01:00
|
|
|
add_custom_target(uninstall
|
2010-03-04 17:41:14 +01:00
|
|
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|