hedgewars/CMakeLists.txt
branchwebgl
changeset 8018 091293bc974f
parent 7995 889ad929cc81
parent 7954 a5f0a6d46c52
child 8026 4a4f21070479
--- a/hedgewars/CMakeLists.txt	Sun Nov 11 14:59:22 2012 +0100
+++ b/hedgewars/CMakeLists.txt	Sun Nov 11 15:14:18 2012 +0100
@@ -193,7 +193,14 @@
 
 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
 if(fpc_version LESS "020600")
-    add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
+    #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
+    #TODO: check if this is needed on windows too
+    if(UNIX)
+        set(SAFE_BUILD_TOOL $(MAKE))
+    else()
+        set(SAFE_BUILD_TOOL ${CMAKE_BUILD_TOOL})
+    endif()
+    add_custom_target(ENGINECLEAN COMMAND ${SAFE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
 endif()
 
 
@@ -201,6 +208,11 @@
     set(FFMPEG_FIND_QUIETLY true)
     find_package(FFMPEG)
     if(${FFMPEG_FOUND})
+        # TODO: this check is only for SDL < 2
+        # fpc will take care of linking but we need to have this library installed
+        find_package(GLUT REQUIRED)
+
+        #TODO: convert avwrapper to .pas unit so we can skip this step
         include_directories(${FFMPEG_INCLUDE_DIR})
         set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
         IF (WIN32)
@@ -212,9 +224,6 @@
             add_library(avwrapper STATIC videorec/avwrapper.c)
             set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags})
         ENDIF()
-        if(fpc_version LESS "020600")
-            add_dependencies(avwrapper ENGINECLEAN)
-        endif()
     else()
         message(STATUS "Could NOT find FFMPEG/LibAV, video recording will be disabled")
     endif()
@@ -260,6 +269,12 @@
     add_dependencies(${engine_output_name} lua)
 endif()
 
+#when ffmpeg/libav is found we need to compile it before engine
+#TODO: convert avwrapper to .pas unit so we can skip this step
+if(${FFMPEG_FOUND})
+    add_dependencies(${engine_output_name} avwrapper)
+endif()
+
 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
 if((fpc_version LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
     add_dependencies(${engine_output_name} ENGINECLEAN)