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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# check http://elementaryos.org/docs/developer-guide/cmake/simple-project
cmake_minimum_required (VERSION 2.8)
cmake_policy (VERSION 2.8)
project (noise C)
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set (GETTEXT_PACKAGE ${CMAKE_PROJECT_NAME})
set (RELEASE_NAME "Luna")
set (VERSION "0.3.0")
set (VERSION_INFO "Stable Release")
include (GNUInstallDirs)
set (DATADIR ${CMAKE_INSTALL_PREFIX}/share)
set (PKG_DATADIR ${DATADIR}/${CMAKE_PROJECT_NAME})
set (ICON_DIR ${DATADIR}/${CMAKE_PROJECT_NAME}/icons)
set (PLUGIN_DIR_UNPREFIXED ${CMAKE_INSTALL_LIBDIR}/${CMAKE_PROJECT_NAME}/plugins)
set (PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/${PLUGIN_DIR_UNPREFIXED})
add_definitions ("-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\"")
# Comment this out to enable C compiler warnings
add_definitions (-w)
# Add 'make dist' command for creating release tarball
set (CPACK_PACKAGE_VERSION ${VERSION})
set (CPACK_SOURCE_GENERATOR "TGZ")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}")
set (CPACK_SOURCE_IGNORE_FILES "/build/;/.bzr/;/.bzrignore;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack)
add_custom_target (dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
option (BUILD_SHARED_LIBS "Switch between shared and static libraries" ON)
if (BUILD_SHARED_LIBS)
message ("-- Shared libraries enabled")
else ()
message ("-- Shared libraries disabled")
endif ()
set (SRC_TARGET ${CMAKE_PROJECT_NAME})
set (CORE_LIBRARY_NAME ${SRC_TARGET}-core)
if (NOT BUILD_SHARED_LIBS)
set (CORE_LIBRARY_NAME ${CORE_LIBRARY_NAME}-static)
endif ()
#
# *_PACKAGES are used with the vala compiler (not versioned.)
# *_PKG are used with PKG-Config and for linking, etc. (They can contain versions.)
#
# Both should contain *the same packages*, except for those whose VAPI file has
# a different name. In such case, *_PACKAGES would use the name of the VAPI while
# *_PKG would use the name of the package known by pkg-config.
#
set (CORE_PACKAGES
glib-2.0
gio-2.0
gee-0.8
libpeas-1.0
libpeas-gtk-1.0
gtk+-3.0
granite
gstreamer-1.0
gstreamer-pbutils-1.0
gstreamer-tag-1.0
)
set (CORE_PKG
glib-2.0>=2.32
gio-2.0
gee-0.8
libpeas-1.0
libpeas-gtk-1.0
gtk+-3.0>=3.11.6
granite
gstreamer-1.0
gstreamer-tag-1.0
gstreamer-pbutils-1.0
)
set (DEPS_PACKAGES
${CORE_LIBRARY_NAME}
${CORE_PACKAGES} # this is needed until we provide a ${CORE_LIBRARY_NAME}.deps file
taglib_c
)
set (DEPS_PKG
taglib_c
)
find_package (PkgConfig)
pkg_check_modules (CORE_DEPS REQUIRED ${CORE_PKG})
pkg_check_modules (DEPS REQUIRED ${DEPS_PKG} ${CORE_PKG})
set (BASIC_VALAC_OPTIONS
--vapidir=${CMAKE_SOURCE_DIR}/vapi
--target-glib=2.32
--thread
# Remove it when vala bindings are no more experimental (see https://bugzilla.gnome.org/show_bug.cgi?id=719597)
--enable-experimental
)
set (GLOBAL_VALAC_OPTIONS
--vapidir=${CMAKE_BINARY_DIR}/core
--vapidir=${CMAKE_BINARY_DIR}/src
${BASIC_VALAC_OPTIONS}
)
#
# SQLHeavy: Use version 0.2 if it is available; otherwise, fall back to 0.1
#
pkg_check_modules (SQLHEAVY2 QUIET sqlheavy-0.2)
if (SQLHEAVY2_FOUND)
message ("-- Will use sqlheavy-0.2")
set (DEPS_PACKAGES ${DEPS_PACKAGES} sqlheavy-0.2)
set (SQLHEAVY_CFLAGS ${SQLHEAVY2_CFLAGS})
set (SQLHEAVY_LIBRARY_DIRS ${SQLHEAVY2_LIBRARY_DIRS})
set (SQLHEAVY_LIBRARIES ${SQLHEAVY2_LIBRARIES})
else ()
message ("-- Will use sqlheavy-0.1")
pkg_check_modules (SQLHEAVY REQUIRED sqlheavy-0.1)
set (DEPS_PACKAGES ${DEPS_PACKAGES} sqlheavy-0.1)
endif ()
set (DEPS_CFLAGS ${DEPS_CFLAGS} ${SQLHEAVY_CFLAGS})
set (DEPS_LIBRARIES ${DEPS_LIBRARIES} ${SQLHEAVY_LIBRARIES})
set (DEPS_LIBRARY_DIRS ${DEPS_LIBRARY_DIRS} ${SQLHEAVY_LIBRARY_DIRS})
#
# Libnotify
#
pkg_check_modules (LIBNOTIFY QUIET libnotify)
if (LIBNOTIFY_FOUND)
message ("-- libnotify enabled")
set (GLOBAL_VALAC_OPTIONS ${GLOBAL_VALAC_OPTIONS} --define=HAVE_LIBNOTIFY)
set (DEPS_PACKAGES ${DEPS_PACKAGES} libnotify)
set (DEPS_CFLAGS ${DEPS_CFLAGS} ${LIBNOTIFY_CFLAGS})
set (DEPS_LIBRARIES ${DEPS_LIBRARIES} ${LIBNOTIFY_LIBRARIES})
set (DEPS_LIBRARY_DIRS ${DEPS_LIBRARY_DIRS} ${LIBNOTIFY_LIBRARY_DIRS})
else ()
message ("-- libnotify disabled")
endif ()
find_package (Vala REQUIRED)
include (ValaVersion)
ensure_vala_version ("0.23.2" MINIMUM)
include (ValaPrecompile)
set (DEPS_LIBRARIES ${DEPS_LIBRARIES} -lm)
add_subdirectory (schemas)
add_subdirectory (core)
# 'src' and 'plugins' depend on the core library
include_directories (${CMAKE_BINARY_DIR}/core)
set (DEPS_LIBRARIES ${DEPS_LIBRARIES} ${CORE_LIBRARY_NAME})
add_subdirectory (src)
add_subdirectory (plugins)
add_subdirectory (po)
add_subdirectory (data)
add_subdirectory (images)
|