src_CMakeLists.txt 8.74 KB
Newer Older
1

2
add_definitions(-Dasm=__asm__ -D_INTL_REDIRECT_MACROS)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
3
4
add_definitions(-DLOCALEDIR=\\"${CMAKE_INSTALL_PREFIX}/locale\\")
add_definitions(-DPLUGIN_PATH=\\"${CMAKE_INSTALL_PREFIX}/lib/vlc\\")
5
add_definitions(-DDATA_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/vlc\\")
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# vlc
add_executable(vlc vlc.c)
target_link_libraries(vlc libvlc)

# libvlc

set( SOURCES_libvlc_beos misc/beos_specific.cpp )
set( SOURCES_libvlc_darwin misc/darwin_specific.c )
set( SOURCES_libvlc_win32 misc/win32_specific.c )
set( SOURCES_libvlc_dirent extras/dirent.c )
set( SOURCES_libvlc_getopt misc/getopt.c misc/getopt.h misc/getopt1.c )
set( SOURCES_libvlc_common
    libvlc.c
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
    libvlc-common.c
    libvlc.h
    libvlc-module.c
    interface/interface.h
    interface/interface.c
    interface/intf_eject.c
    interface/interaction.c
    playlist/playlist_internal.h
    playlist/thread.c
    playlist/control.c
    playlist/engine.c
    playlist/sort.c
    playlist/loadsave.c
    playlist/tree.c
    playlist/item.c
    playlist/search.c
    playlist/services_discovery.c
    input/item.c
    input/access.c
    input/clock.c
    input/control.c
    input/decoder.c
    input/decoder_synchro.c
    input/demux.c
    input/es_out.c
    input/input.c
    input/meta.c
    input/input_internal.h
    input/vlm_internal.h
    input/stream.c
    input/mem_stream.c
    input/subtitles.c
    input/var.c
    video_output/video_output.c
    video_output/vout_pictures.c
    video_output/vout_pictures.h
    video_output/video_text.c
    video_output/video_widgets.c
    video_output/vout_subpictures.c
    video_output/vout_intf.c
    audio_output/aout_internal.h
    audio_output/common.c
    audio_output/dec.c
    audio_output/filters.c
    audio_output/input.c
    audio_output/mixer.c
    audio_output/output.c
    audio_output/intf.c
    stream_output/stream_output.c
    stream_output/stream_output.h
    stream_output/announce.c
    stream_output/profiles.c
    stream_output/sap.c
    stream_output/sdp.c
    osd/osd.c
    osd/osd_text.c
    osd/osd_widgets.c
    network/acl.c
    network/getaddrinfo.c
    network/io.c
    network/error.c
    network/tcp.c
    network/udp.c
    network/httpd.c
    network/rootwrap.c
    network/tls.c
    network/poll.c
    text/charset.c
    text/strings.c
    text/unicode.c
    text/wincp.c
    text/iso_lang.c
    text/iso-639_def.h
    misc/md5.c
    misc/rand.c
    misc/mtime.c
    misc/block.c
    ${CMAKE_BINARY_DIR}/src/modules/builtin.h
    modules/modules.h
    modules/modules.c
    modules/cache.c
    modules/entry.c
    modules/os.c
    misc/threads.c
    misc/stats.c
    misc/cpu.c
    config/configuration.h
    config/core.c
    config/chain.c
    config/file.c
110
    config/intf.c
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
    config/cmdline.c
    misc/events.c
    misc/image.c
    misc/messages.c
    misc/objects.c
    misc/variables.h
    misc/variables.c
    misc/error.c
    misc/update.c
    ${CMAKE_BINARY_DIR}/src/misc/revision.c
    input/vlm.c
    misc/xml.c
    misc/devices.c
    extras/libc.c
    ${CMAKE_BINARY_DIR}/include/vlc_about.h )
126
127
128
129
130
131
132
133

set( SOURCES_libvlc ${SOURCES_libvlc_common} )

if(SYS_DARWIN)
    set( SOURCES_libvlc ${SOURCES_libvlc} ${SOURCES_libvlc_darwin} )
endif(SYS_DARWIN)

add_library(libvlc SHARED ${SOURCES_libvlc})
134

135
136
137
set_target_properties(libvlc PROPERTIES
        OUTPUT_NAME vlc
        SOVERSION 1 VERSION 1.0.0)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
138

139
target_link_libraries(libvlc ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES})
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
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
# libvlc-control
set( SOURCES_libvlc_control
     control/libvlc_internal.h
     control/core.c
     control/log.c
     control/playlist.c
     control/vlm.c
     control/video.c
     control/audio.c
     control/dynamic_media_list.c
     control/event.c
     control/flat_media_list_view.c
     control/hierarchical_media_list_view.c
     control/hierarchical_node_media_list_view.c
     control/media_descriptor.c
     control/media_instance.c
     control/media_list.c
     control/media_list_path.h
     control/media_list_player.c
     control/media_list_view.c
     control/media_library.c
     control/mediacontrol_internal.h
     control/mediacontrol_core.c
     control/mediacontrol_util.c
     control/mediacontrol_audio_video.c
     control/media_discoverer.c
     control/tag_query.c )

