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