hedgewars/CMakeLists.txt
changeset 8188 4c166505e5c8
parent 8166 5bc0fc0bab4d
child 8195 37d47f09f981
equal deleted inserted replaced
8187:fa725fe25708 8188:4c166505e5c8
   109 
   109 
   110 # Check Freepascal version
   110 # Check Freepascal version
   111 find_package(Freepascal)
   111 find_package(Freepascal)
   112 
   112 
   113 if (FPC_VERSION VERSION_LESS required_fpc_version)
   113 if (FPC_VERSION VERSION_LESS required_fpc_version)
   114     message(FATAL_ERROR "Necessary FPC version not found (version >= ${required_fpc_version} required)")
   114     message(FATAL_ERROR "Necessary FPC version not found (required version = ${required_fpc_version})")
   115 else()
   115 else()
   116     message(STATUS "Found FPC: ${FPC_EXECUTABLE} (version ${FPC_VERSION})")
   116     message(STATUS "Found FPC: ${FPC_EXECUTABLE} (version ${FPC_VERSION})")
   117 endif()
   117 endif()
   118 
   118 
   119 
   119 
   163     message(STATUS "Screenshots will be in BMP format per user request")
   163     message(STATUS "Screenshots will be in BMP format per user request")
   164 endif()
   164 endif()
   165 
   165 
   166 
   166 
   167 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   167 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   168 if(fpc_version LESS "020600")
   168 if(FPC_VERSION LESS "020600")
   169     #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
   169     #under some configurations CMAKE_BUILD_TOOL fails to pass on the jobserver, breaking parallel compilation
   170     #TODO: check if this is needed on windows too
   170     #TODO: check if this is needed on windows too
   171     if(UNIX)
   171     if(UNIX)
   172         set(SAFE_BUILD_TOOL $(MAKE))
   172         set(SAFE_BUILD_TOOL $(MAKE))
   173     else()
   173     else()
   204     message(STATUS "Video recording disabled by user")
   204     message(STATUS "Video recording disabled by user")
   205 endif()
   205 endif()
   206 
   206 
   207 set(pascal_flags "-Fl${LIBRARY_OUTPUT_PATH}" ${pascal_flags})
   207 set(pascal_flags "-Fl${LIBRARY_OUTPUT_PATH}" ${pascal_flags})
   208 
   208 
   209 set(fpc_flags ${noexecstack_flags} ${pascal_flags} ${hwengine_project})
   209 set(fpc_flags ${NOEXECSTACK_FLAGS} ${pascal_flags} ${hwengine_project})
   210 
   210 
   211 if(NOT APPLE)
   211 if(NOT APPLE)
   212     #here is the command for standard executables or for shared library
   212     #here is the command for standard executables or for shared library
   213     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
   213     add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}"
   214         COMMAND "${fpc_executable}"
   214         COMMAND "${FPC_EXECUTABLE}"
   215         ARGS ${fpc_flags}
   215         ARGS ${fpc_flags}
   216         MAIN_DEPENDENCY ${hwengine_project}
   216         MAIN_DEPENDENCY ${hwengine_project}
   217         DEPENDS ${engine_sources}
   217         DEPENDS ${engine_sources}
   218         )
   218         )
   219 else()
   219 else()
   220     #these are the dependencies for building a universal binary on Mac OS X
   220     #these are the dependencies for building a universal binary on Mac OS X
   221     foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
   221     foreach (build_arch ${powerpc_build} ${i386_build} ${x86_64_build})
   222         set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
   222         set(lipo_args_list "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}" ${lipo_args_list})
   223         add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
   223         add_custom_command(OUTPUT "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}"
   224             COMMAND "${fpc_executable}"
   224             COMMAND "${FPC_EXECUTABLE}"
   225             ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch}
   225             ARGS ${fpc_flags} -ohwengine.${build_arch} -P${build_arch}
   226             MAIN_DEPENDENCY ${hwengine_project}
   226             MAIN_DEPENDENCY ${hwengine_project}
   227             DEPENDS ${engine_sources}
   227             DEPENDS ${engine_sources}
   228             )
   228             )
   229         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   229         add_custom_target(hwengine.${build_arch} ALL DEPENDS "${EXECUTABLE_OUTPUT_PATH}/hwengine.${build_arch}")
   252 if(${FFMPEG_FOUND})
   252 if(${FFMPEG_FOUND})
   253     add_dependencies(${engine_output_name} avwrapper)
   253     add_dependencies(${engine_output_name} avwrapper)
   254 endif()
   254 endif()
   255 
   255 
   256 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   256 #this command is a workaround to some inlining issues present in older FreePascal versions and fixed in 2.6
   257 if((fpc_version LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
   257 if((FPC_VERSION LESS "020600") AND (NOVIDEOREC OR NOT ${FFMPEG_FOUND}))
   258     add_dependencies(${engine_output_name} ENGINECLEAN)
   258     add_dependencies(${engine_output_name} ENGINECLEAN)
   259 endif()
   259 endif()
   260 
   260 
   261 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})
   261 install(PROGRAMS "${EXECUTABLE_OUTPUT_PATH}/${engine_output_name}${CMAKE_EXECUTABLE_SUFFIX}" DESTINATION ${target_dir})