jpeg.cmake 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. # cmake for windows
  20. set(JPEG_EXTRA_ARGS -DNASM=${NASM_PATH} -DWITH_JPEG8=ON -DCMAKE_DEBUG_POSTFIX=d)
  21. ExternalProject_Add(external_jpeg
  22. URL ${JPEG_URI}
  23. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  24. URL_HASH MD5=${JPEG_HASH}
  25. PREFIX ${BUILD_DIR}/jpg
  26. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
  27. INSTALL_DIR ${LIBDIR}/jpg
  28. )
  29. if(BUILD_MODE STREQUAL Debug)
  30. ExternalProject_Add_Step(external_jpeg after_install
  31. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/jpg/lib/jpegd${LIBEXT} ${LIBDIR}/jpg/lib/jpeg${LIBEXT}
  32. DEPENDEES install
  33. )
  34. endif()
  35. if(BUILD_MODE STREQUAL Release)
  36. set(JPEG_LIBRARY jpeg-static${LIBEXT})
  37. else()
  38. set(JPEG_LIBRARY jpeg-staticd${LIBEXT})
  39. endif()
  40. else(WIN32)
  41. # autoconf for unix
  42. if(APPLE)
  43. set(JPEG_EXTRA_ARGS --host x86_64-apple-darwin --with-jpeg8)
  44. else()
  45. set(JPEG_EXTRA_ARGS --with-jpeg8)
  46. endif()
  47. ExternalProject_Add(external_jpeg
  48. URL ${JPEG_URI}
  49. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  50. URL_HASH MD5=${JPEG_HASH}
  51. CONFIGURE_COMMAND ${CONFIGURE_ENV} && autoreconf -fiv && ${CONFIGURE_COMMAND} --prefix=${LIBDIR}/jpg NASM=yasm ${JPEG_EXTRA_ARGS}
  52. BUILD_IN_SOURCE 1
  53. BUILD_COMMAND ${CONFIGURE_ENV} && make install
  54. PREFIX ${BUILD_DIR}/jpg
  55. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/jpg ${DEFAULT_CMAKE_FLAGS} ${JPEG_EXTRA_ARGS}
  56. INSTALL_DIR ${LIBDIR}/jpg
  57. )
  58. set(JPEG_LIBRARY libjpeg${LIBEXT})
  59. endif(WIN32)