forked from clangen/musikcube
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
235 lines (202 loc) · 6.88 KB
/
CMakeLists.txt
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
#cmake -DCMAKE_BUILD_TYPE=Release .
#cmake -DCMAKE_BUILD_TYPE=Debug .
#cmake -DGENERATE_DEB=1 -DDEB_ARCHITECTURE=i386|amd64|armhf -DDEB_DISTRO=stretch -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release .
#cmake -DCMAKE_BUILD_TYPE=Release -DLINK_STATICALLY=true .
cmake_minimum_required(VERSION 3.0)
project(musikcube)
set (musikcube_VERSION_MAJOR 0)
set (musikcube_VERSION_MINOR 26)
set (musikcube_VERSION_PATCH 0)
set (musikcube_VERSION "${musikcube_VERSION_MAJOR}.${musikcube_VERSION_MINOR}.${musikcube_VERSION_PATCH}")
include(CMakeToolsHelpers OPTIONAL)
include(ExternalProject)
ExternalProject_Add(taglib
SOURCE_DIR "${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11"
BUILD_IN_SOURCE 0
DOWNLOAD_COMMAND ""
UPDATE_COMMAND ""
CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX:PATH=${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/"
INSTALL_COMMAND make install
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wno-unused-result -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
# enable for additional memory checking with fsanitize
# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3 -fsanitize=address,undefined")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
if (${LINK_STATICALLY} MATCHES "true")
set(Boost_USE_STATIC_LIBS ON)
endif()
set (BOOST_LIBS
system
filesystem
thread
)
find_package(Boost 1.55.0 REQUIRED ${BOOST_LIBS})
add_definitions (-DHAVE_BOOST -D_FILE_OFFSET_BITS=64 -DSIGSLOT_USE_POSIX_THREADS)
set (BOOST_LINK_LIBS ${Boost_LIBRARIES})
#message(STATUS "boost libs: " ${BOOST_LINK_LIBS})
#message(STATUS "boost includes: " ${Boost_INCLUDE_DIRS})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Modules)
# SET (CMAKE_BUILD_TYPE DEBUG)
set (LIBRARY_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin/plugins)
set (EXECUTABLE_OUTPUT_PATH ${musikcube_SOURCE_DIR}/bin)
link_directories (
${musikcube_SOURCE_DIR}/bin/plugins
${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/lib
)
set (musikcube_LINK_LIBS
${linux_LINK_LIBS}
${BOOST_LINK_LIBS}
dl
curl
pthread
)
include_directories (
"${musikcube_SOURCE_DIR}/src"
"${musikcube_SOURCE_DIR}/src/core"
"${musikcube_SOURCE_DIR}/src/musikcube"
"${musikcube_SOURCE_DIR}/src/3rdparty/include"
"${musikcube_SOURCE_DIR}/src/plugins/taglib_plugin/taglib-1.11/stage/include"
)
# "/usr/local" doesn't seem to be included by default on macOS 10.12+
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
link_directories ("/usr/local/lib")
include_directories("/usr/local/include")
endif ()
if (EXISTS "/etc/arch-release" OR EXISTS "/etc/manjaro-release" OR NO_NCURSESW)
add_definitions (-DNO_NCURSESW)
endif()
add_subdirectory(src/core)
add_subdirectory(src/glue)
add_subdirectory(src/musikcube)
add_subdirectory(src/plugins/taglib_plugin)
add_subdirectory(src/plugins/m4adecoder)
add_subdirectory(src/plugins/oggdecoder)
add_subdirectory(src/plugins/nomaddecoder)
add_subdirectory(src/plugins/flacdecoder)
add_subdirectory(src/plugins/nullout)
add_subdirectory(src/plugins/websocket_remote)
add_subdirectory(src/plugins/httpdatastream)
add_dependencies(taglibreader taglib)
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(src/plugins/alsaout)
add_subdirectory(src/plugins/pulseout)
else (CMAKE_SYSTEM_NAME MATCHES "Linux")
# macos
add_subdirectory(src/plugins/coreaudioout)
endif (CMAKE_SYSTEM_NAME MATCHES "Linux")
# install the binary
install(
FILES bin/musikcube DESTINATION share/musikcube
PERMISSIONS
OWNER_EXECUTE OWNER_READ OWNER_WRITE
GROUP_EXECUTE GROUP_READ GROUP_WRITE
WORLD_EXECUTE WORLD_READ
)
# install the plugins
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
# linux
install(
FILES
bin/plugins/libalsaout.so
bin/plugins/libpulseout.so
bin/plugins/libnullout.so
bin/plugins/libflacdecoder.so
bin/plugins/libm4adecoder.so
bin/plugins/libnomaddecoder.so
bin/plugins/liboggdecoder.so
bin/plugins/libtaglibreader.so
bin/plugins/libwebsocket_remote.so
bin/plugins/libhttpdatastream.so
DESTINATION share/musikcube/plugins
)
else (CMAKE_SYSTEM_NAME MATCHES "Linux")
# macos
install(
FILES
bin/plugins/libcoreaudioout.dylib
bin/plugins/libnullout.dylib
bin/plugins/libflacdecoder.dylib
bin/plugins/libm4adecoder.dylib
bin/plugins/libnomaddecoder.dylib
bin/plugins/liboggdecoder.dylib
bin/plugins/libtaglibreader.dylib
bin/plugins/libwebsocket_remote.dylib
bin/plugins/libhttpdatastream.dylib
DESTINATION share/musikcube/plugins
)
endif (CMAKE_SYSTEM_NAME MATCHES "Linux")
file(GLOB sdk_headers "src/core/sdk/*.h")
file(GLOB themes "src/musikcube/data/themes/*.json")
file(GLOB locales "src/musikcube/data/locales/*.json")
file(COPY ${themes}
DESTINATION bin/themes
)
install(
FILES ${themes}
DESTINATION share/musikcube/themes
)
file(COPY ${locales}
DESTINATION bin/locales
)
install(
FILES ${locales}
DESTINATION share/musikcube/locales
)
install(
FILES ${sdk_headers}
DESTINATION include/musikcube/core/sdk
)
# shell script that starts the app.
install(
FILES src/musikcube/musikcube
DESTINATION bin/
PERMISSIONS
OWNER_EXECUTE OWNER_READ OWNER_WRITE
GROUP_EXECUTE GROUP_READ GROUP_WRITE
WORLD_EXECUTE WORLD_READ
)
if (GENERATE_DEB MATCHES "1")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(DEB_BOOST_VERSION "1.55.0")
set(DEB_MICROHTTPD_VERSION "10")
if (DEB_DISTRO MATCHES "stretch")
set(DEB_BOOST_VERSION "1.62.0")
set(DEB_MICROHTTPD_VERSION "12")
elseif (DEB_DISTRO MATCHES "zesty")
set(DEB_BOOST_VERSION "1.62.0")
set(DEB_MICROHTTPD_VERSION "10")
elseif (DEB_DISTRO MATCHES "artsy")
set(DEB_BOOST_VERSION "1.63.0")
set(DEB_MICROHTTPD_VERSION "12")
endif()
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_DESCRIPTION "musikcube, a terminal-based music player and library")
set(CPACK_PACKAGE_VERSION_MAJOR "${musikcube_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${musikcube_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${musikcube_VERSION_PATCH}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS
"libboost-thread${DEB_BOOST_VERSION},
libboost-system${DEB_BOOST_VERSION},
libboost-filesystem${DEB_BOOST_VERSION},
libboost-date-time${DEB_BOOST_VERSION},
libboost-atomic${DEB_BOOST_VERSION},
libboost-chrono${DEB_BOOST_VERSION},
libmicrohttpd${DEB_MICROHTTPD_VERSION},
libogg0,
libvorbis0a,
libvorbisfile3,
libflac8,
libfaad2,
libncursesw5,
libasound2,
libpulse0,
pulseaudio,
libmp3lame0")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "casey langen")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${DEB_ARCHITECTURE})
set(CPACK_PACKAGE_FILE_NAME "musikcube_${musikcube_VERSION}_${DEB_DISTRO}_${DEB_ARCHITECTURE}")
include(CPack)
endif()
endif()