File: CMakeLists.txt

package info (click to toggle)
kmetronome 0.10.1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 828 kB
  • ctags: 453
  • sloc: cpp: 3,114; sh: 18; xml: 18; makefile: 5
file content (142 lines) | stat: -rw-r--r-- 5,470 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# KMetronome - ALSA Sequencer based MIDI metronome
# Copyright (C) 2005-2012 Pedro Lopez-Cabanillas <plcl@users.sourceforge.net>
#
# 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 2 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, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA

PROJECT(KMETRONOME)

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
SET(CMAKE_USE_RELATIVE_PATHS OFF)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_admin")

SET (VERSION_MAJOR "0")
SET (VERSION_MINOR "10")
SET (VERSION_PATCH "1")
SET (VERSION_SUFFIX "")
SET (VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX})
ADD_DEFINITIONS(-D'VERSION="${VERSION}"')

OPTION(ENABLE_PCH "Enable precompiled headers" OFF)
OPTION(STATIC_DRUMSTICK "Build drumstick static library" OFF)

FIND_PACKAGE(KDE4 REQUIRED)
INCLUDE(KDE4Defaults)
INCLUDE_DIRECTORIES(${QT_INCLUDES} ${KDE4_INCLUDES})
STRING(REPLACE "-fno-exceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
SET(LIB "lib${LIB_SUFFIX}")
SEPARATE_ARGUMENTS(KDE4_DEFINITIONS)
SEPARATE_ARGUMENTS(QT_DEFINITIONS)
ADD_DEFINITIONS(${KDE4_DEFINITIONS})
ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_STRICT_ITERATORS)

MESSAGE(STATUS "Build configuration: ${CMAKE_BUILD_TYPE}")

FIND_PACKAGE(MSGFMT REQUIRED)
IF(MSGFMT_FOUND)
    MESSAGE(STATUS "Program msgfmt found (${MSGFMT_EXECUTABLE})")
ELSE(MSGFMT_FOUND)
    MESSAGE(FATAL_ERROR "Please install the program msgfmt (gettext)")
ENDIF(MSGFMT_FOUND)

FIND_PACKAGE(PkgConfig REQUIRED)
IF(PKG_CONFIG_FOUND)
    MESSAGE(STATUS "Program pkg-config found (${PKG_CONFIG_EXECUTABLE})")
ELSE(PKG_CONFIG_FOUND)
    MESSAGE(FATAL_ERROR "Please install pkg-config")
ENDIF(PKG_CONFIG_FOUND)

SET(HAVE_ALSA FALSE)
PKG_CHECK_MODULES(ALSA REQUIRED alsa>=1.0)
IF(ALSA_FOUND)
    SET(HAVE_ALSA TRUE)
    ADD_DEFINITIONS(-DHAVE_ALSA)
    SET(ALSA_LIBS ${ALSA_LIBRARIES})
    #MESSAGE("ALSA_LIBS: ${ALSA_LIBS}")
    LIST(APPEND ALSA_LIB_DIR ${ALSA_LIBRARY_DIRS} ${ALSA_LIBDIR} )
    #MESSAGE("ALSA_LIB_DIR: ${ALSA_LIB_DIR}")
    LIST(APPEND ALSA_INC_DIR ${ALSA_INCLUDE_DIRS} ${ALSA_INCLUDEDIR})
    #MESSAGE("ALSA_INC_DIR: ${ALSA_INC_DIR}")
ELSE(ALSA_FOUND)
    MESSAGE(FATAL_ERROR "Please install ALSA library and headers (libasound2)")
ENDIF(ALSA_FOUND)

# DRUMSTICK LIBRARY BUILD TYPE
IF(STATIC_DRUMSTICK)
    SET(BUILD_SHARED_LIBS OFF)
    SET(DRUMSTICK_LIBS drumstick-alsa)
    SET(DRUMSTICK_LIB_DIR ${KMETRONOME_BINARY_DIR})
    SET(DRUMSTICK_INC_DIR ${KMETRONOME_SOURCE_DIR}/drumstick/include)
    ADD_SUBDIRECTORY(drumstick)
