Drag'n Drop for macOS / Fix #1109 / ... (#1353)

This commit is contained in:
Markus 2021-10-16 05:07:36 -07:00 committed by GitHub
parent c9a7258160
commit a1dee08195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 384 additions and 186 deletions

View File

@ -106,7 +106,7 @@ jobs:
shell: bash
run: |
mkdir -p macOS
mv build/*.tar.gz macOS
mv build/*.dmg macOS
# Upload artifacts
- name: Upload artifacts

12
.vscode/launch.json vendored
View File

@ -33,6 +33,18 @@
"cwd": "${workspaceFolder}",
"environment": [],
"console": "internalConsole"
},
{
"name": "(macOS) Hyperion.app",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/hyperiond.app/Contents/MacOS/hyperiond",
"args": ["-d"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"console": "internalConsole",
"MIMode": "lldb"
}
]
}

View File

@ -802,6 +802,35 @@ HIDAPI
long as the copyright notice in the source files
remains intact.
==============================
HyperHDR
==============================
MIT License
Copyright (c) 2021 awawa-dev
Project homesite: https://github.com/awawa-dev/HyperHDR
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
===========
JSON-Editor
===========
@ -1754,4 +1783,3 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS

View File

@ -121,6 +121,8 @@ MACRO(FIRSTSUBDIR result curdir)
ENDMACRO()
if ( "${PLATFORM}" MATCHES "osx" )
# specify the min version of the target platform
SET ( CMAKE_OSX_DEPLOYMENT_TARGET "10.15" )
# add specific prefix paths
FIRSTSUBDIR(SUBDIRQT "/usr/local/Cellar/qt")
FIRSTSUBDIR(SUBDIRPY "/usr/local/opt/python3/Frameworks/Python.framework/Versions")

View File

@ -58,21 +58,18 @@
initRestart();
});
var url = 'https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/3RD_PARTY_LICENSES';
fetch(url)
.then(function (response) {
if (!response.ok) {
$("#3rdpartylicenses").html('<a href="' + url + '">' + $.i18n("about_3rd_party_licenses_error") + '</a>');
}
else {
response.text().then(function (text) {
$("#3rdpartylicenses").html('<code>' + text + '</code>');
});
}
})
.catch(function (rejected) {
$("#3rdpartylicenses").html('<a href="' + url + '">' + $.i18n("about_3rd_party_licenses_error") + '</a>');
});
$.ajax({
url:'3RD_PARTY_LICENSES',
dataType: "text",
success: function()
{
$("#3rdpartylicenses").html('<a href="https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/3RD_PARTY_LICENSES">' + $.i18n("about_3rd_party_licenses_error") + '</a>');
},
error: function(data)
{
$("#3rdpartylicenses").html('<code>' + data + '</code>');
}
});
removeOverlay();
</script>

View File

@ -1,4 +1,94 @@
macro(DeployUnix TARGET)
macro(DeployMacOS TARGET)
if (EXISTS ${TARGET_FILE})
message(STATUS "Collecting Dependencies for target file: ${TARGET_FILE}")
get_target_property(QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
execute_process(
COMMAND ${QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGIN_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
install(CODE "set(TARGET_FILE \"${TARGET_FILE}\") \n set(TARGET_BUNDLE_NAME \"${TARGET}.app\") \n set(PLUGIN_DIR \"${QT_PLUGIN_DIR}\")" COMPONENT "Hyperion")
install(CODE [[
file(GET_RUNTIME_DEPENDENCIES
EXECUTABLES ${TARGET_FILE}
RESOLVED_DEPENDENCIES_VAR resolved_deps
UNRESOLVED_DEPENDENCIES_VAR unresolved_deps
PRE_INCLUDE_REGEXES ".dylib"
PRE_EXCLUDE_REGEXES ".*"
)
foreach(dependency ${resolved_deps})
file(INSTALL
FILES "${dependency}"
DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/Frameworks"
TYPE SHARED_LIBRARY
)
endforeach()
list(LENGTH unresolved_deps unresolved_length)
if("${unresolved_length}" GREATER 0)
message(WARNING "The following unresolved dependencies were discovered: ${unresolved_deps}")
endif()
foreach(PLUGIN "platforms" "sqldrivers" "imageformats")
if(EXISTS ${PLUGIN_DIR}/${PLUGIN})
file(GLOB files "${PLUGIN_DIR}/${PLUGIN}/*")
foreach(file ${files})
get_filename_component(plugin ${file} NAME)
list(APPEND QT_PLUGINS "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/plugins/${PLUGIN}/${plugin}")
file(INSTALL
FILES ${file}
DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/plugins/${PLUGIN}"
TYPE SHARED_LIBRARY
)
endforeach()
endif()
endforeach()
include(BundleUtilities)
fixup_bundle("${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}" "${QT_PLUGINS}" "" IGNORE_ITEM "python;python3;Python;Python3;.Python;.Python3")
# Detect the Python version and modules directory
find_package(Python3 3.5 REQUIRED)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))"
OUTPUT_VARIABLE PYTHON_MODULES_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Copy Python modules to '/../Frameworks/Python.framework/Versions/Current/lib/PythonMAJOR.MINOR' and ignore the unnecessary stuff listed below
if (PYTHON_MODULES_DIR)
set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
file(
COPY ${PYTHON_MODULES_DIR}/
DESTINATION "${CMAKE_INSTALL_PREFIX}/${TARGET_BUNDLE_NAME}/Contents/Frameworks/Python.framework/Versions/Current/lib/python${PYTHON_VERSION_MAJOR_MINOR}"
PATTERN "*.pyc" EXCLUDE # compiled bytecodes
PATTERN "__pycache__" EXCLUDE # any cache
PATTERN "config-${PYTHON_VERSION_MAJOR_MINOR}*" EXCLUDE # static libs
PATTERN "lib2to3" EXCLUDE # automated Python 2 to 3 code translation
PATTERN "tkinter" EXCLUDE # Tk interface
PATTERN "turtledemo" EXCLUDE # Tk demo folder
PATTERN "turtle.py" EXCLUDE # Tk demo file
PATTERN "test" EXCLUDE # unittest module
PATTERN "sitecustomize.py" EXCLUDE # site-specific configs
)
endif(PYTHON_MODULES_DIR)
]] COMPONENT "Hyperion")
else()
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND "${CMAKE_COMMAND}" "-DTARGET_FILE=$<TARGET_FILE:${TARGET}>"
ARGS ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
VERBATIM
)
endif()
endmacro()
macro(DeployLinux TARGET)
if (EXISTS ${TARGET_FILE})
message(STATUS "Collecting Dependencies for target file: ${TARGET_FILE}")
include(GetPrerequisites)
@ -80,8 +170,8 @@ macro(DeployUnix TARGET)
endforeach()
endif(OPENSSL_FOUND)
# Detect the Qt5 plugin directory, source: https://github.com/lxde/lxqt-qtplugin/blob/master/src/CMakeLists.txt
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
# Detect the Qt5 plugin directory
get_target_property(QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGINS_DIR
@ -139,26 +229,18 @@ macro(DeployUnix TARGET)
# Detect the Python version and modules directory
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
set(PYTHON_VERSION_MAJOR_MINOR "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))"
OUTPUT_VARIABLE PYTHON_MODULES_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(PYTHON_MODULES_DIR "${Python3_STDLIB}")
else()
set(PYTHON_VERSION_MAJOR_MINOR "${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(standard_lib=True))"
OUTPUT_VARIABLE PYTHON_MODULES_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
# Copy Python modules to 'share/hyperion/lib/pythonXX' and ignore the unnecessary stuff listed below
# Copy Python modules to 'share/hyperion/lib/pythonMAJOR.MINOR' and ignore the unnecessary stuff listed below
if (PYTHON_MODULES_DIR)
install(

View File

@ -0,0 +1,61 @@
on run argv
set image_name to item 1 of argv
tell application "Finder"
tell disk image_name
-- wait for the image to finish mounting
set open_attempts to 0
repeat while open_attempts < 4
try
open
delay 1
set open_attempts to 5
close
on error errStr number errorNumber
set open_attempts to open_attempts + 1
delay 10
end try
end repeat
delay 5
-- open the image the first time and save a DS_Store with just
-- background and icon setup
open
set current view of container window to icon view
set theViewOptions to the icon view options of container window
set background picture of theViewOptions to file ".background:background.png"
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 100
delay 5
close
-- next setup the position of the app and Applications symlink
-- plus hide all the window decoration
open
tell container window
set sidebar width to 0
set toolbar visible to false
set statusbar visible to false
set the bounds to {300, 100, 1000, 548}
set position of item "Hyperion.app" to {260, 230}
set extension hidden of item "Hyperion.app" to true
set position of item "Applications" to {590, 228}
-- Move these out of the way for users with Finder configured to show all files
set position of item ".background" to {800, 280}
set position of item ".fseventsd" to {800, 280}
set position of item ".VolumeIcon.icns" to {800, 280}
end tell
delay 1
close
-- one last open and close so you can see everything looks correct
open
delay 5
close
end tell
delay 1
end tell
end run

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -1,70 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleVersion</key>
<string>1489366340</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleExecutable</key>
<string>hyperiond</string>
<key>CFBundleIconFile</key>
<string>Hyperion.icns</string>
<key>CFBundleIdentifier</key>
<string>com.hyperion-project.Hyperion</string>
<key>CFBundleName</key>
<string>Hyperion</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>BuildMachineOSBuild</key>
<string>11G63</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>DTCompiler</key>
<string></string>
<key>DTPlatformBuild</key>
<string>4H1003</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>12D75</string>
<key>DTSDKName</key>
<string>macosx10.8</string>
<key>DTXcode</key>
<string>0462</string>
<key>DTXcodeBuild</key>
<string>4H1003</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Hyperion team. All rights reserved.</string>
<!--key>NSMainNibFile</key>
<string>MainMenu</string-->
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>SUEnableAutomaticChecks</key>
<true/>
<key>SUEnableSystemProfiling</key>
<false/>
<key>SUShowReleaseNotes</key>
<true/>
<key>SUAllowsAutomaticUpdates</key>
<true/>
</dict>
<dict>
<key>CFBundleDeveloperRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>com.hyperion-project.hyperiond</string>
<key>CFBundleName</key>
<string>Hyperion</string>
<key>CFBundleExecutable</key>
<string>Hyperion</string>
<key>CFBundleIconFile</key>
<string>Hyperion.icns</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>NSHumanReadableCopyright</key>
<string>MIT License</string>
<key>Source Code</key>
<string>"https://github.com/hyperion-project/hyperion.ng"</string>
</dict>
</plist>

Binary file not shown.

View File

@ -1,5 +0,0 @@
#!/bin/sh
cd "$(dirname "$0")"
# Path to hyperiond!?
cd ../Resources/bin
exec ./hyperiond "$@"

View File

@ -1,8 +1,9 @@
# cmake file for generating distribution packages
# default packages to build
# Default packages to build
IF (APPLE)
SET ( CPACK_GENERATOR "TGZ")
SET ( CPACK_GENERATOR "DragNDrop")
SET ( CPACK_DMG_FORMAT "UDBZ" )
ELSEIF (UNIX)
SET ( CPACK_GENERATOR "TGZ")
ELSEIF (WIN32)
@ -11,11 +12,12 @@ ENDIF()
# Determine packages by found generator executables
find_package(RpmBuilder)
find_package(DebBuilder)
IF(RPM_BUILDER_FOUND)
message(STATUS "CPACK: Found RPM builder")
SET ( CPACK_GENERATOR ${CPACK_GENERATOR} "RPM")
ENDIF()
find_package(DebBuilder)
IF(DEB_BUILDER_FOUND)
message(STATUS "CPACK: Found DEB builder")
SET ( CPACK_GENERATOR ${CPACK_GENERATOR} "DEB")
@ -43,12 +45,12 @@ SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org")
SET ( CPACK_PACKAGE_VENDOR "hyperion-project")
SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" )
SET ( CPACK_PACKAGE_INSTALL_DIRECTORY "Hyperion" )
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png")
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png" )
SET ( CPACK_PACKAGE_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}")
SET ( CPACK_PACKAGE_VERSION_MINOR "${HYPERION_VERSION_MINOR}")
SET ( CPACK_PACKAGE_VERSION_PATCH "${HYPERION_VERSION_PATCH}")
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" )
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE" )
SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" )
SET ( CPACK_CREATE_DESKTOP_LINKS "hyperiond;Hyperion" )
@ -57,46 +59,46 @@ if (NOT "${HYPERION_VERSION_PRE}" STREQUAL "")
string(APPEND CPACK_PACKAGE_VERSION_PATCH ${HYPERION_VERSION_PRE})
endif()
# Define the install prefix path for cpack
IF ( UNIX )
#SET ( CPACK_PACKAGING_INSTALL_PREFIX "share/hyperion")
ENDIF()
# Specific CPack Package Generators
# https://cmake.org/Wiki/CMake:CPackPackageGenerators
# https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/PackageGenerators
# .deb files for apt
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-scripts/preinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-scripts/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-scripts/prerm" )
# https://cmake.org/cmake/help/latest/cpack_gen/deb.html
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/package-scripts/preinst;${CMAKE_SOURCE_DIR}/cmake/package-scripts/postinst;${CMAKE_SOURCE_DIR}/cmake/package-scripts/prerm" )
SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libcec6 | libcec4" )
SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" )
# .rpm for rpm
# https://cmake.org/cmake/help/v3.5/module/CPackRPM.html
# https://cmake.org/cmake/help/latest/cpack_gen/rpm.html
SET ( CPACK_RPM_PACKAGE_RELEASE 1 )
SET ( CPACK_RPM_PACKAGE_LICENSE "MIT" )
SET ( CPACK_RPM_PACKAGE_GROUP "Applications" )
SET ( CPACK_RPM_PACKAGE_REQUIRES "libcec >= 4.0.0" )
SET ( CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-scripts/preinst" )
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-scripts/postinst" )
SET ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-scripts/prerm" )
SET ( CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/cmake/package-scripts/preinst" )
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/cmake/package-scripts/postinst" )
SET ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/cmake/package-scripts/prerm" )
# OSX "Bundle" generator TODO Add more osx generators
# https://cmake.org/cmake/help/v3.10/module/CPackBundle.html
SET ( CPACK_BUNDLE_NAME "Hyperion" )
SET ( CPACK_BUNDLE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/Hyperion.icns )
SET ( CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/Info.plist )
SET ( CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_SOURCE_DIR}/cmake/osxbundle/launch.sh" )
# .dmg for Apple macOS
# https://cmake.org/cmake/help/latest/cpack_gen/dmg.html
IF (APPLE)
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/osxbundle/PackageIcon.icns" )
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_BINARY_DIR}/LICENSE" )
SET ( CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/cmake/osxbundle/Background.png" )
SET ( CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_SOURCE_DIR}/cmake/osxbundle/AppleScript.scpt" )
ENDIF(APPLE)
# Windows NSIS
# Use custom script based on cpack nsis template
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/nsis/template ${CMAKE_MODULE_PATH})
# Some path transformations
if(WIN32)
file(TO_NATIVE_PATH ${CPACK_PACKAGE_ICON} CPACK_PACKAGE_ICON)
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
endif()
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/nsis/installer.ico" NSIS_HYP_ICO)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/nsis/header.bmp" NSIS_HYP_LOGO_HORI)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/nsis/logo.bmp" NSIS_HYP_LOGO_VERT)
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/cmake/nsis/installer.ico" NSIS_HYP_ICO)
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/cmake/nsis/header.bmp" NSIS_HYP_LOGO_HORI)
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}/cmake/nsis/logo.bmp" NSIS_HYP_LOGO_VERT)
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_ICO "${NSIS_HYP_ICO}")
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_LOGO_VERT "${NSIS_HYP_LOGO_VERT}")
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_LOGO_HORI "${NSIS_HYP_LOGO_HORI}")
@ -113,19 +115,25 @@ SET ( CPACK_NSIS_HELP_LINK "https://www.hyperion-project.org")
SET ( CPACK_NSIS_URL_INFO_ABOUT "https://www.hyperion-project.org")
SET ( CPACK_NSIS_MUI_FINISHPAGE_RUN "hyperiond.exe")
SET ( CPACK_NSIS_BRANDING_TEXT "Hyperion-${HYPERION_VERSION}")
# custom nsis plugin directory
SET ( CPACK_NSIS_EXTRA_DEFS "!addplugindir ${CMAKE_SOURCE_DIR}/cmake/nsis/plugins")
# additional hyperiond startmenu link, won't be created if the user disables startmenu links
SET ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Hyperion (Console).lnk' '$INSTDIR\\\\bin\\\\hyperiond.exe' '-d -c'")
SET ( CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$MUI_TEMP\\\\Hyperion (Console).lnk'")
# define the install components
# Define the install components
# See also https://gitlab.kitware.com/cmake/community/-/wikis/doc/cpack/Component-Install-With-CPack
# and https://cmake.org/cmake/help/latest/module/CPackComponent.html
SET ( CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE")
# Components base
SET ( CPACK_COMPONENTS_ALL "Hyperion" "hyperion_remote" )
# optional compiled
# Components base (All builds)
SET ( CPACK_COMPONENTS_ALL "Hyperion" )
SET ( CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} "hyperion_remote" )
# Optional compiled
if(ENABLE_QT)
SET ( CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} "hyperion_qt" )
endif()
@ -151,6 +159,11 @@ if(ENABLE_OSX)
SET ( CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} "hyperion_osx" )
endif()
# Only include Hyperion to macOS dmg package (without standalone programs)
IF ( CPACK_GENERATOR MATCHES "DragNDrop" )
LIST ( REMOVE_ITEM CPACK_COMPONENTS_ALL "hyperion_remote" "hyperion_qt" "hyperion_osx" )
ENDIF()
SET ( CPACK_ARCHIVE_COMPONENT_INSTALL ON )
SET ( CPACK_DEB_COMPONENT_INSTALL ON )
SET ( CPACK_RPM_COMPONENT_INSTALL ON )
@ -164,6 +177,7 @@ cpack_add_install_type(Full DISPLAY_NAME "Full")
cpack_add_install_type(Min DISPLAY_NAME "Minimal")
cpack_add_component_group(Runtime EXPANDED DESCRIPTION "Hyperion runtime and hyperion-remote commandline tool")
cpack_add_component_group(Screencapture EXPANDED DESCRIPTION "Standalone Screencapture commandline programs")
# Components base
cpack_add_component(Hyperion
DISPLAY_NAME "Hyperion"
@ -172,6 +186,7 @@ cpack_add_component(Hyperion
GROUP Runtime
REQUIRED
)
cpack_add_component(hyperion_remote
DISPLAY_NAME "Hyperion Remote"
DESCRIPTION "Hyperion remote cli tool"
@ -253,4 +268,3 @@ if(ENABLE_OSX)
DEPENDS Hyperion
)
endif()

View File

@ -7,6 +7,9 @@
// qt include
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QVector>
#include <QStringList>
// modules to init
#include <effectengine/EffectModule.h>
@ -31,21 +34,39 @@ PythonInit::PythonInit()
Py_SetProgramName(L"Hyperion");
// set Python module path when exists
QString py_patch = QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python" + STRINGIFY(PYTHON_VERSION_MAJOR) + "." + STRINGIFY(PYTHON_VERSION_MINOR));
QString py_file = QDir::cleanPath(qApp->applicationDirPath() + "/python" + STRINGIFY(PYTHON_VERSION_MAJOR) + STRINGIFY(PYTHON_VERSION_MINOR) + ".zip");
QString py_path = QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python" + STRINGIFY(PYTHON_VERSION_MAJOR) + "." + STRINGIFY(PYTHON_VERSION_MINOR));
QString py_file = QDir::cleanPath(qApp->applicationDirPath() + "/python" + STRINGIFY(PYTHON_VERSION_MAJOR) + STRINGIFY(PYTHON_VERSION_MINOR) + ".zip");
QString py_framework = QDir::cleanPath(qApp->applicationDirPath() + "/../Frameworks/Python.framework/Versions/Current/lib/python" + STRINGIFY(PYTHON_VERSION_MAJOR) + "." + STRINGIFY(PYTHON_VERSION_MINOR));
if (QFile(py_file).exists() || QDir(py_patch).exists())
if (QFile(py_file).exists() || QDir(py_path).exists() || QDir(py_framework).exists() )
{
Py_NoSiteFlag++;
if (QFile(py_file).exists())
if (QFile(py_file).exists()) // Windows
{
Py_SetPythonHome(Py_DecodeLocale(py_file.toLatin1().data(), nullptr));
Py_SetPath(Py_DecodeLocale(py_file.toLatin1().data(), nullptr));
}
else if (QDir(py_patch).exists())
else if (QDir(py_path).exists()) // Linux
{
Py_SetPythonHome(Py_DecodeLocale(py_patch.toLatin1().data(), nullptr));
Py_SetPath(Py_DecodeLocale(py_patch.toLatin1().data(), nullptr));
QStringList python_paths;
python_paths.append(QDir(py_path).absolutePath());
python_paths.append(QDir(py_path + "/lib-dynload").absolutePath());
QVector<wchar_t> joined_paths(python_paths.join(":").size() + 1, 0);
python_paths.join(":").toWCharArray(joined_paths.data());
Py_SetPath(joined_paths.data());
py_path = QDir::cleanPath(qApp->applicationDirPath() + "/../");
Py_SetPythonHome(Py_DecodeLocale(py_path.toLatin1().data(), nullptr));
}
else if (QDir(py_framework).exists()) // macOS
{
QStringList python_paths;
python_paths.append(QDir(py_framework).absolutePath());
python_paths.append(QDir(py_framework + "/lib-dynload").absolutePath());
QVector<wchar_t> joined_paths(python_paths.join(":").size() + 1, 0);
python_paths.join(":").toWCharArray(joined_paths.data());
Py_SetPath(joined_paths.data());
py_framework = QDir::cleanPath(qApp->applicationDirPath() + "/../Frameworks/Python.framework/Versions/Current");
Py_SetPythonHome(Py_DecodeLocale(py_framework.toLatin1().data(), nullptr));
}
}
#endif

View File

@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
<file alias="/webconfig/3RD_PARTY_LICENSES">${CMAKE_SOURCE_DIR}/3RD_PARTY_LICENSES</file>
${HYPERION_WEBCONFIG_RES}
</qresource>
</RCC>

View File

@ -34,10 +34,4 @@ target_link_libraries( ${PROJECT_NAME}
Qt5::Network
)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_osx" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_osx" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_osx" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_osx" )
endif(CMAKE_HOST_UNIX)
install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_osx" )

View File

@ -40,14 +40,16 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Network
)
if(NOT WIN32)
if(APPLE)
install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_qt" )
elseif(NOT WIN32)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_qt" )
else()
install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "hyperion_qt" )
endif()
if(CMAKE_HOST_UNIX)
if(CMAKE_HOST_UNIX AND NOT APPLE)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_qt" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_qt" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_qt" )
endif(CMAKE_HOST_UNIX)
endif()

View File

@ -44,14 +44,16 @@ if (ENABLE_AMLOGIC)
)
endif()
if(NOT WIN32)
if(APPLE)
install ( TARGETS ${PROJECT_NAME} DESTINATION "." COMPONENT "hyperion_remote" )
elseif(NOT WIN32)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "hyperion_remote" )
else()
install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "hyperion_remote" )
endif()
if(CMAKE_HOST_UNIX)
if(CMAKE_HOST_UNIX AND NOT APPLE)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "hyperion_remote" )
install(FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME "${PROJECT_NAME}" COMPONENT "hyperion_remote" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME} )" COMPONENT "hyperion_remote" )
endif(CMAKE_HOST_UNIX)
endif()

View File

@ -1,3 +1,9 @@
if (APPLE)
project(Hyperion)
else()
project(hyperiond)
endif()
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
include_directories(${Python3_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}/..)
@ -11,10 +17,18 @@ find_package(Qt5Widgets REQUIRED)
# generate windows .rc file for this binary
if (WIN32)
include(${CMAKE_SOURCE_DIR}/cmake/win/win_rc.cmake)
generate_win_rc_file(hyperiond)
generate_win_rc_file(${PROJECT_NAME})
endif(WIN32)
add_executable(hyperiond
# include resource files for macos bundle (copy LICENSE file and correct line breaks)
if (APPLE)
configure_file(${CMAKE_SOURCE_DIR}/LICENSE ${CMAKE_BINARY_DIR}/LICENSE COPYONLY)
execute_process(COMMAND bash -c "perl -pi -e 's/\n/\r/g' ${CMAKE_BINARY_DIR}/LICENSE")
set(BUNDLE_RESOURCE_FILES ${CMAKE_SOURCE_DIR}/cmake/osxbundle/Hyperion.icns ${CMAKE_BINARY_DIR}/LICENSE)
set_source_files_properties(${BUNDLE_RESOURCE_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif(APPLE)
add_executable(${PROJECT_NAME}
console.h
hyperiond.h
systray.h
@ -22,14 +36,15 @@ add_executable(hyperiond
systray.cpp
main.cpp
${hyperiond_WIN_RC_PATH}
${BUNDLE_RESOURCE_FILES}
)
# promote hyperiond as GUI app
if (WIN32)
target_link_options(hyperiond PUBLIC /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup)
target_link_options(${PROJECT_NAME} PUBLIC /SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup)
endif(WIN32)
target_link_libraries(hyperiond
target_link_libraries(${PROJECT_NAME}
commandline
hyperion
effectengine
@ -45,17 +60,17 @@ target_link_libraries(hyperiond
)
if (NOT CMAKE_VERSION VERSION_LESS "3.12")
target_link_libraries( hyperiond ${Python3_LIBRARIES} )
target_link_libraries( ${PROJECT_NAME} ${Python3_LIBRARIES} )
else()
target_link_libraries( hyperiond ${PYTHON_LIBRARIES} )
target_link_libraries( ${PROJECT_NAME} ${PYTHON_LIBRARIES} )
endif()
if (ENABLE_AVAHI)
target_link_libraries(hyperiond bonjour)
target_link_libraries(${PROJECT_NAME} bonjour)
endif (ENABLE_AVAHI)
if (ENABLE_AMLOGIC)
target_link_libraries(hyperiond
target_link_libraries(${PROJECT_NAME}
Qt5::Core
pcre16 dl z
)
@ -69,64 +84,79 @@ if (ENABLE_DISPMANX)
SET(BCM_INCLUDE_DIRS "")
SET(BCM_LIBRARIES "")
ENDIF()
target_link_libraries(hyperiond dispmanx-grabber)
target_link_libraries(${PROJECT_NAME} dispmanx-grabber)
endif (ENABLE_DISPMANX)
if (ENABLE_FB)
target_link_libraries(hyperiond framebuffer-grabber)
target_link_libraries(${PROJECT_NAME} framebuffer-grabber)
endif (ENABLE_FB)
if (ENABLE_OSX)
target_link_libraries(hyperiond osx-grabber)
target_link_libraries(${PROJECT_NAME} osx-grabber)
endif (ENABLE_OSX)
if (ENABLE_V4L2)
target_link_libraries(hyperiond v4l2-grabber)
target_link_libraries(${PROJECT_NAME} v4l2-grabber)
endif ()
if (ENABLE_MF)
target_link_libraries(hyperiond mf-grabber)
target_link_libraries(${PROJECT_NAME} mf-grabber)
endif (ENABLE_MF)
if (ENABLE_AMLOGIC)
target_link_libraries(hyperiond amlogic-grabber)
target_link_libraries(${PROJECT_NAME} amlogic-grabber)
endif (ENABLE_AMLOGIC)
if (ENABLE_X11)
if(APPLE)
include_directories("/opt/X11/include")
endif(APPLE)
target_link_libraries(hyperiond x11-grabber)
target_link_libraries(${PROJECT_NAME} x11-grabber)
endif (ENABLE_X11)
if (ENABLE_XCB)
target_link_libraries(hyperiond xcb-grabber)
target_link_libraries(${PROJECT_NAME} xcb-grabber)
endif (ENABLE_XCB)
if (ENABLE_QT)
target_link_libraries(hyperiond qt-grabber)
target_link_libraries(${PROJECT_NAME} qt-grabber)
endif (ENABLE_QT)
if (ENABLE_DX)
include_directories(${DIRECTX9_INCLUDE_DIRS})
target_link_libraries(hyperiond directx-grabber)
target_link_libraries(${PROJECT_NAME} directx-grabber)
endif (ENABLE_DX)
if (ENABLE_CEC)
target_link_libraries(hyperiond cechandler)
target_link_libraries(${PROJECT_NAME} cechandler)
endif (ENABLE_CEC)
if(NOT WIN32)
install ( TARGETS hyperiond DESTINATION "share/hyperion/bin" COMPONENT "Hyperion" )
if (APPLE)
set_target_properties( ${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/cmake/osxbundle/Info.plist
MACOSX_BUNDLE_BUNDLE_NAME "Hyperion"
MACOSX_BUNDLE_BUNDLE_VERSION ${HYPERION_VERSION}
MACOSX_BUNDLE_COPYRIGHT "Copyright (c) 2014-2021 Hyperion Project"
MACOSX_BUNDLE_GUI_IDENTIFIER "com.hyperion-project.${PROJECT_NAME}"
MACOSX_BUNDLE_ICON_FILE "Hyperion.icns"
MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} Version ${HYPERION_VERSION}"
MACOSX_BUNDLE_LONG_VERSION_STRING ${HYPERION_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${HYPERION_VERSION}
)
install ( TARGETS ${PROJECT_NAME} DESTINATION . COMPONENT "Hyperion")
elseif(NOT WIN32)
install ( TARGETS ${PROJECT_NAME} DESTINATION "share/hyperion/bin" COMPONENT "Hyperion" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/" COMPONENT "Hyperion" )
install ( FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "share/hyperion/effects" COMPONENT "Hyperion" )
install ( FILES ${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png DESTINATION "share/hyperion/icons" COMPONENT "Hyperion" )
# Desktop file for hyperiond
# Desktop file for Hyperion
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperiond_128.png DESTINATION "share/hyperion/desktop" COMPONENT "Hyperion" )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperiond.desktop DESTINATION "share/hyperion/desktop" COMPONENT "Hyperion" )
else()
install ( TARGETS hyperiond DESTINATION "bin" COMPONENT "Hyperion" )
install ( TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "Hyperion" )
install ( FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "effects" COMPONENT "Hyperion" )
#set( CMAKE_INSTALL_UCRT_LIBRARIES TRUE )
@ -134,30 +164,31 @@ else()
#include( InstallRequiredSystemLibraries )
endif()
if(CMAKE_HOST_UNIX)
install( CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/hyperiond\" \"${CMAKE_BINARY_DIR}/symlink_hyperiond\" )" COMPONENT "Hyperion" )
install( FILES ${CMAKE_BINARY_DIR}/symlink_hyperiond DESTINATION "bin" RENAME hyperiond COMPONENT "Hyperion" )
install( CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_hyperiond )" COMPONENT "Hyperion" )
install ( FILES ${CMAKE_SOURCE_DIR}/bin/scripts/updateHyperionUser.sh DESTINATION "share/hyperion/scripts" COMPONENT "Hyperion" )
if (CMAKE_HOST_UNIX AND NOT APPLE)
install( CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/${PROJECT_NAME}\" \"${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}\" )" COMPONENT "Hyperion" )
install( FILES "${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME}" DESTINATION "bin" RENAME ${PROJECT_NAME} COMPONENT "Hyperion" )
install( CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_${PROJECT_NAME})" COMPONENT "Hyperion" )
endif()
# Deploy Qt DLLs into the binary folder.
# This is necessary for starting the application from within the IDE
if(WIN32)
if (WIN32)
get_target_property(QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
set(WINDEPLOYQT_PARAMS --verbose 0 --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler)
add_custom_command(TARGET hyperiond POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} ${WINDEPLOYQT_PARAMS} "$<TARGET_FILE:hyperiond>")
endif()
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} ${WINDEPLOYQT_PARAMS} "$<TARGET_FILE:${PROJECT_NAME}>")
endif(WIN32)
if(ENABLE_DEPLOY_DEPENDENCIES)
# Deploy all dependencies for package creation (not for OSX)
# Deploy all dependencies for package creation
include(${CMAKE_SOURCE_DIR}/cmake/Dependencies.cmake)
if (NOT ENABLE_OSX AND NOT WIN32) # Unix
DeployUnix("hyperiond")
if (APPLE) #macOS
DeployMacOS(${PROJECT_NAME})
elseif (NOT WIN32) # Linux
DeployLinux(${PROJECT_NAME})
elseif(WIN32) # Windows
DeployWindows("hyperiond")
DeployWindows(${PROJECT_NAME})
endif ()
endif(ENABLE_DEPLOY_DEPENDENCIES)

View File

@ -130,7 +130,9 @@ QCoreApplication* createApplication(int &argc, char *argv[])
// add optional library path
app->addLibraryPath(QApplication::applicationDirPath() + "/../lib");
app->setApplicationDisplayName("Hyperion");
#ifndef __APPLE__
app->setWindowIcon(QIcon(":/hyperion-icon-32px.png"));
#endif
return app;
}