x264.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ***** END GPL LICENSE BLOCK *****
  18. if(WIN32)
  19. set(X264_EXTRA_ARGS --enable-win32thread --cross-prefix=${MINGW_HOST}- --host=${MINGW_HOST})
  20. set(X264_PATCH_CMD ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/x264/src/external_x264 < ${PATCH_DIR}/x264.diff)
  21. else()
  22. set(X264_PATCH_CMD echo .)
  23. endif()
  24. ExternalProject_Add(external_x264
  25. URL ${X264_URI}
  26. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  27. URL_HASH SHA256=${X264_HASH}
  28. PREFIX ${BUILD_DIR}/x264
  29. PATCH_COMMAND ${X264_PATCH_CMD}
  30. CONFIGURE_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/x264
  31. --enable-static
  32. --enable-pic
  33. --disable-lavf
  34. ${X264_EXTRA_ARGS}
  35. BUILD_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && make -j${MAKE_THREADS}
  36. INSTALL_COMMAND ${CONFIGURE_ENV} && cd ${BUILD_DIR}/x264/src/external_x264/ && make install
  37. INSTALL_DIR ${LIBDIR}/x264
  38. )
  39. if(MSVC)
  40. set_target_properties(external_x264 PROPERTIES FOLDER Mingw)
  41. endif()