cmake: fix src/ building
authorRafaël Carré <funman@videolan.org>
Sun, 18 May 2008 14:20:29 +0000 (16:20 +0200)
committerRafaël Carré <funman@videolan.org>
Sun, 18 May 2008 14:20:29 +0000 (16:20 +0200)
extras/buildsystem/cmake/CMakeLists/src_CMakeLists.txt

index 31c0fa2..b2a5a8e 100644 (file)
@@ -1,21 +1,24 @@
 
 add_definitions(-Dasm=__asm__ -D_INTL_REDIRECT_MACROS)
 add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/locale")
+add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_PREFIX}/etc")
 add_definitions(-DPLUGIN_PATH="${CMAKE_INSTALL_PREFIX}/lib/vlc")
 add_definitions(-DDATA_PATH="${CMAKE_INSTALL_PREFIX}/share/vlc")
 
 # vlc
 add_executable(vlc vlc.c)
-target_link_libraries(vlc libvlc)
-
-# libvlc
-
-set( SOURCES_libvlc_beos misc/beos_specific.cpp )
-set( SOURCES_libvlc_darwin misc/darwin_specific.c )
-set( SOURCES_libvlc_win32 misc/win32_specific.c )
-set( SOURCES_libvlc_dirent extras/dirent.c )
-set( SOURCES_libvlc_getopt misc/getopt.c misc/getopt.h misc/getopt1.c )
-set( SOURCES_libvlc_common
+target_link_libraries(vlc libvlccore general libvlc)
+
+# libvlccore
+
+set( SOURCES_libvlccore_beos misc/beos_specific.cpp )
+set( SOURCES_libvlccore_darwin misc/darwin_specific.c )
+set( SOURCES_libvlccore_win32 misc/win32_specific.c )
+set( SOURCES_libvlccore_linux misc/linux_specific.c )
+set( SOURCES_libvlccore_other misc/not_specific.c )
+set( SOURCES_libvlccore_dirent extras/dirent.c )
+set( SOURCES_libvlccore_getopt misc/getopt.c misc/getopt.h misc/getopt1.c )
+set( SOURCES_libvlccore_common
     libvlc.c
     libvlc-common.c
     libvlc.h
@@ -118,31 +121,41 @@ set( SOURCES_libvlc_common
     misc/update.c
     ${CMAKE_BINARY_DIR}/src/misc/revision.c
     input/vlm.c
+    input/vlmshell.c
     misc/xml.c
     misc/devices.c
     extras/libc.c
     ${CMAKE_BINARY_DIR}/include/vlc_about.h )
 
-set( SOURCES_libvlc ${SOURCES_libvlc_common} )
+set( SOURCES_libvlccore ${SOURCES_libvlccore_common} )
 
 if(SYS_DARWIN)
-    set( SOURCES_libvlc ${SOURCES_libvlc} ${SOURCES_libvlc_darwin} )
+    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_darwin} )
+elseif(SYS_BEOS)
+    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_beos} )
+elseif(SYS_WIN32)
+    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_win32} )
+elseif(SYS_LINUX)
+    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_linux} )
+else(SYS_DARWIN)
+    set( SOURCES_libvlccore ${SOURCES_libvlccore} ${SOURCES_libvlccore_other} )
 endif(SYS_DARWIN)
 
-add_library(libvlc SHARED ${SOURCES_libvlc})
 
-set_target_properties(libvlc PROPERTIES
+add_library(libvlccore SHARED ${SOURCES_libvlccore})
+
+set_target_properties(libvlccore PROPERTIES
         OUTPUT_NAME vlc
         SOVERSION 1 VERSION 1.0.0)
 
 if(UPDATE_CHECK)
-target_link_libraries(libvlc ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES} "-lgcrypt")
+target_link_libraries(libvlccore ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES} "-lgcrypt")
 else(UPDATE_CHECK)
-target_link_libraries(libvlc ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES})
+target_link_libraries(libvlccore ${LIBM} ${LIBRT} ${LIBICONV} ${Dlopen_LIBRARIES})
 endif(UPDATE_CHECK)
 
