44f12cdeb8262bc10b68519983ab85801b0519ad
[vlc.git] / extras / buildsystem / cmake / CMakeLists / src_CMakeLists.txt
1 include_directories( . )
2
3 add_definitions(-Dasm=__asm__ -D_INTL_REDIRECT_MACROS)
4 add_definitions(-DLOCALEDIR=\\"${CMAKE_INSTALL_PREFIX}/locale\\")
5 add_definitions(-DDATA_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/vlc\\")
6 add_definitions(-DPLUGIN_PATH=\\"${CMAKE_INSTALL_PREFIX}/lib/vlc\\")
7
8 # vlc
9 add_executable(vlc vlc.c)
10 target_link_libraries(vlc libvlc)
11
12 install_programs(/bin FILES vlc)
13
14 # libvlc
15
16 set( SOURCES_libvlc_beos misc/beos_specific.cpp )
17 set( SOURCES_libvlc_darwin misc/darwin_specific.c )
18 set( SOURCES_libvlc_win32 misc/win32_specific.c )
19 set( SOURCES_libvlc_dirent extras/dirent.c )
20 set( SOURCES_libvlc_getopt misc/getopt.c misc/getopt.h misc/getopt1.c )
21 set( SOURCES_libvlc_common
22     libvlc.c
23         libvlc-common.c
24         libvlc.h
25         libvlc-module.c
26         interface/interface.h
27         interface/interface.c
28         interface/intf_eject.c
29         interface/interaction.c
30         playlist/playlist_internal.h
31         playlist/thread.c
32         playlist/control.c
33         playlist/engine.c
34         playlist/sort.c
35         playlist/loadsave.c
36         playlist/tree.c
37         playlist/item.c
38         playlist/search.c
39         playlist/services_discovery.c
40         input/item.c
41         input/access.c
42         input/clock.c
43         input/control.c
44         input/decoder.c
45         input/decoder_synchro.c
46         input/demux.c
47         input/es_out.c
48         input/input.c
49         input/meta.c
50         input/input_internal.h
51         input/vlm_internal.h
52         input/stream.c
53         input/mem_stream.c
54         input/subtitles.c
55         input/var.c
56         video_output/video_output.c
57         video_output/vout_pictures.c
58         video_output/vout_pictures.h
59         video_output/video_text.c
60         video_output/video_widgets.c
61         video_output/vout_subpictures.c
62         video_output/vout_intf.c
63         audio_output/aout_internal.h
64         audio_output/common.c
65         audio_output/dec.c
66         audio_output/filters.c
67         audio_output/input.c
68         audio_output/mixer.c
69         audio_output/output.c
70         audio_output/intf.c
71         stream_output/stream_output.c
72         stream_output/stream_output.h
73         stream_output/announce.c
74         stream_output/profiles.c
75         stream_output/sap.c
76         stream_output/sdp.c
77         osd/osd.c
78         osd/osd_text.c
79         osd/osd_widgets.c
80         network/acl.c
81         network/getaddrinfo.c
82         network/io.c
83         network/error.c
84         network/tcp.c
85         network/udp.c
86         network/httpd.c
87         network/rootwrap.c
88         network/tls.c
89         network/poll.c
90         text/charset.c
91         text/strings.c
92         text/unicode.c
93         text/wincp.c
94         text/iso_lang.c
95         text/iso-639_def.h
96         misc/md5.c
97         misc/rand.c
98         misc/mtime.c
99         misc/block.c
100         modules/builtin.h
101         modules/modules.h
102         modules/modules.c
103         modules/cache.c
104         modules/entry.c
105         modules/os.c
106         misc/threads.c
107         misc/stats.c
108         misc/cpu.c
109         config/configuration.h
110         config/core.c
111         config/chain.c
112         config/file.c
113         config/cmdline.c
114         misc/events.c
115         misc/image.c
116         misc/messages.c
117         misc/objects.c
118         misc/variables.h
119         misc/variables.c
120         misc/error.c
121         misc/update.c
122         misc/revision.c
123         input/vlm.c
124         misc/xml.c
125         misc/devices.c
126         extras/libc.c
127     ${CMAKE_SOURCE_DIR}/include/vlc_about.h )
128
129 set( SOURCES_libvlc ${SOURCES_libvlc_common} )
130
131 if(SYS_DARWIN)
132     set( SOURCES_libvlc ${SOURCES_libvlc} ${SOURCES_libvlc_darwin} )
133 endif(SYS_DARWIN)
134
135 add_library(libvlc SHARED ${SOURCES_libvlc})
136 install_targets(/lib libvlc)
137
138
139 # libvlc-control
140 set( SOURCES_libvlc_control
141      control/libvlc_internal.h
142      control/core.c
143      control/log.c
144      control/playlist.c
145      control/vlm.c
146      control/video.c
147      control/audio.c
148      control/dynamic_media_list.c
149      control/event.c
150      control/flat_media_list_view.c
151      control/hierarchical_media_list_view.c
152      control/hierarchical_node_media_list_view.c
153      control/media_descriptor.c
154      control/media_instance.c
155      control/media_list.c
156      control/media_list_path.h
157      control/media_list_player.c
158      control/media_list_view.c
159      control/media_library.c
160      control/mediacontrol_internal.h
161      control/mediacontrol_core.c
162      control/mediacontrol_util.c
163      control/mediacontrol_audio_video.c
164      control/media_discoverer.c
165      control/tag_query.c )
166
167 add_library(libvlc-control SHARED ${SOURCES_libvlc_control})
168 install_targets(/lib libvlc-control)
169 target_link_libraries(libvlc-control libvlc)
170
171 ##########################################################
172 # Libraries
173
174 # iconv
175 target_link_libraries(libvlc ${HAVE_ICONV})
176
177 # Carbon
178 if(APPLE)
179   find_library(CARBON_FRAMEWORK Carbon)
180   target_link_libraries(libvlc ${CARBON_FRAMEWORK})
181 endif(APPLE)
182
183 target_link_libraries(libvlc ${Dlopen_LIBRARY})
184
185 ##########################################################
186 # revision.c
187
188 set(rev "${CMAKE_CURRENT_SOURCE_DIR}/misc/revision.c")
189 add_custom_command(
190 OUTPUT ${rev}
191 COMMAND rm -f ${rev} ${rev}.tmp
192 COMMAND echo "/* AUTOGENERATED FILE - DO NOT EDIT */" > ${rev}.tmp
193 COMMAND printf "const char psz_vlc_changeset[] = \"" >> ${rev}.tmp
194 COMMAND sh -c "echo `LANG=C\ svnversion\ ${CMAKE_SOURCE_DIR}\ ||\ echo\ exported`" >> ${rev}.tmp
195 COMMAND echo "\";" >> ${rev}.tmp
196 COMMAND mv -f ${rev}.tmp ${rev}
197 VERBATIM
198 )
199 set(rev)
200
201 ##########################################################
202 # builtin.h
203 # No real use for this one, we just used to need it.
204 # We should really remove that.
205 set(builtin "${CMAKE_CURRENT_SOURCE_DIR}/modules/builtin.h")
206
207 add_custom_command(
208 OUTPUT ${builtin}
209 COMMAND echo "/* Auto generated by ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt */" > ${builtin}
210 COMMAND echo "int vlc_entry__main( module_t* );" >> ${builtin}
211 COMMAND echo "#define ALLOCATE_ALL_BUILTINS() do {} while(0)" >> ${builtin}
212 VERBATIM
213 )
214 set(should)
215
216 ##########################################################
217 # vlc_about.h
218 set(about "${CMAKE_SOURCE_DIR}/include/vlc_about.h")
219
220 add_custom_command(
221 OUTPUT ${about}
222 COMMAND rm -f -- "${about}.tmp"
223 COMMAND mkdir -p -- ../include
224 COMMAND echo "/* Automatically generated file - DO NOT EDIT */" > "${about}.tmp"
225 COMMAND echo "static const char psz_license[] =" >> "${about}.tmp"
226 COMMAND cat ${CMAKE_SOURCE_DIR}/COPYING | sed s/\"/''/g | awk "{ print \"\\\"\"$0\"\\\\n\\\"\" }" >> "${about}.tmp"
227 COMMAND echo ";" >> "${about}.tmp"
228 COMMAND echo "static const char psz_thanks[] =" >> "${about}.tmp"
229 COMMAND grep -v '$$Id:'  ${CMAKE_SOURCE_DIR}/THANKS | sed "s/\"/''/g" | awk "{ print  \"\\\"\"$0\"\\\\n\\\"\" }"|sed "s/\"<.*.> \"//" >> "${about}.tmp"
230 COMMAND echo ";" >> "${about}.tmp"
231 COMMAND echo "static const char psz_authors[] =" >> "${about}.tmp"
232 COMMAND grep N: ${CMAKE_SOURCE_DIR}/AUTHORS | cut -d "\ " -f 2- | sed "s/\"/''/g" | awk "{ print  \"\\\"\"$0\"\\\\n\\\"\" }" >> "${about}.tmp"
233 COMMAND echo ";" >> "${about}.tmp"
234 COMMAND mv -f -- "${about}.tmp" "${about}"
235 DEPENDS ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/THANKS ${CMAKE_SOURCE_DIR}/COPYING
236 VERBATIM)
237 set(about)
238
239 ##########################################################
240 # SET_TARGET_PROPERTIES
241
242 set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS
243     "-Wall -Wextra -Wsign-compare -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wmissing-prototypes" )