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