Skip to content

Commit

Permalink
Merge pull request #16 from cpyarger/master
Browse files Browse the repository at this point in the history
Fix breaks caused by CI additions
  • Loading branch information
cpyarger authored Jun 23, 2020
2 parents eec353f + d5da542 commit dca10ae
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 174 deletions.
2 changes: 1 addition & 1 deletion CI/build-ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
set -ex

mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr -DUSE_UBUNTU_FIX=true ..
cmake -DisAzure=true -DCMAKE_INSTALL_PREFIX=/usr -DUSE_UBUNTU_FIX=true ..
make -j4
13 changes: 0 additions & 13 deletions CI/install-dependencies-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,7 @@ if [ "${OSTYPE}" != "Darwin" ]; then
echo "[obs-midi - Error] macOS install dependencies script can be run on Darwin-type OS only."
exit 1
fi
HAS_PORT=$(type port 2>/dev/null)
if [ "${HAS_PORT}" = "" ]; then
echo "[obs-midi - Error] Mac Ports not installed, Building and installing macports"
curl -O https://distfiles.macports.org/MacPorts/MacPorts-2.6.2.tar.bz2
tar xf MacPorts-2.6.2.tar.bz2
cd MacPorts-2.6.2/
./configure
make
sudo make install
export PATH=/usr/local/git/bin:/usr/local/bin:$PATH
fi
sudo port -v selfupdate

sudo port install jack
HAS_BREW=$(type brew 2>/dev/null)

if [ "${HAS_BREW}" = "" ]; then
Expand Down
2 changes: 1 addition & 1 deletion CI/prepare-obs-windows.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QT
echo:
echo:

dir "%OBSPath%\libobs"
dir "%OBSPath%\libobs"
4 changes: 2 additions & 2 deletions CI/prepare-windows.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ mkdir build32
mkdir build64

cd build32
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QTDIR32%" -DLibObs_DIR="%OBSPath%\build32\libobs" -DLIBOBS_INCLUDE_DIR="%OBSPath%\libobs" -DLIBOBS_LIB="%OBSPath%\build32\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="%OBSPath%\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_SYSTEM_VERSION=10.0 -DisAzure=true -DQTDIR="%QTDIR32%" -DLibObs_DIR="%OBSPath%\build32\libobs" -DLIBOBS_INCLUDE_DIR="%OBSPath%\libobs" -DLIBOBS_LIB="%OBSPath%\build32\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="%OBSPath%\build32\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
cd ..\build64
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0 -DQTDIR="%QTDIR64%" -DLibObs_DIR="%OBSPath%\build64\libobs" -DLIBOBS_INCLUDE_DIR="%OBSPath%\libobs" -DLIBOBS_LIB="%OBSPath%\build64\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="%OBSPath%\build64\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_SYSTEM_VERSION=10.0 -DisAzure=true -DQTDIR="%QTDIR64%" -DLibObs_DIR="%OBSPath%\build64\libobs" -DLIBOBS_INCLUDE_DIR="%OBSPath%\libobs" -DLIBOBS_LIB="%OBSPath%\build64\libobs\%build_config%\obs.lib" -DOBS_FRONTEND_LIB="%OBSPath%\build64\UI\obs-frontend-api\%build_config%\obs-frontend-api.lib" ..
235 changes: 129 additions & 106 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,24 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_definitions(-DASIO_STANDALONE)

if (WIN32 OR APPLE)
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()

find_package(LibObs REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)

include_directories(
"${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api"

"${LIBOBS_INCLUDE_DIR}/../UI/obs-frontend-api"
SYSTEM
${Qt5Core_INCLUDES}
${Qt5Widgets_INCLUDES}
${Qt5Core_INCLUDES}
${Qt5Widgets_INCLUDES}
"${CMAKE_SOURCE_DIR}/UI")

