defaults.cmake 2.5 KB

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