]> git.sesse.net Git - vlc/commitdiff
cmake: FindLua and maintain an enabled module list.
authorPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 7 Feb 2008 16:38:55 +0000 (16:38 +0000)
committerPierre d'Herbemont <pdherbemont@videolan.org>
Thu, 7 Feb 2008 16:38:55 +0000 (16:38 +0000)
extras/buildsystem/cmake/include/FindLua.cmake [new file with mode: 0644]
extras/buildsystem/cmake/include/config.cmake
extras/buildsystem/cmake/include/vlc_module_funcs.cmake

diff --git a/extras/buildsystem/cmake/include/FindLua.cmake b/extras/buildsystem/cmake/include/FindLua.cmake
new file mode 100644 (file)
index 0000000..66ad660
--- /dev/null
@@ -0,0 +1,36 @@
+# - Find library containing Lua()
+# The following variables are set if Lua is found. If Lua is not
+# found, Lua_FOUND is set to false.
+#  Lua_FOUND     - System has Lua.
+#  Lua_LIBRARIES - Link these to use Lua.
+#  Lua_CFLAGS - Link these to use Lua.
+
+
+if (NOT Lua_SEARCHED)
+    include(CheckLibraryExists)
+
+    set(Lua_SEARCHED TRUE CACHE INTERNAL "")
+    set(Lua_FOUND FALSE CACHE INTERNAL "")
+
+    pkg_check_modules(Lua lua>=5.1)
+
+    if (NOT Lua_FOUND)
+        find_library( Lua_LIBRARY NAMES lua5.1 lua51 lua)
+        if (Lua_LIBRARY)
+              set(Lua_LIBRARIES "${Lua_LIBRARY}")
+              set(Lua_FOUND TRUE CACHE INTERNAL "")
+        endif (Lua_LIBRARY)
+    endif (NOT Lua_FOUND)
+
+    if (Lua_FOUND)
+      if (NOT Lua_FIND_QUIETLY)
+        message(STATUS "Found Lua in: ${Lua_LIBRARIES}")
+      endif (NOT Lua_FIND_QUIETLY)
+    else (Lua_FOUND)
+      if (Lua_FIND_REQUIRED)
+        message(FATAL_ERROR "Could not find the library containing Lua")
+      endif (Lua_FIND_REQUIRED)
+    endif (Lua_FOUND)
+
+    mark_as_advanced(Lua_LIBRARIES)
+endif(NOT Lua_SEARCHED)
index 9d4e9fec6632749228d6f3f9e0d554f2b072c89b..4d9d8b506a360c14512f7306bd392529d7c6ce7d 100644 (file)
@@ -136,7 +136,7 @@ if(APPLE)
     include( ${CMAKE_SOURCE_DIR}/cmake/vlc_find_frameworks.cmake )
 
     if(ENABLE_NO_SYMBOL_CHECK)
-        set(DYNAMIC_LOOKUP "-undefined dynamic_lookup" CACHE INTERNAL)
+        set(DYNAMIC_LOOKUP "-undefined dynamic_lookup" CACHE INTERNAL STRING)
     endif(ENABLE_NO_SYMBOL_CHECK)
     set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS
      "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} ${DYNAMIC_LOOKUP}")
@@ -188,9 +188,7 @@ if(APPLE)
         COMMAND cd ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx && xcodebuild -target vlc | grep -vE '^\([ \\t]|$$\)' && cd ../../../../ && cp ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Info.plist ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents && cp -R ${CMAKE_CURRENT_BINARY_DIR}/tmp/extras/package/macosx/build/Default/VLC.bundle/Contents/Resources/English.lproj ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources
         COMMAND cp -r ${CMAKE_CURRENT_SOURCE_DIR}/extras/package/macosx/Resources ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents
         COMMAND find -d ${CMAKE_CURRENT_BINARY_DIR}/VLC.app/Contents/Resources -type d -name \\.svn -exec rm -rf {} "\;"