set(obs-midi_SOURCES
Expand Down Expand Up @@ -89,113 +93,133 @@ add_library(obs-midi MODULE
${obs-midi_SOURCES}
${obs-midi_HEADERS})

target_link_libraries(obs-midi
"${OBS_FRONTEND_LIB}"
${obs-midi_DEPS}
Qt5::Core
Qt5::Widgets
libobs)



# --- Windows-specific build settings and tasks ---
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(WIN32 OR LINUX)
if (${isAzure})


if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_NAME "64bit")
set(OBS_BUILDDIR_ARCH "build64")
target_link_libraries(obs-midi
"${OBS_FRONTEND_LIB}"
${obs-midi_DEPS}
Qt5::Core
Qt5::Widgets
libobs)
else()
set(ARCH_NAME "32bit")
set(OBS_BUILDDIR_ARCH "build32")
endif()
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}")

# --- Release package helper ---
# The "release" folder has a structure similar OBS' one on Windows
set(RELEASE_DIR "${PROJECT_SOURCE_DIR}/release")
add_custom_command(TARGET obs-midi POST_BUILD
# If config is Release, package release files
COMMAND if $<CONFIG:Release>==1 (
"${CMAKE_COMMAND}" -E make_directory
"${RELEASE_DIR}/data/obs-plugins/obs-midi"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data"
"${RELEASE_DIR}/data/obs-plugins/obs-midi")

include_directories(
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/UI"
)
COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-midi>"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

# In Release mode, copy Qt image format plugins
COMMAND if $<CONFIG:Release>==1 (
"${CMAKE_COMMAND}" -E copy
"${QTDIR}/plugins/imageformats/qjpeg.dll"
"${RELEASE_DIR}/bin/${ARCH_NAME}/imageformats/qjpeg.dll")
COMMAND if $<CONFIG:RelWithDebInfo>==1 (
"${CMAKE_COMMAND}" -E copy
"${QTDIR}/plugins/imageformats/qjpeg.dll"
"${RELEASE_DIR}/bin/${ARCH_NAME}/imageformats/qjpeg.dll")

# If config is RelWithDebInfo, package release files
COMMAND if $<CONFIG:RelWithDebInfo>==1 (
"${CMAKE_COMMAND}" -E make_directory
"${RELEASE_DIR}/data/obs-plugins/obs-midi"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data"
"${RELEASE_DIR}/data/obs-plugins/obs-midi")

target_link_libraries(obs-midi
"${OBS_FRONTEND_LIB}")

# --- Release package helper ---
# The "release" folder has a structure similar OBS' one on Windows
set(RELEASE_DIR "${PROJECT_SOURCE_DIR}/release")
add_custom_command(TARGET obs-midi POST_BUILD
# If config is Release, package release files
COMMAND if $<CONFIG:Release>==1 (
"${CMAKE_COMMAND}" -E make_directory
"${RELEASE_DIR}/data/obs-plugins/obs-midi"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data"
"${RELEASE_DIR}/data/obs-plugins/obs-midi")

COMMAND if $<CONFIG:Release>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-midi>"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

# In Release mode, copy Qt image format plugins
COMMAND if $<CONFIG:Release>==1 (
"${CMAKE_COMMAND}" -E copy
"${QTDIR}/plugins/imageformats/qjpeg.dll"
"${RELEASE_DIR}/bin/${ARCH_NAME}/imageformats/qjpeg.dll")
COMMAND if $<CONFIG:RelWithDebInfo>==1 (
"${CMAKE_COMMAND}" -E copy
"${QTDIR}/plugins/imageformats/qjpeg.dll"
"${RELEASE_DIR}/bin/${ARCH_NAME}/imageformats/qjpeg.dll")

# If config is RelWithDebInfo, package release files
COMMAND if $<CONFIG:RelWithDebInfo>==1 (
"${CMAKE_COMMAND}" -E make_directory
"${RELEASE_DIR}/data/obs-plugins/obs-midi"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy_directory
"${PROJECT_SOURCE_DIR}/data"
"${RELEASE_DIR}/data/obs-plugins/obs-midi")

COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-midi>"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_PDB_FILE:obs-midi>"
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

# Copy to obs-studio dev environment for immediate testing
COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E copy
COMMAND if $<CONFIG:RelWithDebInfo>==1 ("${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-midi>"
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/obs-plugins/${ARCH_NAME}")
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E copy
COMMAND if $<CONFIG:RelWithDebInfo>==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 ---
"${RELEASE_DIR}/obs-plugins/${ARCH_NAME}")

# Copy to obs-studio dev environment for immediate testing
COMMAND if $<CONFIG:Debug>==1 (
"${CMAKE_COMMAND}" -E copy
"$<TARGET_FILE:obs-midi>"
"${LIBOBS_INCLUDE_DIR}/../${OBS_BUILDDIR_ARCH}/rundir/$<CONFIG>/obs-plugins/${ARCH_NAME}")

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 section ---
# -- End of if AZURE

# --- Linux-specific build settings and tasks ---
if(UNIX AND NOT APPLE)
Expand All @@ -221,7 +245,6 @@ endif()
# -- OS X specific build settings and tasks --
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++ -fvisibility=default")

set(CMAKE_SKIP_RPATH TRUE)
set_target_properties(obs-midi PROPERTIES PREFIX "")
target_link_libraries(obs-midi "${OBS_FRONTEND_LIB}")
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ Use MIDI devices to trigger events in OBS and visa versa.
* Select your controller, hit configure, Toggle a button and fader, remap it to an action and hit save!



Currently runs on Windows and Linux, and is untested on MAC


# Build instructions
In your obs-studio/plugins folder
1. ```git clone --recursive https://github.com/Alzy/obs-midi.git```
2. Append to CMakeLists.txt
* ```add_subdirectory(obs-midi)```
Go back to your obs Build directory
## windows
Go back to your OBS Build directory
## Windows
1. run ```cmake-gui.exe```
2. click ```configure```
3. click ```generate```
Expand Down
11 changes: 10 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
QTDIR32: '$(QtBaseDir)\5.10.1\msvc2017'
QTDIR64: '$(QtBaseDir)\5.10.1\msvc2017_64'
OBSPath: 'D:\obs-studio'
isAzure: 'true'
steps:
- checkout: self
submodules: true
Expand Down Expand Up @@ -79,6 +80,7 @@ jobs:
QTDIR32: $(QTDIR32)
QTDIR64: $(QTDIR64)
OBSPath: $(OBSPath)
isAzure: $(isAzure)

- task: MSBuild@1
displayName: 'Build OBS Studio 32-bit'
Expand All @@ -99,6 +101,7 @@ jobs:
QTDIR32: $(QTDIR32)
QTDIR64: $(QTDIR64)
OBSPath: $(OBSPath)
isAzure: $(isAzure)

- task: MSBuild@1
displayName: 'Build obs-midi 32-bit'
Expand Down Expand Up @@ -128,6 +131,7 @@ jobs:
BUILD_REASON: $(Build.Reason)
BRANCH_SHORT_NAME: $(Build.SourceBranchName)
BRANCH_FULL_NAME: $(Build.SourceBranch)
isAzure: true
steps:
- checkout: self
submodules: true
Expand All @@ -137,6 +141,8 @@ jobs:

- script: ./CI/build-ubuntu.sh
displayName: 'Build obs-midi'
env:
isAzure: $(isAzure)

- script: ./CI/package-ubuntu.sh
displayName: 'Package obs-midi'
Expand All @@ -149,6 +155,8 @@ jobs:
- job: 'Build_macOS'
pool:
vmImage: 'macos-10.14'
variables:
isAzure: true
steps:
- checkout: self
submodules: true
Expand All @@ -161,7 +169,8 @@ jobs:

- script: ./CI/build-macos.sh
displayName: 'Build obs-midi'

env:
isAzure: $(isAzure)
- script: ./CI/package-macos.sh
displayName: 'Package obs-midi'
env:
Expand Down
Loading

0 comments on commit dca10ae

Please sign in to comment.