Skip to content

OpenReel Video - Professional browser-based video editor. Open source CapCut alternative. 100% browser-based, no installation, no cloud uploads, no watermarks.

TypeScript
2.6 KB
Raw Blame
# openreel-vst3host: the out-of-process VST3 plugin host. C++ against the MIT licensed Steinberg VST3 SDK (hosting utilities),
# which scripts/build-vst3host.mjs fetches at a pinned tag and points OPENREEL_VST3_SDK at. Nothing of the SDK is committed.
cmake_minimum_required(VERSION 3.25.0)

set(OPENREEL_VST3_SDK "" CACHE PATH "Root of the assembled VST3 SDK (see scripts/lib/vst3sdk.mjs)")
if(NOT OPENREEL_VST3_SDK OR NOT EXISTS "${OPENREEL_VST3_SDK}/cmake/modules/SMTG_VST3_SDK.cmake")
    message(FATAL_ERROR "OPENREEL_VST3_SDK must point at the VST3 SDK tree")
endif()

if(NOT DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
    set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "macOS deployment target")
endif()
set(SMTG_ENABLE_VSTGUI_SUPPORT OFF CACHE BOOL "" FORCE)
set(SMTG_ENABLE_VST3_PLUGIN_EXAMPLES OFF CACHE BOOL "" FORCE)
set(SMTG_ENABLE_VST3_HOSTING_EXAMPLES OFF CACHE BOOL "" FORCE)
set(SMTG_CREATE_PLUGIN_LINK OFF CACHE BOOL "" FORCE)
list(APPEND CMAKE_MODULE_PATH "${OPENREEL_VST3_SDK}/cmake/modules")
include(SMTG_VST3_SDK)

project(openreel-vst3host VERSION 1.0.0 LANGUAGES C CXX)
smtg_setup_platform_toolset()
smtg_setup_symbol_visibility()

set(SDK_ROOT "${OPENREEL_VST3_SDK}")
set(public_sdk_SOURCE_DIR ${SDK_ROOT}/public.sdk)
set(pluginterfaces_SOURCE_DIR ${SDK_ROOT}/pluginterfaces)
include_directories(${SDK_ROOT})
smtg_create_lib_base_target()
smtg_create_pluginterfaces_target()
smtg_create_public_sdk_common_target()
smtg_create_public_sdk_target()
smtg_create_public_sdk_hosting_target()

set(sources main.cpp json.h protocol.h ui.h
    ${SDK_ROOT}/public.sdk/source/common/memorystream.cpp
    ${SDK_ROOT}/public.sdk/source/vst/hosting/plugprovider.cpp)
if(APPLE)
    enable_language(OBJCXX)
    list(APPEND sources ui_mac.mm ${SDK_ROOT}/public.sdk/source/vst/hosting/module_mac.mm)
elseif(WIN32)
    list(APPEND sources ui_stub.cpp ${SDK_ROOT}/public.sdk/source/vst/hosting/module_win32.cpp)
else()
    list(APPEND sources ui_stub.cpp ${SDK_ROOT}/public.sdk/source/vst/hosting/module_linux.cpp)
endif()
add_executable(openreel-vst3host ${sources})
target_compile_features(openreel-vst3host PRIVATE cxx_std_17)
if(APPLE)
    set_source_files_properties(ui_mac.mm ${SDK_ROOT}/public.sdk/source/vst/hosting/module_mac.mm PROPERTIES COMPILE_OPTIONS "-fobjc-arc")
endif()
target_link_libraries(openreel-vst3host PRIVATE sdk_hosting sdk_common sdk base pluginterfaces)
if(APPLE)
    target_link_libraries(openreel-vst3host PRIVATE "-framework AppKit" "-framework Foundation" "-framework CoreFoundation")
endif()
set_target_properties(openreel-vst3host PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")