]> git.sesse.net Git - vlc/blob - extras/buildsystem/cmake/CMakeLists/src_CMakeLists.txt
abee3e75661d59e48a0d5ac5932e37f25967023c
[vlc] / extras / buildsystem / cmake / CMakeLists / src_CMakeLists.txt
1
2 add_definitions(-Dasm=__asm__ -D_INTL_REDIRECT_MACROS)
3 add_definitions(-DLOCALEDIR=\\"${CMAKE_INSTALL_PREFIX}/locale\\")
4 add_definitions(-DPLUGIN_PATH=\\"${CMAKE_INSTALL_PREFIX}/lib/vlc\\")
5 add_definitions(-DDATA_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/vlc\\")
6
7 # vlc
8 add_executable(vlc vlc.c)
9 target_link_libraries(vlc libvlc)
10
11 # libvlc
12
13 set( SOURCES_libvlc_beos misc/beos_specific.cpp )
14 set( SOURCES_libvlc_darwin misc/darwin_specific.c )
15 set( SOURCES_libvlc_win32 misc/win32_specific.c )
16 set( SOURCES_libvlc_dirent extras/dirent.c )
17 set( SOURCES_libvlc_getopt misc/getopt.c misc/getopt.h misc/getopt1.c )
18 set( SOURCES_libvlc_common
19     libvlc.c
20     libvlc-common.c
21     libvlc.h
22     libvlc-module.c
23     interface/interface.c
24     interface/intf_eject.c
25     interface/interaction.c
26     playlist/playlist_internal.h
27     playlist/thread.c
28     playlist/control.c
29     playlist/engine.c
30     playlist/sort.c
31     playlist/loadsave.c
32     playlist/tree.c
33     playlist/item.c
34     playlist/search.c
35     playlist/services_discovery.c
36     input/item.c
37     input/access.c
38     input/clock.c
39     input/control.c
40     input/decoder.c
41     input/decoder_synchro.c
42     input/demux.c
43     input/es_out.c
44     input/input.c
45     input/meta.c
46     input/input_internal.h
47     input/vlm_internal.h
48     input/stream.c
49     input/mem_stream.c
50     input/subtitles.c
51     input/var.c
52     video_output/video_output.c
53     video_output/vout_pictures.c
54     video_output/vout_pictures.h
55     video_output/video_text.c
56     video_output/video_widgets.c
57     video_output/vout_subpictures.c
58     video_output/vout_intf.c
59     audio_output/aout_internal.h
60     audio_output/common.c
61     audio_output/dec.c
62     audio_output/filters.c
63     audio_output/input.c
64     audio_output/mixer.c
65     audio_output/output.c
66     audio_output/intf.c
67     stream_output/stream_output.c
68     stream_output/stream_output.h
69     stream_output/announce.c
70     stream_output/profiles.c
71     stream_output/sap.c
72     stream_output/sdp.c
73     osd/osd.c
74     osd/osd_text.c
75     osd/osd_widgets.c
76     network/acl.c
77     network/getaddrinfo.c
78     network/io.c
79     network/error.c
80     network/tcp.c
81     network/udp.c
82     network/httpd.c
83     network/rootwrap.c
84     network/tls.c
85     network/poll.c
86     text/charset.c
87     text/strings.c
88     text/unicode.c
89     text/wincp.c
90     text/iso_lang.c
91     text/iso-639_def.h
92     misc/md5.c
93     misc/rand.c
94     misc/mtime.c
95     misc/block.c
96     ${CMAKE_BINARY_DIR}/src/modules/builtin.h
97     modules/modules.h
98     modules/modules.c
99     modules/cache.c
100     modules/entry.c
101     modules/os.c
102     misc/threads.c
103     misc/stats.c
104     misc/cpu.c
105     config/configuration.h
106     config/core.c
107     config/chain.c
108     config/file.c
109     config/intf.c
110     config/cmdline.c
111     misc/events.c
112     misc/image.c
113     misc/messages.c
114     misc/objects.c
115     misc/variables.h
116     misc/variables.c
117     misc/error.c
118     misc/update.c
119     ${CMAKE_BINARY_DIR}/src/misc/revision.c
120     input/vlm.c
121     misc/xml.c
122     misc/devices.c
123     extras/libc.c
124     ${CMAKE_BINARY_DIR}/include/vlc_about.h )
125
126 set( SOURCES_libvlc ${SOURCES_libvlc_common} )
127
128 if(SYS_DARWIN)
129     set( SOURCES_libvlc ${SOURCES_libvlc} ${SOURCES_libvlc_darwin} )
130 endif(SYS_DARWIN)
131
132 add_library(libvlc SHARED ${SOURCES_libvlc})
133
134 set_target_properties(libvlc PROPERTIES
135         OUTPUT_NAME vlc
136         SOVERSION 1 VERSION 1.0.0)
137
138 if(UPDATE_CHECK)
139 target_link_libraries(libvlc ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES} "-lgcrypt")
140 else(UPDATE_CHECK)
141 target_link_libraries(libvlc ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES})
142 endif(UPDATE_CHECK)
143
144 # libvlc-control
145 set( SOURCES_libvlc_control
146      control/libvlc_internal.h
147      control/core.c
148      control/log.c
149      control/playlist.c
150      control/vlm.c
151      control/video.c
152      control/audio.c
153      control/dynamic_media_list.c
154      control/event.c
155      control/flat_media_list_view.c
156      control/hierarchical_media_list_view.c
157      control/hierarchical_node_media_list_view.c
158      control/media_descriptor.c
159      control/media_instance.c
160      control/media_list.c
161      control/media_list_path.h
162      control/media_list_player.c
163      control/media_list_view.c
164      control/media_library.c
165      control/mediacontrol_internal.h
166      control/mediacontrol_core.c
167      control/mediacontrol_util.c
168      control/mediacontrol_audio_video.c
169      control/media_discoverer.c
170      control/tag_query.c )
171
172 add_library(libvlc-control SHARED ${SOURCES_libvlc_control})
173
174 set_target_properties(libvlc-control PROPERTIES OUTPUT_NAME vlc-control)
175 set_target_properties(libvlc-control PROPERTIES SOVERSION 0)
176 set_target_properties(libvlc PROPERTIES VERSION 0.0.0)
177
178 target_link_libraries(libvlc-control libvlc)
179
180 ##########################################################
181 # Install
182
183 install(TARGETS libvlc libvlc-control DESTINATION lib)
184 install(TARGETS vlc DESTINATION bin)
185
186 ##########################################################
187 # Libraries
188
189 # Carbon
190 if(APPLE)
191   find_library(CARBON_FRAMEWORK Carbon)
192   target_link_libraries(libvlc ${CARBON_FRAMEWORK})
193 endif(APPLE)
194
195 ##########################################################
196 # revision.c
197
198 set(rev "${CMAKE_BINARY_DIR}/src/misc/revision.c")
199 exec_program(dirname ARGS ${rev} OUTPUT_VARIABLE rev_dir)
200
201 add_custom_command(
202 OUTPUT ${rev}
203 COMMAND    rm -f ${rev} ${rev}.tmp
204 COMMAND    mkdir -p ${rev_dir}
205 COMMAND    sh -c "echo '/* AUTOGENERATED FILE - DO NOT EDIT */' > ${rev}.tmp"
206 COMMAND    sh -c "printf 'const char psz_vlc_changeset[] = \"' >> ${rev}.tmp"
207 COMMAND    sh -c "printf `LANG=C svnversion ${CMAKE_SOURCE_DIR} || printf \"exported\"` >> ${rev}.tmp"
208 COMMAND    sh -c "echo '\";' >> ${rev}.tmp"
209 COMMAND    mv -f ${rev}.tmp ${rev}
210 VERBATIM
211 )
212 set(rev)
213
214 ##########################################################
215 # builtin.h
216 # No real use for this one, we just used to need it.
217 # We should really remove that.
218 set(builtin "${CMAKE_BINARY_DIR}/src/modules/builtin.h")
219 exec_program(dirname ARGS ${builtin} OUTPUT_VARIABLE builtin_dir)
220
221 add_custom_command(
222 OUTPUT ${builtin}
223 COMMAND    mkdir -p ${builtin_dir}
224 COMMAND    sh -c "echo '/* Auto generated by ${CMAKE_CURRENT_BUILD_DIR}/CMakeLists.txt */' > ${builtin}"
225 COMMAND    sh -c "echo 'int vlc_entry__main( module_t* );' >> ${builtin}"
226 COMMAND    sh -c "echo '#define ALLOCATE_ALL_BUILTINS() do {} while(0)' >> ${builtin}"
227 VERBATIM
228 )
229 set(should)
230
231 ##########################################################
232 # vlc_about.h
233 set(about "${CMAKE_BINARY_DIR}/include/vlc_about.h")
234 exec_program(dirname ARGS ${about} OUTPUT_VARIABLE about_dir)
235
236 add_custom_command(
237 OUTPUT ${about}
238 COMMAND rm -f "${about}.tmp"
239 COMMAND mkdir -p ${about_dir}
240 COMMAND sh -c "echo '/* Automatically generated file - DO NOT EDIT */' > ${about}.tmp"
241 COMMAND sh -c "echo 'static const char psz_license[] =' >> ${about}.tmp"
242 COMMAND sh -c "cat ${CMAKE_SOURCE_DIR}/COPYING | sed s/\\\"/''/g | awk '{ print \"\\\"\"$0\"\\\\n\\\"\" }' >> ${about}.tmp"
243 COMMAND sh -c "echo ';' >> ${about}.tmp"
244 COMMAND sh -c "echo 'static const char psz_thanks[] =' >> ${about}.tmp"
245 COMMAND sh -c "grep -v '$$Id:'  ${CMAKE_SOURCE_DIR}/THANKS | sed 's/\"/''/g' | awk '{ print  \"\\\"\"$0\"\\\\n\\\"\" }'|sed 's/\"<.*.> \"//' >> ${about}.tmp"
246 COMMAND sh -c "echo ';' >> ${about}.tmp"
247 COMMAND sh -c "echo 'static const char psz_authors[] =' >> ${about}.tmp"
248 COMMAND sh -c "grep N: ${CMAKE_SOURCE_DIR}/AUTHORS | cut -d '\ ' -f 2- | sed 's/\"/''/g' | awk '{ print  \"\\\"\"$0\"\\\\n\\\"\" }' >> ${about}.tmp"
249 COMMAND sh -c "echo ';' >> ${about}.tmp"
250 COMMAND sh -c "mv -f -- ${about}.tmp ${about}"
251 DEPENDS ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/THANKS ${CMAKE_SOURCE_DIR}/COPYING
252 VERBATIM
253 )
254 set(about)
255
256
257 ##########################################################
258 # SET_TARGET_PROPERTIES
259
260 # FIXME: Should probably be autodetected in configure?
261 if(NOT APPLE)
262    set(LINK_FLAGS "-z defs --as-needed")
263 endif(NOT APPLE)
264
265 target_link_libraries(libvlc "${CMAKE_THREAD_LIBS_INIT}")
266 target_link_libraries(libvlc-control "${CMAKE_THREAD_LIBS_INIT}")
267
268 set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS
269     "-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" )
270
271 ##########################################################
272 # Tests
273
274 add_executable(test_testapi    control/testapi.c)
275 add_executable(test_i18n_atof  test/i18n_atof.c)
276 add_executable(test_url        test/url.c)
277 add_executable(test_utf8       test/utf8.c)
278 add_executable(test_dictionary test/dictionary.c)
279
280 target_link_libraries(test_testapi    libvlc-control)
281 target_link_libraries(test_i18n_atof  libvlc)
282 target_link_libraries(test_url        libvlc)
283 target_link_libraries(test_utf8       libvlc)
284 target_link_libraries(test_dictionary libvlc)
285
286 add_test(test_control    ${CMAKE_CURRENT_BINARY_DIR}/test_testapi)
287 add_test(test_i18n_atof  ${CMAKE_CURRENT_BINARY_DIR}/test_i18n_atof)
288 add_test(test_url        ${CMAKE_CURRENT_BINARY_DIR}/test_url)
289 add_test(test_utf8       ${CMAKE_CURRENT_BINARY_DIR}/test_utf8)
290 add_test(test_dictionary ${CMAKE_CURRENT_BINARY_DIR}/test_dictionary)
291