hedgewars/CMakeLists.txt
changeset 7628 bc7b1d228a2c
parent 7622 172fb1c7615b
child 7653 6dda2562f692
--- a/hedgewars/CMakeLists.txt	Thu Aug 30 12:47:41 2012 -0400
+++ b/hedgewars/CMakeLists.txt	Thu Aug 30 13:02:19 2012 -0400
@@ -3,6 +3,7 @@
 find_package(SDL_net)
 find_package(SDL_ttf)
 find_package(SDL_mixer)
+find_package(FFMPEG)
 
 include(${CMAKE_MODULE_PATH}/FindSDL_Extras.cmake)
 
@@ -33,7 +34,9 @@
     uGame.pas
     uGears.pas
     uGearsHandlers.pas
+    uGearsHandlersRope.pas
     uGearsRender.pas
+    uGearsUtils.pas
     uIO.pas
     uInputHandler.pas
     uLand.pas
@@ -60,6 +63,7 @@
     uTypes.pas
     uUtils.pas
     uVariables.pas
+    uVideoRec.pas
     uVisualGears.pas
     uWorld.pas
     GSHandlers.inc
@@ -183,9 +187,31 @@
     message(STATUS "PNG screenshots disabled per user request, using BMP format")
 endif()
 
+if(NOT NO_VIDEOREC)
+    if(${FFMPEG_FOUND})
+        message(STATUS "Compiling with video recording")
+        include_directories(${FFMPEG_INCLUDE_DIR})
+        set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
+        set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
+        IF (WIN32)
+            # there are some problems with linking our avwrapper as static lib, so link it as shared
+            add_library(avwrapper SHARED avwrapper.c)
+            target_link_libraries(avwrapper ${FFMPEG_LIBRARIES})
+            install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avwrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION ${target_dir})
+        ELSE()
+            add_library(avwrapper STATIC avwrapper.c)
+            set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags})
+         #   set(pascal_flags "-k${LIBRARY_OUTPUT_PATH}/${CMAKE_STATIC_LIBRARY_PREFIX}avwrapper${CMAKE_STATIC_LIBRARY_SUFFIX}" ${pascal_flags})
+        ENDIF()
+    else()
+        message(STATUS "FFMPEG library not found, video recording will be disabled")
+    endif()
+else()
+    message(STATUS "Video recording disabled by user")
+endif()
+
 set(fpc_flags ${noexecstack_flags} ${pascal_flags} ${hwengine_project})
 
-
 IF(NOT APPLE)
     #here is the command for standard executables or for shared library
     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
@@ -225,10 +251,9 @@
 #this command is a workaround to some inlining issues present in older
 # FreePascal versions and fixed in 2.6, That version is mandatory on OSX,
 # hence the command is not needed there
-if(NOT APPLE)
-    add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
-    add_dependencies(${engine_output_name} ENGINECLEAN)
-endif()
+# if(NOT APPLE)
+#    add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
+#    add_dependencies(${engine_output_name} ENGINECLEAN)
+# endif()
 
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
-