cmake: Default to RelWithDebugInfo.
[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 set_target_properties(libvlc PROPERTIES OUTPUT_NAME vlc)
139 set_target_properties(libvlc PROPERTIES SOVERSION 1)
140 set_target_properties(libvlc PROPERTIES VERSION 1.0.0)
141
142 target_link_libraries(libvlc ${LIBM})
143 target_link_libraries(libvlc ${LIBRT})
144 target_link_libraries(libvlc ${LIBICONV})
145 target_link_libraries(libvlc ${Dlopen_LIBRARIES})
146
147
148 # libvlc-control
149 set( SOURCES_libvlc_control
150      control/libvlc_internal.h
151      control/core.c
152      control/log.c
153      control/playlist.c
154      control/vlm.c
155      control/video.c
156      control/audio.c
157      control/dynamic_media_list.c
158      control/event.c
159      control/flat_media_list_view.c
160      control/hierarchical_media_list_view.c
161      control/hierarchical_node_media_list_view.c
162      control/media_descriptor.c
163      control/media_instance.c
164      control/media_list.c
165      control/media_list_path.h
166      control/media_list_player.c
167      control/media_list_view.c
168      control/media_library.c
169      control/mediacontrol_internal.h
170      control/mediacontrol_core.c
171      control/mediacontrol_util.c
172      control/mediacontrol_audio_video.c
173      control/media_discoverer.c
174      control/tag_query.c )
175
176 add_library(libvlc-control SHARED ${SOURCES_libvlc_control})
177 install_targets(/lib libvlc-control)
178
179 set_target_properties(libvlc-control PROPERTIES OUTPUT_NAME vlc-control)
180 set_target_properties(libvlc-control PROPERTIES SOVERSION 0)
181 set_target_properties(libvlc PROPERTIES VERSION 0.0.0)
182
183 target_link_libraries(libvlc-control libvlc)
184
185 ##########################################################
186 # Libraries
187
188 # Carbon
189 if(APPLE)
190   find_library(CARBON_FRAMEWORK Carbon)
191   target_link_libraries(libvlc ${CARBON_FRAMEWORK})
192 endif(APPLE)
193
194 ##########################################################
195 # revision.c
196
197 set(rev "${CMAKE_BINARY_DIR}/src/misc/revision.c")
198 add_custom_command(
199 OUTPUT ${rev}
200 COMMAND    rm -f ${rev} ${rev}.tmp
201 COMMAND    mkdir -p `dirname ${rev}`
202 COMMAND    echo "/* AUTOGENERATED FILE - DO NOT EDIT */" > ${rev}.tmp
203 COMMAND    printf "const char psz_vlc_changeset[] = \"" >> ${rev}.tmp
204 COMMAND    sh -c "printf `LANG=C svnversion ${CMAKE_SOURCE_DIR} || printf \"exported\"`" >> ${rev}.tmp
205 COMMAND    echo "\";" >> ${rev}.tmp
206 COMMAND    mv -f ${rev}.tmp ${rev}
207 VERBATIM
208 )
209 set(rev)
210
211 ##########################################################
212 # builtin.h
213 # No real use for this one, we just used to need it.
214 # We should really remove that.
215 set(builtin "${CMAKE_BINARY_DIR}/src/modules/builtin.h")
216
217 add_custom_command(
218 OUTPUT ${builtin}
219 COMMAND    mkdir -p `dirname ${builtin}`
220 COMMAND    echo "/* Auto generated by ${CMAKE_CURRENT_BUILD_DIR}/CMakeLists.txt */" > ${builtin}
221 COMMAND    echo "int vlc_entry__main( module_t* );" >> ${builtin}
222 COMMAND    echo "#define ALLOCATE_ALL_BUILTINS() do {} while(0)" >> ${builtin}
223 VERBATIM
224 )
225 set(should)
226
227 ##########################################################
228 # vlc_about.h
229 set(about "${CMAKE_BINARY_DIR}/include/vlc_about.h")
230
231 add_custom_command(
232 OUTPUT ${about}
233 COMMAND rm -f -- "${about}.tmp"
234 COMMAND    mkdir -p `dirname ${about}`
235 COMMAND mkdir -p -- ../include
236 COMMAND echo "/* Automatically generated file - DO NOT EDIT */" > "${about}.tmp"
237 COMMAND echo "static const char psz_license[] =" >> "${about}.tmp"
238 COMMAND cat ${CMAKE_SOURCE_DIR}/COPYING | sed s/\"/''/g | awk "{ print \"\\\"\"$0\"\\\\n\\\"\" }" >> "${about}.tmp"
239 COMMAND echo ";" >> "${about}.tmp"
240 COMMAND echo "static const char psz_thanks[] =" >> "${about}.tmp"
241 COMMAND grep -v '$$Id:'  ${CMAKE_SOURCE_DIR}/THANKS | sed "s/\"/''/g" | awk "{ print  \"\\\"\"$0\"\\\\n\\\"\" }"|sed "s/\"<.*.> \"//" >> "${about}.tmp"
242 COMMAND echo ";" >> "${about}.tmp"
243 COMMAND echo "static const char psz_authors[] =" >> "${about}.tmp"
244 COMMAND grep N: ${CMAKE_SOURCE_DIR}/AUTHORS | cut -d "\ " -f 2- | sed "s/\"/''/g" | awk "{ print  \"\\\"\"$0\"\\\\n\\\"\" }" >> "${about}.tmp"
245 COMMAND echo ";" >> "${about}.tmp"
246 COMMAND mv -f -- "${about}.tmp" "${about}"
247 DEPENDS ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/THANKS ${CMAKE_SOURCE_DIR}/COPYING
248 VERBATIM)
249 set(about)
250
251
252 ##########################################################
253 # SET_TARGET_PROPERTIES
254
255 # FIXME: Should probably be autodetected in configure?
256 if(NOT APPLE)
257    set(LINK_FLAGS "-z defs --as-needed")
258 endif(NOT APPLE)
259
260 set_target_properties(libvlc libvlc-control PROPERTIES LINK_FLAGS "${LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}")
261 set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS
262     "-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" )
263
264 ##########################################################
265 # Tests
266
267 add_executable(testapi   control/testapi.c)
268 add_executable(i18n_atof test/i18n_atof.c)
269 add_executable(url       test/url.c)
270 add_executable(utf8      test/utf8.c)
271
272 target_link_libraries(testapi   libvlc-control)
273 target_link_libraries(i18n_atof libvlc)
274 target_link_libraries(url       libvlc)
275 target_link_libraries(utf8      libvlc)
276
277 add_test(testapi   ${EXECUTABLE_OUTPUT_PATH}/testapi)
278 add_test(i18n_atof ${EXECUTABLE_OUTPUT_PATH}/i18n_atof)
279 add_test(url       ${EXECUTABLE_OUTPUT_PATH}/url)
280 add_test(utf8      ${EXECUTABLE_OUTPUT_PATH}/utf8)