alembic.cmake 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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(ALEMBIC_HDF5)
  19. set(ALEMBIC_HDF5_HL)
  20. # in debug mode we do not build HDF5_hdf5_hl_LIBRARY which makes cmake really
  21. # unhappy, stub it with the debug mode lib. it's not linking it in at this
  22. # point in time anyhow
  23. if(BUILD_MODE STREQUAL Debug)
  24. set(ALEMBIC_HDF5_HL -DHDF5_hdf5_hl_LIBRARY=${LIBDIR}/hdf5/lib/libhdf5_hl_D.${LIBEXT})
  25. endif()
  26. endif()
  27. if(WIN32)
  28. set(ALEMBIC_ILMBASE ${LIBDIR}/openexr)
  29. else()
  30. set(ALEMBIC_ILMBASE ${LIBDIR}/ilmbase)
  31. endif()
  32. set(ALEMBIC_EXTRA_ARGS
  33. -DBUILDSTATIC=ON
  34. -DLINKSTATIC=ON
  35. -DALEMBIC_LIB_USES_BOOST=ON
  36. -DBoost_COMPILER:STRING=${BOOST_COMPILER_STRING}
  37. -DBoost_USE_MULTITHREADED=ON
  38. -DUSE_STATIC_BOOST=On
  39. -DBoost_USE_STATIC_LIBS=ON
  40. -DBoost_USE_STATIC_RUNTIME=ON
  41. -DBoost_DEBUG=ON
  42. -DBOOST_ROOT=${LIBDIR}/boost
  43. -DBoost_NO_SYSTEM_PATHS=ON
  44. -DILMBASE_ROOT=${ALEMBIC_ILMBASE}
  45. -DALEMBIC_ILMBASE_INCLUDE_DIRECTORY=${ALEMBIC_ILMBASE}/include/OpenEXR
  46. -DALEMBIC_ILMBASE_HALF_LIB=${ALEMBIC_ILMBASE}/lib/${LIBPREFIX}Half${ILMBASE_VERSION_POSTFIX}${LIBEXT}
  47. -DALEMBIC_ILMBASE_IMATH_LIB=${ALEMBIC_ILMBASE}/lib/${LIBPREFIX}Imath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
  48. -DALEMBIC_ILMBASE_ILMTHREAD_LIB=${ALEMBIC_ILMBASE}/lib/${LIBPREFIX}IlmThread${ILMBASE_VERSION_POSTFIX}${LIBEXT}
  49. -DALEMBIC_ILMBASE_IEX_LIB=${ALEMBIC_ILMBASE}/lib/${LIBPREFIX}Iex${ILMBASE_VERSION_POSTFIX}${LIBEXT}
  50. -DALEMBIC_ILMBASE_IEXMATH_LIB=${ALEMBIC_ILMBASE}/lib/${LIBPREFIX}IexMath${ILMBASE_VERSION_POSTFIX}${LIBEXT}
  51. -DUSE_PYILMBASE=0
  52. -DUSE_PYALEMBIC=0
  53. -DUSE_ARNOLD=0
  54. -DUSE_MAYA=0
  55. -DUSE_PRMAN=0
  56. -DUSE_HDF5=Off
  57. -DUSE_STATIC_HDF5=Off
  58. -DHDF5_ROOT=${LIBDIR}/hdf5
  59. -DUSE_TESTS=Off
  60. -DALEMBIC_NO_OPENGL=1
  61. -DUSE_BINARIES=ON
  62. -DALEMBIC_ILMBASE_LINK_STATIC=On
  63. -DALEMBIC_SHARED_LIBS=OFF
  64. -DGLUT_INCLUDE_DIR=""
  65. -DZLIB_LIBRARY=${LIBDIR}/zlib/lib/${ZLIB_LIBRARY}
  66. -DZLIB_INCLUDE_DIR=${LIBDIR}/zlib/include/
  67. ${ALEMBIC_HDF5_HL}
  68. )
  69. ExternalProject_Add(external_alembic
  70. URL ${ALEMBIC_URI}
  71. DOWNLOAD_DIR ${DOWNLOAD_DIR}
  72. URL_HASH MD5=${ALEMBIC_MD5}
  73. PREFIX ${BUILD_DIR}/alembic
  74. CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${LIBDIR}/alembic -Wno-dev ${DEFAULT_CMAKE_FLAGS} ${ALEMBIC_EXTRA_ARGS}
  75. INSTALL_DIR ${LIBDIR}/alembic
  76. )
  77. if(WIN32)
  78. if(BUILD_MODE STREQUAL Release)
  79. ExternalProject_Add_Step(external_alembic after_install
  80. COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDIR}/alembic ${HARVEST_TARGET}/alembic
  81. DEPENDEES install
  82. )
  83. endif()
  84. if(BUILD_MODE STREQUAL Debug)
  85. ExternalProject_Add_Step(external_alembic after_install
  86. COMMAND ${CMAKE_COMMAND} -E copy ${LIBDIR}/alembic/lib/alembic.lib ${HARVEST_TARGET}/alembic/lib/alembic_d.lib
  87. DEPENDEES install
  88. )
  89. endif()
  90. endif()
  91. add_dependencies(
  92. external_alembic
  93. external_boost
  94. external_zlib
  95. external_ilmbase
  96. external_openexr
  97. )