hedgewars/CMakeLists.txt
branchwebgl
changeset 8018 091293bc974f
parent 7995 889ad929cc81
parent 7954 a5f0a6d46c52
child 8026 4a4f21070479
equal deleted inserted replaced
8008:2ed42786aca7 8018:091293bc974f
   191 
   191 
   192 
   192 
   193 
   193 
   194 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   194 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   195 if(fpc_version LESS "020600")
   195 if(fpc_version LESS "020600")
   196     add_custom_target(ENGINECLEAN COMMAND ${CMAKE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
   196     #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
       
   197     #TODO: check if this is needed on windows too
       
   198     if(UNIX)
       
   199         set(SAFE_BUILD_TOOL $(MAKE))
       
   200     else()
       
   201         set(SAFE_BUILD_TOOL ${CMAKE_BUILD_TOOL})
       
   202     endif()
       
   203     add_custom_target(ENGINECLEAN COMMAND ${SAFE_BUILD_TOOL} "clean" "${PROJECT_BINARY_DIR}" "${hedgewars_SOURCE_DIR}/hedgewars")
   197 endif()
   204 endif()
   198 
   205 
   199 
   206 
   200 if(NOT NOVIDEOREC)
   207 if(NOT NOVIDEOREC)
   201     set(FFMPEG_FIND_QUIETLY true)
   208     set(FFMPEG_FIND_QUIETLY true)
   202     find_package(FFMPEG)
   209     find_package(FFMPEG)
   203     if(${FFMPEG_FOUND})
   210     if(${FFMPEG_FOUND})
       
   211         # TODO: this check is only for SDL < 2
       
   212         # fpc will take care of linking but we need to have this library installed
       
   213         find_package(GLUT REQUIRED)
       
   214 
       
   215         #TODO: convert avwrapper to .pas unit so we can skip this step
   204         include_directories(${FFMPEG_INCLUDE_DIR})
   216         include_directories(${FFMPEG_INCLUDE_DIR})
   205         set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
   217         set(pascal_flags "-dUSE_VIDEO_RECORDING" ${pascal_flags})
   206         IF (WIN32)
   218         IF (WIN32)
   207             # there are some problems with linking our avwrapper as static lib, so link it as shared
   219             # there are some problems with linking our avwrapper as static lib, so link it as shared
   208             add_library(avwrapper SHARED videorec/avwrapper.c)
   220             add_library(avwrapper SHARED videorec/avwrapper.c)
   210             install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avwrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION ${target_dir})
   222             install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}avwrapper${CMAKE_SHARED_LIBRARY_SUFFIX}" DESTINATION ${target_dir})
   211         ELSE()
   223         ELSE()
   212             add_library(avwrapper STATIC videorec/avwrapper.c)
   224             add_library(avwrapper STATIC videorec/avwrapper.c)
   213             set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags})
   225             set(pascal_flags "-k${FFMPEG_LIBAVCODEC}" "-k${FFMPEG_LIBAVFORMAT}" "-k${FFMPEG_LIBAVUTIL}" ${pascal_flags})
   214         ENDIF()
   226         ENDIF()
   215         if(fpc_version LESS "020600")
       
   216             add_dependencies(avwrapper ENGINECLEAN)
       
   217         endif()
       
   218     else()
   227     else()
   219         message(STATUS "Could NOT find FFMPEG/LibAV, video recording will be disabled")
   228         message(STATUS "Could NOT find FFMPEG/LibAV, video recording will be disabled")
   220     endif()
   229     endif()
   221 else()
   230 else()
   222     message(STATUS "Video recording disabled by user")
   231     message(STATUS "Video recording disabled by user")
   258 #when system Lua is not found we need to compile it before engine
   267 #when system Lua is not found we need to compile it before engine
   259 if(NOT LUA_FOUND)
   268 if(NOT LUA_FOUND)
   260     add_dependencies(${engine_output_name} lua)
   269     add_dependencies(${engine_output_name} lua)
   261 endif()
   270 endif()
   262 
   271 
       
   272 #when ffmpeg/libav is found we need to compile it before engine
       
   273 #TODO: convert avwrapper to .pas unit so we can skip this step
       
   274 if(${FFMPEG_FOUND})
       
   275     add_dependencies(${engine_output_name} avwrapper)
       
   276 endif()
       
   277 
   263 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   278 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   264 if((fpc_version LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
   279 if((fpc_version LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
   265     add_dependencies(${engine_output_name} ENGINECLEAN)
   280     add_dependencies(${engine_output_name} ENGINECLEAN)
   266 endif()
   281 endif()
   267 
   282