hedgewars/CMakeLists.txt
changeset 8665 3ff8694d9e22
parent 8664 6204ac0293b4
child 8666 1652c1d9adc8
equal deleted inserted replaced
8664:6204ac0293b4 8665:3ff8694d9e22
   118 else(${BUILD_ENGINE_LIBRARY})
   118 else(${BUILD_ENGINE_LIBRARY})
   119     set(destination_dir ${target_binary_install_dir})
   119     set(destination_dir ${target_binary_install_dir})
   120 endif(${BUILD_ENGINE_LIBRARY})
   120 endif(${BUILD_ENGINE_LIBRARY})
   121 
   121 
   122 
   122 
   123 # Check Freepascal version
   123 find_package(FreePascal REQUIRED)
   124 find_package(Freepascal)
   124 #when cmake-2.6 support is dropped, this ought to be inside FindFreePascal.cmake
   125 
   125 if (FREEPASCAL_VERSION VERSION_LESS required_fpc_version)
   126 if (FPC_VERSION VERSION_LESS required_fpc_version)
   126     message(FATAL_ERROR "Freepascal ${FREEPASCAL_VERSION} is too old, minimum version required is ${required_fpc_version}")
   127     message(FATAL_ERROR "Freepascal is too old, minimum version required is ${required_fpc_version}")
       
   128 endif()
   127 endif()
   129 
   128 
   130 
   129 
   131 #DEPENDECIES AND EXECUTABLES SECTION
   130 #DEPENDECIES AND EXECUTABLES SECTION
   132 if(APPLE)
   131 if(APPLE)
   177     message(STATUS "Screenshots will be in BMP format per user request")
   176     message(STATUS "Screenshots will be in BMP format per user request")
   178 endif()
   177 endif()
   179 
   178 
   180 
   179 
   181 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   180 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   182 if(FPC_VERSION VERSION_LESS "2.6")
   181 if(FREEPASCAL_VERSION VERSION_LESS "2.6")
   183     #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
   182     #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
   184     if(UNIX)
   183     if(UNIX)
   185         set(SAFE_BUILD_TOOL $(MAKE))
   184         set(SAFE_BUILD_TOOL $(MAKE))
   186     else()
   185     else()
   187         set(SAFE_BUILD_TOOL ${CMAKE_BUILD_TOOL})
   186         set(SAFE_BUILD_TOOL ${CMAKE_BUILD_TOOL})
   215 else()
   214 else()
   216     message(STATUS "Video recording disabled by user")
   215     message(STATUS "Video recording disabled by user")
   217 endif()
   216 endif()
   218 
   217 
   219 
   218 
   220 set(fpc_flags ${NOEXECSTACK_FLAGS} ${pascal_flags} ${hwengine_project})
   219 set(fpc_flags ${pascal_flags} ${hwengine_project})
   221 
   220 
   222 if(NOT APPLE)
   221 if(NOT APPLE)
   223     #here is the command for standard executables or for shared library
   222     #here is the command for standard executables or for shared library
   224     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}"
   223     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}"
   225         COMMAND "${FPC_EXECUTABLE}"
   224         COMMAND "${FREEPASCAL_EXECUTABLE}"
   226         ARGS ${fpc_flags} -o${engine_output_name}
   225         ARGS ${fpc_flags} -o${engine_output_name}
   227         MAIN_DEPENDENCY ${hwengine_project}
   226         MAIN_DEPENDENCY ${hwengine_project}
   228         DEPENDS ${engine_sources}
   227         DEPENDS ${engine_sources}
   229         )
   228         )
   230 else()
   229 else()
   231     #these are the dependencies for building a universal binary on Mac OS X
   230     #these are the dependencies for building a universal binary on Mac OS X
   232     foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
   231     foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
   233         list(APPEND lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   232         list(APPEND lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   234         add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
   233         add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
   235             COMMAND "${FPC_EXECUTABLE}"
   234             COMMAND "${FREEPASCAL_EXECUTABLE}"
   236             ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch}
   235             ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch}
   237             MAIN_DEPENDENCY ${hwengine_project}
   236             MAIN_DEPENDENCY ${hwengine_project}
   238             DEPENDS ${engine_sources}
   237             DEPENDS ${engine_sources}
   239             )
   238             )
   240         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   239         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   272 if(${FFMPEG_FOUND})
   271 if(${FFMPEG_FOUND})
   273     add_dependencies(hwengine avwrapper)
   272     add_dependencies(hwengine avwrapper)
   274 endif()
   273 endif()
   275 
   274 
   276 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   275 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   277 if((FPC_VERSION VERSION_LESS "2.6") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
   276 if((FREEPASCAL_VERSION VERSION_LESS "2.6") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
   278     add_dependencies(hwengine ENGINECLEAN)
   277     add_dependencies(hwengine ENGINECLEAN)
   279 endif()
   278 endif()
   280 
   279 
   281 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir})
   280 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}" DESTINATION ${destination_dir})