univrsal / spectralizer

Audio visualizer plugin for obs-studio
GNU General Public License v2.0
588 stars 57 forks source link

install_obs_plugin_with_data isn't exposed by obs-studio #16

Closed yurivict closed 3 years ago

yurivict commented 4 years ago

This comment explains how you can work around this issue: https://github.com/obsproject/obs-studio/issues/2647#issuecomment-609096266

univrsal commented 4 years ago

To build this you need to put it in the same folder as the other obs plugins in the obs source tree. I know that there's a CMake script to allow for linking against just libobs but for development and debugging it's easier for me to just put the plugin alongside the obs source.

yurivict commented 4 years ago

Users can't just build everything manually. Users aren't engineers. It should build and install as a package.

univrsal commented 4 years ago

That's what the release page is for. I'm open to PRs that add this behavior though.

MoMaT commented 3 years ago

Here is a CMakeList.txtfile that builds and install the plugin on GNU/Linux externally (that is, not inside the OBS source tree). You only need the obs-studio and fftw3-dev installed. Tested on Ubuntu with OBS 23.

cmake_minimum_required(VERSION 2.8)

project(spectralizer)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

find_path(OBS_INCLUDE_DIRS
    NAMES obs-module.h
    PATH_SUFFIXES obs libobs
)

find_library(OBS_LIBRARIES
    NAMES obs libobs
    PATH_SUFFIXES libobs
)

FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(FFTW fftw3 REQUIRED)

include_directories(
    ${OBS_INCLUDE_DIRS}
    ${FFTW_INCLUDE_DIRS}
)

set(spectralizer_SOURCES
    src/spectralizer.cpp
    src/source/visualizer_source.cpp
    src/source/visualizer_source.hpp
    src/util/util.hpp
    src/util/audio/spectrum_visualizer.cpp
    src/util/audio/spectrum_visualizer.hpp
    src/util/audio/bar_visualizer.cpp
    src/util/audio/bar_visualizer.hpp
    src/util/audio/wire_visualizer.cpp
    src/util/audio/wire_visualizer.hpp
    src/util/audio/fifo.cpp
    src/util/audio/fifo.hpp
    src/util/audio/obs_internal_source.cpp
    src/util/audio/obs_internal_source.hpp
    src/util/audio/audio_visualizer.cpp
    src/util/audio/audio_visualizer.hpp
    src/util/audio/audio_source.hpp)

add_library(spectralizer MODULE
    ${spectralizer_SOURCES})

target_link_libraries(spectralizer
    ${OBS_LIBRARIES}
    ${FFTW_LIBRARIES}
)

set(CMAKE_INSTALL_PREFIX $ENV{HOME}/.config/obs-studio)
math(EXPR BITS "8 * ${CMAKE_SIZEOF_VOID_P}")
install(TARGETS spectralizer
    LIBRARY DESTINATION "plugins/spectralizer/bin/${BITS}bit")
install(DIRECTORY data
    DESTINATION plugins/spectralizer)
univrsal commented 3 years ago

The cmakelists file now allows to install into the home directory or into the obs studio plugin folder. Also works without building obs studio from source.