Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Audio Unit v2 support #8

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
vst3sdk
Makefile
CMakeCache.txt
CMakeFiles
Expand Down
151 changes: 54 additions & 97 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set(CMAKE_COLOR_MAKEFILE ON)
project(Fogpad)
set(PROJECT_VERSION 1)
set(target fogpad)
set(copyright "igorski.nl 2019-2023")
set(copyright "igorski.nl 2019-2024")
set(major_version 1)
set(minor_version 0)
set(release_number 3)
Expand Down Expand Up @@ -64,24 +64,23 @@ endif()

list(APPEND CMAKE_MODULE_PATH "${VST3_SDK_ROOT}/cmake/modules")

include(SMTG_Global)
# include(SMTG_AAXSupport)
include(SMTG_AddVST3Library)
include(SMTG_AddVST3Options)
include(SMTG_Bundle)
include(SMTG_CoreAudioSupport)
include(SMTG_ExportedSymbols)
include(SMTG_PrefixHeader)
include(SMTG_Global)
include(SMTG_PlatformIOS)
include(SMTG_PlatformToolset)
include(SMTG_CoreAudioSupport)
include(SMTG_AAXSupport)
include(SMTG_VstGuiSupport)
include(SMTG_PrefixHeader)
include(SMTG_UniversalBinary)
include(SMTG_AddVST3Options)
include(SMTG_VstGuiSupport)

#########################
# Steinberg VST sources #
#########################

