OpenEXR.cmake 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. ${_openxr_list_sep}
  21. CMAKE_ARGS
  22. -DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local
  23. -DBUILD_SHARED_LIBS:BOOL=OFF
  24. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  25. -DBUILD_TESTING=OFF
  26. -DPYILMBASE_ENABLE:BOOL=OFF
  27. -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF
  28. -DOPENEXR_BUILD_UTILS:BOOL=OFF
  29. ${_cmake_openexr_arch}
  30. )
  31. else()
  32. prusaslicer_add_cmake_project(OpenEXR
  33. # GIT_REPOSITORY https://github.com/openexr/openexr.git
  34. URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
  35. URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
  36. DEPENDS ${ZLIB_PKG}
  37. GIT_TAG v2.5.5
  38. CMAKE_ARGS
  39. -DCMAKE_POSITION_INDEPENDENT_CODE=ON
  40. -DBUILD_TESTING=OFF
  41. -DPYILMBASE_ENABLE:BOOL=OFF
  42. -DOPENEXR_VIEWERS_ENABLE:BOOL=OFF
  43. -DOPENEXR_BUILD_UTILS:BOOL=OFF
  44. )
  45. endif()
  46. if (MSVC)
  47. add_debug_dep(dep_OpenEXR)
  48. endif ()