defaults.cmake 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. # OBS CMake macOS defaults module
  2. # Enable selection between arm64 and x86_64 targets
  3. if(NOT CMAKE_OSX_ARCHITECTURES)
  4. set(CMAKE_OSX_ARCHITECTURES
  5. arm64
  6. CACHE STRING "Build architectures for macOS" FORCE)
  7. endif()
  8. set_property(CACHE CMAKE_OSX_ARCHITECTURES PROPERTY STRINGS arm64 x86_64)
  9. # Set empty codesigning team if not specified as cache variable
  10. if(NOT OBS_CODESIGN_TEAM)
  11. set(OBS_CODESIGN_TEAM
  12. ""
  13. CACHE STRING "OBS code signing team for macOS" FORCE)
  14. # Set ad-hoc codesigning identity if not specified as cache variable
  15. if(NOT OBS_CODESIGN_IDENTITY)
  16. set(OBS_CODESIGN_IDENTITY
  17. "-"
  18. CACHE STRING "OBS code signing identity for macOS" FORCE)
  19. endif()
  20. endif()
  21. if(XCODE)
  22. include(xcode)
  23. endif()
  24. include(buildspec)
  25. # SWIG hard codes the directory to its library directory at compile time. As obs-deps need to be relocatable, we need to
  26. # force SWIG to look for its files in a directory relative to the PREFIX_PATH. The best way to ensure this is to set the
  27. # SWIG_LIB environment variable.
  28. foreach(path IN LISTS CMAKE_PREFIX_PATH)
  29. if(NOT DEFINED ENV{SWIG_LIB} AND EXISTS "${path}/bin/swig")
  30. set(ENV{SWIG_LIB} "${path}/share/swig/CURRENT")
  31. break()
  32. endif()
  33. endforeach()
  34. # Set default values for CMake's bundle generator and created Info.plist files
  35. set(MACOSX_BUNDLE_EXECUTABLE_NAME OBS)
  36. set(MACOSX_BUNDLE_BUNDLE_NAME "${OBS_PRODUCT_NAME}")
  37. set(MACOSX_BUNDLE_BUNDLE_VERSION ${OBS_BUILD_NUMBER})
  38. set(MACOSX_BUNDLE_COPYRIGHT "${OBS_LEGAL_COPYRIGHT}")
  39. set(MACOSX_BUNDLE_GUI_IDENTIFIER com.obsproject.obs-studio)
  40. set(MACOSX_BUNDLE_ICON_FILE AppIcon)
  41. set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${OBS_VERSION_CANONICAL})
  42. string(TIMESTAMP CURRENT_YEAR "%Y")
  43. # Enable find_package targets to become globally available targets
  44. set(CMAKE_FIND_PACKAGE_TARGETS_GLOBAL TRUE)
  45. # Enable RPATH support for generated binaries
  46. set(CMAKE_MACOSX_RPATH TRUE)
  47. # Use RPATHs from build tree _in_ the build tree
  48. set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
  49. # Do not add default linker search paths to RPATH
  50. set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
  51. # Use common bundle-relative RPATH for installed targets
  52. set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
  53. # Used for library exports only (obs-frontend-api)
  54. set(OBS_LIBRARY_DESTINATION "lib")
  55. set(OBS_INCLUDE_DESTINATION "include/obs")
  56. set(OBS_CMAKE_DESTINATION "lib/cmake")
  57. set(_dmg_package_name "OBS")
  58. set(_dmg_background_filename "background.tiff")
  59. set(_dmg_window_x 100)
  60. set(_dmg_window_y 100)
  61. set(_dmg_window_width 540)
  62. set(_dmg_window_height 380)
  63. set(_dmg_icon_size 96)
  64. set(_dmg_text_size 16)
  65. set(_dmg_obs_x 124)
  66. set(_dmg_obs_y 180)
  67. set(_dmg_app_link_x 416)
  68. set(_dmg_app_link_y 180)
  69. configure_file("${CMAKE_SOURCE_DIR}/cmake/macos/resources/package.applescript.in"
  70. "${CMAKE_BINARY_DIR}/package.applescript" @ONLY)