OpenEXR.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Check if we're building for arm on x86_64 and just for OpenEXR, build fat
  2. # binaries. We need this because it compiles some code to generate other
  3. # source and we need to be able to run the executables. When we link the
  4. # library, the x86_64 part will be ignored.
  5. if (APPLE AND IS_CROSS_COMPILE)
  6. if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" AND ${CMAKE_OSX_ARCHITECTURES} MATCHES "arm")
  7. set(_openexr_arch arm64^^x86_64)
  8. set(_openxr_list_sep LIST_SEPARATOR ^^)
  9. set(_cmake_openexr_arch -DCMAKE_OSX_ARCHITECTURES:STRING=${_openexr_arch})
  10. else()
  11. set(_openexr_arch ${CMAKE_OSX_ARCHITECTURES})
  12. set(_cmake_openexr_arch -DCMAKE_OSX_ARCHITECTURES:STRING=${_openexr_arch})
  13. endif()
  14. ExternalProject_Add(dep_OpenEXR
  15. EXCLUDE_FROM_ALL ON
  16. URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
  17. URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
  18. INSTALL_DIR ${DESTDIR}/usr/local
  19. DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenEXR
  20. PATCH_COMMAND COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/OpenEXR.patch
  21. ${_openxr_list_sep}
  22. CMAKE_ARGS
  23. -DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local
  24. -DBUILD_SHARED_LIBS:BOOL=OFF
  25. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  26. -DBUILD_TESTING=OFF
  27. -DPYILMBASE_ENABLE:BOOL=OFF
  28. -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF
  29. -DOPENEXR_BUILD_UTILS:BOOL=OFF
  30. ${_cmake_openexr_arch}
  31. )
  32. else()
  33. add_cmake_project(OpenEXR
  34. # GIT_REPOSITORY https://github.com/openexr/openexr.git
  35. URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
  36. URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
  37. GIT_TAG v2.5.5
  38. PATCH_COMMAND COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/OpenEXR.patch
  39. CMAKE_ARGS
  40. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  41. -DBUILD_TESTING=OFF
  42. -DPYILMBASE_ENABLE:BOOL=OFF
  43. -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF
  44. -DOPENEXR_BUILD_UTILS:BOOL=OFF
  45. )
  46. endif()
  47. set(DEP_OpenEXR_DEPENDS ZLIB)