ELSE(STATIC_DRUMSTICK)
    SET(BUILD_SHARED_LIBS ON)
    PKG_CHECK_MODULES(DRUMSTICK REQUIRED drumstick-alsa>=0.5)
    IF(DRUMSTICK_FOUND)
       SET(DRUMSTICK_LIBS ${DRUMSTICK_LIBRARIES})
       #MESSAGE(STATUS "DRUMSTICK_LIBS: ${DRUMSTICK_LIBS}")
       LIST(APPEND DRUMSTICK_LIB_DIR ${DRUMSTICK_LIBRARY_DIRS} ${DRUMSTICK_LIBDIR} )
       #MESSAGE(STATUS "DRUMSTICK_LIB_DIR: ${DRUMSTICK_LIB_DIR}")
       LIST(APPEND DRUMSTICK_INC_DIR ${DRUMSTICK_INCLUDE_DIRS} ${DRUMSTICK_INCLUDEDIR})
       #MESSAGE(STATUS "DRUMSTICK_INC_DIR: ${DRUMSTICK_INC_DIR}")
    ELSE(DRUMSTICK_FOUND)
       MESSAGE(FATAL_ERROR "Please install drumstick libraries and headers (libdrumstick-alsa)")
    ENDIF(DRUMSTICK_FOUND)
ENDIF(STATIC_DRUMSTICK)

SET(USE_PCH FALSE)
IF(ENABLE_PCH)
    FIND_PACKAGE(PCHSupport)
    IF(PCHSupport_FOUND)
        SET(USE_PCH TRUE)
        MESSAGE(STATUS "Enabling precompiled headers for GCC ${gcc_compiler_version}") 
    ENDIF(PCHSupport_FOUND)
ENDIF(ENABLE_PCH)

MESSAGE(STATUS "kmetronome ${VERSION} install prefix: ${CMAKE_INSTALL_PREFIX}")

ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(icons)
ADD_SUBDIRECTORY(po)
ADD_SUBDIRECTORY(doc)
ADD_SUBDIRECTORY(data)

INCLUDE(DBusMacros)
dbus_add_activation_service(net.sourceforge.kmetronome.service.in)

CONFIGURE_FILE(
    "${CMAKE_SOURCE_DIR}/kmetronome.spec.in"
    "${CMAKE_SOURCE_DIR}/kmetronome.spec"
    IMMEDIATE @ONLY)

ADD_CUSTOM_TARGET ( tarball
    COMMAND mkdir -p kmetronome-${VERSION}
    COMMAND cp -r cmake_admin kmetronome-${VERSION}
    COMMAND cp -r data kmetronome-${VERSION}
    COMMAND cp -r doc kmetronome-${VERSION}
    COMMAND cp -r icons kmetronome-${VERSION}
    COMMAND cp -r po kmetronome-${VERSION}
    COMMAND cp -r src kmetronome-${VERSION}
    #COMMAND cp -rHL drumstick kmetronome-${VERSION}
    COMMAND cp AUTHORS ChangeLog CMakeLists.txt configure.* COPYING INSTALL kmetronome.* net.sourceforge.kmetronome.* NEWS README TODO kmetronome-${VERSION}
    COMMAND tar -cj --exclude .svn --exclude *.old --exclude *~ -f kmetronome-${VERSION}.tar.bz2 kmetronome-${VERSION}
    COMMAND tar -cz --exclude .svn --exclude *.old --exclude *~ -f kmetronome-${VERSION}.tar.gz kmetronome-${VERSION}
    COMMAND rm -rf kmetronome-${VERSION}
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

INSTALL( FILES kmetronome.desktop
         DESTINATION ${XDG_APPS_INSTALL_DIR} )