From 986648c0b24dd6f0f718d86b64e6a670e865591c Mon Sep 17 00:00:00 2001 From: Vladimir Romashchenko <52473614+eaglesemanation@users.noreply.github.com> Date: Wed, 22 Dec 2021 06:11:58 -0500 Subject: [PATCH] feat: Out of tree build (#105) Allows to build this plugin outside of obs-studio project tree --- CMakeLists.txt | 28 ++++++++++++++++++++++------ README.md | 13 +++++++++---- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 45dbc13..252a4c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,16 +32,32 @@ if(WIN32) move-transition.rc) endif() +if(BUILD_OUT_OF_TREE) + find_package(LibObs REQUIRED) +endif() + add_library(move-transition MODULE ${move-transition_HEADERS} ${move-transition_SOURCES}) - -target_include_directories(move-transition PRIVATE - "${CMAKE_SOURCE_DIR}/UI/obs-frontend-api") - target_link_libraries(move-transition obs-frontend-api libobs) -set_target_properties(move-transition PROPERTIES FOLDER "plugins/exeldro") -install_obs_plugin_with_data(move-transition data) +if(BUILD_OUT_OF_TREE) + if(NOT LIB_OUT_DIR) + set(LIB_OUT_DIR "/lib/obs-plugins") + endif() + if(NOT DATA_OUT_DIR) + set(DATA_OUT_DIR "/share/obs/obs-plugins/move-transition") + endif() + set_target_properties(move-transition PROPERTIES PREFIX "") + install(TARGETS move-transition + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/${LIB_OUT_DIR}) + install(DIRECTORY data/locale + DESTINATION ${CMAKE_INSTALL_PREFIX}/${DATA_OUT_DIR}) +else() + target_include_directories(move-transition PRIVATE + "${CMAKE_SOURCE_DIR}/UI/obs-frontend-api") + set_target_properties(move-transition PROPERTIES FOLDER "plugins/exeldro") + install_obs_plugin_with_data(move-transition data) +endif() diff --git a/README.md b/README.md index 0a1390e..46bcd76 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,15 @@ Plugin for OBS Studio to move source to a new position during scene transition https://obsproject.com/forum/resources/move-transition.913/ # Build -- Build OBS Studio: https://obsproject.com/wiki/Install-Instructions -- Check out this repository to plugins/move-transition -- Add `add_subdirectory(move-transition)` to plugins/CMakeLists.txt -- Rebuild OBS Studio +1. In-tree build + - Build OBS Studio: https://obsproject.com/wiki/Install-Instructions + - Check out this repository to plugins/move-transition + - Add `add_subdirectory(move-transition)` to plugins/CMakeLists.txt + - Rebuild OBS Studio + +1. Stand-alone build (Linux only) + - Verify that you have package with development files for OBS + - Check out this repository and run `cmake -S . -B build -DBUILD_OUT_OF_TREE=On && cmake --build build` # Donations https://www.paypal.me/exeldro