blosc.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. set(BLOSC_EXTRA_ARGS
  19. -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
  20. -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
  21. -DBUILD_TESTS=OFF
  22. -DBUILD_BENCHMARKS=OFF
  23. -DCMAKE_DEBUG_POSTFIX=_d
  24. -DThreads_FOUND=1
  25. -DPTHREAD_LIBS=${LIBDIR}/pthreads/lib/pthreadVC3.lib
  26. -DPTHREAD_INCLUDE_DIR=${LIBDIR}/pthreads/inc
  27. -DDEACTIVATE_SNAPPY=ON
  28. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  29. )
  30. if(WIN32)
  31. #prevent blosc from including it's own local copy of zlib in the object file
  32. #and cause linker errors with everybody else
  33. set(BLOSC_EXTRA_ARGS ${BLOSC_EXTRA_ARGS}
  34. -DPREFER_EXTERNAL_ZLIB=ON
  35. )
  36. endif()
  37. ExternalProject_Add(external_blosc
  38. URL ${BLOSC_URI}
  39. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  40. URL_HASH MD5=${BLOSC_HASH}
  41. PREFIX ${BUILD_DIR}/blosc
  42. PATCH_COMMAND ${PATCH_CMD} --verbose -p 1 -N -d ${BUILD_DIR}/blosc/src/external_blosc < ${PATCH_DIR}/blosc.diff
  43. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/blosc ${DEFAULT_CMAKE_FLAGS} ${BLOSC_EXTRA_ARGS}
  44. INSTALL_DIR ${LIBDIR}/blosc
  45. )
  46. add_dependencies(
  47. external_blosc
  48. external_zlib
  49. )
  50. if(WIN32)
  51. add_dependencies(
  52. external_blosc
  53. external_pthreads
  54. )
  55. endif()
  56. if(WIN32)
  57. if(BUILD_MODE STREQUAL Release)
  58. ExternalProject_Add_Step(external_blosc after_install
  59. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc.lib ${HARVEST_TARGET}/blosc/lib/libblosc.lib
  60. COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/blosc/include/ ${HARVEST_TARGET}/blosc/include/
  61. DEPENDEES install
  62. )
  63. endif()
  64. if(BUILD_MODE STREQUAL Debug)
  65. ExternalProject_Add_Step(external_blosc after_install
  66. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/blosc/lib/libblosc_d.lib ${HARVEST_TARGET}/blosc/lib/libblosc_d.lib
  67. DEPENDEES install
  68. )
  69. endif()
  70. endif()