-        COMMAND rm -rf ${MacOS}/modules ${MacOS}/locale
-        COMMAND mkdir ${MacOS}/modules
-        COMMAND rm -f ${MacOS}/share #remove the link if it exists
+        COMMAND rm -rf ${MacOS}/modules ${MacOS}/locale ${MacOS}/share
         COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR}/share ${MacOS}/share
         COMMAND ln -s ${CMAKE_CURRENT_BINARY_DIR}/modules ${MacOS}/modules
         COMMAND find ${CMAKE_BINARY_DIR}/po -name *.gmo -exec sh -c \"mkdir -p ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES\; ln -s {} ${MacOS}/locale/\\`basename {}|sed s/\\.gmo//\\`/LC_MESSAGES/vlc.mo\" "\;"
@@ -222,8 +220,6 @@ command_to_configvar( "${CMAKE_C_COMPILER} --version" CONFIGURE_LINE )
 set( VLC_COMPILER "${CMAKE_C_COMPILER}" )
 
 
-
-
 ###########################################################
 # Modules: Following are all listed in options
 ###########################################################
@@ -247,8 +243,6 @@ vlc_enable_modules(packetizer_mpeg4video packetizer_mpeg4audio)
 vlc_enable_modules(packetizer_vc1)
 vlc_enable_modules(spatializer)
 
-vlc_enable_modules(ffmpeg)
-
 if(NOT mingwce)
    set(enabled ON)
 endif(NOT mingwce)
@@ -289,8 +283,8 @@ if(ENABLE_CONTRIB)
   set( CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -L${CONTRIB_LIB}" )
   set( CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
   set( CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
-  set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS} -L${CONTRIB_LIB}" )
+  set( CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -L${CONTRIB_LIB}" )
   add_definitions(-I${CONTRIB_INCLUDE})
 endif(ENABLE_CONTRIB)
 
@@ -307,10 +301,21 @@ find_package(Dlopen)
 set(HAVE_DL_DLOPEN ${Dlopen_FOUND})
 
 find_package(FFmpeg)
-vlc_check_include_files (ffmpeg/avcodec.h)
-vlc_check_include_files (postproc/postprocess.h)
-vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS} )
-vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
+if(FFmpeg_FOUND)
+  vlc_check_include_files (ffmpeg/avcodec.h)
+  vlc_check_include_files (postproc/postprocess.h)
+  vlc_enable_modules(ffmpeg)
+  vlc_add_module_compile_flag(ffmpeg ${FFmpeg_CFLAGS} )
+  vlc_module_add_link_libraries(ffmpeg ${FFmpeg_LIBRARIES})
+endif(FFmpeg_FOUND)
+
+find_package(Lua)
+if(Lua_FOUND)
+  set(HAVE_LUA TRUE)
+  vlc_enable_modules(lua)
+  vlc_add_module_compile_flag(lua ${Lua_CFLAGS} )
+  vlc_module_add_link_libraries(lua ${Lua_LIBRARIES})
+endif(Lua_FOUND)
 
 set(CMAKE_REQUIRED_INCLUDES)
 
index a66c7b69ce667b4238b7a6840cf912729f396e3c..3ea7846e1a72bcdd592d36223adce7c1979109c5 100644 (file)
@@ -15,9 +15,14 @@ MACRO(vlc_add_module module_name)
     endif(ENABLE_VLC_MODULE_${module_name})
 ENDMACRO(vlc_add_module)
 
-MACRO(vlc_register_modules state)
+MACRO(vlc_register_modules module_state)
     foreach( module_name ${ARGN} )
-        OPTION( ENABLE_VLC_MODULE_${module_name} "Enable the ${module_name} module" ${state} )
+        set( STATE module_state)
+        if(STATE)
+            set(VLC_ENABLED_MODULES_LIST ${VLC_ENABLED_MODULES_LIST} ${module_name}_plugin)
+        else(STATE)
+        endif(STATE)
+        OPTION( ENABLE_VLC_MODULE_${module_name} "Enable the ${module_name} module" ${module_state} )
     endforeach( module_name )
 ENDMACRO(vlc_register_modules)