From 8904ffb26d8d1641733ca2395b2c4f0e2fbb354c Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Wed, 4 Oct 2023 06:32:12 +0200 Subject: [PATCH 1/2] Fix up bundles for MacOS installation --- CMakeLists.txt | 107 +++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 65 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64b93a178d..44ec0771ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -305,8 +305,6 @@ if(STANDALONE) set(STRUCTURE_UNIFIED CACHE BOOL "Install for use in a Plugin Manager") if(D_PLATFORM_LINUX) set(STRUCTURE_PACKAGEMANAGER CACHE BOOL "Install for use in a Package Manager (system-wide installation)") - elseif(D_PLATFORM_MAC) - set(STRUCTURE_BUNDLE ON CACHE BOOL "Install as a Loadable Bundle (.plugin)") endif() set(PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Where to place the packages?") @@ -1267,9 +1265,7 @@ else() ) endif() -if(D_PLATFORM_WINDOWS) - # Windows-exclusive - +if(D_PLATFORM_WINDOWS) # Windows-exclusive # Version Resource set(PROJECT_PRODUCT_NAME "${PROJECT_FULL_NAME}") set(PROJECT_COMPANY_NAME "${PROJECT_AUTHORS}") @@ -1286,57 +1282,22 @@ if(D_PLATFORM_WINDOWS) "templates/windows/version.rc.in" "${PROJECT_BINARY_DIR}/generated/version.rc" ) -elseif(D_PLATFORM_MAC) - # MacOS exclusive Changes - +elseif(D_PLATFORM_MAC) # MacOS exclusive Changes set_target_properties(StreamFX PROPERTIES # No automatic code signing in XCode XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "" XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO" + # @rpath in installed binaries INSTALL_RPATH "@executable_path/../Frameworks/;@loader_path/../Frameworks/;@loader_path/../Resources/" ) + if(STANDALONE) set_target_properties(StreamFX PROPERTIES # @rpath in built binaries BUILD_WITH_INSTALL_RPATH ON ) endif() - - # Bundle exporting - if(STRUCTURE_BUNDLE) - # Proper location for resources in Bundles - foreach(FILE IN LISTS PROJECT_DATA) - cmake_path(ABSOLUTE_PATH FILE OUTPUT_VARIABLE FILE_PATH) - cmake_path(RELATIVE_PATH FILE_PATH BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/data/") - cmake_path(GET FILE_PATH PARENT_PATH FILE_PATH) - set_source_files_properties("${FILE}" PROPERTIES - MACOSX_PACKAGE_LOCATION "Resources/${FILE_PATH}" - ) - endforeach() - - # Bundle Icon - set_source_files_properties("media/icon.png" PROPERTIES - MACOSX_PACKAGE_LOCATION "Resources" - ) - - # Bundle Information - set(MACOSX_BUNDLE_BUNDLE_NAME "StreamFX") - set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}") - set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT}") - set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_IDENTIFER}") - set(MACOSX_BUNDLE_ICON_FILE "icon.png") - set(MACOSX_BUNDLE_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") - set(MACOSX_BUNDLE_LONG_VERSION_STRING "${_VERSION}") - set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") - set_target_properties(StreamFX PROPERTIES - BUNDLE ON - BUNDLE_EXTENSION "plugin" - OUTPUT_NAME StreamFX - MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/templates/macos/Info.plist.in" - XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}" - ) - endif() endif() # Set file version @@ -1669,29 +1630,45 @@ if(STANDALONE) ) endif() elseif(D_PLATFORM_MAC) - if(STRUCTURE_BUNDLE) - install( - TARGETS StreamFX - RUNTIME DESTINATION "." COMPONENT StreamFX - LIBRARY DESTINATION "." COMPONENT StreamFX - BUNDLE DESTINATION "." COMPONENT StreamFX - PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - ) - else() - install( - TARGETS StreamFX - RUNTIME DESTINATION "StreamFX/bin/" COMPONENT StreamFX - LIBRARY DESTINATION "StreamFX/bin/" COMPONENT StreamFX - PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - ) - install( - DIRECTORY "data/" - DESTINATION "StreamFX/data/" - COMPONENT StreamFX - FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE + # Bundle Information + set(MACOSX_BUNDLE_BUNDLE_NAME "StreamFX") + set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}") + set(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT}") + set(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_IDENTIFER}") + set(MACOSX_BUNDLE_ICON_FILE "icon.png") + set(MACOSX_BUNDLE_VERSION_STRING "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") + set(MACOSX_BUNDLE_LONG_VERSION_STRING "${_VERSION}") + set(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}") + set_target_properties(StreamFX PROPERTIES + BUNDLE ON + BUNDLE_EXTENSION "plugin" + OUTPUT_NAME StreamFX + MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/templates/macos/Info.plist.in" + XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${MACOSX_BUNDLE_GUI_IDENTIFIER}" + ) + + # Proper location for resources in Bundles + foreach(FILE IN LISTS PROJECT_DATA) + cmake_path(ABSOLUTE_PATH FILE OUTPUT_VARIABLE FILE_PATH) + cmake_path(RELATIVE_PATH FILE_PATH BASE_DIRECTORY "${PROJECT_SOURCE_DIR}/data/") + cmake_path(GET FILE_PATH PARENT_PATH FILE_PATH) + set_source_files_properties("${FILE}" PROPERTIES + MACOSX_PACKAGE_LOCATION "Resources/${FILE_PATH}" ) - endif() + endforeach() + + # Bundle Icon + set_source_files_properties("media/icon.png" PROPERTIES + MACOSX_PACKAGE_LOCATION "Resources" + ) + + install( + TARGETS StreamFX + RUNTIME DESTINATION "." COMPONENT StreamFX + LIBRARY DESTINATION "." COMPONENT StreamFX + BUNDLE DESTINATION "." COMPONENT StreamFX + PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE + ) endif() else() if(COMMAND setup_plugin_target) From 69b896346fe62569aa2b14c44d88d0ed554d72d3 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Wed, 4 Oct 2023 06:35:20 +0200 Subject: [PATCH 2/2] Strip out unnecessary packaging logic --- CMakeLists.txt | 127 +++++++++++-------------------------------------- 1 file changed, 28 insertions(+), 99 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44ec0771ac..3c60522998 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,7 +302,6 @@ endif() # Installation / Packaging if(STANDALONE) - set(STRUCTURE_UNIFIED CACHE BOOL "Install for use in a Plugin Manager") if(D_PLATFORM_LINUX) set(STRUCTURE_PACKAGEMANAGER CACHE BOOL "Install for use in a Package Manager (system-wide installation)") endif() @@ -1533,56 +1532,7 @@ endforeach() ################################################################################ if(STANDALONE) - if(STRUCTURE_UNIFIED) - install( - DIRECTORY "data/" - DESTINATION "data/" - FILE_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - DIRECTORY_PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - ) - - if(D_PLATFORM_WINDOWS) - install( - TARGETS StreamFX - RUNTIME DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX - LIBRARY DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX - PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - ) - if(MSVC) - install( - FILES $ - DESTINATION "bin/windows-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" - COMPONENT StreamFX - OPTIONAL - ) - endif() - elseif(D_PLATFORM_LINUX) - install( - TARGETS StreamFX - RUNTIME DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX - LIBRARY DESTINATION "bin/linux-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX - PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - ) - elseif(D_PLATFORM_MAC) - install( - TARGETS StreamFX - RUNTIME DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX - LIBRARY DESTINATION "bin/mac-${D_PLATFORM_INSTR}-${D_PLATFORM_BITS}/" COMPONENT StreamFX - PERMISSIONS WORLD_EXECUTE;WORLD_READ;OWNER_EXECUTE;OWNER_READ;OWNER_WRITE;GROUP_EXECUTE;GROUP_READ;GROUP_WRITE - ) - endif() - - install( - FILES LICENSE - DESTINATION "LICENSE" - COMPONENT StreamFX - ) - install( - FILES icon.png - DESTINATION "icon.png" - COMPONENT StreamFX - ) - elseif(D_PLATFORM_WINDOWS) + if(D_PLATFORM_WINDOWS) install( TARGETS StreamFX RUNTIME DESTINATION "obs-plugins/${D_PLATFORM_BITS}bit/" COMPONENT StreamFX @@ -1692,59 +1642,38 @@ if(STANDALONE) endif() set(_PACKAGE_FULL_NAME "${PACKAGE_PREFIX}/${PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}") - if(STRUCTURE_UNIFIED) - add_custom_target( - PACKAGE_ZIP - ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.obs" --format=zip -- - "." - WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" + if(D_PLATFORM_WINDOWS) + ## Installer (InnoSetup) + get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR) + + get_filename_component(ISS_PACKAGE_DIR "${PACKAGE_PREFIX}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR) + + get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR) + + get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH) + + configure_file( + "templates/windows/installer.iss.in" + "installer.iss" ) - else() - add_custom_target( - PACKAGE_7Z - ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.7z" --format=7zip -- - "." - WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" + elseif(D_PLATFORM_MAC) + # .pkg Installer + set(PACKAGES_PATH_NAME "StreamFX") + set(PACKAGES_PATH_NAME "${PACKAGES_PATH_NAME}.plugin") + configure_file( + "templates/macos/installer.pkgproj.in" + "installer.pkgproj" ) + elseif(D_PLATFORM_LINUX) add_custom_target( - PACKAGE_ZIP - ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.zip" --format=zip -- + PACKAGE + ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.7z" --format=7zip -- "." WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" ) - - # Windows - if(D_PLATFORM_WINDOWS) - ## Installer (InnoSetup) - get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) - file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR) - - get_filename_component(ISS_PACKAGE_DIR "${PACKAGE_PREFIX}" ABSOLUTE) - file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR) - - get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE) - file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR) - - get_filename_component(ISS_MSVCHELPER_PATH "${msvc-redist-helper_BUILD_DIR}" ABSOLUTE) - file(TO_NATIVE_PATH "${ISS_MSVCHELPER_PATH}" ISS_MSVCHELPER_PATH) - - configure_file( - "templates/windows/installer.iss.in" - "installer.iss" - ) - endif() - - # Apple MacOS - if(D_PLATFORM_MAC) - # .pkg Installer - set(PACKAGES_PATH_NAME "StreamFX") - if(STRUCTURE_BUNDLE) - set(PACKAGES_PATH_NAME "${PACKAGES_PATH_NAME}.plugin") - endif() - configure_file( - "templates/macos/installer.pkgproj.in" - "installer.pkgproj" - ) - endif() endif() endif()