diff --git a/.azure.yml b/.azure.yml index dbe65e63..024397fb 100644 --- a/.azure.yml +++ b/.azure.yml @@ -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 diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh index 45fd8ead..a5a0bbeb 100755 --- a/.ci/ci_build.sh +++ b/.ci/ci_build.sh @@ -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; } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..9e26dfee --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 496779ea..e3c4bd47 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) - diff --git a/HyperionConfig.h.in b/HyperionConfig.h.in index 1fb0e3eb..6b3804ae 100644 --- a/HyperionConfig.h.in +++ b/HyperionConfig.h.in @@ -40,10 +40,9 @@ #define HYPERION_BUILD_ID "${HYPERION_BUILD_ID}" #define HYPERION_GIT_REMOTE "${HYPERION_GIT_REMOTE}" -#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_MAJOR "${HYPERION_VERSION_MAJOR}" +#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}" +#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}" +#define HYPERION_VERSION "${HYPERION_VERSION}" #define HYPERION_JSON_VERSION "1.0.0" diff --git a/README.md b/README.md index 9637846d..67a38bd5 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/bin/create_all_releases.sh b/bin/create_all_releases.sh index f384780f..778e108f 100755 --- a/bin/create_all_releases.sh +++ b/bin/create_all_releases.sh @@ -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} } diff --git a/bin/create_release.sh b/bin/create_release.sh index 8de2675c..6436572e 100755 --- a/bin/create_release.sh +++ b/bin/create_release.sh @@ -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\ diff --git a/bin/scripts/docker-compile.sh b/bin/scripts/docker-compile.sh index 96211580..06904548 100644 --- a/bin/scripts/docker-compile.sh +++ b/bin/scripts/docker-compile.sh @@ -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; } diff --git a/cmake/FindGitVersion.cmake b/cmake/FindGitVersion.cmake index 24ba3175..b959bbf2 100644 --- a/cmake/FindGitVersion.cmake +++ b/cmake/FindGitVersion.cmake @@ -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}" ) diff --git a/cmake/packages.cmake b/cmake/packages.cmake index a9b9ba9b..c065f828 100644 --- a/cmake/packages.cmake +++ b/cmake/packages.cmake @@ -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! diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 00000000..1945d6d7 --- /dev/null +++ b/cmake/version.cmake @@ -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() \ No newline at end of file diff --git a/libsrc/api/JsonAPI.cpp b/libsrc/api/JsonAPI.cpp index 14ee36a7..0ab8e360 100644 --- a/libsrc/api/JsonAPI.cpp +++ b/libsrc/api/JsonAPI.cpp @@ -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__); diff --git a/libsrc/python/PythonInit.cpp b/libsrc/python/PythonInit.cpp index 48c734b2..7bad37ab 100644 --- a/libsrc/python/PythonInit.cpp +++ b/libsrc/python/PythonInit.cpp @@ -8,6 +8,10 @@ #include #include +// qt include +#include +#include + // modules to init #include @@ -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); diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index c24e105a..affe720b 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -10,7 +10,7 @@ FILE ( GLOB Hyperion_RESFILES "${CURRENT_SOURCE_DIR}/icons/*" "${CURRENT_SOURCE_ # fill resources.qrc with RESFILES FOREACH( f ${Hyperion_RESFILES} ) get_filename_component(fname ${f} NAME) - SET(HYPERION_RES "${HYPERION_RES}\n\t\t${f}") + SET(HYPERION_RES "${HYPERION_RES}\n\t\t${f}") ENDFOREACH() # prep file diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index 8667ac30..1c7bcb94 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -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}) diff --git a/src/hyperiond/main.cpp b/src/hyperiond/main.cpp index dd89ae43..17df633a 100644 --- a/src/hyperiond/main.cpp +++ b/src/hyperiond/main.cpp @@ -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; } diff --git a/test/jsonchecks/version.py b/test/jsonchecks/version.py deleted file mode 100644 index 06f6e2a7..00000000 --- a/test/jsonchecks/version.py +++ /dev/null @@ -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) diff --git a/version b/version new file mode 100644 index 00000000..68e06170 --- /dev/null +++ b/version @@ -0,0 +1 @@ +2.0.0-alpha.1 \ No newline at end of file diff --git a/version.json b/version.json deleted file mode 100644 index d84a7b78..00000000 --- a/version.json +++ /dev/null @@ -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" -}