Professional Documents
Culture Documents
CMake Lists
CMake Lists
CMake Lists
10)
# Change obs-plugintemplate to your plugin's name in a machine-readable format
# (e.g.: obs-myawesomeplugin) and set
project(obs-midi VERSION 0.2.4)
# Replace `Your Name Here` with the name (yours or your organization's) you want
# to see as the author of the plugin (in the plugin's metadata itself and in the
installers)
set(PLUGIN_AUTHOR "Alzy")
# Replace `me@contoso.com` with the maintainer email address you want to put in
Linux packages
set(LINUX_MAINTAINER_EMAIL "alfredo@seriousbusiness.la")
if(WIN32)
set(MODULE_DESCRIPTION "OBS MIDI module")
endif()
# Version bits
execute_process(
COMMAND git rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/version.h.in
${CMAKE_CURRENT_SOURCE_DIR}/src/version.h
)
##################
# THE GOOD STUFF #
##################
# RTMIDI
add_subdirectory(src/RtMidi17)
set(obs-midi_DEPS RtMidi17)
include_directories(src/RtMidi17)
# OBS MIDI
set(CMAKE_PREFIX_PATH "${QTDIR}")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-DASIO_STANDALONE)
if (${isAzure})
if (WIN32 OR APPLE)
include(external/FindLibObs.cmake)
endif()
find_package(LibObs REQUIRED)
endif()
if (APPLE)
include(external/FindLibObs.cmake)
find_package(LibObs REQUIRED)
endif()
include_directories(
"${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api"
SYSTEM
${Qt5Core_INCLUDES}
${Qt5Widgets_INCLUDES}
"${CMAKE_SOURCE_DIR}/UI")
set(obs-midi_SOURCES
src/utils.cpp
src/config.cpp
src/midi-agent.cpp
src/device-manager.cpp
src/obs-controller.cpp
src/forms/settings-dialog.cpp
src/forms/configwindow.cpp
src/obs-midi.cpp
src/events.cpp
src/rpc/RpcEvent.cpp
list(APPEND obs-midi_HEADERS
src/utils.h
src/config.h
src/midi-agent.h
src/device-manager.h
src/obs-controller.h
src/forms/settings-dialog.h
src/forms/configwindow.h
src/obs-midi.h
src/events.h
src/rpc/RpcEvent.h
)
add_library(obs-midi MODULE
${obs-midi_SOURCES}
${obs-midi_HEADERS})
if(WIN32 OR LINUX)
if (${isAzure})
target_link_libraries(obs-midi
"${OBS_FRONTEND_LIB}"
${obs-midi_DEPS}
Qt5::Core
Qt5::Widgets
libobs)
else()
target_link_libraries(obs-midi
obs-frontend-api
${obs-midi_DEPS}
Qt5::Core
Qt5::Widgets
libobs)
endif()
else()
target_link_libraries(obs-midi
"${OBS_FRONTEND_LIB}"
${obs-midi_DEPS}
Qt5::Core
Qt5::Widgets
libobs)
endif()
if (${isAzure})
# --- Windows-specific build settings and tasks ---
message(WARNING "IS AZURE")
if(WIN32)
if(NOT DEFINED OBS_FRONTEND_LIB)
set(OBS_FRONTEND_LIB "OBS_FRONTEND_LIB-NOTFOUND" CACHE FILEPATH
"OBS frontend library")
message(FATAL_ERROR "Could not find OBS Frontend API's
library !")
endif()
if(MSVC)
# Enable Multicore Builds and disable FH4 (to not depend on
VCRUNTIME140_1.DLL)
add_definitions(/MP /d2FH4-)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_NAME "64bit")
set(OBS_BUILDDIR_ARCH "build64")
else()
set(ARCH_NAME "32bit")
set(OBS_BUILDDIR_ARCH "build32")
endif()
include_directories(
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/UI"
)
target_link_libraries(obs-midi
"${OBS_FRONTEND_LIB}")
COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E copy
"$<TARGET_PDB_FILE:obs-midi>"
"${LIBOBS_INCLUDE_DIR}/../$
{OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/obs-plugins/${ARCH_NAME}")
COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E make_directory
"${LIBOBS_INCLUDE_DIR}/../$
{OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/data/obs-plugins/obs-midi")
COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data"
"${LIBOBS_INCLUDE_DIR}/../$
{OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/data/obs-plugins/obs-midi")
)
# --- End of sub-section ---
endif()
# --- End of section ---
endif()
# -- End of if AZURE
if(${USE_UBUNTU_FIX})
install(TARGETS obs-midi
LIBRARY DESTINATION "/usr/lib/obs-plugins")
endif()
install(TARGETS obs-midi
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/obs-plugins")
install(FILES ${locale_files}
DESTINATION "${CMAKE_INSTALL_FULL_DATAROOTDIR}/obs/obs-plugins/obs-
midi/locale")
endif()
# --- End of section ---