add_library(libvlc-control SHARED ${SOURCES_libvlc_control})
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
171
172
173
174
175

set_target_properties(libvlc-control PROPERTIES OUTPUT_NAME vlc-control)
set_target_properties(libvlc-control PROPERTIES SOVERSION 0)
set_target_properties(libvlc PROPERTIES VERSION 0.0.0)

176
target_link_libraries(libvlc-control libvlc)
177

178
179
180
181
182
183
##########################################################
# Install

install(TARGETS libvlc libvlc-control DESTINATION lib)
install(TARGETS vlc DESTINATION bin)

184
185
186
187
##########################################################
# Libraries

# Carbon
188
189
190
191
if(APPLE)
  find_library(CARBON_FRAMEWORK Carbon)
  target_link_libraries(libvlc ${CARBON_FRAMEWORK})
endif(APPLE)
192
193

##########################################################
194
# revision.c
195

196
set(rev "${CMAKE_BINARY_DIR}/src/misc/revision.c")
197
198
exec_program(dirname ARGS ${rev} OUTPUT_VARIABLE rev_dir)

199
add_custom_command(
200
OUTPUT ${rev}
201
COMMAND    rm -f ${rev} ${rev}.tmp
202
COMMAND    mkdir -p ${rev_dir}
203
204
205
206
COMMAND    sh -c "echo '/* AUTOGENERATED FILE - DO NOT EDIT */' > ${rev}.tmp"
COMMAND    sh -c "printf 'const char psz_vlc_changeset[] = \"' >> ${rev}.tmp"
COMMAND    sh -c "printf `LANG=C svnversion ${CMAKE_SOURCE_DIR} || printf \"exported\"` >> ${rev}.tmp"
COMMAND    sh -c "echo '\";' >> ${rev}.tmp"
207
COMMAND    mv -f ${rev}.tmp ${rev}
208
VERBATIM
209
)
210
set(rev)
211

212
213
214
215
##########################################################
# builtin.h
# No real use for this one, we just used to need it.
# We should really remove that.
216
set(builtin "${CMAKE_BINARY_DIR}/src/modules/builtin.h")
217
exec_program(dirname ARGS ${builtin} OUTPUT_VARIABLE builtin_dir)
218
219
220

add_custom_command(
OUTPUT ${builtin}
221
COMMAND    mkdir -p ${builtin_dir}
222
223
224
COMMAND    sh -c "echo '/* Auto generated by ${CMAKE_CURRENT_BUILD_DIR}/CMakeLists.txt */' > ${builtin}"
COMMAND    sh -c "echo 'int vlc_entry__main( module_t* );' >> ${builtin}"
COMMAND    sh -c "echo '#define ALLOCATE_ALL_BUILTINS() do {} while(0)' >> ${builtin}"
225
VERBATIM
226
)
227
228
229
230
set(should)

