From 95fdcff3a9667baed479c4856421ebd07e9a48a8 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 23 Dec 2018 20:49:18 +0100 Subject: [PATCH] cmake: Reworked build system for Installers and Archives --- CMakeLists.txt | 345 ++++++++++---------- appveyor.yml | 65 ++-- ci/appveyor-build.bat | 4 + ci/appveyor-install.bat | 8 + ci/appveyor-package.bat | 6 + ci/make.bat | 22 -- {ci => cmake}/installer.iss.in | 6 +- cmake/module.cpp.in | 17 + source/version.h.in => cmake/version.hpp.in | 0 source/plugin.cpp | 14 - source/plugin.h | 2 +- 11 files changed, 245 insertions(+), 244 deletions(-) create mode 100644 ci/appveyor-build.bat create mode 100644 ci/appveyor-install.bat create mode 100644 ci/appveyor-package.bat delete mode 100644 ci/make.bat rename {ci => cmake}/installer.iss.in (95%) create mode 100644 cmake/module.cpp.in rename source/version.h.in => cmake/version.hpp.in (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index e62d63f0..e4a278ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,8 +18,6 @@ # CMake Setup CMake_Minimum_Required(VERSION 3.1.0) Include("cmake/util.cmake") -Include("cmake/DownloadProject.cmake") -Include("cmake/cppcheck.cmake") # Automatic Versioning Set(VERSION_MAJOR 0) @@ -56,137 +54,158 @@ EndIf() PROJECT( obs-stream-effects VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK} - DESCRIPTION "" - HOMEPAGE_URL "https://www.xaymar.com/portfolio/obs-stream-effects/" ) +set(PROJECT_FULL_NAME "Stream Effects for OBS Studio") +set(PROJECT_DESCRIPTION "New Sources, Filters and Transitions for OB Studio") +set(PROJECT_AUTHORS "Michael Fabian 'Xaymar' Dirks ") +set(PROJECT_COPYRIGHT_YEARS "2018") + +################################################################################ +# Setup / Bootstrap +################################################################################ + +# Detect Build Type +if("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") + set(PropertyPrefix "") +else() + set(PropertyPrefix "${PROJECT_NAME}_") +endif() + +# Detect Architecture +math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}") +if("${BITS}" STREQUAL "32") + set(ARCH "x86") +else() + set(ARCH "x64") +endif() + +# Search Path +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/") ################################################################################ # CMake / Compiler ################################################################################ -# Detect Build Type -If("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") - Set(PropertyPrefix "") -Else() - Set(PropertyPrefix "${PROJECT_NAME}_") -EndIf() - -# Detect Architecture -math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}") -IF("${BITS}" STREQUAL "32") - SET(ARCH "x86") -Else() - SET(ARCH "x64") -ENDIF() - -# Configure Installer script -Configure_File( - "${PROJECT_SOURCE_DIR}/ci/installer.iss.in" - "${PROJECT_BINARY_DIR}/ci/installer.iss" +# Configure Version Header +configure_file( + "${PROJECT_SOURCE_DIR}/cmake/version.hpp.in" + "${PROJECT_BINARY_DIR}/source/version.hpp" +) +configure_file( + "${PROJECT_SOURCE_DIR}/cmake/module.cpp.in" + "${PROJECT_BINARY_DIR}/source/module.cpp" ) -# Configure Version Header +# Windows +## Installer (InnoSetup) Configure_File( - "${PROJECT_SOURCE_DIR}/source/version.h.in" - "${PROJECT_BINARY_DIR}/source/version.h" + "${PROJECT_SOURCE_DIR}/cmake/installer.iss.in" + "${PROJECT_BINARY_DIR}/installer.iss" ) # Windows Specific Resource Definition -If(WIN32) - Set(PROJECT_PRODUCT_NAME "OBS Studio Stream Effects") - Set(PROJECT_COMPANY_NAME "Xaymar") - Set(PROJECT_COPYRIGHT "Xaymar © 2017 - 2018") - Set(PROJECT_LEGAL_TRADEMARKS_1 "") - Set(PROJECT_LEGAL_TRADEMARKS_2 "") - Set(PROJECT_DESCRIPTION "Stream Effects for OBS Studio") +if(WIN32) + set(PROJECT_PRODUCT_NAME "${PROJECT_FULL_NAME}") + set(PROJECT_COMPANY_NAME "${PROJECT_AUTHORS}") + set(PROJECT_COPYRIGHT "${PROJECT_AUTHORS} © ${PROJECT_COPYRIGHT_YEARS}") + set(PROJECT_LEGAL_TRADEMARKS_1 "") + set(PROJECT_LEGAL_TRADEMARKS_2 "") - Configure_File( + configure_file( "${PROJECT_SOURCE_DIR}/cmake/version.rc.in" "${PROJECT_BINARY_DIR}/cmake/version.rc" @ONLY ) -EndIf() +endif() # All Warnings, Extra Warnings, Pedantic -If(MSVC) +if(MSVC) # Force to always compile with W4 - If(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") - String(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - Else() - Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") - EndIf() -ElseIf(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - # Update If necessary - Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic") -EndIf() - -math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}") + if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") + string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") + endif() +elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + # Update if necessary + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic") +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) +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 "22.0.2" CACHE STRING "OBS Studio Version to download") -EndIf() +if(NOT TARGET libobs) + set(${PropertyPrefix}OBS_STUDIO_DIR "" CACHE PATH "OBS Studio Source/Package Directory") + set(${PropertyPrefix}OBS_DOWNLOAD_VERSION "22.0.2" CACHE STRING "OBS Studio Version to download") +endif() -If(NOT ${PropertyPrefix}OBS_NATIVE) - 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() +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.") +if(TARGET libobs) + message(STATUS "${PROJECT_NAME}: Using native obs-studio.") CacheSet(${PropertyPrefix}OBS_NATIVE TRUE) -Else() +else() CacheSet(${PropertyPrefix}OBS_NATIVE FALSE) - IF(EXISTS "${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake") - Message(STATUS "${PROJECT_NAME}: Using packaged obs-studio.") + if(EXISTS "${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake") + message(STATUS "${PROJECT_NAME}: Using packaged obs-studio.") CacheSet(${PropertyPrefix}OBS_PACKAGE TRUE) - ElseIf(EXISTS "${OBS_STUDIO_DIR}/libobs/obs-module.h") - Message(STATUS "${PROJECT_NAME}: Using referenced obs-studio.") + elseif(EXISTS "${OBS_STUDIO_DIR}/libobs/obs-module.h") + message(STATUS "${PROJECT_NAME}: Using referenced obs-studio.") CacheSet(${PropertyPrefix}OBS_REFERENCE TRUE) - Else() - Message(STATUS "${PROJECT_NAME}: No OBS Studio detected, using downloadable prebuilt binaries.") + else() + message(STATUS "${PROJECT_NAME}: No OBS Studio detected, using downloadable prebuilt binaries.") CacheSet(${PropertyPrefix}OBS_DOWNLOAD TRUE) - Set(${PropertyPrefix}OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}/obs-studio-${ARCH}-vs2017.7z") - EndIf() -EndIf() + set(${PropertyPrefix}OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}/obs-studio-${ARCH}-vs2017.7z") + endif() +endif() -If(${PropertyPrefix}OBS_NATIVE) - Option(BUILD_AMD_ENCODER "Build AMD Encoder module" ON) - If (NOT BUILD_AMD_ENCODER) - Message(STATUS "Not building AMD Encoder") - Return() - EndIf() -ElseIf(${PropertyPrefix}OBS_PACKAGE) - Include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake") -ElseIf(${PropertyPrefix}OBS_REFERENCE) - Set(obsPath "${OBS_STUDIO_DIR}") - Include("${OBS_STUDIO_DIR}/cmake/external/Findlibobs.cmake") -ElseIf(${PropertyPrefix}OBS_DOWNLOAD) +# CMake Modules +if(${PropertyPrefix}OBS_DOWNLOAD) + include("cmake/DownloadProject.cmake") +endif() +if(NOT ${PropertyPrefix}OBS_NATIVE) + include("cmake/cppcheck.cmake") +endif() + +# Load OBS Studio +if(${PropertyPrefix}OBS_NATIVE) + option(BUILD_FFMPEG_ENCODER "Build AMD Encoder module" ON) + if (NOT BUILD_FFMPEG_ENCODER) + message(STATUS "Not building AMD Encoder") + return() + endif() +elseif(${PropertyPrefix}OBS_PACKAGE) + include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake") +elseif(${PropertyPrefix}OBS_REFERENCE) + set(obsPath "${OBS_STUDIO_DIR}") + include("${OBS_STUDIO_DIR}/cmake/external/Findlibobs.cmake") +elseif(${PropertyPrefix}OBS_DOWNLOAD) download_project( PROJ libobs URL ${OBS_DOWNLOAD_URL} UPDATE_DISCONNECTED 1 ) - INCLUDE("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake") -Else() - Message(CRITICAL "Impossible case reached, verify system stability.") - Return() -EndIf() + include("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake") +else() + message(CRITICAL "Impossible case reached, verify system stability.") + return() +endif() ################################################################################ # Code @@ -218,6 +237,8 @@ SET(PROJECT_PRIVATE ${PROJECT_DATA_EFFECTS} ${PROJECT_DATA_SHADERS} ${PROJECT_DATA_SHADERS_FILTER} + "${PROJECT_BINARY_DIR}/source/module.cpp" + "${PROJECT_BINARY_DIR}/source/version.hpp" "${PROJECT_SOURCE_DIR}/source/plugin.h" "${PROJECT_SOURCE_DIR}/source/plugin.cpp" "${PROJECT_SOURCE_DIR}/source/filter-displacement.h" @@ -261,7 +282,6 @@ SET(PROJECT_PRIVATE "${PROJECT_SOURCE_DIR}/source/obs-audio-capture.cpp" "${PROJECT_SOURCE_DIR}/source/obs-tools.hpp" "${PROJECT_SOURCE_DIR}/source/obs-tools.cpp" - "${PROJECT_BINARY_DIR}/source/version.h" "${PROJECT_SOURCE_DIR}/source/strings.h" "${PROJECT_SOURCE_DIR}/source/utility.h" "${PROJECT_SOURCE_DIR}/source/utility.cpp" @@ -275,75 +295,71 @@ SET(PROJECT_PRIVATE "${PROJECT_SOURCE_DIR}/source/obs-source.cpp" ) -Source_Group("Data Files\\Locale" FILES ${PROJECT_DATA_LOCALE}) -Source_Group("Data Files\\Effects" FILES ${PROJECT_DATA_EFFECTS}) -Source_Group("Data Files\\Shaders" FILES ${PROJECT_DATA_SHADERS}) -Source_Group("Data Files\\Shaders\\Filter" FILES ${PROJECT_DATA_SHADERS_FILTER}) +source_group("Data Files\\Locale" FILES ${PROJECT_DATA_LOCALE}) +source_group("Data Files\\Effects" FILES ${PROJECT_DATA_EFFECTS}) +source_group("Data Files\\Shaders" FILES ${PROJECT_DATA_SHADERS}) +source_group("Data Files\\Shaders\\Filter" FILES ${PROJECT_DATA_SHADERS_FILTER}) ################################################################################ # Target ################################################################################ -Add_Library(${PROJECT_NAME} MODULE + +add_library(${PROJECT_NAME} MODULE ${PROJECT_PUBLIC} ${PROJECT_PRIVATE} ) # Include Directories -Target_Include_Directories(${PROJECT_NAME} +target_include_directories(${PROJECT_NAME} PUBLIC - "${PROJECT_BINARY_DIR}/source" - "${PROJECT_SOURCE_DIR}/source" PRIVATE "${PROJECT_BINARY_DIR}/source" "${PROJECT_SOURCE_DIR}/source" - "${PROJECT_BINARY_DIR}" - "${PROJECT_SOURCE_DIR}" - "${CMAKE_SOURCE_DIR}" + ${FFMPEG_INCLUDE_DIRS} ) # OBS Studio -If(${PropertyPrefix}OBS_NATIVE) - Target_Link_Libraries(${PROJECT_NAME} +if(${PropertyPrefix}OBS_NATIVE) + target_link_libraries(${PROJECT_NAME} libobs ) -ElseIf(${PropertyPrefix}OBS_REFERENCE) - Target_Include_Directories(${PROJECT_NAME} +elseif(${PropertyPrefix}OBS_REFERENCE) + target_include_directories(${PROJECT_NAME} PRIVATE "${OBS_STUDIO_DIR}/libobs" ) - Target_Link_Libraries(${PROJECT_NAME} + target_link_libraries(${PROJECT_NAME} "${LIBOBS_LIB}" ) -ElseIf(${PropertyPrefix}OBS_PACKAGE) - Target_Include_Directories(${PROJECT_NAME} +elseif(${PropertyPrefix}OBS_PACKAGE) + target_include_directories(${PROJECT_NAME} PRIVATE "${OBS_STUDIO_DIR}/include" ) - Target_Link_Libraries(${PROJECT_NAME} + target_link_libraries(${PROJECT_NAME} libobs ) -ElseIf(${PropertyPrefix}OBS_DOWNLOAD) - Target_Link_Libraries(${PROJECT_NAME} +elseif(${PropertyPrefix}OBS_DOWNLOAD) + target_link_libraries(${PROJECT_NAME} libobs ) -EndIf() - +endif() # Link Libraries -TARGET_LINK_LIBRARIES(${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} "${PROJECT_LIBRARIES}" ) # Definitions -If (WIN32) - Target_Compile_Definitions(${PROJECT_NAME} +if (WIN32) + target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS # windows.h WIN32_LEAN_AND_MEAN NOGPICAPMASKS NOVIRTUALKEYCODES - NOWINMESSAGES + #NOWINMESSAGES NOWINSTYLES NOSYSMETRICS NOMENUS @@ -357,10 +373,10 @@ If (WIN32) NOCOLOR NOCTLMGR NODRAWTEXT - NOGDI + #NOGDI NOKERNEL #NOUSER - NONLS + #NONLS NOMB NOMEMMGR NOMETAFILE @@ -370,7 +386,7 @@ If (WIN32) NOSCROLL NOSERVICE NOSOUND - NOTEXTMETRIC + #NOTEXTMETRIC NOWH NOWINOFFSETS NOCOMM @@ -383,103 +399,86 @@ If (WIN32) NOMDI NOINOUT ) -EndIf() +endif() # File Version -If(WIN32) - Set_Target_Properties( +if(WIN32) + set_target_properties( ${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} ) -Else() - Set_Target_Properties( +else() + set_target_properties( ${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} ) -EndIf() +endif() # CPPCheck -If(NOT ${PropertyPrefix}OBS_NATIVE) - SET(excludes ) - If(${PropertyPrefix}OBS_REFERENCE) - LIST(APPEND excludes "${OBS_STUDIO_DIR}/libobs") - ElseIf(${PropertyPrefix}OBS_PACKAGE) - LIST(APPEND excludes "${OBS_STUDIO_DIR}/libobs") - ElseIf(${PropertyPrefix}OBS_DOWNLOAD) - LIST(APPEND excludes "${libobs_SOURCE_DIR}") - EndIf() +if(NOT ${PropertyPrefix}OBS_NATIVE) + set(excludes ) + list(APPEND excludes "${OBS_DEPENDENCIES_DIR}") + if(${PropertyPrefix}OBS_REFERENCE) + list(APPEND excludes "${OBS_STUDIO_DIR}/libobs") + elseif(${PropertyPrefix}OBS_PACKAGE) + list(APPEND excludes "${OBS_STUDIO_DIR}/libobs") + elseif(${PropertyPrefix}OBS_DOWNLOAD) + list(APPEND excludes "${libobs_SOURCE_DIR}") + endif() - CppCheck( + cppcheck( EXCLUDE ${excludes} ) - CppCheck_Add_Project(${PROJECT_NAME}) -EndIf() + cppcheck_add_project(${PROJECT_NAME}) +endif() ################################################################################ # Installation ################################################################################ -If(${PropertyPrefix}OBS_NATIVE) +if(${PropertyPrefix}OBS_NATIVE) install_obs_plugin_with_data(${PROJECT_NAME} data) -Else() - Install(TARGETS ${PROJECT_NAME} +else() + install( + TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "./obs-plugins/${BITS}bit/" COMPONENT Runtime LIBRARY DESTINATION "./obs-plugins/${BITS}bit/" COMPONENT Runtime ) - If(MSVC) - Install( + if(MSVC) + install( FILES $ DESTINATION "./obs-plugins/${BITS}bit/" OPTIONAL ) - EndIf() + endif() - Install( + install( DIRECTORY "${PROJECT_SOURCE_DIR}/data/" DESTINATION "./data/obs-plugins/${PROJECT_NAME}/" ) - # Packaging - 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() + 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( + add_custom_target( PACKAGE_7Z ${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.7z" --format=7zip -- "${CMAKE_INSTALL_PREFIX}/obs-plugins" "${CMAKE_INSTALL_PREFIX}/data" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" ) - Add_Custom_Target( + add_custom_target( PACKAGE_ZIP ${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.zip" --format=zip -- "${CMAKE_INSTALL_PREFIX}/obs-plugins" "${CMAKE_INSTALL_PREFIX}/data" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" ) - - # CPack - Set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) - Set(CPACK_PACKAGE_VENDOR "Xaymar") - Set(CPACK_PACKAGE_HOMEPAGE_URL "https://xaymar.com/") - - Set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) - Set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) - Set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) - Set(CPACK_PACKAGE_VERSION_TWEAK ${PROJECT_VERSION_TWEAK}) - Set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}.${CPACK_PACKAGE_VERSION_TWEAK}") - - Set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}") - Set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}-source") - Set(CPACK_PACKAGE_CHECKSUM SHA512) - Set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY FALSE) - - include(CPack) -EndIf() +endif() diff --git a/appveyor.yml b/appveyor.yml index 82a36a80..f60dc5b9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,44 +1,47 @@ -version: 0.4.2-{build}-{branch} - -platform: x64 -image: Visual Studio 2017 - matrix: fast_finish: true +image: + - Visual Studio 2017 + +platform: x64 + +version: '{build}-{branch}' + environment: + CMAKE_SYSTEM_VERSION: 10.0.17134.0 + PACKAGE_PREFIX: amd-encoder-for-obs-studio + INNOSETUP_URL: http://www.jrsoftware.org/download.php/is-unicode.exe CURL_VERSION: 7.39.0 - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_COMPILER: Visual Studio 15 2017 - CMAKE_COMPILER_TARGET: host=x64 - CMAKE_SYSTEM_VERSION: 10.0.16299.91 - CPACK_SYSTEM_NAME: win32 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_COMPILER: Visual Studio 15 2017 Win64 - CMAKE_COMPILER_TARGET: host=x64 - CMAKE_SYSTEM_VERSION: 10.0.16299.91 - CPACK_SYSTEM_NAME: win64 - -pull_requests: - do_not_increment_build_number: true - + install: - - git submodule update --init --recursive - -before_build: - - mkdir build - - cd build - - cmake -G "%CMAKE_COMPILER%" -T "%CMAKE_COMPILER_TARGET%" -DCMAKE_SYSTEM_VERSION="%CMAKE_SYSTEM_VERSION%" -DCMAKE_INSTALL_PREFIX="%CD%/distrib" -DCPACK_GENERATOR="7Z;ZIP" -DCPACK_SYSTEM_NAME="%CPACK_SYSTEM_NAME%" .. +- cmd: ci/appveyor-install.bat build_script: - - cmake --build . --config RelWithDebInfo - - cmake --build . --target PACKAGE --config RelWithDebInfo +- cmd: ci/appveyor-build.bat + +after_build: +- cmd: ci/appveyor-package.bat + +cache: + - inno.exe artifacts: - - path: build/*.zip - - path: build/*.7z - - path: build/*.sha512 + - path: build/obs-stream-effects-*.zip + - path: build/obs-stream-effects-*.7z + - path: build/obs-stream-effects-*.exe + +deploy: + - provider: GitHub + auth_token: + secure: QwBI/KNma7xeTcwQUGpTNSFaZU13Qv9UpiqUKHndJgAsh3aoRM8jnGUvCcg8aQIO + draft: true + prerelease: false + force_update: true + on: + appveyor_repo_tag: true + +test: off notifications: - provider: Webhook diff --git a/ci/appveyor-build.bat b/ci/appveyor-build.bat new file mode 100644 index 00000000..b0c1b726 --- /dev/null +++ b/ci/appveyor-build.bat @@ -0,0 +1,4 @@ +cmake -H. -B"build/32" -G"Visual Studio 15 2017" -DCMAKE_INSTALL_PREFIX="%CD%/build/distrib" -DCMAKE_PACKAGE_PREFIX="%CD%/build" -DCMAKE_PACKAGE_NAME="obs-stream-effects" +cmake -H. -B"build/64" -G"Visual Studio 15 2017 Win64" -T"host=x64" -DCMAKE_INSTALL_PREFIX="%CD%/build/distrib" -DCMAKE_PACKAGE_PREFIX="%CD%/build" -DCMAKE_PACKAGE_NAME="obs-stream-effects" -DOBS_DEPENDENCIES_DIR="%CD%/build/32/obsdeps-src" +cmake --build build/32 --target INSTALL --config RelWithDebInfo -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" +cmake --build build/64 --target INSTALL --config RelWithDebInfo -- /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" \ No newline at end of file diff --git a/ci/appveyor-install.bat b/ci/appveyor-install.bat new file mode 100644 index 00000000..d579ad82 --- /dev/null +++ b/ci/appveyor-install.bat @@ -0,0 +1,8 @@ +git submodule update --init --force --recursive + +IF EXIST inno.exe ( + curl -kL "%INNOSETUP_URL%" -f --retry 5 -o inno.exe -z inno.exe +) else ( + curl -kL "%INNOSETUP_URL%" -f --retry 5 -o inno.exe +) +inno.exe /VERYSILENT /NORETART /SP- /SUPPRESSMSGBOXES \ No newline at end of file diff --git a/ci/appveyor-package.bat b/ci/appveyor-package.bat new file mode 100644 index 00000000..191d5a91 --- /dev/null +++ b/ci/appveyor-package.bat @@ -0,0 +1,6 @@ +ECHO -- Building 7z Archive -- +cmake --build build/64 --target PACKAGE_7Z --config RelWithDebInfo +ECHO -- Building Zip Archive -- +cmake --build build/64 --target PACKAGE_ZIP --config RelWithDebInfo +ECHO -- Building Installer -- +"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /Qp ".\build\64\installer.iss" > nul \ No newline at end of file diff --git a/ci/make.bat b/ci/make.bat deleted file mode 100644 index d4ebe76e..00000000 --- a/ci/make.bat +++ /dev/null @@ -1,22 +0,0 @@ -mkdir build -mkdir build\32 -mkdir build\64 - -IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" ( - cd build\32 - cmake -G "Visual Studio 12 2013" --target INSTALL -DPATH_OBSStudio="%CD%/deps/obs" -DINSTALL_DIR="../distrib" -DPACKAGE_SUFFIX=".%APPVEYOR_BUILD_VERSION%" -DPACKAGE_PREFIX="" ../.. - cd ..\64 - cmake -G "Visual Studio 12 2013 Win64" -T host=x64 --target INSTALL -DPATH_OBSStudio="%CD%/deps/obs" -DINSTALL_DIR="../distrib" -DPACKAGE_SUFFIX=".%APPVEYOR_BUILD_VERSION%" -DPACKAGE_PREFIX="" ../.. -) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( - cd build\32 - cmake -G "Visual Studio 14 2015" --target INSTALL -DPATH_OBSStudio="%CD%/deps/obs" -DINSTALL_DIR="../distrib" -DPACKAGE_SUFFIX=".%APPVEYOR_BUILD_VERSION%" -DPACKAGE_PREFIX="vs2015_" ../.. - cd ..\64 - cmake -G "Visual Studio 14 2015 Win64" -T host=x64 --target INSTALL -DPATH_OBSStudio="%CD%/deps/obs" -DINSTALL_DIR="../distrib" -DPACKAGE_SUFFIX=".%APPVEYOR_BUILD_VERSION%" -DPACKAGE_PREFIX="vs2015_" ../.. -) ELSE IF "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( - cd build\32 - cmake -G "Visual Studio 15 2017" --target INSTALL -DPATH_OBSStudio="%CD%/deps/obs" -DINSTALL_DIR="../distrib" -DPACKAGE_SUFFIX=".%APPVEYOR_BUILD_VERSION%" -DPACKAGE_PREFIX="vs2017_" ../.. - cd ..\64 - cmake -G "Visual Studio 15 2017 Win64" -T host=x64 --target INSTALL -DPATH_OBSStudio="%CD%/deps/obs" -DINSTALL_DIR="../distrib" -DPACKAGE_SUFFIX=".%APPVEYOR_BUILD_VERSION%" -DPACKAGE_PREFIX="vs2017_" ../.. -) - -cd ..\.. \ No newline at end of file diff --git a/ci/installer.iss.in b/cmake/installer.iss.in similarity index 95% rename from ci/installer.iss.in rename to cmake/installer.iss.in index 01bc7e0d..1a1b5a7f 100644 --- a/ci/installer.iss.in +++ b/cmake/installer.iss.in @@ -1,16 +1,16 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -#define MyAppName "Stream Effects for OBS Studio" +#define MyAppName "@PROJECT_FULL_NAME@" #define MyAppVersion "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@" #define MyAppPublisher "Xaymars Technology Workshop" -#define MyAppURL "https://www.xaymar.com/portfolio/obs-stream-effects/" +#define MyAppURL "https://www.xaymar.com/" [Setup] ; NOTE: The value of AppId uniquely identifies this application. ; Do not use the same AppId value in installers for other applications. ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) -AppId={6559B77C-0F41-4F97-AC9D-2C13DE22D236} +AppId={{DE56A03A-C8A4-474B-83B0-CFD270262D38}} AppName={#MyAppName} AppVersion={#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion} diff --git a/cmake/module.cpp.in b/cmake/module.cpp.in new file mode 100644 index 00000000..07e79670 --- /dev/null +++ b/cmake/module.cpp.in @@ -0,0 +1,17 @@ +#include +#include + +OBS_DECLARE_MODULE(); +OBS_MODULE_AUTHOR("@PROJECT_AUTHORS@"); +OBS_MODULE_USE_DEFAULT_LOCALE("@PROJECT_NAME@", "en-US"); + +MODULE_EXPORT const char* obs_module_name() +{ + return "@PROJECT_FULL_NAME@"; +} + + +MODULE_EXPORT const char* obs_module_description() +{ + return "@PROJECT_DESCRIPTION@"; +} diff --git a/source/version.h.in b/cmake/version.hpp.in similarity index 100% rename from source/version.h.in rename to cmake/version.hpp.in diff --git a/source/plugin.cpp b/source/plugin.cpp index d051a36c..96b28e95 100644 --- a/source/plugin.cpp +++ b/source/plugin.cpp @@ -23,10 +23,6 @@ #include "filter-shape.h" #include "filter-transform.h" -OBS_DECLARE_MODULE(); -OBS_MODULE_AUTHOR("Michael Fabian Dirks"); -OBS_MODULE_USE_DEFAULT_LOCALE("obs-stream-effects", "en-US"); - filter::Displacement* filterDisplacement; filter::Shape* filterShape; filter::Transform* filterTransform; @@ -53,16 +49,6 @@ MODULE_EXPORT void obs_module_unload(void) } } -MODULE_EXPORT const char* obs_module_name() -{ - return PLUGIN_NAME; -} - -MODULE_EXPORT const char* obs_module_description() -{ - return PLUGIN_NAME; -} - #ifdef _WIN32 #define NOMINMAX #define NOINOUT diff --git a/source/plugin.h b/source/plugin.h index a39233f0..c91219a5 100644 --- a/source/plugin.h +++ b/source/plugin.h @@ -32,7 +32,7 @@ extern "C" { // Plugin #define PLUGIN_NAME "Stream Effects" -#include "version.h" +#include "version.hpp" #define P_LOG(level, ...) blog(level, "[" PLUGIN_NAME "] " __VA_ARGS__); #define P_LOG_ERROR(...) P_LOG(LOG_ERROR, __VA_ARGS__)