src_CMakeLists.txt 9.49 KB
Newer Older
1

2
add_definitions(-Dasm=__asm__ -D_INTL_REDIRECT_MACROS)
3
add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/locale")
Rafaël Carré's avatar
Rafaël Carré committed
4
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_PREFIX}/etc")
5 6
add_definitions(-DPLUGIN_PATH="${CMAKE_INSTALL_PREFIX}/lib/vlc")
add_definitions(-DDATA_PATH="${CMAKE_INSTALL_PREFIX}/share/vlc")
7 8 9

# vlc
add_executable(vlc vlc.c)
10
target_link_libraries(vlc libvlccore libvlc)
Rafaël Carré's avatar
Rafaël Carré committed
11 12 13 14 15 16 17 18 19 20 21

# libvlccore

set( SOURCES_libvlccore_beos misc/beos_specific.cpp )
set( SOURCES_libvlccore_darwin misc/darwin_specific.c )
set( SOURCES_libvlccore_win32 misc/win32_specific.c )
set( SOURCES_libvlccore_linux misc/linux_specific.c )
set( SOURCES_libvlccore_other misc/not_specific.c )
set( SOURCES_libvlccore_dirent extras/dirent.c )
set( SOURCES_libvlccore_getopt misc/getopt.c misc/getopt.h misc/getopt1.c )
set( SOURCES_libvlccore_common
22
    libvlc.c
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
    libvlc-common.c
    libvlc.h
    libvlc-module.c
    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/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
94
    misc/action.c
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
    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
112
    config/intf.c
113 114 115 116 117 118 119 120
    config/cmdline.c
    misc/events.c
    misc/image.c
    misc/messages.c
    misc/objects.c
    misc/variables.h
    misc/variables.c
    misc/error.c
121
    misc/update.h
122 123 124
    misc/update.c
    ${CMAKE_BINARY_DIR}/src/misc/revision.c
    input/vlm.c
Rafaël Carré's avatar
Rafaël Carré committed
125
    input/vlmshell.c
126 127 128 129
    misc/xml.c
    misc/devices.c
    extras/libc.c
    ${CMAKE_BINARY_DIR}/include/vlc_about.h )
130

Rafaël Carré's avatar
Rafaël Carré committed
131
set( SOURCES_libvlccore ${SOURCES_libvlccore_common} )
132 133

if(SYS_DARWIN)
Rafaël Carré's avatar
Rafaël Carré committed
134 135 136 137 138 139 140 141 142
    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_darwin} )
elseif(SYS_BEOS)
    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_beos} )
elseif(SYS_WIN32)
    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_win32} )
elseif(SYS_LINUX)
    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_linux} )
else(SYS_DARWIN)
    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_other} )
143 144
endif(SYS_DARWIN)

145

Rafaël Carré's avatar
Rafaël Carré committed
146 147 148
add_library(libvlccore SHARED ${SOURCES_libvlccore})

set_target_properties(libvlccore PROPERTIES
149 150
        OUTPUT_NAME vlccore
        SOVERSION 0 VERSION 0.0.0)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
151

152
if(UPDATE_CHECK)
Rafaël Carré's avatar
Rafaël Carré committed
153
target_link_libraries(libvlccore ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES} "-lgcrypt")
154
else(UPDATE_CHECK)
Rafaël Carré's avatar
Rafaël Carré committed
155
target_link_libraries(libvlccore ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES})
156
endif(UPDATE_CHECK)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
157

Rafaël Carré's avatar
Rafaël Carré committed
158 159
# libvlc
set( SOURCES_libvlc
160 161 162 163 164 165 166 167 168 169 170
     control/libvlc_internal.h
     control/core.c
     control/log.c
     control/playlist.c
     control/vlm.c
     control/video.c
     control/audio.c
     control/event.c
     control/flat_media_list_view.c
     control/hierarchical_media_list_view.c
     control/hierarchical_node_media_list_view.c
171 172
     control/media.c
     control/media_player.c
173 174 175 176 177 178 179 180 181
     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
182
     control/media_discoverer.c )
183

Rafaël Carré's avatar
Rafaël Carré committed
184 185 186
add_library(libvlc SHARED ${SOURCES_libvlc})

set_target_properties(libvlc PROPERTIES OUTPUT_NAME vlc)
187
set_target_properties(libvlc PROPERTIES SOVERSION 2)
Rafaël Carré's avatar
Rafaël Carré committed
188
set_target_properties(libvlccore PROPERTIES VERSION 0.0.0)
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
189