##########################################################
# vlc_about.h
231
set(about "${CMAKE_BINARY_DIR}/include/vlc_about.h")
232
exec_program(dirname ARGS ${about} OUTPUT_VARIABLE about_dir)
233
234
235

add_custom_command(
OUTPUT ${about}
236
COMMAND rm -f "${about}.tmp"
237
COMMAND mkdir -p ${about_dir}
238
239
240
241
242
243
244
245
246
247
248
COMMAND sh -c "echo '/* Automatically generated file - DO NOT EDIT */' > ${about}.tmp"
COMMAND sh -c "echo 'static const char psz_license[] =' >> ${about}.tmp"
COMMAND sh -c "cat ${CMAKE_SOURCE_DIR}/COPYING | sed s/\\\"/''/g | awk '{ print \"\\\"\"$0\"\\\\n\\\"\" }' >> ${about}.tmp"
COMMAND sh -c "echo ';' >> ${about}.tmp"
COMMAND sh -c "echo 'static const char psz_thanks[] =' >> ${about}.tmp"
COMMAND sh -c "grep -v '$$Id:'  ${CMAKE_SOURCE_DIR}/THANKS | sed 's/\"/''/g' | awk '{ print  \"\\\"\"$0\"\\\\n\\\"\" }'|sed 's/\"<.*.> \"//' >> ${about}.tmp"
COMMAND sh -c "echo ';' >> ${about}.tmp"
COMMAND sh -c "echo 'static const char psz_authors[] =' >> ${about}.tmp"
COMMAND sh -c "grep N: ${CMAKE_SOURCE_DIR}/AUTHORS | cut -d '\ ' -f 2- | sed 's/\"/''/g' | awk '{ print  \"\\\"\"$0\"\\\\n\\\"\" }' >> ${about}.tmp"
COMMAND sh -c "echo ';' >> ${about}.tmp"
COMMAND sh -c "mv -f -- ${about}.tmp ${about}"
249
DEPENDS ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/THANKS ${CMAKE_SOURCE_DIR}/COPYING
250
VERBATIM
251
)
252
set(about)
253

254

255
256
257
##########################################################
# SET_TARGET_PROPERTIES

258
259
260
261
262
# FIXME: Should probably be autodetected in configure?
if(NOT APPLE)
   set(LINK_FLAGS "-z defs --as-needed")
endif(NOT APPLE)

Konstantin Pavlov's avatar
Konstantin Pavlov committed
263
264
265
target_link_libraries(libvlc "${CMAKE_THREAD_LIBS_INIT}")
target_link_libraries(libvlc-control "${CMAKE_THREAD_LIBS_INIT}")

266
set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS
267
    "-Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wmissing-prototypes -I${CMAKE_BINARY_DIR}/src -I${CMAKE_BINARY_DIR}/include" )
268
269
270
271

##########################################################
# Tests

Pierre's avatar
Pierre committed
272
add_executable(test_testapi    control/testapi.c)
273
274
275
276
277
add_executable(test_i18n_atof  test/i18n_atof.c)
add_executable(test_url        test/url.c)
add_executable(test_utf8       test/utf8.c)
add_executable(test_dictionary test/dictionary.c)

Pierre's avatar
Pierre committed
278
target_link_libraries(test_testapi    libvlc-control)
279
280
281
282
283
target_link_libraries(test_i18n_atof  libvlc)
target_link_libraries(test_url        libvlc)
target_link_libraries(test_utf8       libvlc)
target_link_libraries(test_dictionary libvlc)

Pierre's avatar
Pierre committed
284
285
286
287
288
add_test(test_control    ${CMAKE_CURRENT_BINARY_DIR}/test_testapi)
add_test(test_i18n_atof  ${CMAKE_CURRENT_BINARY_DIR}/test_i18n_atof)
add_test(test_url        ${CMAKE_CURRENT_BINARY_DIR}/test_url)
add_test(test_utf8       ${CMAKE_CURRENT_BINARY_DIR}/test_utf8)
add_test(test_dictionary ${CMAKE_CURRENT_BINARY_DIR}/test_dictionary)
289