From a99030f5c0f7939085cf8eed6e86fe6508230686 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 22 Dec 2019 06:26:28 +0100 Subject: [PATCH] ci: Build Installers and rename to StreamFX --- .github/workflows/main.yml | 3 ++ CMakeLists.txt | 82 ++++++++++++++++++++------------------ ci/builder.js | 6 +-- cmake/installer.iss.in | 8 ++-- 4 files changed, 53 insertions(+), 46 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 071acaec..c653d038 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,17 +25,20 @@ jobs: with: node-version: 10 - name: Configure & Compile + shell: bash env: CMAKE_GENERATOR_32: ${{ matrix.generator_32 }} CMAKE_GENERATOR_64: ${{ matrix.generator_64 }} CMAKE_SYSTEM_VERSION: ${{ matrix.sysversion }} run: node ./ci/builder.js - name: Package + shell: bash env: CMAKE_GENERATOR_32: ${{ matrix.generator_32 }} CMAKE_GENERATOR_64: ${{ matrix.generator_64 }} run: | mkdir build/package + ls build/ node ./ci/packager.js - name: "Package Installer (Prereqs)" run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 8be3f633..7de06504 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git") set(VERSION_TWEAK ${GIT_OUTPUT}) endif() execute_process( - COMMAND git rev-parse HEAD + COMMAND git rev-parse --short=8 HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} RESULT_VARIABLE GIT_RESULT OUTPUT_VARIABLE GIT_OUTPUT @@ -51,11 +51,11 @@ endif() # Define Project project( - obs-stream-effects + StreamFX VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK} ) -set(PROJECT_FULL_NAME "Stream Effects for OBS Studio") -set(PROJECT_DESCRIPTION "New Sources, Filters and Transitions for OBS Studio") +set(PROJECT_FULL_NAME "StreamFX for OBS Studio") +set(PROJECT_DESCRIPTION "Adds new Effects, like Sources, Transitions and Filters to OBS Studio.") set(PROJECT_AUTHORS "Michael Fabian 'Xaymar' Dirks ") set(PROJECT_COPYRIGHT_YEARS "2018 - 2019") @@ -81,7 +81,7 @@ endif() math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}") if("${BITS}" STREQUAL "32") set(ARCH "x86") - message(STATUS "Stream Effects no longer supports 32-bit builds, you are on your own if you continue.") + message(STATUS "StreamFX no longer supports 32-bit builds, you are on your own if you continue.") else() set(ARCH "x64") endif() @@ -121,7 +121,28 @@ set(_CXX_STANDARD 17) set(_CXX_EXTENSIONS OFF) ################################################################################ -# CMake / Compiler +# Options +################################################################################ +set(${PropertyPrefix}OBS_NATIVE FALSE CACHE BOOL "Use native obs-studio build" FORCE) +set(${PropertyPrefix}OBS_REFERENCE FALSE CACHE BOOL "Use referenced obs-studio build" FORCE) +set(${PropertyPrefix}OBS_PACKAGE FALSE CACHE BOOL "Use packaged obs-studio build" FORCE) +set(${PropertyPrefix}OBS_DOWNLOAD FALSE CACHE BOOL "Use downloaded obs-studio build" FORCE) +mark_as_advanced(FORCE OBS_NATIVE OBS_PACKAGE OBS_REFERENCE OBS_DOWNLOAD) + +if(NOT TARGET libobs) + set(${PropertyPrefix}OBS_STUDIO_DIR "" CACHE PATH "OBS Studio Source/Package Directory") + set(${PropertyPrefix}OBS_DOWNLOAD_VERSION "24.0.3-ci" CACHE STRING "OBS Studio Version to download") +endif() + +if(NOT ${PropertyPrefix}OBS_NATIVE) + set(${PropertyPrefix}OBS_DEPENDENCIES_DIR "" CACHE PATH "Path to OBS Dependencies") + set(CMAKE_PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Path for generated archives.") + set(CMAKE_PACKAGE_NAME "${PROJECT_NAME}" CACHE STRING "Name for the generated archives.") + set(CMAKE_PACKAGE_SUFFIX_OVERRIDE "" CACHE STRING "Override for the suffix.") +endif() + +################################################################################ +# CMake / Compiler Dependencies ################################################################################ # Configure Version Header @@ -134,9 +155,23 @@ configure_file( "${PROJECT_BINARY_DIR}/source/module.cpp" ) +# Packaging +if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "") + set(_PACKAGE_SUFFIX_OVERRIDE "${PROJECT_VERSION}-${PROJECT_COMMIT}") +else() + set(_PACKAGE_SUFFIX_OVERRIDE "${CMAKE_PACKAGE_SUFFIX_OVERRIDE}") +endif() +set(_PACKAGE_FULL_NAME "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${_PACKAGE_SUFFIX_OVERRIDE}") + # Windows if(WIN32) ## Installer (InnoSetup) + get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR) + get_filename_component(ISS_PACKAGE_DIR "${CMAKE_PACKAGE_PREFIX}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR) + get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE) + file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR) configure_file( "${PROJECT_SOURCE_DIR}/cmake/installer.iss.in" "${PROJECT_BINARY_DIR}/installer.iss" @@ -156,31 +191,6 @@ if(WIN32) ) endif() -################################################################################ -# Options -################################################################################ -set(${PropertyPrefix}OBS_NATIVE FALSE CACHE BOOL "Use native obs-studio build" FORCE) -set(${PropertyPrefix}OBS_REFERENCE FALSE CACHE BOOL "Use referenced obs-studio build" FORCE) -set(${PropertyPrefix}OBS_PACKAGE FALSE CACHE BOOL "Use packaged obs-studio build" FORCE) -set(${PropertyPrefix}OBS_DOWNLOAD FALSE CACHE BOOL "Use downloaded obs-studio build" FORCE) -mark_as_advanced(FORCE OBS_NATIVE OBS_PACKAGE OBS_REFERENCE OBS_DOWNLOAD) - -if(NOT TARGET libobs) - set(${PropertyPrefix}OBS_STUDIO_DIR "" CACHE PATH "OBS Studio Source/Package Directory") - set(${PropertyPrefix}OBS_DOWNLOAD_VERSION "24.0.0-rc2-ci" CACHE STRING "OBS Studio Version to download") -endif() - -if(NOT ${PropertyPrefix}OBS_NATIVE) - set(${PropertyPrefix}OBS_DEPENDENCIES_DIR "" CACHE PATH "Path to OBS Dependencies") - set(CMAKE_PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Path for generated archives.") - set(CMAKE_PACKAGE_NAME "${PROJECT_NAME}" CACHE STRING "Name for the generated archives.") - set(CMAKE_PACKAGE_SUFFIX_OVERRIDE "" CACHE STRING "Override for the suffix.") -endif() - -################################################################################ -# Dependencies -################################################################################ - # Detect OBS Studio Type if(TARGET libobs) message(STATUS "${PROJECT_NAME}: Using native obs-studio.") @@ -568,22 +578,16 @@ else() DESTINATION "./data/obs-plugins/${PROJECT_NAME}/" ) - if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "") - set(PackageFullName "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${PROJECT_VERSION}") - else() - set(PackageFullName "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${CMAKE_PACKAGE_SUFFIX_OVERRIDE}") - endif() - add_custom_target( PACKAGE_7Z - ${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.7z" --format=7zip -- + ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.7z" --format=7zip -- "${CMAKE_INSTALL_PREFIX}/obs-plugins" "${CMAKE_INSTALL_PREFIX}/data" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" ) add_custom_target( PACKAGE_ZIP - ${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.zip" --format=zip -- + ${CMAKE_COMMAND} -E tar cfv "${_PACKAGE_FULL_NAME}.zip" --format=zip -- "${CMAKE_INSTALL_PREFIX}/obs-plugins" "${CMAKE_INSTALL_PREFIX}/data" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" diff --git a/ci/builder.js b/ci/builder.js index a873a790..91fcd9e7 100644 --- a/ci/builder.js +++ b/ci/builder.js @@ -11,9 +11,9 @@ if ((process.platform == "win32") || (process.platform == "win64")) { // Windows let extra_conf = [ `-DCMAKE_SYSTEM_VERSION=${process.env.CMAKE_SYSTEM_VERSION}`, - `-DCMAKE_PACKAGE_NAME=obs-ffmpeg-encoder`, - '-DCMAKE_INSTALL_PREFIX="build/distrib/"', - '-DCMAKE_PACKAGE_PREFIX="build/package/"', + `-DCMAKE_PACKAGE_NAME=StreamFX`, + '-DCMAKE_INSTALL_PREFIX="build/distrib"', + '-DCMAKE_PACKAGE_PREFIX="build/package"', ]; let extra_build = [ diff --git a/cmake/installer.iss.in b/cmake/installer.iss.in index 3e7e8ca0..e9f0c59a 100644 --- a/cmake/installer.iss.in +++ b/cmake/installer.iss.in @@ -21,9 +21,9 @@ AppUpdatesURL={#MyAppURL} DefaultDirName={code:GetDirName} DefaultGroupName={#MyAppName} AllowNoIcons=yes -LicenseFile="@PROJECT_SOURCE_DIR@/LICENSE" -OutputDir="@CMAKE_INSTALL_PREFIX@/../" -OutputBaseFilename=obs-stream-effects-{#MyAppVersion}-@PROJECT_COMMIT@ +LicenseFile="@ISS_SOURCE_DIR@/LICENSE" +OutputDir="@ISS_PACKAGE_DIR@" +OutputBaseFilename=@CMAKE_PACKAGE_NAME@-@_PACKAGE_SUFFIX_OVERRIDE@ Compression=lzma SolidCompression=yes VersionInfoVersion={#MyAppVersion} @@ -34,7 +34,7 @@ VersionInfoDescription={#MyAppName} Setup Name: "english"; MessagesFile: "compiler:Default.isl" [Files] -Source: "@CMAKE_INSTALL_PREFIX@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons]