Attempt to allow building video recording in pas2c mode, currently fails parsing
authorunc0rr
Sun, 16 Dec 2018 18:40:25 +0100
changeset 14461 9844450389a4
parent 14460 3897da404301
child 14462 4c743ef80b1b
Attempt to allow building video recording in pas2c mode, currently fails parsing
CMakeLists.txt
hedgewars/uVideoRec.pas
project_files/hwc/CMakeLists.txt
--- a/CMakeLists.txt	Sun Dec 16 10:42:50 2018 -0500
+++ b/CMakeLists.txt	Sun Dec 16 18:40:25 2018 +0100
@@ -72,9 +72,6 @@
 if("${CMAKE_SIZEOF_VOID_P}" EQUAL "4" AND UNIX AND NOT APPLE)
     set(BUILD_ENGINE_C ON CACHE STRING "PAS2C force-enabled due to a freepascal 32 bit alignment bug" FORCE)
 endif()
-if(BUILD_ENGINE_C)
-    set(NOVIDEOREC ON CACHE STRING "PAS2C does not support video recording at present" FORCE)
-endif()
 
 #system paths for finding required fonts (see share/hedgewars/Data/fonts)
 #subdirectories will NOT be searched.
--- a/hedgewars/uVideoRec.pas	Sun Dec 16 10:42:50 2018 -0500
+++ b/hedgewars/uVideoRec.pas	Sun Dec 16 18:40:25 2018 +0100
@@ -36,7 +36,7 @@
 var flagPrerecording: boolean = false;
 
 function BeginVideoRecording: Boolean;
-function LoadNextCameraPosition(out newRealTicks, newGameTicks: LongInt): Boolean;
+function LoadNextCameraPosition(var newRealTicks, newGameTicks: LongInt): Boolean;
 procedure EncodeFrame;
 procedure StopVideoRecording;
 
@@ -190,7 +190,7 @@
     inc(numFrames);
 end;
 
-function LoadNextCameraPosition(out newRealTicks, newGameTicks: LongInt): Boolean;
+function LoadNextCameraPosition(var newRealTicks, newGameTicks: LongInt): Boolean;
 var frame: TFrame = (realTicks: 0; gameTicks: 0; CamX: 0; CamY: 0; zoom: 0);
 begin
     // we need to skip or duplicate frames to match target framerate
--- a/project_files/hwc/CMakeLists.txt	Sun Dec 16 10:42:50 2018 -0500
+++ b/project_files/hwc/CMakeLists.txt	Sun Dec 16 18:40:25 2018 +0100
@@ -32,7 +32,6 @@
 
 #get the list of pas files that are going to be converted and compiled
 file(GLOB engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/*.pas")
-list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/uVideoRec.pas")
 list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/uTouch.pas")
 list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/PNGh.pas")
 list(REMOVE_ITEM engine_sources_pas "${CMAKE_SOURCE_DIR}/hedgewars/pas2cSystem.pas")
@@ -73,6 +72,12 @@
     set(pas2c_args ${pas2c_args} -d GL2)
 endif()
 
+if(LIBAV_FOUND)
+    add_subdirectory(${CMAKE_SOURCE_DIR}/hedgewars/avwrapper ${CMAKE_CURRENT_BINARY_DIR}/avwrapper)
+    list(APPEND HW_LINK_LIBS avwrapper)
+    set(pas2c_args ${pas2c_args} -d USE_VIDEO_RECORDING)
+endif()
+
 #invoke pas2c on main module, it will call all the others
 add_custom_command(OUTPUT ${engine_sources}
                    COMMAND "${EXECUTABLE_OUTPUT_PATH}/pas2c${CMAKE_EXECUTABLE_SUFFIX}"
@@ -111,6 +116,7 @@
                                 physfs
                                 physlayer
                                 m
+                                ${HW_LINK_LIBS}
                                 #TODO: add other libraries
                             )
 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/hwengine${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_binary_install_dir})