2017-11-02 23:30:53 +00:00
|
|
|
cmake_minimum_required(VERSION 3.2)
|
2017-06-28 21:21:42 +00:00
|
|
|
PROJECT(obs-stream-effects)
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Version
|
|
|
|
################################################################################
|
|
|
|
SET(VERSION_MAJOR 0)
|
2017-12-14 07:54:52 +00:00
|
|
|
SET(VERSION_MINOR 4)
|
2018-01-18 04:26:56 +00:00
|
|
|
SET(VERSION_PATCH 1)
|
2017-11-02 23:30:53 +00:00
|
|
|
SET(VERSION_STR "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
|
|
|
|
2017-06-28 21:21:42 +00:00
|
|
|
configure_file(
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/version.h.in"
|
|
|
|
"${PROJECT_BINARY_DIR}/source/version.h"
|
|
|
|
)
|
|
|
|
|
2017-11-02 23:30:53 +00:00
|
|
|
################################################################################
|
|
|
|
# Configuration
|
|
|
|
################################################################################
|
|
|
|
math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
|
|
|
|
|
|
|
|
SET(INSTALL_DIR "${PROJECT_BINARY_DIR}/distribute" CACHE PATH "Installation directory")
|
2017-11-05 13:34:28 +00:00
|
|
|
IF(NOT DEFINED PACKAGE_PREFIX)
|
|
|
|
SET(PACKAGE_PREFIX "")
|
|
|
|
ENDIF()
|
|
|
|
IF(NOT DEFINED PACKAGE_SUFFIX)
|
|
|
|
SET(PACKAGE_SUFFIX ".${VERSION_STR}")
|
|
|
|
ENDIF()
|
2017-11-02 23:30:53 +00:00
|
|
|
|
2017-06-28 21:21:42 +00:00
|
|
|
################################################################################
|
|
|
|
# Code
|
|
|
|
################################################################################
|
|
|
|
SET(obs-stream-effects_HEADERS
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/plugin.h"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-displacement.h"
|
2017-07-03 00:46:33 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-blur.h"
|
2017-06-28 21:21:42 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-shape.h"
|
2017-06-29 01:41:32 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-transform.h"
|
2017-11-06 11:36:01 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-custom-shader.h"
|
2017-12-14 07:06:09 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/source-mirror.h"
|
2017-06-28 21:21:42 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-helper.h"
|
2017-09-17 19:55:16 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-effect.h"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.h"
|
2018-01-18 03:57:24 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-limits.h"
|
|
|
|
# "${PROJECT_SOURCE_DIR}/source/gs-mipmapper.h"
|
2017-09-17 19:55:16 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.h"
|
2018-01-19 04:06:42 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-sampler.h"
|
2017-09-17 19:55:16 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-texture.h"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-vertex.h"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.h"
|
2017-06-28 21:21:42 +00:00
|
|
|
"${PROJECT_BINARY_DIR}/source/version.h"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/strings.h"
|
2017-12-13 23:28:35 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/util-math.h"
|
2018-01-08 09:52:53 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/util-memory.h"
|
2018-03-05 14:17:34 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/util-source-texture.h"
|
2017-06-28 21:21:42 +00:00
|
|
|
)
|
|
|
|
SET(obs-stream-effects_SOURCES
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/plugin.cpp"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-displacement.cpp"
|
2017-07-03 00:46:33 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-blur.cpp"
|
2017-06-28 21:21:42 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-shape.cpp"
|
2017-06-29 01:41:32 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-transform.cpp"
|
2017-11-06 11:36:01 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/filter-custom-shader.cpp"
|
2017-12-14 07:06:09 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/source-mirror.cpp"
|
2017-06-28 21:21:42 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-helper.cpp"
|
2017-09-17 19:55:16 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-effect.cpp"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-indexbuffer.cpp"
|
2018-01-18 03:57:24 +00:00
|
|
|
# "${PROJECT_SOURCE_DIR}/source/gs-mipmapper.cpp"
|
2017-09-17 19:55:16 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-rendertarget.cpp"
|
2018-01-19 04:06:42 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-sampler.cpp"
|
2017-09-17 19:55:16 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-texture.cpp"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-vertex.cpp"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source/gs-vertexbuffer.cpp"
|
2017-12-13 23:28:35 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/util-math.cpp"
|
2018-01-08 09:52:53 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/util-memory.cpp"
|
2018-03-05 14:17:34 +00:00
|
|
|
"${PROJECT_SOURCE_DIR}/source/util-source-texture.cpp"
|
2017-09-17 19:55:16 +00:00
|
|
|
)
|
|
|
|
SET(obs-stream-effects_LOCALE
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/locale/en-US.ini"
|
|
|
|
)
|
|
|
|
SET(obs-stream-effects_EFFECTS
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/bilateral-blur.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/box-blur.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/gaussian-blur.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/displace.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/color-conversion.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/mip-mapper.effect"
|
2017-06-28 21:21:42 +00:00
|
|
|
)
|
2017-08-19 21:47:30 +00:00
|
|
|
SET(obs-stream-effects_LOCALE
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/locale/en-US.ini"
|
|
|
|
)
|
|
|
|
SET(obs-stream-effects_EFFECTS
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/bilateral-blur.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/box-blur.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/gaussian-blur.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/displace.effect"
|
|
|
|
"${PROJECT_SOURCE_DIR}/data/effects/color-conversion.effect"
|
|
|
|
)
|
2017-06-28 21:21:42 +00:00
|
|
|
SET(obs-stream-effects_LIBRARIES
|
|
|
|
)
|
2017-08-19 21:47:30 +00:00
|
|
|
#set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
source_group("Data Files\\Locale" FILES ${obs-stream-effects_LOCALE})
|
|
|
|
source_group("Data Files\\Effects" FILES ${obs-stream-effects_EFFECTS})
|
2017-06-28 21:21:42 +00:00
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Standalone and OBS Studio Build Data
|
|
|
|
################################################################################
|
2017-08-19 21:47:30 +00:00
|
|
|
if(TARGET libobs)
|
2017-06-28 21:21:42 +00:00
|
|
|
# OBS Studio Specific
|
|
|
|
INCLUDE_DIRECTORIES(
|
|
|
|
"${CMAKE_SOURCE_DIR}"
|
|
|
|
"${PROJECT_BINARY_DIR}"
|
|
|
|
"${PROJECT_BINARY_DIR}/source"
|
|
|
|
"${PROJECT_SOURCE_DIR}"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source"
|
|
|
|
)
|
|
|
|
SET(LIBOBS_LIBRARIES libobs)
|
|
|
|
else()
|
|
|
|
# Standlone Specific
|
|
|
|
SET(PATH_OBSStudio "" CACHE PATH "OBS Studio Source Code Directory")
|
|
|
|
if(PATH_OBSStudio STREQUAL "")
|
|
|
|
message(FATAL_ERROR "PATH_OBSStudio not set!")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
if(NOT EXISTS "${PATH_OBSStudio}/libobs/obs-module.h")
|
|
|
|
message(FATAL_ERROR "PATH_OBSStudio invalid!")
|
|
|
|
return()
|
|
|
|
endif()
|
2017-08-19 21:47:30 +00:00
|
|
|
|
2017-06-28 21:21:42 +00:00
|
|
|
# Find OBS Libraries
|
|
|
|
SET(obsPath "${PATH_OBSStudio}")
|
2017-11-11 20:12:07 +00:00
|
|
|
INCLUDE("${PATH_OBSStudio}/cmake/external/FindLibobs.cmake")
|
2017-08-19 21:47:30 +00:00
|
|
|
|
2017-06-28 21:21:42 +00:00
|
|
|
# Compiling
|
|
|
|
INCLUDE_DIRECTORIES(
|
|
|
|
"${PROJECT_BINARY_DIR}"
|
|
|
|
"${PROJECT_BINARY_DIR}/source"
|
|
|
|
"${PROJECT_SOURCE_DIR}"
|
|
|
|
"${PROJECT_SOURCE_DIR}/source"
|
|
|
|
"${PATH_OBSStudio}"
|
|
|
|
)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
2017-12-14 02:27:49 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# All Warnings, Extra Warnings, Pedantic
|
|
|
|
if(MSVC)
|
|
|
|
# Force to always compile with W4
|
|
|
|
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
2017-11-02 23:30:53 +00:00
|
|
|
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
2017-12-14 02:27:49 +00:00
|
|
|
else()
|
2017-11-02 23:30:53 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
|
|
|
|
endif()
|
2017-12-14 02:27:49 +00:00
|
|
|
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")
|
2017-06-28 21:21:42 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Build
|
|
|
|
################################################################################
|
|
|
|
ADD_LIBRARY(obs-stream-effects MODULE
|
|
|
|
${obs-stream-effects_HEADERS}
|
|
|
|
${obs-stream-effects_SOURCES}
|
2017-08-19 21:47:30 +00:00
|
|
|
${obs-stream-effects_LOCALE}
|
|
|
|
${obs-stream-effects_EFFECTS}
|
2017-06-28 21:21:42 +00:00
|
|
|
)
|
|
|
|
TARGET_LINK_LIBRARIES(obs-stream-effects
|
|
|
|
${LIBOBS_LIBRARIES}
|
|
|
|
${obs-stream-effects_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2017-08-19 21:47:30 +00:00
|
|
|
if(TARGET libobs)
|
2017-06-28 21:21:42 +00:00
|
|
|
install_obs_plugin_with_data(obs-stream-effects data)
|
|
|
|
else()
|
2017-11-02 23:30:53 +00:00
|
|
|
INSTALL(TARGETS obs-stream-effects DESTINATION "${INSTALL_DIR}/obs-plugins/${BITS}bit")
|
|
|
|
INSTALL(FILES $<TARGET_PDB_FILE:obs-stream-effects> DESTINATION "${INSTALL_DIR}/obs-plugins/${BITS}bit" OPTIONAL)
|
2017-11-03 09:48:06 +00:00
|
|
|
INSTALL(DIRECTORY "${PROJECT_SOURCE_DIR}/data/" DESTINATION "${INSTALL_DIR}/data/obs-plugins/obs-stream-effects" OPTIONAL)
|
2017-11-02 23:30:53 +00:00
|
|
|
|
|
|
|
# Zip Generator
|
|
|
|
ADD_CUSTOM_TARGET(PACKAGE_ZIP COMMAND
|
2017-11-05 13:34:28 +00:00
|
|
|
${CMAKE_COMMAND} -E tar "cfv" "${INSTALL_DIR}/${PACKAGE_PREFIX}obs-stream-effects${PACKAGE_SUFFIX}.zip" --format=zip -- "${INSTALL_DIR}/data/" "${INSTALL_DIR}/obs-plugins"
|
2017-11-03 09:48:06 +00:00
|
|
|
DEPENDS INSTALL obs-stream-effects
|
|
|
|
WORKING_DIRECTORY "${INSTALL_DIR}")
|
2017-11-02 23:30:53 +00:00
|
|
|
|
|
|
|
# 7-Zip Generator
|
|
|
|
ADD_CUSTOM_TARGET(PACKAGE_7ZIP COMMAND
|
2017-11-05 13:34:28 +00:00
|
|
|
${CMAKE_COMMAND} -E tar "cfv" "${INSTALL_DIR}/${PACKAGE_PREFIX}obs-stream-effects${PACKAGE_SUFFIX}.7z" --format=7zip -- "${INSTALL_DIR}/data/" "${INSTALL_DIR}/obs-plugins"
|
2017-11-03 09:48:06 +00:00
|
|
|
DEPENDS INSTALL obs-stream-effects
|
|
|
|
WORKING_DIRECTORY "${INSTALL_DIR}")
|
2017-11-02 23:30:53 +00:00
|
|
|
|
2017-06-28 21:21:42 +00:00
|
|
|
endif()
|