mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-10 22:05:06 +00:00
132 lines
4.1 KiB
CMake
132 lines
4.1 KiB
CMake
cmake_minimum_required(VERSION 2.8.12)
|
|
PROJECT(obs-stream-effects)
|
|
|
|
################################################################################
|
|
# Version
|
|
################################################################################
|
|
SET(VERSION_MAJOR 0)
|
|
SET(VERSION_MINOR 1)
|
|
SET(VERSION_PATCH 0)
|
|
#configure_file(
|
|
# "${PROJECT_SOURCE_DIR}/#Resources/package.in.bat"
|
|
# "${PROJECT_SOURCE_DIR}/#Resources/package.bat"
|
|
#)
|
|
#configure_file(
|
|
# "${PROJECT_SOURCE_DIR}/#Resources/Installer.in.iss"
|
|
# "${PROJECT_SOURCE_DIR}/#Resources/Installer.iss"
|
|
#)
|
|
configure_file(
|
|
"${PROJECT_SOURCE_DIR}/source/version.h.in"
|
|
"${PROJECT_BINARY_DIR}/source/version.h"
|
|
)
|
|
|
|
################################################################################
|
|
# Code
|
|
################################################################################
|
|
SET(obs-stream-effects_HEADERS
|
|
"${PROJECT_SOURCE_DIR}/source/plugin.h"
|
|
"${PROJECT_SOURCE_DIR}/source/filter-displacement.h"
|
|
"${PROJECT_SOURCE_DIR}/source/filter-shape.h"
|
|
"${PROJECT_SOURCE_DIR}/source/filter-transform.h"
|
|
"${PROJECT_SOURCE_DIR}/source/gs-helper.h"
|
|
"${PROJECT_BINARY_DIR}/source/version.h"
|
|
"${PROJECT_SOURCE_DIR}/source/strings.h"
|
|
)
|
|
SET(obs-stream-effects_SOURCES
|
|
"${PROJECT_SOURCE_DIR}/source/plugin.cpp"
|
|
"${PROJECT_SOURCE_DIR}/source/filter-displacement.cpp"
|
|
"${PROJECT_SOURCE_DIR}/source/filter-shape.cpp"
|
|
"${PROJECT_SOURCE_DIR}/source/filter-transform.cpp"
|
|
"${PROJECT_SOURCE_DIR}/source/gs-helper.cpp"
|
|
)
|
|
SET(obs-stream-effects_LIBRARIES
|
|
)
|
|
|
|
################################################################################
|
|
# Standalone and OBS Studio Build Data
|
|
################################################################################
|
|
if(DepsPath)
|
|
# OBS Studio Specific
|
|
|
|
# Directories
|
|
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()
|
|
|
|
# Find OBS Libraries
|
|
SET(obsPath "${PATH_OBSStudio}")
|
|
INCLUDE("${PATH_OBSStudio}/cmake/external/Findlibobs.cmake")
|
|
|
|
# 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)
|
|
endif()
|
|
|
|
################################################################################
|
|
# Build
|
|
################################################################################
|
|
ADD_LIBRARY(obs-stream-effects MODULE
|
|
${obs-stream-effects_HEADERS}
|
|
${obs-stream-effects_SOURCES}
|
|
)
|
|
TARGET_LINK_LIBRARIES(obs-stream-effects
|
|
${LIBOBS_LIBRARIES}
|
|
${obs-stream-effects_LIBRARIES}
|
|
)
|
|
|
|
# All Warnings, Extra Warnings, Pedantic
|
|
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()
|
|
|
|
if(DepsPath)
|
|
install_obs_plugin_with_data(obs-stream-effects data)
|
|
else()
|
|
math(EXPR BITS "8*${CMAKE_SIZEOF_VOID_P}")
|
|
add_custom_command(TARGET obs-stream-effects POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
"${PROJECT_SOURCE_DIR}/data"
|
|
"${PROJECT_SOURCE_DIR}/#Build/data/obs-plugins/obs-stream-effects"
|
|
)
|
|
add_custom_command(TARGET obs-stream-effects POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
"$<TARGET_FILE:obs-stream-effects>"
|
|
"${PROJECT_SOURCE_DIR}/#Build/obs-plugins/${BITS}bit/$<TARGET_FILE_NAME:obs-stream-effects>"
|
|
)
|
|
add_custom_command(TARGET obs-stream-effects POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
"$<TARGET_FILE_DIR:obs-stream-effects>/obs-stream-effects.pdb"
|
|
"${PROJECT_SOURCE_DIR}/#Build/obs-plugins/${BITS}bit/obs-stream-effects.pdb"
|
|
)
|
|
endif()
|