deps-unix-common.cmake 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. # The unix common part expects DEP_CMAKE_OPTS to be set
  2. if (MINGW)
  3. set(TBB_MINGW_WORKAROUND "-flifetime-dse=1")
  4. else ()
  5. set(TBB_MINGW_WORKAROUND "")
  6. endif ()
  7. find_package(ZLIB QUIET)
  8. if (NOT ZLIB_FOUND)
  9. message(WARNING "No ZLIB dev package found in system, building static library. You should install the system package.")
  10. endif ()
  11. # TODO Evaluate expat modifications in the bundled version and test with system versions in various distros and OSX SDKs
  12. # find_package(EXPAT QUIET)
  13. # if (NOT EXPAT_FOUND)
  14. # message(WARNING "No EXPAT dev package found in system, building static library. Consider installing the system package.")
  15. # endif ()
  16. ExternalProject_Add(dep_tbb
  17. EXCLUDE_FROM_ALL 1
  18. URL "https://github.com/wjakob/tbb/archive/a0dc9bf76d0120f917b641ed095360448cabc85b.tar.gz"
  19. URL_HASH SHA256=0545cb6033bd1873fcae3ea304def720a380a88292726943ae3b9b207f322efe
  20. CMAKE_ARGS
  21. -DTBB_BUILD_SHARED=OFF
  22. -DTBB_BUILD_TESTS=OFF
  23. -DCMAKE_CXX_FLAGS=${TBB_MINGW_WORKAROUND}
  24. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  25. ${_cmake_osx_arch}
  26. ${DEP_CMAKE_OPTS}
  27. )
  28. ExternalProject_Add(dep_gtest
  29. EXCLUDE_FROM_ALL 1
  30. URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
  31. URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
  32. CMAKE_ARGS
  33. -DBUILD_GMOCK=OFF ${DEP_CMAKE_OPTS}
  34. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  35. ${_cmake_osx_arch}
  36. )
  37. ExternalProject_Add(dep_cereal
  38. EXCLUDE_FROM_ALL 1
  39. URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz"
  40. # URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
  41. CMAKE_ARGS
  42. -DJUST_INSTALL_CEREAL=on
  43. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  44. ${_cmake_osx_arch}
  45. ${DEP_CMAKE_OPTS}
  46. )
  47. ExternalProject_Add(dep_nlopt
  48. EXCLUDE_FROM_ALL 1
  49. URL "https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz"
  50. URL_HASH SHA256=c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
  51. CMAKE_ARGS
  52. -DBUILD_SHARED_LIBS=OFF
  53. -DNLOPT_PYTHON=OFF
  54. -DNLOPT_OCTAVE=OFF
  55. -DNLOPT_MATLAB=OFF
  56. -DNLOPT_GUILE=OFF
  57. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  58. ${_cmake_osx_arch}
  59. ${DEP_CMAKE_OPTS}
  60. )
  61. ExternalProject_Add(dep_qhull
  62. EXCLUDE_FROM_ALL 1
  63. #URL "https://github.com/qhull/qhull/archive/v7.3.2.tar.gz"
  64. #URL_HASH SHA256=619c8a954880d545194bc03359404ef36a1abd2dde03678089459757fd790cb0
  65. GIT_REPOSITORY https://github.com/qhull/qhull.git
  66. GIT_TAG 7afedcc73666e46a9f1d74632412ebecf53b1b30 # v7.3.2 plus the mac build patch
  67. CMAKE_ARGS
  68. -DBUILD_SHARED_LIBS=OFF
  69. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  70. ${_cmake_osx_arch}
  71. ${DEP_CMAKE_OPTS}
  72. )
  73. ExternalProject_Add(dep_blosc
  74. EXCLUDE_FROM_ALL 1
  75. GIT_REPOSITORY https://github.com/Blosc/c-blosc.git
  76. GIT_TAG e63775855294b50820ef44d1b157f4de1cc38d3e #v1.17.0
  77. DEPENDS
  78. CMAKE_ARGS
  79. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  80. -DBUILD_SHARED_LIBS=OFF
  81. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  82. -DCMAKE_DEBUG_POSTFIX=d
  83. -DBUILD_SHARED=OFF
  84. -DBUILD_STATIC=ON
  85. -DBUILD_TESTS=OFF
  86. -DBUILD_BENCHMARKS=OFF
  87. -DPREFER_EXTERNAL_ZLIB=ON
  88. ${_cmake_osx_arch}
  89. PATCH_COMMAND ${GIT_EXECUTABLE} reset --hard && git clean -df &&
  90. ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/blosc-mods.patch
  91. )
  92. # Check if we're building for arm on x86_64 and just for OpenEXR, build fat
  93. # binaries. We need this because it compiles some code to generate other
  94. # source and we need to be able to run the executables. When we link the
  95. # library, the x86_64 part will be ignored.
  96. if (APPLE AND IS_CROSS_COMPILE)
  97. if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND ${CMAKE_OSX_ARCHITECTURES} MATCHES "arm")
  98. set(_openexr_arch arm64^^x86_64)
  99. set(_openxr_list_sep LIST_SEPARATOR ^^)
  100. set(_cmake_openexr_arch -DCMAKE_OSX_ARCHITECTURES:STRING=${_openexr_arch})
  101. else()
  102. set(_openexr_arch ${CMAKE_OSX_ARCHITECTURES})
  103. set(_cmake_openexr_arch -DCMAKE_OSX_ARCHITECTURES:STRING=${_openexr_arch})
  104. endif()
  105. endif()
  106. ExternalProject_Add(dep_openexr
  107. EXCLUDE_FROM_ALL 1
  108. GIT_REPOSITORY https://github.com/openexr/openexr.git
  109. GIT_TAG eae0e337c9f5117e78114fd05f7a415819df413a #v2.4.0
  110. ${_openxr_list_sep}
  111. CMAKE_ARGS
  112. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  113. -DBUILD_SHARED_LIBS=OFF
  114. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  115. -DBUILD_TESTING=OFF
  116. -DPYILMBASE_ENABLE:BOOL=OFF
  117. -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF
  118. -DOPENEXR_BUILD_UTILS:BOOL=OFF
  119. ${_cmake_openexr_arch}
  120. )
  121. ExternalProject_Add(dep_openvdb
  122. EXCLUDE_FROM_ALL 1
  123. GIT_REPOSITORY https://github.com/AcademySoftwareFoundation/openvdb.git
  124. GIT_TAG aebaf8d95be5e57fd33949281ec357db4a576c2e #v6.2.1
  125. DEPENDS dep_blosc dep_openexr dep_tbb
  126. CMAKE_ARGS
  127. -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
  128. -DCMAKE_DEBUG_POSTFIX=d
  129. -DCMAKE_PREFIX_PATH=${DESTDIR}/usr/local
  130. -DBUILD_SHARED_LIBS=OFF
  131. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  132. -DOPENVDB_BUILD_PYTHON_MODULE=OFF
  133. -DUSE_BLOSC=ON
  134. -DOPENVDB_CORE_SHARED=OFF
  135. -DOPENVDB_CORE_STATIC=ON
  136. -DTBB_STATIC=ON
  137. -DOPENVDB_BUILD_VDB_PRINT=ON
  138. -DDISABLE_DEPENDENCY_VERSION_CHECKS=ON
  139. ${_cmake_osx_arch}
  140. PATCH_COMMAND PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
  141. ${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_SOURCE_DIR}/openvdb-mods.patch
  142. )