Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions exporter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,32 @@ if (APPLE)
VERBATIM
)

# Find macdeployqt next to the Qt bin directory
find_program(DEPLOYQT_EXECUTABLE macdeployqt
PATHS ${CMAKE_PREFIX_PATH}/../../bin
REQUIRED)

# Deploy Qt and ffmovie into the plugin bundle
set(PLUGIN_BUNDLE_DIR "$<TARGET_BUNDLE_DIR:PAGExporter>")
set(PLUGIN_FRAMEWORKS_DIR "${PLUGIN_BUNDLE_DIR}/Contents/Frameworks")
set(PLUGIN_FFMOVIE_SRC "${CMAKE_CURRENT_SOURCE_DIR}/../viewer/vendor/ffmovie/mac/${ARCH}/libffmovie.dylib")

add_custom_command(
TARGET PAGExporter POST_BUILD
# Extract dSYM before macdeployqt (which may strip the binary)
COMMAND /bin/sh -c "dsymutil '${PLUGIN_BUNDLE_DIR}/Contents/MacOS/PAGExporter' -o '${CMAKE_BINARY_DIR}/PAGExporter.dSYM' 2>/dev/null || true"
# Copy libffmovie.dylib
COMMAND /bin/sh -c "mkdir -p '${PLUGIN_FRAMEWORKS_DIR}' && [ -f '${PLUGIN_FRAMEWORKS_DIR}/libffmovie.dylib' ] || cp '${PLUGIN_FFMOVIE_SRC}' '${PLUGIN_FRAMEWORKS_DIR}/'"
# Deploy Qt (skip if already deployed). macdeployqt only supports .app bundles
# (CFBundlePackageType=APPL), so it may exit non-zero for .plugin bundles.
# The non-zero exit is safe to ignore as Qt frameworks are still copied successfully.
COMMAND /bin/sh -c "[ -d '${PLUGIN_FRAMEWORKS_DIR}/QtCore.framework' ] || '${DEPLOYQT_EXECUTABLE}' -no-strip '${PLUGIN_BUNDLE_DIR}' -qmldir='${CMAKE_CURRENT_SOURCE_DIR}/assets/qml' || true"
# Set rpath
COMMAND /bin/sh -c "install_name_tool -add_rpath '@loader_path/../Frameworks' '${PLUGIN_BUNDLE_DIR}/Contents/MacOS/PAGExporter' 2>/dev/null || true"
COMMENT "Deploying runtime dependencies into PAGExporter.plugin"
VERBATIM
)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
add_custom_command(
TARGET PAGExporter POST_BUILD
Expand Down
6 changes: 3 additions & 3 deletions exporter/scripts/mac/debugbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ plugiPath=$1
script_path=$(realpath "$0")
script_dir=$(dirname "$script_path")
rootPath=$(realpath "$script_dir/../..")
if ! [ -w '${AE_PLUGIN_PATH}/PAGExporter.plugin' ]; then
if ! [ -w "${AE_PLUGIN_PATH}/PAGExporter.plugin" ]; then
${rootPath}/scripts/mac/takeControl
fi
rm -r -f "${AE_PLUGIN_PATH}/PAGExporter.plugin"
cp -r -f ${plugiPath} "${AE_PLUGIN_PATH}/"
rm -rf "${AE_PLUGIN_PATH}/PAGExporter.plugin"
cp -a "${plugiPath}" "${AE_PLUGIN_PATH}/"
11 changes: 8 additions & 3 deletions exporter/src/platform/mac/PlatformHelper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <dlfcn.h>
#include <QDir>
#include <QFileInfo>
#include <filesystem>
#include <string>
#include "platform/PAGViewerCheck.h"
#include "platform/PAGViewerInstaller.h"
Expand Down Expand Up @@ -79,9 +80,13 @@ bool IsAEWindowActive() {
}

std::string GetQmlPath() {
// Use shared Qt resources directory to avoid modifying plugin bundle (which would break code
// signature)
return "/Library/Application Support/PAGExporter/Resources/qml";
Dl_info info;
if (dladdr((void*)GetQmlPath, &info) && info.dli_fname) {
std::filesystem::path exePath(info.dli_fname);
auto pluginContents = exePath.parent_path().parent_path();
return (pluginContents / "Resources" / "qml").string();
}
return "";
}

std::string GetDownloadsPath() {
Expand Down
63 changes: 63 additions & 0 deletions viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,66 @@ endif ()
target_include_directories(PAGViewer PUBLIC ${PAG_VIEWER_INCLUDES})
target_include_directories(PAGViewer SYSTEM PRIVATE ${PAG_VIEWER_SYSTEM_INCLUDES})
target_link_libraries(PAGViewer ${PAG_VIEWER_PLATFORM_LIBS} ${VIEWER_VENDOR_LIBRARIES})

if (APPLE)
# Find macdeployqt next to the Qt bin directory
find_program(DEPLOYQT_EXECUTABLE macdeployqt
PATHS ${CMAKE_PREFIX_PATH}/../../bin
REQUIRED)

set_target_properties(PAGViewer PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME "PAGViewer"
MACOSX_BUNDLE_GUI_IDENTIFIER "im.pag.viewer"
BUILD_RPATH "@executable_path/../Frameworks"
INSTALL_RPATH "@executable_path/../Frameworks"
)

set(VIEWER_BUNDLE_DIR "$<TARGET_BUNDLE_DIR:PAGViewer>")
set(VIEWER_FRAMEWORKS_DIR "${VIEWER_BUNDLE_DIR}/Contents/Frameworks")
set(VIEWER_RESOURCES_DIR "${VIEWER_BUNDLE_DIR}/Contents/Resources")
set(VIEWER_FFMOVIE_SRC "${CMAKE_SOURCE_DIR}/vendor/ffmovie/mac/${ARCH}/libffmovie.dylib")
set(VIEWER_SPARKLE_SRC "${CMAKE_SOURCE_DIR}/vendor/sparkle/mac/Sparkle.framework")

add_custom_command(TARGET PAGViewer POST_BUILD
# Extract dSYM before macdeployqt (which may strip the binary)
COMMAND /bin/sh -c "dsymutil '${VIEWER_BUNDLE_DIR}/Contents/MacOS/PAGViewer' -o '${CMAKE_BINARY_DIR}/PAGViewer.dSYM' 2>/dev/null || true"
# Copy libffmovie.dylib
COMMAND /bin/sh -c "mkdir -p '${VIEWER_FRAMEWORKS_DIR}' && [ -f '${VIEWER_FRAMEWORKS_DIR}/libffmovie.dylib' ] || cp '${VIEWER_FFMOVIE_SRC}' '${VIEWER_FRAMEWORKS_DIR}/'"
# Copy Sparkle.framework
COMMAND /bin/sh -c "[ -d '${VIEWER_FRAMEWORKS_DIR}/Sparkle.framework' ] || cp -R '${VIEWER_SPARKLE_SRC}' '${VIEWER_FRAMEWORKS_DIR}/'"
# Copy resources
COMMAND /bin/sh -c "mkdir -p '${VIEWER_RESOURCES_DIR}' && cp -f '${CMAKE_SOURCE_DIR}/assets/images/appIcon.icns' '${VIEWER_RESOURCES_DIR}/' && cp -f '${CMAKE_SOURCE_DIR}/assets/images/pagIcon.icns' '${VIEWER_RESOURCES_DIR}/'"
# Copy Info.plist
COMMAND /bin/sh -c "cp -f '${CMAKE_SOURCE_DIR}/package/templates/Info.plist' '${VIEWER_BUNDLE_DIR}/Contents/'"
# Deploy Qt (skip if already deployed)
COMMAND /bin/sh -c "[ -d '${VIEWER_FRAMEWORKS_DIR}/QtCore.framework' ] || '${DEPLOYQT_EXECUTABLE}' '${VIEWER_BUNDLE_DIR}' -qmldir='${CMAKE_SOURCE_DIR}/assets/qml'"
COMMENT "Deploying runtime dependencies into PAGViewer.app"
VERBATIM
)
elseif (WIN32)
get_target_property(qmake_executable Qt6::qmake IMPORTED_LOCATION)
if (NOT qmake_executable)
message(FATAL_ERROR "qmake executable not found")
endif ()
get_filename_component(qt_bin_dir "${qmake_executable}" DIRECTORY)
find_program(DEPLOYQT_EXECUTABLE windeployqt HINTS "${qt_bin_dir}")
if (NOT DEPLOYQT_EXECUTABLE)
message(FATAL_ERROR "windeployqt.exe not found in ${qt_bin_dir}")
endif ()

set(VIEWER_OUTPUT_DIR "$<TARGET_FILE_DIR:PAGViewer>")
set(VIEWER_WINSPARKLE_DLL "${CMAKE_SOURCE_DIR}/vendor/winsparkle/win/x64/${CMAKE_BUILD_TYPE}/WinSparkle.dll")
set(VIEWER_FFMOVIE_DLL "${CMAKE_SOURCE_DIR}/vendor/ffmovie/win/${ARCH}/ffmovie.dll")

add_custom_command(TARGET PAGViewer POST_BUILD
# Copy WinSparkle.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${VIEWER_WINSPARKLE_DLL}" "${VIEWER_OUTPUT_DIR}/"
# Copy ffmovie.dll
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${VIEWER_FFMOVIE_DLL}" "${VIEWER_OUTPUT_DIR}/"
# Deploy Qt (skip if already deployed)
COMMAND cmd /c "if not exist \"${VIEWER_OUTPUT_DIR}\\Qt6Core.dll\" \"${DEPLOYQT_EXECUTABLE}\" \"$<TARGET_FILE:PAGViewer>\" --qmldir=\"${CMAKE_SOURCE_DIR}/assets/qml\""
COMMENT "Deploying runtime dependencies for PAGViewer"
VERBATIM
)
endif ()
52 changes: 26 additions & 26 deletions viewer/assets/translation/Chinese.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,17 +630,17 @@
<context>
<name>pag::PluginInstaller</name>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="127"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="126"/>
<source>Install Adobe After Effects Plug-in</source>
<translation>安装 Adobe After Effects 插件</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="131"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="130"/>
<source>Do you want to install the Adobe After Effects plugins?</source>
<translation>是否要安装 Adobe After Effects 插件?</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="135"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="134"/>
<source>Update Adobe After Effects Plug-in</source>
<translation>更新 Adobe After Effects 插件</translation>
</message>
Expand All @@ -649,105 +649,105 @@
<translation type="vanished">有新版本的插件可用。是否要安装?</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="73"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="72"/>
<source>Reinstall Adobe After Effects Plug-in</source>
<translation>重新安装 Adobe After Effects 插件</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="74"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="73"/>
<source>The plugins are already installed with the latest version. Do you want to reinstall them?</source>
<translation>插件已是最新版本。是否要重新安装?</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="146"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="189"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="145"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="188"/>
<source>Please close Adobe After Effects</source>
<translation>请关闭 Adobe After Effects</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="147"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="190"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="146"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="189"/>
<source>Adobe After Effects is currently running. Please close it and click OK to continue, or Cancel to abort.</source>
<translation>Adobe After Effects 正在运行。请关闭它并点击确定继续,或点击取消中止。</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="157"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="172"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="156"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="171"/>
<source>Installation Failed</source>
<translation>安装失败</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="157"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="156"/>
<source>Plugin source not found: %1</source>
<translation>未找到插件源:%1</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="166"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="165"/>
<source>Installation Complete</source>
<translation>安装完成</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="167"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="166"/>
<source>Adobe After Effects plugins have been successfully installed!</source>
<translation>Adobe After Effects 插件已成功安装!</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="169"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="168"/>
<source>Adobe After Effects plug-in installed successfully.</source>
<translation>Adobe After Effects 插件安装成功。</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="173"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="172"/>
<source>Failed to install Adobe After Effects plugins. Please check permissions.</source>
<translation>安装 Adobe After Effects 插件失败。请检查权限。</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="177"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="176"/>
<source>Failed to install Adobe After Effects plug-in due to permission issues.</source>
<translation>由于权限问题,安装 Adobe After Effects 插件失败。</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="183"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="182"/>
<source>Uninstall Plugins</source>
<translation>卸载插件</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="184"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="183"/>
<source>Are you sure you want to uninstall the selected plugins?</source>
<translation>确定要卸载选中的插件吗?</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="200"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="199"/>
<source>Uninstallation Complete</source>
<translation>卸载完成</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="200"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="199"/>
<source>Plugins have been successfully removed!</source>
<translation>插件已成功移除!</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="201"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="200"/>
<source>Uninstalled AE Plug-in Successfully</source>
<translation>AE 插件卸载成功</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="204"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="203"/>
<source>Uninstallation Failed</source>
<translation>卸载失败</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="205"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="204"/>
<source>Failed to uninstall plugins. Please check permissions.</source>
<translation>卸载插件失败。请检查权限。</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="207"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="206"/>
<source>Failed to uninstall AE Plug-in due to permission issues.</source>
<translation>由于权限问题,卸载 AE 插件失败。</translation>
</message>
<message>
<location filename="../../src/platform/PluginInstaller.cpp" line="139"/>
<location filename="../../src/platform/PluginInstaller.cpp" line="138"/>
<source>A new version of the Adobe After Effects plugin is available. Would you like to update it now?</source>
<translation>Adobe After Effects 插件有新版本可用,是否立即更新?</translation>
</message>
Expand Down
Loading
Loading