chore: Package creation with dependencies (#636)

* Packages are now created with dependencies

Signed-off-by: Paulchen-Panther <paulchen-panter@protonmail.com>

* Ignore site packages

Signed-off-by: Paulchen-Panther <paulchen-panter@protonmail.com>

* MacOS Package creation disabled

* Append the OpenSSL library to the dependency list

* - Exit codes and Error message are suppressed when copying files
- OpenSSL root directory is set under MacOS
- OpenSSL symlinks are attached
- Packages and build directory renamed into Hyperion

Signed-off-by: Paulchen-Panther <paulchen-panter@protonmail.com>

* Update to semver version

* Use version file for version management

* Read version file in azure

Co-authored-by: brindosch <edeltraud70@gmx.de>
This commit is contained in:
Paulchen Panther 2020-02-16 16:24:33 +01:00 committed by GitHub
parent b9ecd0e112
commit 17a9cd2b02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 272 additions and 113 deletions

View File

@ -35,12 +35,9 @@ jobs:
- checkout: self # represents the repo where the initial Pipelines YAML file was found
submodules: recursive # set to 'recursive' to get submodules of submodules
# read channel tag in version.json
- task: oneLuckiDevJson2Variable@1
inputs:
jsonFile: 'version.json'
shouldPrefixVariables: true
variablePrefix: 'json'
# read version file
- bash: echo "##vso[task.setvariable variable=semVer]$(grep -oE 'alpha|beta' version)"
workingDirectory: '$(Build.SourcesDirectory)'
displayName: 'Read and generate pipeline variables'
# build process
@ -52,7 +49,7 @@ jobs:
PLATFORM: $(platform)
# copy files
- bash: 'cp -v deploy/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
- bash: 'cp -v deploy/Hyperion-* $(Build.ArtifactStagingDirectory) 2>/dev/null || :'
workingDirectory: '$(Build.SourcesDirectory)'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Collecting deployable artifacts'
@ -67,8 +64,8 @@ jobs:
# set release to pre-release
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark beta as pre-release'
condition: and(succeeded(), or(contains(variables['semVer'], 'alpha'), contains(variables['semVer'], 'beta')), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark alpha or beta as pre-release'
# create or update github release
- task: GithubRelease@0
@ -99,12 +96,9 @@ jobs:
- checkout: self # represents the repo where the initial Pipelines YAML file was found
submodules: recursive # set to 'recursive' to get submodules of submodules
# read channel tag in version.json
- task: oneLuckiDevJson2Variable@1
inputs:
jsonFile: 'version.json'
shouldPrefixVariables: true
variablePrefix: 'json'
# read version file
- bash: echo "##vso[task.setvariable variable=semVer]$(grep -oE 'alpha|beta' version)"
workingDirectory: '$(Build.SourcesDirectory)'
displayName: 'Read and generate pipeline variables'
# install dependencies
@ -118,7 +112,7 @@ jobs:
PLATFORM: 'osx'
# copy files
- bash: 'cp -v build/Hyperion.NG-* $(Build.ArtifactStagingDirectory)'
- bash: 'cp -v build/Hyperion-* $(Build.ArtifactStagingDirectory) 2>/dev/null || :'
workingDirectory: '$(Build.SourcesDirectory)'
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Collecting deployable artifacts'
@ -133,8 +127,8 @@ jobs:
# set release to pre-release
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
condition: and(succeeded(), contains(variables['json.channel'], 'beta'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark beta as pre-release'
condition: and(succeeded(), or(contains(variables['semVer'], 'alpha'), contains(variables['semVer'], 'beta')), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: 'Mark alpha or beta as pre-release'
# create or update github release
- task: GithubRelease@0

View File

@ -34,7 +34,7 @@ if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then
mkdir build || exit 1
cd build
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ../ || exit 2
make -j $(sysctl -n hw.ncpu) package || exit 3
make -j $(sysctl -n hw.ncpu) || exit 3 # Notes: The package creation is currently not supported because of strange errors.
cd ${CI_BUILD_DIR} && source /${CI_BUILD_DIR}/test/testrunner.sh || exit 4
exit 0;
exit 1 || { echo "---> Hyperion compilation failed! Abort"; exit 5; }
@ -48,13 +48,13 @@ elif [[ "$CI_NAME" == 'linux' ]]; then
-v "${CI_BUILD_DIR}/deploy:/deploy" \
-v "${CI_BUILD_DIR}:/source:ro" \
hyperionproject/hyperion-ci:$DOCKER_TAG \
/bin/bash -c "mkdir hyperion.ng && cp -r source/. /hyperion.ng &&
cd /hyperion.ng && mkdir build && cd build &&
/bin/bash -c "mkdir hyperion && cp -r source/. /hyperion &&
cd /hyperion && mkdir build && cd build &&
cmake -DPLATFORM=${PLATFORM} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DDOCKER_PLATFORM=${DOCKER_TAG} ../ || exit 2 &&
make -j $(nproc) package || exit 3 &&
cp /hyperion.ng/build/bin/h* /deploy/ 2>/dev/null || : &&
cp /hyperion.ng/build/Hyperion.NG-* /deploy/ 2>/dev/null || : &&
cd /hyperion.ng && source /hyperion.ng/test/testrunner.sh || exit 4 &&
cp /hyperion/build/bin/h* /deploy/ 2>/dev/null || : &&
cp /hyperion/build/Hyperion-* /deploy/ 2>/dev/null || : &&
cd /hyperion && source /hyperion/test/testrunner.sh || exit 4 &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 5; }

1
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -1,7 +1,14 @@
cmake_minimum_required(VERSION 3.0.0)
message( STATUS "CMake Version: ${CMAKE_VERSION}" )
PROJECT(hyperion)
# Parse semantic version of version file
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)
file (STRINGS "version" HYPERION_VERSION)
SetVersionNumber(HYPERION ${HYPERION_VERSION})
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
# auto prepare .qrc files
@ -21,42 +28,6 @@ endif(CCACHE_FOUND)
set(Python_ADDITIONAL_VERSIONS 3.5)
find_package( PythonInterp 3.5 REQUIRED )
# Read version from version.json
EXECUTE_PROCESS (
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_VERSION
)
SET( VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?" )
if ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${RETURN_VERSION} )
LIST( GET VERSION_PARTS 0 VERSION_MAJOR )
LIST( GET VERSION_PARTS 1 VERSION_MINOR )
LIST( GET VERSION_PARTS 2 VERSION_PATCH )
else ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()
SET( HYPERION_VERSION_MAJOR ${VERSION_MAJOR} )
SET( HYPERION_VERSION_MINOR ${VERSION_MINOR} )
SET( HYPERION_VERSION_PATCH ${VERSION_PATCH} )
# Read channel from version.json
EXECUTE_PROCESS (
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json "channel"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_CHANNEL
)
if ( error_code )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()
SET ( HYPERION_VERSION_CHANNEL ${RETURN_CHANNEL} )
# Set build variables
SET ( DEFAULT_AMLOGIC OFF )
SET ( DEFAULT_DISPMANX OFF )
@ -285,11 +256,15 @@ endif()
# Use GNU gold linker if available
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/LDGold.cmake)
# setup -rpath to search for shared libs in BINARY/../libs folder
# Don't create new dynamic tags (RUNPATH)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--disable-new-dtags")
# setup -rpath to search for shared libs in BINARY/../lib folder
if (UNIX AND NOT APPLE)
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN/../lib")
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:$ORIGIN/../lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
endif ()
# add QT5 dependency
@ -369,4 +344,3 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_D
# enable make package - no code after this line !
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)

View File

@ -43,7 +43,6 @@
#define HYPERION_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}"
#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}"
#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION_CHANNEL "${HYPERION_VERSION_CHANNEL}"
#define HYPERION_VERSION "${HYPERION_VERSION}"
#define HYPERION_JSON_VERSION "1.0.0"

View File

@ -1,4 +1,4 @@
![Hyperion.NG](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/assets/webconfig/img/hyperion/hyperionlogo.png)
![Hyperion](https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/assets/webconfig/img/hyperion/hyperionlogo.png)
[![Dependencies](https://img.shields.io/librariesio/github/hyperion-project/hyperion.ng.svg)](https://github.com/hyperion-project/hyperion.ng/tree/master/dependencies/external)
[![Azure-Pipeline](https://dev.azure.com/Hyperion-Project/Hyperion.NG/_apis/build/status/Hyperion.NG?branchName=master)](https://dev.azure.com/Hyperion-Project/Hyperion.NG/_build/latest?definitionId=7&branchName=master)
@ -9,7 +9,7 @@
## About Hyperion
[Hyperion.NG](https://github.com/hyperion-project/hyperion.ng) is an opensource [Bias or Ambient Lighting](https://en.wikipedia.org/wiki/Bias_lighting) implementation which you might know from TV manufacturers. It supports many LED devices and video grabbers. The project is still in a beta development stage (no stable release available).
[Hyperion](https://github.com/hyperion-project/hyperion.ng) is an opensource [Bias or Ambient Lighting](https://en.wikipedia.org/wiki/Bias_lighting) implementation which you might know from TV manufacturers. It supports many LED devices and video grabbers. The project is still in a beta development stage (no stable release available).
![Screenshot](doc/screenshot.png)

View File

@ -20,7 +20,7 @@ make_release()
make -j $(nproc) || exit 1
#strip bin/*
make package -j $(nproc)
mv Hyperion.NG-* ../deploy/${RELEASE}
mv Hyperion-* ../deploy/${RELEASE}
cd ..
bin/create_release.sh . ${RELEASE}
}

View File

@ -15,7 +15,7 @@ if ! [ -d "$builddir" ]; then
exit 1
fi
outfile="$repodir/deploy/hyperion.ng_$buildid.tar.gz"
outfile="$repodir/deploy/hyperion_$buildid.tar.gz"
echo create $outfile
tar --create --gzip --absolute-names --show-transformed-names --ignore-failed-read\

View File

@ -81,8 +81,8 @@ mkdir $SCRIPT_PATH/deploy >/dev/null 2>&1
# get Hyperion source, cleanup previous folder
echo "---> Downloading Hyperion source code from ${GIT_REPO_URL}"
sudo rm -fr $SCRIPT_PATH/hyperion.ng >/dev/null 2>&1
git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion.ng || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; }
sudo rm -fr $SCRIPT_PATH/hyperion >/dev/null 2>&1
git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion || { echo "---> Failed to download Hyperion source code! Abort"; exit 1; }
# start compilation
# Remove container after stop
@ -93,15 +93,15 @@ git clone --recursive --depth 1 -q $GIT_REPO_URL $SCRIPT_PATH/hyperion.ng || { e
echo "---> Startup docker..."
$DOCKER run --rm \
-v "${SCRIPT_PATH}/deploy:/deploy" \
-v "${SCRIPT_PATH}/hyperion.ng:/source:ro" \
-v "${SCRIPT_PATH}/hyperion:/source:ro" \
hyperionproject/hyperion-ci:$BUILD_TARGET \
/bin/bash -c "mkdir hyperion.ng && cp -r /source/. /hyperion.ng &&
cd /hyperion.ng && mkdir build && cd build &&
/bin/bash -c "mkdir hyperion && cp -r /source/. /hyperion &&
cd /hyperion && mkdir build && cd build &&
cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} .. || exit 2 &&
make -j $(nproc) ${PACKAGES} || exit 3 &&
echo '---> Copy binaries and packages to host folder: ${SCRIPT_PATH}/deploy' &&
cp -v /hyperion.ng/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /hyperion.ng/build/Hyperion.NG-* /deploy/ 2>/dev/null || : &&
cp -v /hyperion/build/bin/h* /deploy/ 2>/dev/null || : &&
cp -v /hyperion/build/Hyperion-* /deploy/ 2>/dev/null || : &&
exit 0;
exit 1 " || { echo "---> Hyperion compilation failed! Abort"; exit 4; }

View File

@ -6,8 +6,6 @@ execute_process( COMMAND sh -c "git remote --verbose | grep origin | grep fetch
STRING ( STRIP "${BUILD_ID}" BUILD_ID )
STRING ( STRIP "${VERSION_ID}" VERSION_ID )
STRING ( STRIP "${GIT_REMOTE_PATH}" GIT_REMOTE_PATH )
SET ( HYPERION_BUILD_ID "${VERSION_ID} (${BUILD_ID})" )
SET ( HYPERION_GIT_REMOTE "${GIT_REMOTE_PATH}" )
SET ( HYPERION_VERSION "${HYPERION_VERSION_CHANNEL} ${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}" )
SET ( HYPERION_BUILD_ID "${VERSION_ID} (${BUILD_ID}) Git Remote: ${GIT_REMOTE_PATH}" )
message ( STATUS "Current Version: ${HYPERION_VERSION}" )
message ( STATUS " - Build: ${HYPERION_BUILD_ID}" )

View File

@ -24,15 +24,15 @@ ENDIF()
# Apply to all packages, some of these can be overwritten with generator specific content
# https://cmake.org/cmake/help/v3.5/module/CPack.html
SET ( CPACK_PACKAGE_NAME "Hyperion.NG" )
SET ( CPACK_PACKAGE_NAME "Hyperion" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an open source ambient light implementation" )
SET ( CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md" )
if ( NOT DEFINED DOCKER_PLATFORM )
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}")
else()
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion.NG-${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}-${CMAKE_SYSTEM_NAME}-${DOCKER_PLATFORM}")
endif()
IF ( NOT DEFINED DOCKER_PLATFORM )
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion-${HYPERION_VERSION}-${CMAKE_SYSTEM_NAME}")
ELSE()
SET ( CPACK_PACKAGE_FILE_NAME "Hyperion-${HYPERION_VERSION}-${CMAKE_SYSTEM_NAME}-${DOCKER_PLATFORM}")
ENDIF()
SET ( CPACK_PACKAGE_CONTACT "packages@hyperion-project.org")
SET ( CPACK_PACKAGE_EXECUTABLES "hyperiond;Hyperion" )
@ -43,13 +43,11 @@ SET ( CPACK_PACKAGE_VERSION_PATCH "${HYPERION_VERSION_PATCH}")
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" )
SET ( CPACK_CREATE_DESKTOP_LINKS "hyperiond;Hyperion" )
# Specific CPack Package Generators
# https://cmake.org/Wiki/CMake:CPackPackageGenerators
# .deb files for apt
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/preinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/prerm" )
SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5core5a (>= 5.5.0), libqt5network5 (>= 5.5.0), libqt5gui5 (>= 5.5.0), libqt5serialport5 (>= 5.5.0), libqt5sql5 (>= 5.5.0), libqt5sql5-sqlite (>= 5.5.0), libavahi-core7 (>= 0.6.31), libavahi-compat-libdnssd1 (>= 0.6.31), libusb-1.0-0, libpython3.5, libc6" )
SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" )
# .rpm for rpm
@ -57,7 +55,6 @@ SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" )
SET ( CPACK_RPM_PACKAGE_RELEASE 1)
SET ( CPACK_RPM_PACKAGE_LICENSE "MIT")
SET ( CPACK_RPM_PACKAGE_GROUP "Applications")
SET ( CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase >= 5.5.0, qt5-qtbase-gui >= 5.5.0, qt5-qtserialport >= 5.5.0, avahi-libs >= 0.6.31, avahi-compat-libdns_sd >= 0.6.31, libusbx, python35 >= 3.5.0")
# Notes: This is a dependency list for Fedora 27, different .rpm OSes use different names for their deps
SET ( CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/preinst" )
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/postinst" )
@ -82,9 +79,16 @@ SET ( CPACK_NSIS_URL_INFO_ABOUT "https://www.hyperion-project.org")
# define the install components
SET ( CPACK_COMPONENTS_ALL "${PLATFORM}" )
SET ( CPACK_COMPONENT_${PLATFORM}_ARCHIVE_FILE "${CPACK_PACKAGE_FILE_NAME}" )
SET ( CPACK_ARCHIVE_COMPONENT_INSTALL ON )
SET ( CPACK_DEBIAN_${PLATFORM}_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.deb" )
SET ( CPACK_DEB_COMPONENT_INSTALL ON )
SET ( CPACK_RPM_${PLATFORM}_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.rpm" )
SET ( CPACK_RPM_COMPONENT_INSTALL ON )
SET ( CPACK_STRIP_FILES ON )
# no code after following line!

16
cmake/version.cmake Normal file
View File

@ -0,0 +1,16 @@
function(SetVersionNumber PREFIX VERSION_STRING)
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_STRING} )
LIST( GET VERSION_PARTS 0 VERSION_MAJOR )
LIST( GET VERSION_PARTS 1 VERSION_MINOR )
LIST( GET VERSION_PARTS 2 VERSION_PATCH )
set(${PREFIX}_VERSION_MAJOR ${VERSION_MAJOR} PARENT_SCOPE)
set(${PREFIX}_VERSION_MINOR ${VERSION_MINOR} PARENT_SCOPE)
set(${PREFIX}_VERSION_PATCH ${VERSION_PATCH} PARENT_SCOPE)
#if(NOT VERSION_PRE MATCHES "stable")
# set(${PREFIX}_VERSION_PRE ${VERSION_PRE} PARENT_SCOPE)
# set( VERSION_PRE_FULL "-${VERSION_PRE}")
#endif()
endfunction()

View File

@ -378,7 +378,6 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject&, const QString& command, c
QJsonObject hyperion;
hyperion["jsonrpc_version" ] = QString(HYPERION_JSON_VERSION);
hyperion["version" ] = QString(HYPERION_VERSION);
hyperion["channel" ] = QString(HYPERION_VERSION_CHANNEL);
hyperion["build" ] = QString(HYPERION_BUILD_ID);
hyperion["gitremote" ] = QString(HYPERION_GIT_REMOTE);
hyperion["time" ] = QString(__DATE__ " " __TIME__);

View File

@ -8,6 +8,10 @@
#include <python/PythonInit.h>
#include <python/PythonUtils.h>
// qt include
#include <QCoreApplication>
#include <QDir>
// modules to init
#include <effectengine/EffectModule.h>
@ -16,6 +20,15 @@ PythonInit::PythonInit()
// register modules
EffectModule::registerHyperionExtensionModule();
// set Python module path when exists
const wchar_t *pythonPath = Py_DecodeLocale((QDir::cleanPath(qApp->applicationDirPath() + "/../lib/python")).toLatin1().data(), nullptr);
if(QDir(QString::fromWCharArray(pythonPath)).exists())
{
Py_NoSiteFlag++;
Py_SetPath(pythonPath);
}
delete pythonPath;
// init Python
Debug(Logger::getInstance("DAEMON"), "Initializing Python interpreter");
Py_InitializeEx(0);

View File

@ -2,6 +2,178 @@ find_package(PythonLibs 3.4 REQUIRED)
find_package(Qt5Widgets REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS}/..)
macro(InstallDependencies TARGET INSTALL_COMPONENT)
set(TARGET_FILE ${CMAKE_BINARY_DIR}/bin/${TARGET})
set(SYSTEM_LIBS_SKIP
"libavahi-client"
"libavahi-common"
"libbsd"
"libc"
"libdbus-1"
"libdl"
"libexpat"
"libfontconfig"
"libfreetype"
"libgcc_s"
"libgcrypt"
"libGL"
"libGLdispatch"
"libglib-2"
"libGLX"
"libgpg-error"
"liblz4"
"liblzma"
"libm"
"libpthread"
"librt"
"libstdc++"
"libsystemd"
"libudev"
"libusb-1"
"libutil"
"libX11"
"libXau"
"libxcb"
"libXdmcp"
"libXext"
"libXrender"
"libz"
)
if(EXISTS ${TARGET_FILE})
include(GetPrerequisites)
if (APPLE)
set(OPENSSL_ROOT_DIR /usr/local/opt/openssl)
endif(APPLE)
find_package(OpenSSL 1.0.0 REQUIRED)
# Extract dependencies ignoring the system ones
get_prerequisites(${TARGET_FILE} DEPENDENCIES 0 1 "" "")
# Append symlink and non-symlink dependencies to the list
set(PREREQUISITE_LIBS "")
foreach(DEPENDENCY ${DEPENDENCIES})
get_filename_component(resolved ${DEPENDENCY} NAME_WE)
list(FIND SYSTEM_LIBS_SKIP ${resolved} _index)
if (${_index} GREATER -1)
continue() # Skip system libraries
else()
gp_resolve_item("${TARGET_FILE}" "${DEPENDENCY}" "" "" resolved_file)
get_filename_component(resolved_file ${resolved_file} ABSOLUTE)
gp_append_unique(PREREQUISITE_LIBS ${resolved_file})
get_filename_component(file_canonical ${resolved_file} REALPATH)
gp_append_unique(PREREQUISITE_LIBS ${file_canonical})
endif()
endforeach()
# Append the OpenSSL library to the list
if (OPENSSL_FOUND)
foreach(openssl_lib ${OPENSSL_LIBRARIES})
get_prerequisites(${openssl_lib} openssl_deps 0 1 "" "")
foreach(openssl_dep ${openssl_deps})
get_filename_component(resolved ${openssl_dep} NAME_WE)
list(FIND SYSTEM_LIBS_SKIP ${resolved} _index)
if (${_index} GREATER -1)
continue() # Skip system libraries
else()
gp_resolve_item("${openssl_lib}" "${openssl_dep}" "" "" resolved_file)
get_filename_component(resolved_file ${resolved_file} ABSOLUTE)
gp_append_unique(PREREQUISITE_LIBS ${resolved_file})
get_filename_component(file_canonical ${resolved_file} REALPATH)
gp_append_unique(PREREQUISITE_LIBS ${file_canonical})
endif()
endforeach()
gp_append_unique(PREREQUISITE_LIBS ${openssl_lib})
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)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_PLUGINS_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Copy Qt plugins to 'share/hyperion/lib'
if(QT_PLUGINS_DIR)
foreach(PLUGIN "platforms" "sqldrivers" "imageformats")
if(EXISTS ${QT_PLUGINS_DIR}/${PLUGIN})
file(GLOB files "${QT_PLUGINS_DIR}/${PLUGIN}/*")
foreach(file ${files})
get_prerequisites(${file} PLUGINS 0 1 "" "")
foreach(DEPENDENCY ${PLUGINS})
get_filename_component(resolved ${DEPENDENCY} NAME_WE)
list(FIND SYSTEM_LIBS_SKIP ${resolved} _index)
if (${_index} GREATER -1)
continue() # Skip system libraries
else()
gp_resolve_item("${file}" "${DEPENDENCY}" "" "" resolved_file)
get_filename_component(resolved_file ${resolved_file} ABSOLUTE)
gp_append_unique(PREREQUISITE_LIBS ${resolved_file})
get_filename_component(file_canonical ${resolved_file} REALPATH)
gp_append_unique(PREREQUISITE_LIBS ${file_canonical})
endif()
endforeach()
install(
FILES ${file}
DESTINATION "share/hyperion/lib/${PLUGIN}"
COMPONENT "${INSTALL_COMPONENT}"
)
endforeach()
endif()
endforeach()
endif()
# Create a qt.conf file in 'share/hyperion/bin' to override hard-coded search paths in Qt plugins
file(WRITE "${CMAKE_BINARY_DIR}/qt.conf" "[Paths]\nPlugins=../lib/\n")
install(
FILES "${CMAKE_BINARY_DIR}/qt.conf"
DESTINATION "share/hyperion/bin"
COMPONENT "${INSTALL_COMPONENT}"
)
# Copy dependencies to 'share/hyperion/lib'
foreach(PREREQUISITE_LIB ${PREREQUISITE_LIBS})
install(
FILES ${PREREQUISITE_LIB}
DESTINATION "share/hyperion/lib"
COMPONENT "${INSTALL_COMPONENT}"
)
endforeach()
# Detect the Python modules directory
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
)
# Copy Python modules to 'share/hyperion/lib/python'
if (PYTHON_MODULES_DIR)
install(
DIRECTORY ${PYTHON_MODULES_DIR}/
DESTINATION "share/hyperion/lib/python"
COMPONENT "${INSTALL_COMPONENT}"
)
endif()
else()
# Run CMake after target was built to run get_prerequisites on ${TARGET_FILE}
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
VERBATIM
)
endif()
endmacro()
add_executable(hyperiond
hyperiond.h
systray.h
@ -83,3 +255,6 @@ if(CMAKE_HOST_UNIX)
install(FILES ${CMAKE_BINARY_DIR}/symlink_hyperiond DESTINATION "bin" RENAME hyperiond COMPONENT "${PLATFORM}" )
install(CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_hyperiond )" COMPONENT "${PLATFORM}" )
endif(CMAKE_HOST_UNIX)
# Copy dependencies
InstallDependencies("hyperiond" ${PLATFORM})

View File

@ -190,6 +190,8 @@ QCoreApplication* createApplication(int &argc, char *argv[])
if (isGuiApp)
{
QApplication* app = new QApplication(argc, argv);
// add optional library path
app->addLibraryPath(QApplication::applicationDirPath() + "/../lib");
app->setApplicationDisplayName("Hyperion");
app->setWindowIcon(QIcon(":/hyperion-icon-32px.png"));
return app;
@ -198,6 +200,9 @@ QCoreApplication* createApplication(int &argc, char *argv[])
QCoreApplication* app = new QCoreApplication(argc, argv);
app->setApplicationName("Hyperion");
app->setApplicationVersion(HYPERION_VERSION);
// add optional library path
app->addLibraryPath(QApplication::applicationDirPath() + "/../lib");
return app;
}

View File

@ -1,14 +0,0 @@
#!/usr/bin/env python
import json, sys
retval = 0
with open(sys.argv[1]) as f:
if len(sys.argv) < 3:
data = json.load(f)
sys.stdout.write(data['versionnr'])
sys.exit(0)
else:
data = json.load(f)
sys.stdout.write(data['channel'])
sys.exit(0)

1
version Normal file
View File

@ -0,0 +1 @@
2.0.0-alpha.1

View File

@ -1,6 +0,0 @@
{
"versionnr": "1.0.0",
"versiondesc": "Hyperion.NG introduces the succesor of Hyperion 1.0 with plenty new features to discover with a entire code rework and a highly extended JSON RPC!",
"versionchangelog": "https://www.hyperion-project.org/blog/id0",
"channel": "Beta"
}