-# libvlc-control
-set( SOURCES_libvlc_control
+# libvlc
+set( SOURCES_libvlc
      control/libvlc_internal.h
      control/core.c
      control/log.c
@@ -167,18 +180,21 @@ set( SOURCES_libvlc_control
      control/mediacontrol_audio_video.c
      control/media_discoverer.c )
 
-add_library(libvlc-control SHARED ${SOURCES_libvlc_control})
+add_library(libvlc SHARED ${SOURCES_libvlc})
+
+set_target_properties(libvlc PROPERTIES OUTPUT_NAME vlc)
+set_target_properties(libvlc PROPERTIES SOVERSION 0)
+set_target_properties(libvlccore PROPERTIES VERSION 0.0.0)
 
-set_target_properties(libvlc-control PROPERTIES OUTPUT_NAME vlc-control)
-set_target_properties(libvlc-control PROPERTIES SOVERSION 0)
-set_target_properties(libvlc PROPERTIES VERSION 0.0.0)
+set_source_files_properties(${SOURCES_libvlc} PROPERTIES COMPILE_FLAGS -DMODULE_STRING=\\"control\\")
+set_source_files_properties(${SOURCES_libvlccore} PROPERTIES COMPILE_FLAGS -DMODULE_STRING=\\"main\\")
 
-target_link_libraries(libvlc-control libvlc)
+target_link_libraries(libvlc libvlccore)
 
 ##########################################################
 # Install
 
-install(TARGETS libvlc libvlc-control DESTINATION lib)
+install(TARGETS libvlccore libvlc DESTINATION lib)
 install(TARGETS vlc DESTINATION bin)
 
 ##########################################################
@@ -187,7 +203,7 @@ install(TARGETS vlc DESTINATION bin)
 # Carbon
 if(APPLE)
   find_library(CARBON_FRAMEWORK Carbon)
-  target_link_libraries(libvlc ${CARBON_FRAMEWORK})
+  target_link_libraries(libvlccore ${CARBON_FRAMEWORK})
 endif(APPLE)
 
 ##########################################################
@@ -202,7 +218,7 @@ COMMAND    rm -f ${rev} ${rev}.tmp
 COMMAND    mkdir -p ${rev_dir}
 COMMAND    sh -c "echo '/* AUTOGENERATED FILE - DO NOT EDIT */' > ${rev}.tmp"
 COMMAND    sh -c "printf 'const char psz_vlc_changeset[] = \"' >> ${rev}.tmp"
-COMMAND    sh -c "printf `LANG=C svnversion ${CMAKE_SOURCE_DIR} || printf \"exported\"` >> ${rev}.tmp"
+COMMAND    sh -c "printf `LANG=C git --git-dir=${CMAKE_SOURCE_DIR}/.git show-ref -s HEAD 2>/dev/null || printf exported` >> ${rev}.tmp"
 COMMAND    sh -c "echo '\";' >> ${rev}.tmp"
 COMMAND    mv -f ${rev}.tmp ${rev}
 VERBATIM
@@ -256,14 +272,15 @@ set(about)
 # SET_TARGET_PROPERTIES
 
 # FIXME: Should probably be autodetected in configure?
-if(NOT APPLE)
-   set(LINK_FLAGS "-z defs --as-needed")
-endif(NOT APPLE)
+# FIXME: This breaks on FreeBSD also
+#if(NOT APPLE)
+#   set(LINK_FLAGS "-z defs --as-needed")
+#endif(NOT APPLE)
 
+target_link_libraries(libvlccore "${CMAKE_THREAD_LIBS_INIT}")
 target_link_libraries(libvlc "${CMAKE_THREAD_LIBS_INIT}")
-target_link_libraries(libvlc-control "${CMAKE_THREAD_LIBS_INIT}")
 
-set_target_properties(libvlc libvlc-control vlc PROPERTIES COMPILE_FLAGS
+set_target_properties(libvlccore libvlc vlc PROPERTIES COMPILE_FLAGS
     "-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" )
 
 ##########################################################
@@ -274,10 +291,10 @@ add_executable(test_url        test/url.c)
 add_executable(test_utf8       test/utf8.c)
 add_executable(test_dictionary test/dictionary.c)
 
-target_link_libraries(test_i18n_atof  libvlc)
-target_link_libraries(test_url        libvlc)
-target_link_libraries(test_utf8       libvlc)
-target_link_libraries(test_dictionary libvlc)
+target_link_libraries(test_i18n_atof  libvlccore)
+target_link_libraries(test_url        libvlccore)
+target_link_libraries(test_utf8       libvlccore)
+target_link_libraries(test_dictionary libvlccore)
 
 add_test(test_i18n_atof  ${CMAKE_CURRENT_BINARY_DIR}/test_i18n_atof)
 add_test(test_url        ${CMAKE_CURRENT_BINARY_DIR}/test_url)