cmake: Reworked build system for Installers and Archives

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2018-12-23 20:49:18 +01:00
parent c94a3fa11f
commit 95fdcff3a9
11 changed files with 245 additions and 244 deletions

View file

@ -18,8 +18,6 @@
# CMake Setup # CMake Setup
CMake_Minimum_Required(VERSION 3.1.0) CMake_Minimum_Required(VERSION 3.1.0)
Include("cmake/util.cmake") Include("cmake/util.cmake")
Include("cmake/DownloadProject.cmake")
Include("cmake/cppcheck.cmake")
# Automatic Versioning # Automatic Versioning
Set(VERSION_MAJOR 0) Set(VERSION_MAJOR 0)
@ -56,137 +54,158 @@ EndIf()
PROJECT( PROJECT(
obs-stream-effects obs-stream-effects
VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_TWEAK} 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 <info@xaymar.com>")
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 # CMake / Compiler
################################################################################ ################################################################################
# Detect Build Type # Configure Version Header
If("${CMAKE_SOURCE_DIR}" STREQUAL "${PROJECT_SOURCE_DIR}") configure_file(
Set(PropertyPrefix "") "${PROJECT_SOURCE_DIR}/cmake/version.hpp.in"
Else() "${PROJECT_BINARY_DIR}/source/version.hpp"
Set(PropertyPrefix "${PROJECT_NAME}_") )
EndIf() configure_file(
"${PROJECT_SOURCE_DIR}/cmake/module.cpp.in"
# Detect Architecture "${PROJECT_BINARY_DIR}/source/module.cpp"
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 # Windows
## Installer (InnoSetup)
Configure_File( Configure_File(
"${PROJECT_SOURCE_DIR}/source/version.h.in" "${PROJECT_SOURCE_DIR}/cmake/installer.iss.in"
"${PROJECT_BINARY_DIR}/source/version.h" "${PROJECT_BINARY_DIR}/installer.iss"
) )
# Windows Specific Resource Definition # Windows Specific Resource Definition
If(WIN32) if(WIN32)
Set(PROJECT_PRODUCT_NAME "OBS Studio Stream Effects") set(PROJECT_PRODUCT_NAME "${PROJECT_FULL_NAME}")
Set(PROJECT_COMPANY_NAME "Xaymar") set(PROJECT_COMPANY_NAME "${PROJECT_AUTHORS}")
Set(PROJECT_COPYRIGHT "Xaymar © 2017 - 2018") set(PROJECT_COPYRIGHT "${PROJECT_AUTHORS} © ${PROJECT_COPYRIGHT_YEARS}")
Set(PROJECT_LEGAL_TRADEMARKS_1 "") set(PROJECT_LEGAL_TRADEMARKS_1 "")
Set(PROJECT_LEGAL_TRADEMARKS_2 "") set(PROJECT_LEGAL_TRADEMARKS_2 "")
Set(PROJECT_DESCRIPTION "Stream Effects for OBS Studio")
Configure_File( configure_file(
"${PROJECT_SOURCE_DIR}/cmake/version.rc.in" "${PROJECT_SOURCE_DIR}/cmake/version.rc.in"
"${PROJECT_BINARY_DIR}/cmake/version.rc" "${PROJECT_BINARY_DIR}/cmake/version.rc"
@ONLY @ONLY
) )
EndIf() endif()
# All Warnings, Extra Warnings, Pedantic # All Warnings, Extra Warnings, Pedantic
If(MSVC) if(MSVC)
# Force to always compile with W4 # Force to always compile with W4
If(CMAKE_CXX_FLAGS MATCHES "/W[0-4]") if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
String(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
Else() else()
Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
EndIf() endif()
ElseIf(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
# Update If necessary # Update if necessary
Set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -pedantic")
EndIf() endif()
math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
################################################################################ ################################################################################
# Options # Options
################################################################################ ################################################################################
Set(${PropertyPrefix}OBS_NATIVE FALSE CACHE BOOL "Use native obs-studio build" FORCE) 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_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_PACKAGE FALSE CACHE BOOL "Use packaged obs-studio build" FORCE)
Set(${PropertyPrefix}OBS_DOWNLOAD FALSE CACHE BOOL "Use downloaded 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) mark_as_advanced(FORCE OBS_NATIVE OBS_PACKAGE OBS_REFERENCE OBS_DOWNLOAD)
If(NOT TARGET libobs) if(NOT TARGET libobs)
Set(${PropertyPrefix}OBS_STUDIO_DIR "" CACHE PATH "OBS Studio Source/Package Directory") 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") set(${PropertyPrefix}OBS_DOWNLOAD_VERSION "22.0.2" CACHE STRING "OBS Studio Version to download")
EndIf() endif()
If(NOT ${PropertyPrefix}OBS_NATIVE) if(NOT ${PropertyPrefix}OBS_NATIVE)
Set(CMAKE_PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Path for generated archives.") set(${PropertyPrefix}OBS_DEPENDENCIES_DIR "" CACHE PATH "Path to OBS Dependencies")
Set(CMAKE_PACKAGE_NAME "${PROJECT_NAME}" CACHE STRING "Name for the generated archives.") set(CMAKE_PACKAGE_PREFIX "${CMAKE_BINARY_DIR}" CACHE PATH "Path for generated archives.")
Set(CMAKE_PACKAGE_SUFFIX_OVERRIDE "" CACHE STRING "Override for the suffix.") set(CMAKE_PACKAGE_NAME "${PROJECT_NAME}" CACHE STRING "Name for the generated archives.")
EndIf() set(CMAKE_PACKAGE_SUFFIX_OVERRIDE "" CACHE STRING "Override for the suffix.")
endif()
################################################################################ ################################################################################
# Dependencies # Dependencies
################################################################################ ################################################################################
# Detect OBS Studio Type # Detect OBS Studio Type
If(TARGET libobs) if(TARGET libobs)
Message(STATUS "${PROJECT_NAME}: Using native obs-studio.") message(STATUS "${PROJECT_NAME}: Using native obs-studio.")
CacheSet(${PropertyPrefix}OBS_NATIVE TRUE) CacheSet(${PropertyPrefix}OBS_NATIVE TRUE)
Else() else()
CacheSet(${PropertyPrefix}OBS_NATIVE FALSE) CacheSet(${PropertyPrefix}OBS_NATIVE FALSE)
IF(EXISTS "${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake") if(EXISTS "${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake")
Message(STATUS "${PROJECT_NAME}: Using packaged obs-studio.") message(STATUS "${PROJECT_NAME}: Using packaged obs-studio.")
CacheSet(${PropertyPrefix}OBS_PACKAGE TRUE) CacheSet(${PropertyPrefix}OBS_PACKAGE TRUE)
ElseIf(EXISTS "${OBS_STUDIO_DIR}/libobs/obs-module.h") elseif(EXISTS "${OBS_STUDIO_DIR}/libobs/obs-module.h")
Message(STATUS "${PROJECT_NAME}: Using referenced obs-studio.") message(STATUS "${PROJECT_NAME}: Using referenced obs-studio.")
CacheSet(${PropertyPrefix}OBS_REFERENCE TRUE) CacheSet(${PropertyPrefix}OBS_REFERENCE TRUE)
Else() else()
Message(STATUS "${PROJECT_NAME}: No OBS Studio detected, using downloadable prebuilt binaries.") message(STATUS "${PROJECT_NAME}: No OBS Studio detected, using downloadable prebuilt binaries.")
CacheSet(${PropertyPrefix}OBS_DOWNLOAD TRUE) 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") set(${PropertyPrefix}OBS_DOWNLOAD_URL "https://github.com/Xaymar/obs-studio/releases/download/${OBS_DOWNLOAD_VERSION}/obs-studio-${ARCH}-vs2017.7z")
EndIf() endif()
EndIf() endif()
If(${PropertyPrefix}OBS_NATIVE) # CMake Modules
Option(BUILD_AMD_ENCODER "Build AMD Encoder module" ON) if(${PropertyPrefix}OBS_DOWNLOAD)
If (NOT BUILD_AMD_ENCODER) include("cmake/DownloadProject.cmake")
Message(STATUS "Not building AMD Encoder") endif()
Return() if(NOT ${PropertyPrefix}OBS_NATIVE)
EndIf() include("cmake/cppcheck.cmake")
ElseIf(${PropertyPrefix}OBS_PACKAGE) endif()
Include("${OBS_STUDIO_DIR}/cmake/LibObs/LibObsConfig.cmake")
ElseIf(${PropertyPrefix}OBS_REFERENCE) # Load OBS Studio
Set(obsPath "${OBS_STUDIO_DIR}") if(${PropertyPrefix}OBS_NATIVE)
Include("${OBS_STUDIO_DIR}/cmake/external/Findlibobs.cmake") option(BUILD_FFMPEG_ENCODER "Build AMD Encoder module" ON)
ElseIf(${PropertyPrefix}OBS_DOWNLOAD) 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( download_project(
PROJ libobs PROJ libobs
URL ${OBS_DOWNLOAD_URL} URL ${OBS_DOWNLOAD_URL}
UPDATE_DISCONNECTED 1 UPDATE_DISCONNECTED 1
) )
INCLUDE("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake") include("${libobs_SOURCE_DIR}/cmake/LibObs/LibObsConfig.cmake")
Else() else()
Message(CRITICAL "Impossible case reached, verify system stability.") message(CRITICAL "Impossible case reached, verify system stability.")
Return() return()
EndIf() endif()
################################################################################ ################################################################################
# Code # Code
@ -218,6 +237,8 @@ SET(PROJECT_PRIVATE
${PROJECT_DATA_EFFECTS} ${PROJECT_DATA_EFFECTS}
${PROJECT_DATA_SHADERS} ${PROJECT_DATA_SHADERS}
${PROJECT_DATA_SHADERS_FILTER} ${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.h"
"${PROJECT_SOURCE_DIR}/source/plugin.cpp" "${PROJECT_SOURCE_DIR}/source/plugin.cpp"
"${PROJECT_SOURCE_DIR}/source/filter-displacement.h" "${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-audio-capture.cpp"
"${PROJECT_SOURCE_DIR}/source/obs-tools.hpp" "${PROJECT_SOURCE_DIR}/source/obs-tools.hpp"
"${PROJECT_SOURCE_DIR}/source/obs-tools.cpp" "${PROJECT_SOURCE_DIR}/source/obs-tools.cpp"
"${PROJECT_BINARY_DIR}/source/version.h"
"${PROJECT_SOURCE_DIR}/source/strings.h" "${PROJECT_SOURCE_DIR}/source/strings.h"
"${PROJECT_SOURCE_DIR}/source/utility.h" "${PROJECT_SOURCE_DIR}/source/utility.h"
"${PROJECT_SOURCE_DIR}/source/utility.cpp" "${PROJECT_SOURCE_DIR}/source/utility.cpp"
@ -275,75 +295,71 @@ SET(PROJECT_PRIVATE
"${PROJECT_SOURCE_DIR}/source/obs-source.cpp" "${PROJECT_SOURCE_DIR}/source/obs-source.cpp"
) )
Source_Group("Data Files\\Locale" FILES ${PROJECT_DATA_LOCALE}) source_group("Data Files\\Locale" FILES ${PROJECT_DATA_LOCALE})
Source_Group("Data Files\\Effects" FILES ${PROJECT_DATA_EFFECTS}) source_group("Data Files\\Effects" FILES ${PROJECT_DATA_EFFECTS})
Source_Group("Data Files\\Shaders" FILES ${PROJECT_DATA_SHADERS}) source_group("Data Files\\Shaders" FILES ${PROJECT_DATA_SHADERS})
Source_Group("Data Files\\Shaders\\Filter" FILES ${PROJECT_DATA_SHADERS_FILTER}) source_group("Data Files\\Shaders\\Filter" FILES ${PROJECT_DATA_SHADERS_FILTER})
################################################################################ ################################################################################
# Target # Target
################################################################################ ################################################################################
Add_Library(${PROJECT_NAME} MODULE
add_library(${PROJECT_NAME} MODULE
${PROJECT_PUBLIC} ${PROJECT_PUBLIC}
${PROJECT_PRIVATE} ${PROJECT_PRIVATE}
) )
# Include Directories # Include Directories
Target_Include_Directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}
PUBLIC PUBLIC
"${PROJECT_BINARY_DIR}/source"
"${PROJECT_SOURCE_DIR}/source"
PRIVATE PRIVATE
"${PROJECT_BINARY_DIR}/source" "${PROJECT_BINARY_DIR}/source"
"${PROJECT_SOURCE_DIR}/source" "${PROJECT_SOURCE_DIR}/source"
"${PROJECT_BINARY_DIR}" ${FFMPEG_INCLUDE_DIRS}
"${PROJECT_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}"
) )
# OBS Studio # OBS Studio
If(${PropertyPrefix}OBS_NATIVE) if(${PropertyPrefix}OBS_NATIVE)
Target_Link_Libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
libobs libobs
) )
ElseIf(${PropertyPrefix}OBS_REFERENCE) elseif(${PropertyPrefix}OBS_REFERENCE)
Target_Include_Directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}
PRIVATE PRIVATE
"${OBS_STUDIO_DIR}/libobs" "${OBS_STUDIO_DIR}/libobs"
) )
Target_Link_Libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
"${LIBOBS_LIB}" "${LIBOBS_LIB}"
) )
ElseIf(${PropertyPrefix}OBS_PACKAGE) elseif(${PropertyPrefix}OBS_PACKAGE)
Target_Include_Directories(${PROJECT_NAME} target_include_directories(${PROJECT_NAME}
PRIVATE PRIVATE
"${OBS_STUDIO_DIR}/include" "${OBS_STUDIO_DIR}/include"
) )
Target_Link_Libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
libobs libobs
) )
ElseIf(${PropertyPrefix}OBS_DOWNLOAD) elseif(${PropertyPrefix}OBS_DOWNLOAD)
Target_Link_Libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
libobs libobs
) )
EndIf() endif()
# Link Libraries # Link Libraries
TARGET_LINK_LIBRARIES(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
"${PROJECT_LIBRARIES}" "${PROJECT_LIBRARIES}"
) )
# Definitions # Definitions
If (WIN32) if (WIN32)
Target_Compile_Definitions(${PROJECT_NAME} target_compile_definitions(${PROJECT_NAME}
PRIVATE PRIVATE
_CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_WARNINGS
# windows.h # windows.h
WIN32_LEAN_AND_MEAN WIN32_LEAN_AND_MEAN
NOGPICAPMASKS NOGPICAPMASKS
NOVIRTUALKEYCODES NOVIRTUALKEYCODES
NOWINMESSAGES #NOWINMESSAGES
NOWINSTYLES NOWINSTYLES
NOSYSMETRICS NOSYSMETRICS
NOMENUS NOMENUS
@ -357,10 +373,10 @@ If (WIN32)
NOCOLOR NOCOLOR
NOCTLMGR NOCTLMGR
NODRAWTEXT NODRAWTEXT
NOGDI #NOGDI
NOKERNEL NOKERNEL
#NOUSER #NOUSER
NONLS #NONLS
NOMB NOMB
NOMEMMGR NOMEMMGR
NOMETAFILE NOMETAFILE
@ -370,7 +386,7 @@ If (WIN32)
NOSCROLL NOSCROLL
NOSERVICE NOSERVICE
NOSOUND NOSOUND
NOTEXTMETRIC #NOTEXTMETRIC
NOWH NOWH
NOWINOFFSETS NOWINOFFSETS
NOCOMM NOCOMM
@ -383,103 +399,86 @@ If (WIN32)
NOMDI NOMDI
NOINOUT NOINOUT
) )
EndIf() endif()
# File Version # File Version
If(WIN32) if(WIN32)
Set_Target_Properties( set_target_properties(
${PROJECT_NAME} ${PROJECT_NAME}
PROPERTIES PROPERTIES
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} 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} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}
) )
Else() else()
Set_Target_Properties( set_target_properties(
${PROJECT_NAME} ${PROJECT_NAME}
PROPERTIES PROPERTIES
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK} 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} SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.${PROJECT_VERSION_TWEAK}
) )
EndIf() endif()
# CPPCheck # CPPCheck
If(NOT ${PropertyPrefix}OBS_NATIVE) if(NOT ${PropertyPrefix}OBS_NATIVE)
SET(excludes ) set(excludes )
If(${PropertyPrefix}OBS_REFERENCE) list(APPEND excludes "${OBS_DEPENDENCIES_DIR}")
LIST(APPEND excludes "${OBS_STUDIO_DIR}/libobs") if(${PropertyPrefix}OBS_REFERENCE)
ElseIf(${PropertyPrefix}OBS_PACKAGE) list(APPEND excludes "${OBS_STUDIO_DIR}/libobs")
LIST(APPEND excludes "${OBS_STUDIO_DIR}/libobs") elseif(${PropertyPrefix}OBS_PACKAGE)
ElseIf(${PropertyPrefix}OBS_DOWNLOAD) list(APPEND excludes "${OBS_STUDIO_DIR}/libobs")
LIST(APPEND excludes "${libobs_SOURCE_DIR}") elseif(${PropertyPrefix}OBS_DOWNLOAD)
EndIf() list(APPEND excludes "${libobs_SOURCE_DIR}")
endif()
CppCheck( cppcheck(
EXCLUDE ${excludes} EXCLUDE ${excludes}
) )
CppCheck_Add_Project(${PROJECT_NAME}) cppcheck_add_project(${PROJECT_NAME})
EndIf() endif()
################################################################################ ################################################################################
# Installation # Installation
################################################################################ ################################################################################
If(${PropertyPrefix}OBS_NATIVE) if(${PropertyPrefix}OBS_NATIVE)
install_obs_plugin_with_data(${PROJECT_NAME} data) install_obs_plugin_with_data(${PROJECT_NAME} data)
Else() else()
Install(TARGETS ${PROJECT_NAME} install(
TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION "./obs-plugins/${BITS}bit/" COMPONENT Runtime RUNTIME DESTINATION "./obs-plugins/${BITS}bit/" COMPONENT Runtime
LIBRARY DESTINATION "./obs-plugins/${BITS}bit/" COMPONENT Runtime LIBRARY DESTINATION "./obs-plugins/${BITS}bit/" COMPONENT Runtime
) )
If(MSVC) if(MSVC)
Install( install(
FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> FILES $<TARGET_PDB_FILE:${PROJECT_NAME}>
DESTINATION "./obs-plugins/${BITS}bit/" DESTINATION "./obs-plugins/${BITS}bit/"
OPTIONAL OPTIONAL
) )
EndIf() endif()
Install( install(
DIRECTORY "${PROJECT_SOURCE_DIR}/data/" DIRECTORY "${PROJECT_SOURCE_DIR}/data/"
DESTINATION "./data/obs-plugins/${PROJECT_NAME}/" DESTINATION "./data/obs-plugins/${PROJECT_NAME}/"
) )
# Packaging if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "")
If("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "") set(PackageFullName "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${PROJECT_VERSION}")
Set(PackageFullName "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${PROJECT_VERSION}") else()
Else() set(PackageFullName "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${CMAKE_PACKAGE_SUFFIX_OVERRIDE}")
Set(PackageFullName "${CMAKE_PACKAGE_PREFIX}/${CMAKE_PACKAGE_NAME}-${CMAKE_PACKAGE_SUFFIX_OVERRIDE}") endif()
EndIf()
Add_Custom_Target( add_custom_target(
PACKAGE_7Z PACKAGE_7Z
${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.7z" --format=7zip -- ${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.7z" --format=7zip --
"${CMAKE_INSTALL_PREFIX}/obs-plugins" "${CMAKE_INSTALL_PREFIX}/obs-plugins"
"${CMAKE_INSTALL_PREFIX}/data" "${CMAKE_INSTALL_PREFIX}/data"
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
) )
Add_Custom_Target( add_custom_target(
PACKAGE_ZIP PACKAGE_ZIP
${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.zip" --format=zip -- ${CMAKE_COMMAND} -E tar cfv "${PackageFullName}.zip" --format=zip --
"${CMAKE_INSTALL_PREFIX}/obs-plugins" "${CMAKE_INSTALL_PREFIX}/obs-plugins"
"${CMAKE_INSTALL_PREFIX}/data" "${CMAKE_INSTALL_PREFIX}/data"
WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}" WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX}"
) )
endif()
# 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()

View file

@ -1,44 +1,47 @@
version: 0.4.2-{build}-{branch}
platform: x64
image: Visual Studio 2017
matrix: matrix:
fast_finish: true fast_finish: true
environment: image:
CURL_VERSION: 7.39.0 - Visual Studio 2017
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: platform: x64
do_not_increment_build_number: true
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
install: install:
- git submodule update --init --recursive - cmd: ci/appveyor-install.bat
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%" ..
build_script: build_script:
- cmake --build . --config RelWithDebInfo - cmd: ci/appveyor-build.bat
- cmake --build . --target PACKAGE --config RelWithDebInfo
after_build:
- cmd: ci/appveyor-package.bat
cache:
- inno.exe
artifacts: artifacts:
- path: build/*.zip - path: build/obs-stream-effects-*.zip
- path: build/*.7z - path: build/obs-stream-effects-*.7z
- path: build/*.sha512 - 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: notifications:
- provider: Webhook - provider: Webhook

4
ci/appveyor-build.bat Normal file
View file

@ -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"

8
ci/appveyor-install.bat Normal file
View file

@ -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

6
ci/appveyor-package.bat Normal file
View file

@ -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

View file

@ -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 ..\..

View file

@ -1,16 +1,16 @@
; Script generated by the Inno Setup Script Wizard. ; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; 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 MyAppVersion "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@"
#define MyAppPublisher "Xaymars Technology Workshop" #define MyAppPublisher "Xaymars Technology Workshop"
#define MyAppURL "https://www.xaymar.com/portfolio/obs-stream-effects/" #define MyAppURL "https://www.xaymar.com/"
[Setup] [Setup]
; NOTE: The value of AppId uniquely identifies this application. ; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications. ; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) ; (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} AppName={#MyAppName}
AppVersion={#MyAppVersion} AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion} ;AppVerName={#MyAppName} {#MyAppVersion}

17
cmake/module.cpp.in Normal file
View file

@ -0,0 +1,17 @@
#include <obs.h>
#include <obs-module.h>
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@";
}

View file

@ -23,10 +23,6 @@
#include "filter-shape.h" #include "filter-shape.h"
#include "filter-transform.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::Displacement* filterDisplacement;
filter::Shape* filterShape; filter::Shape* filterShape;
filter::Transform* filterTransform; 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 #ifdef _WIN32
#define NOMINMAX #define NOMINMAX
#define NOINOUT #define NOINOUT

View file

@ -32,7 +32,7 @@ extern "C" {
// Plugin // Plugin
#define PLUGIN_NAME "Stream Effects" #define PLUGIN_NAME "Stream Effects"
#include "version.h" #include "version.hpp"
#define P_LOG(level, ...) blog(level, "[" PLUGIN_NAME "] " __VA_ARGS__); #define P_LOG(level, ...) blog(level, "[" PLUGIN_NAME "] " __VA_ARGS__);
#define P_LOG_ERROR(...) P_LOG(LOG_ERROR, __VA_ARGS__) #define P_LOG_ERROR(...) P_LOG(LOG_ERROR, __VA_ARGS__)