set(VSTSDK_INCLUDE_DIR ${VST3_SDK_ROOT})
set(VSTSDK_PLUGIN_SOURCE
${VST3_SDK_ROOT}/public.sdk/source/common/commoniids.cpp
${VST3_SDK_ROOT}/public.sdk/source/vst/vstaudioeffect.cpp
Expand Down Expand Up @@ -152,67 +151,23 @@ if(SMTG_CREATE_VST2_VERSION)
endif()
endif()


set(vst_resources
"resource/background.png"
"resource/version.png"
)
set(vst_ui_descr "resource/plugin.uidesc")

##############
# Audio Unit #
##############

if (JAMBA_ENABLE_AUDIO_UNIT)
set(JAMBA_TEST_CASES_DIR "${JAMBA_ROOT}/test/cpp")
set(JAMBA_TEST_CASES_SOURCES
${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/Collection/test-CircularBuffer.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/Concurrent/test-concurrent.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/Concurrent/test-concurrent_lockfree.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/test-Lerp.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/Utils/test-StringUtils.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Params/test-GUIParameters.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Params/test-ParamAware.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Views/test-CustomViewCreator.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/GUI/Views/test-SelfContainedViewListener.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-AudioBuffers.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-AudioUtils.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-ParamConverters.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/test-SampleRateBasedClock.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/Utils/test-Utils.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/Utils/test-FastWriteMemoryStream.cpp
${JAMBA_TEST_CASES_DIR}/pongasoft/VST/Utils/test-ReadOnlyMemoryStream.cpp
)

include(jamba.cmake)
set(CPP_SOURCES src)

configure_file(${CPP_SOURCES}/version.h ${CMAKE_BINARY_DIR}/generated/version.h)
include_directories(${CMAKE_BINARY_DIR}/generated/)

jamba_add_vst_plugin(
TARGET "${target}"
RELEASE_FILENAME "${target}.component"
TARGETS_PREFIX "jmb_"
VST_SOURCES "${vst_sources}"
UIDESC "${vst_ui_descr}"
RESOURCES "${vst_resources}"
TEST_CASE_SOURCES "${JAMBA_TEST_CASES_SOURCES}"
TEST_LINK_LIBRARIES "jamba"
)

else()

#######
# VST #
#######

smtg_add_vst3plugin(${target} ${vst_sources})
smtg_target_configure_version_file(${target})

## include Steinberg libraries

set(steinberg_libs "base" "pluginterfaces" "sdk" "vstgui_support" "vstgui_uidescription" "vstgui")
include_directories(${VSTSDK_INCLUDE_DIR})
set(steinberg_libs "base" "pluginterfaces" "sdk" "vstgui" "vstgui_support" "vstgui_uidescription")
include_directories(${VST3_SDK_ROOT})
foreach(lib IN ITEMS ${steinberg_libs})
if(UNIX)
target_link_libraries(${target} PRIVATE ${VST3_SDK_ROOT}/build/lib/Release/lib${lib}.a)
Expand All @@ -235,32 +190,9 @@ target_sources(${target} PRIVATE
IF (APPLE)
target_sources (${target} PRIVATE
${VST3_SDK_ROOT}/public.sdk/source/main/macmain.cpp
${VST3_SDK_ROOT}/vstgui4/vstgui/vstgui_mac.mm
)
if(XCODE)
if(SMTG_IOS_DEVELOPMENT_TEAM)
## iOS plugin
set(target ${target}_ios)
smtg_add_ios_vst3plugin("${SMTG_CODE_SIGN_IDENTITY_IOS}" ${target} "${target}" "${vst_sources}")
set_target_properties(${target} PROPERTIES ${SDK_IDE_PLUGIN_EXAMPLES_FOLDER})
target_link_libraries(${target} PRIVATE
base_ios
sdk_ios
"-framework UIKit"
"-framework CoreGraphics"
"-framework QuartzCore"
"-framework CoreText"
"-framework Accelerate"
"-framework ImageIO"
"-framework MobileCoreServices"
)
target_sources(${target} PRIVATE
${VST3_SDK_ROOT}/vstgui4/vstgui/vstgui_ios.mm
)
else()
## macOS plugin
target_link_libraries(${target} PRIVATE "-framework Cocoa" "-framework OpenGL" "-framework Accelerate" "-framework QuartzCore" "-framework Carbon")
endif()
target_link_libraries(${target} PRIVATE "-framework Cocoa" "-framework OpenGL" "-framework Accelerate" "-framework QuartzCore" "-framework Carbon")
else()
find_library(COREFOUNDATION_FRAMEWORK CoreFoundation)
find_library(COCOA_FRAMEWORK Cocoa)
Expand Down Expand Up @@ -322,7 +254,7 @@ endif()
## Include Windows specific libraries

if(WIN)
target_sources (${target} PRIVATE
target_sources(${target} PRIVATE
${VST3_SDK_ROOT}/public.sdk/source/main/dllmain.cpp
# ${VST3_SDK_ROOT}/vstgui4/vstgui/vstgui_win32.cpp
)
Expand All @@ -335,9 +267,36 @@ smtg_target_add_plugin_resources(${target}
)

if(APPLE)
smtg_target_set_bundle(${target} INFOPLIST "${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist" PREPROCESS)
# adding PkgInfo at root level makes plugin appear as a file instead of folder
smtg_target_add_plugin_resources(${target} RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/mac/PkgInfo" OUTPUT_SUBDIRECTORY "../")
##############
# Audio Unit #
##############
if (XCODE AND SMTG_CREATE_AU_VERSION)
message(STATUS "SMTG_CREATE_AU_VERSION is set. An Audio Unit version of the plug-in will be created.")
set(public_sdk_SOURCE_DIR ${VST3_SDK_ROOT}/public.sdk)
set(SMTG_ENABLE_AUV2_BUILDS true)
include(SMTG_AddVST3AuV2)
smtg_target_add_auv2(${target}-au
BUNDLE_NAME fogpad
BUNDLE_IDENTIFIER nl.igorski.fogpad.audiounit
INFO_PLIST_TEMPLATE ${CMAKE_CURRENT_SOURCE_DIR}/mac/au-info.plist
VST3_PLUGIN_TARGET fogpad
)
# exposes Steinberg libs to the Audio Unit target
target_link_directories(${target}-au PRIVATE "${VST3_SDK_ROOT}/build/lib")
target_link_libraries(${target}-au
PUBLIC
${steinberg_libs}
sdk_common
)
else()
smtg_target_set_bundle(${target} INFOPLIST "${CMAKE_CURRENT_SOURCE_DIR}/mac/Info.plist" PREPROCESS)
# adding PkgInfo at root level makes plugin appear as a file instead of folder
smtg_target_add_plugin_resources(${target} RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/mac/PkgInfo" OUTPUT_SUBDIRECTORY "../")
endif()
smtg_target_set_bundle(${target}
BUNDLE_IDENTIFIER "nl.igorski.${target}"
COMPANY_NAME "igorski.nl"
)
elseif(WIN)
target_sources(${target} PRIVATE resource/plugin.rc)
endif()
Expand All @@ -353,26 +312,24 @@ if (SMTG_CREATE_VST2_VERSION)
endif()
endif()

endif()

######################
# Installation paths #
######################

if(APPLE)
install(TARGETS ${target}
DESTINATION "$ENV{HOME}/Library/Audio/Plug-Ins/VST"
)
install(TARGETS ${target}
DESTINATION "$ENV{HOME}/Library/Audio/Plug-Ins/VST"
)
elseif(WIN32)
install(TARGETS ${target}
DESTINATION "C:/Program Files (x86)/Common Files/VST3/"
)
install(TARGETS ${target}
DESTINATION "C:/Program Files (x86)/Common Files/VST3/"
)
elseif(WIN)
install(TARGETS ${target}
DESTINATION "C:/Program Files/Common Files/VST3/"
)
install(TARGETS ${target}
DESTINATION "C:/Program Files/Common Files/VST3/"
)
elseif(LINUX)
install(TARGETS ${target}
DESTINATION "/usr/lib/lxvst"
)
install(TARGETS ${target}
DESTINATION "/usr/lib/lxvst"
)
endif()
Loading