diff --git a/CMakeLists.txt b/CMakeLists.txt index 6cb90feb..9aab5f95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,6 +85,10 @@ if (BUILD_WEBSITE AND NOT IMATH_IS_SUBPROJECT) add_subdirectory(website) endif() +if (APPLE) + option(IMATH_BUILD_APPLE_FRAMEWORKS "Build as Apple Frameworks" OFF) +endif() + # If you want to use ctest to configure, build and # upload the results, cmake has builtin support for # submitting to CDash, or any server who speaks the diff --git a/config/LibraryDefine.cmake b/config/LibraryDefine.cmake index 576aa2e4..b5671003 100644 --- a/config/LibraryDefine.cmake +++ b/config/LibraryDefine.cmake @@ -87,10 +87,18 @@ function(IMATH_DEFINE_LIBRARY libname) if (IMATH_INSTALL) install(TARGETS ${libname} EXPORT ${PROJECT_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + RUNTIME + DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY + DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE + DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT runtime + OPTIONAL + INCLUDES + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${IMATH_OUTPUT_SUBDIR} ) diff --git a/src/Imath/CMakeLists.txt b/src/Imath/CMakeLists.txt index 7990bde0..d8f775cb 100644 --- a/src/Imath/CMakeLists.txt +++ b/src/Imath/CMakeLists.txt @@ -47,3 +47,13 @@ imath_define_library(Imath ImathVec.h ImathVecAlgo.h ) + +if(IMATH_BUILD_APPLE_FRAMEWORKS) + set_target_properties(Imath PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION IMATH_LIB_VERSION + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.AcademySoftwareFoundation.Imath + MACOSX_FRAMEWORK_IDENTIFIER com.AcademySoftwareFoundation.Imath + MACOSX_FRAMEWORK_BUNDLE_VERSION IMATH_LIB_VERSION + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${Imath_VERSION}) +endif() diff --git a/src/ImathTest/CMakeLists.txt b/src/ImathTest/CMakeLists.txt index 58820316..4447af33 100644 --- a/src/ImathTest/CMakeLists.txt +++ b/src/ImathTest/CMakeLists.txt @@ -84,6 +84,10 @@ function(DEFINE_IMATH_TESTS) endforeach() endfunction() +if (TBB_BUILD_APPLE_FRAMEWORKS) + add_compile_definitions(TBB_USE_APPLE_FRAMEWORKS) +endif() + define_imath_tests( testToFloat testSize diff --git a/src/pybind11/PyBindImath/CMakeLists.txt b/src/pybind11/PyBindImath/CMakeLists.txt index 15473c69..94aee49e 100644 --- a/src/pybind11/PyBindImath/CMakeLists.txt +++ b/src/pybind11/PyBindImath/CMakeLists.txt @@ -78,6 +78,7 @@ if (IMATH_INSTALL) RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) if(BUILD_SHARED_LIBS AND (NOT "${IMATH_LIB_SUFFIX}" STREQUAL "") AND IMATH_INSTALL_SYM_LINK) @@ -109,3 +110,13 @@ if (IMATH_INSTALL) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${pcout} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() + +if(IMATH_BUILD_APPLE_FRAMEWORKS) + set_target_properties(${PYBINDIMATH_LIBRARY} PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION PYBINDIMATH_LIB_SUFFIX + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER com.AcademySoftwareFoundation.Imath.PyBind + MACOSX_FRAMEWORK_IDENTIFIER com.AcademySoftwareFoundation.Imath.PyBind + MACOSX_FRAMEWORK_BUNDLE_VERSION PYBINDIMATH_LIB_SUFFIX + MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${Imath_VERSION}) +endif() \ No newline at end of file