cmake: Don't use tabs and generate revision.c builtin.h vlc_about.h in the build...
[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_targets(/bin 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     ${CMAKE_BINARY_DIR}/src/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     ${CMAKE_BINARY_DIR}/src/misc/revision.c
123     input/vlm.c
124     misc/xml.c
125     misc/devices.c
126     extras/libc.c
127     ${CMAKE_BINARY_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 # libvlc-control
139 set( SOURCES_libvlc_control
140      control/libvlc_internal.h
141      control/core.c
142      control/log.c
143      control/playlist.c
144      control/vlm.c
145      control/video.c
146      control/audio.c
147      control/dynamic_media_list.c
148      control/event.c
149      control/flat_media_list_view.c
150      control/hierarchical_media_list_view.c
151      control/hierarchical_node_media_list_view.c
152      control/media_descriptor.c
153      control/media_instance.c
154      control/media_list.c
155      control/media_list_path.h
156      control/media_list_player.c
157      control/media_list_view.c
158      control/media_library.c
159      control/mediacontrol_internal.h
160      control/mediacontrol_core.c
161      control/mediacontrol_util.c
162      control/mediacontrol_audio_video.c
163      control/media_discoverer.c
164      control/tag_query.c )
165
166 add_library(libvlc-control SHARED ${SOURCES_libvlc_control})
167 install_targets(/lib libvlc-control)
168 target_link_libraries(libvlc-control libvlc)
169
170 ##########################################################
171 # Libraries
172
173 # iconv
174 target_link_libraries(libvlc ${LIBICONV})
175
176 # Carbon
177 if(APPLE)
178   find_library(CARBON_FRAMEWORK Carbon)
179   target_link_libraries(libvlc ${CARBON_FRAMEWORK})
180 endif(APPLE)
181
182 ##########################################################
183 # revision.c
184
185 set(rev "${CMAKE_BINARY_DIR}/src/misc/revision.c")
186 add_custom_command(
187 OUTPUT ${rev}
188 COMMAND    rm -f ${rev} ${rev}.tmp
189 COMMAND    mkdir -p `dirname ${rev}`
190 COMMAND    echo "/* AUTOGENERATED FILE - DO NOT EDIT */" > ${rev}.tmp
191 COMMAND    printf "const char psz_vlc_changeset[] = \"" >> ${rev}.tmp
192 COMMAND    sh -c "printf `LANG=C svnversion ${CMAKE_SOURCE_DIR} || printf \"exported\"`" >> ${rev}.tmp
193 COMMAND    echo "\";" >> ${rev}.tmp
194 COMMAND    mv -f ${rev}.tmp ${rev}
195 VERBATIM
196 )
197 set(rev)
198
199 ##########################################################
200 # builtin.h
201 # No real use for this one, we just used to need it.
202 # We should really remove that.
203 set(builtin "${CMAKE_BINARY_DIR}/src/modules/builtin.h")
204
205 add_custom_command(
206 OUTPUT ${builtin}
207 COMMAND    mkdir -p `dirname ${builtin}`
208 COMMAND    echo "/* Auto generated by ${CMAKE_CURRENT_BUILD_DIR}/CMakeLists.txt */" > ${builtin}
209 COMMAND    echo "int vlc_entry__main( module_t* );" >> ${builtin}
210 COMMAND    echo "#define ALLOCATE_ALL_BUILTINS() do {} while(0)" >> ${builtin}
211 VERBATIM
212 )
213 set(should)
214
215 ##########################################################
216 # vlc_about.h
217 set(about "${CMAKE_BINARY_DIR}/include/vlc_about.h")
218
219 add_custom_command(
220 OUTPUT ${about}
221 COMMAND rm -f -- "${about}.tmp"
222 COMMAND    mkdir -p `dirname ${about}`
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 ##########################################################
241 # SET_TARGET_PROPERTIES
242
243 # FIXME: Should probably be autodetected in configure?
244 if(NOT APPLE)
245    set(LINK_FLAGS "-z defs --as-needed")
246 endif(NOT APPLE)
247
248 target_link_libraries(libvlc ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES})
249 target_link_libraries(libvlc ${LIBM})
250
251 set_target_properties(libvlc PROPERTIES SOVERSION 1.0.0)
252 set_target_properties(libvlc libvlc-control PROPERTIES PREFIX "")
253 set_target_properties(libvlc libvlc-control PROPERTIES LINK_FLAGS "${LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
254 set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS
255     "-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" )