diff --git a/CMake/CreateDmgInstaller.cmake b/CMake/CreateDmgInstaller.cmake index 15c87e64..193f2bd3 100644 --- a/CMake/CreateDmgInstaller.cmake +++ b/CMake/CreateDmgInstaller.cmake @@ -1,22 +1,41 @@ message(STATUS "[DMG INSTALLER ENABLED]: Configuring. This can take some time...") + +set(CPACK_PACKAGE_VENDOR "Elias Steurer Tachiom") +set(CPACK_PACKAGE_NAME "ScreenPlay") +set(CPACK_PACKAGE_CONTACT "Elias Steurer ") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "ScreenPlay is an Open Source Live-Wallpaper app for Windows and OSX. ") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + set(CPACK_GENERATOR "DragNDrop") -set(CPACK_DMG_FORMAT "UDBZ") -set(CPACK_DMG_VOLUME_NAME "ScreenPlay") +set(MACOSX_BUNDLE_BUNDLE_NAME ${CPACK_PACKAGE_NAME}) +set(MACOSX_BUNDLE_BUNDLE_GUI_IDENTIFIER "app.screenplay.screenplay") +set(CPACK_DMG_VOLUME_NAME ${CPACK_PACKAGE_NAME}) set(CPACK_SYSTEM_NAME "OSX") -set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/ScreenPlay/assets/icons/app.ico") set(CPACK_COMPONENTS_GROUPING IGNORE) -set(CPACK_PACKAGE_NAME "ScreenPlay") +set(CPACK_PACKAGING_INSTALL_PREFIX "/") set(CPACK_PACKAGE_FILE_NAME "ScreenPlay-Installer") -set(CPACK_PACKAGE_VENDOR "Elias Steurer") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") -set(CPACK_PACKAGE_DIRECTORY "${CMAKE_BINARY_DIR}") +set(CPACK_COMPONENTS_ALL "ScreenPlayComponent") +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE ON) -include(CPack) +set(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") +set(MACOSX_BUNDLE_ICON_FILE "${CMAKE_SOURCE_DIR}/CMake/exampleApp.icns") +set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_SOURCE_DIR}/CMake/DS_Store.scpt") +set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/CMake/dmg_background.png") +set(MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/CMake/MacOSXBundleInfo.plist.in") + +set_source_files_properties(${CMAKE_SOURCE_DIR}/CMake/exampleApp.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") # Install all files from /bin install( DIRECTORY "${CMAKE_BINARY_DIR}/bin/" - COMPONENT ScreenPlay - DESTINATION "./") \ No newline at end of file + COMPONENT ScreenPlayComponent + DESTINATION "./") + +include(CPack) diff --git a/CMake/DS_Store.scpt b/CMake/DS_Store.scpt new file mode 100644 index 00000000..8f2fed73 --- /dev/null +++ b/CMake/DS_Store.scpt @@ -0,0 +1,41 @@ +on run argv + -- Constants for window dimensions + + set BG_W to 780 + set BG_H to 390 + set TITLE_BAR_H to 22 + + set diskImage to item 1 of argv + + tell application "Finder" + tell disk diskImage + -- Must call open and close to set window options later + open + -- Setup background and icon arrangement + set current view of container window to icon view + set theViewOptions to the icon view options of container window + -- Note: CMake automatically renames the file to background. + set background picture of theViewOptions to file ".background:background.png" + set arrangement of theViewOptions to not arranged + set icon size of theViewOptions to 72 + + -- Attempt to hide sidebar and toolbar + set toolbar visible of container window to false + set statusbar visible of container window to false + set sidebar width of container window to 0 + + -- Get current position of the window + set {currentX, currentY} to position of container window + -- Set the new bounds of the window + set bounds of container window to {currentX, currentY, currentX + BG_W, currentY + BG_H + TITLE_BAR_H} + -- Set icon positions + set position of item "ScreenPlay.app" to {137, 99} + set position of item "Applications" to {287, 99} + + -- Update and apply changes + update without registering applications + delay 5 + close + end tell + end tell +end run diff --git a/CMake/MacOSXBundleInfo.plist.in b/CMake/MacOSXBundleInfo.plist.in new file mode 100644 index 00000000..e5447fc9 --- /dev/null +++ b/CMake/MacOSXBundleInfo.plist.in @@ -0,0 +1,36 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + NSHighResolutionCapable + True + NSSupportsAutomaticGraphicsSwitching + + + diff --git a/CMake/dmg_background.png b/CMake/dmg_background.png new file mode 100755 index 00000000..9ff37b72 Binary files /dev/null and b/CMake/dmg_background.png differ diff --git a/Tools/build.py b/Tools/build.py index 190c8959..6d603e49 100755 --- a/Tools/build.py +++ b/Tools/build.py @@ -14,7 +14,7 @@ from typing import Tuple from pathlib import Path import macos_sign import build_godot -from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string +from util import sha256, cd_repo_root_path, repo_root_path, zipdir, run, get_vs_env_dict, get_latest_git_tag, parse_semver, semver_to_string, check_universal_binary from sys import stdout stdout.reconfigure(encoding='utf-8') @@ -219,6 +219,8 @@ def package(build_config: BuildConfig): build_bin_dir=build_bin_dir, app="ScreenPlayWallpaper"), cwd=cwd) run(cmd=cmd_raw.format(qt_bin_path=qt_bin_path, repo_root_path=source_path, build_bin_dir=build_bin_dir, app="ScreenPlayWidget"), cwd=cwd) + + check_universal_binary() if platform.system() == "Windows": print("Executing deploy commands...") @@ -294,6 +296,7 @@ def package(build_config: BuildConfig): if file.is_file(): print("Remove: %s" % file.resolve()) file.unlink() + def build_installer(build_config: BuildConfig, build_result: BuildResult): diff --git a/Tools/util.py b/Tools/util.py index 0f00b965..8d127a2b 100644 --- a/Tools/util.py +++ b/Tools/util.py @@ -177,4 +177,42 @@ def unzip(zip_path: str, destination_path: str, specific_file: str = None): if specific_file: zip_ref.extract(specific_file, path=destination_path) else: - zip_ref.extractall(path=destination_path) \ No newline at end of file + zip_ref.extractall(path=destination_path) + + +def listfiles(path): + files = [] + extensions = ('.dylib', '.so','') + ignored = ('qmldir') + print(f"WALK: {path}") + for dirName, subdirList, fileList in os.walk(path): + dir = dirName.replace(path, '') + for fname in fileList: + if Path(fname).suffix in extensions and not fname in ignored: + file = path + os.path.join(dir, fname) + if(os.path.isfile(file)): + files.append(file) + if os.path.islink(file): + print(f"Warning: file {file} is a symlink!") + print("Symlink target: ", os.readlink(file)) + return files + + +def check_universal_binary(): + dir = 'build-64-osx-universal-release/bin/ScreenPlay.app/Contents' + path = Path(repo_root_path()).joinpath(dir).absolute() + print(f"Checking files at: {path}") + files = listfiles(str(path)) + none_fat_found = False + none_fat_files = [] + for file in files: + out = run_and_capture_output(f"lipo -info {file}") + if out.startswith('Non-fat'): + none_fat_found = True + none_fat_files.append(file) + if none_fat_found: + print("❌ None universal binaries found") + for file in none_fat_files: + print(f"❌ {file}") + else: + print("✅ All files are a universal binaries") \ No newline at end of file