Rafaël Carré's avatar
Rafaël Carré committed
190 191
set_source_files_properties(${SOURCES_libvlc} PROPERTIES COMPILE_FLAGS -DMODULE_STRING=\\"control\\")
set_source_files_properties(${SOURCES_libvlccore} PROPERTIES COMPILE_FLAGS -DMODULE_STRING=\\"main\\")
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
192

Rafaël Carré's avatar
Rafaël Carré committed
193
target_link_libraries(libvlc libvlccore)
194

195 196 197
##########################################################
# Install

Rafaël Carré's avatar
Rafaël Carré committed
198
install(TARGETS libvlccore libvlc DESTINATION lib)
199 200
install(TARGETS vlc DESTINATION bin)

201 202 203 204
##########################################################
# Libraries

# Carbon
205 206
if(APPLE)
  find_library(CARBON_FRAMEWORK Carbon)
Rafaël Carré's avatar
Rafaël Carré committed
207
  target_link_libraries(libvlccore ${CARBON_FRAMEWORK})
208
endif(APPLE)
209 210

##########################################################
211
# revision.c
212

213
set(rev "${CMAKE_BINARY_DIR}/src/misc/revision.c")
214 215
exec_program(dirname ARGS ${rev} OUTPUT_VARIABLE rev_dir)

216
add_custom_command(
217
OUTPUT ${rev}
218
COMMAND    rm -f ${rev} ${rev}.tmp
219
COMMAND    mkdir -p ${rev_dir}
220 221
COMMAND    sh -c "echo '/* AUTOGENERATED FILE - DO NOT EDIT */' > ${rev}.tmp"
COMMAND    sh -c "printf 'const char psz_vlc_changeset[] = \"' >> ${rev}.tmp"
Rafaël Carré's avatar
Rafaël Carré committed
222
COMMAND    sh -c "printf `LANG=C git --git-dir=${CMAKE_SOURCE_DIR}/.git show-ref -s HEAD 2>/dev/null || printf exported` >> ${rev}.tmp"
223
COMMAND    sh -c "echo '\";' >> ${rev}.tmp"
224
COMMAND    mv -f ${rev}.tmp ${rev}
225
VERBATIM
226
)
227
set(rev)
228

229 230 231 232
##########################################################
# builtin.h
# No real use for this one, we just used to need it.
# We should really remove that.
233
set(builtin "${CMAKE_BINARY_DIR}/src/modules/builtin.h")
234
exec_program(dirname ARGS ${builtin} OUTPUT_VARIABLE builtin_dir)
235 236 237

add_custom_command(
OUTPUT ${builtin}
238
COMMAND    mkdir -p ${builtin_dir}
239 240 241
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}"
242
VERBATIM
243
)
244 245 246 247
set(should)

##########################################################
# vlc_about.h
248
set(about "${CMAKE_BINARY_DIR}/include/vlc_about.h")
249
exec_program(dirname ARGS ${about} OUTPUT_VARIABLE about_dir)
250 251 252

add_custom_command(
OUTPUT ${about}
253
COMMAND rm -f "${about}.tmp"
254
COMMAND mkdir -p ${about_dir}
255 256 257 258 259 260 261 262 263 264 265
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}"
266
DEPENDS ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/THANKS ${CMAKE_SOURCE_DIR}/COPYING
267
VERBATIM
268
)
269
set(about)
270

271

272 273 274
##########################################################
# SET_TARGET_PROPERTIES

275
# FIXME: Should probably be autodetected in configure?
Rafaël Carré's avatar
Rafaël Carré committed
276 277 278 279
# FIXME: This breaks on FreeBSD also
#if(NOT APPLE)
#   set(LINK_FLAGS "-z defs --as-needed")
#endif(NOT APPLE)
280

Rafaël Carré's avatar
Rafaël Carré committed
281
target_link_libraries(libvlccore "${CMAKE_THREAD_LIBS_INIT}")
Konstantin Pavlov's avatar
Konstantin Pavlov committed
282 283
target_link_libraries(libvlc "${CMAKE_THREAD_LIBS_INIT}")

Rafaël Carré's avatar
Rafaël Carré committed
284
set_target_properties(libvlccore libvlc vlc PROPERTIES COMPILE_FLAGS
285
    "-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" )
286 287 288 289

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

290 291 292 293 294
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)

Rafaël Carré's avatar
Rafaël Carré committed
295 296 297 298
target_link_libraries(test_i18n_atof  libvlccore)
target_link_libraries(test_url        libvlccore)
target_link_libraries(test_utf8       libvlccore)
target_link_libraries(test_dictionary libvlccore)
299

Pierre's avatar
Pierre committed
300 301 302 303
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)
304