cmake_minimum_required(VERSION 3.20) project(sonicforge_native_host LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) if(NOT DEFINED VST3_SDK_ROOT) set(VST3_SDK_ROOT "" CACHE PATH "Path to VST3 SDK root") endif() add_library(vst3_host_bridge SHARED vst3_host_bridge.cpp ${VST3_SDK_ROOT}/public.sdk/source/common/commonstringconvert.cpp ${VST3_SDK_ROOT}/public.sdk/source/common/threadchecker_win32.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/hosting/module.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/hosting/module_win32.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/hosting/plugprovider.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/hosting/hostclasses.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/hosting/pluginterfacesupport.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/hosting/connectionproxy.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/utility/stringconvert.cpp ${VST3_SDK_ROOT}/public.sdk/source/vst/vstinitiids.cpp ${VST3_SDK_ROOT}/pluginterfaces/base/funknown.cpp ${VST3_SDK_ROOT}/pluginterfaces/base/ustring.cpp ${VST3_SDK_ROOT}/pluginterfaces/base/coreiids.cpp ${VST3_SDK_ROOT}/base/source/baseiids.cpp ) target_include_directories(vst3_host_bridge PRIVATE ${VST3_SDK_ROOT}) target_compile_definitions(vst3_host_bridge PRIVATE _CRT_SECURE_NO_WARNINGS NOMINMAX WIN32_LEAN_AND_MEAN ) target_link_libraries(vst3_host_bridge PRIVATE audio_engine native_mixer) # Native audio loop (T12): SPSC + WASAPI — dùng chung cho cả 2 bridge. add_library(audio_engine STATIC AudioEngine.cpp ) target_include_directories(audio_engine PUBLIC native_host) target_compile_definitions(audio_engine PRIVATE _CRT_SECURE_NO_WARNINGS NOMINMAX WIN32_LEAN_AND_MEAN _WIN32_WINNT=0x0601 ) target_link_libraries(audio_engine PUBLIC ole32 avrt) # NativeMixer (T13): track gain/pan + master brickwall limiter — mirror server. add_library(native_mixer STATIC NativeMixer.cpp ) target_include_directories(native_mixer PUBLIC native_host) # VST2 host bridge — chỉ cần vestige.h clean-room, không cần SDK. add_library(vst2_host_bridge SHARED VST2AudioEngine.cpp ) target_include_directories(vst2_host_bridge PRIVATE native_host) target_compile_definitions(vst2_host_bridge PRIVATE _CRT_SECURE_NO_WARNINGS NOMINMAX WIN32_LEAN_AND_MEAN ) target_link_libraries(vst2_host_bridge PRIVATE audio_engine native_mixer) # SF host bridge (T14): FluidSynth native — load libfluidsynth runtime DLL # (fluidsynth_runtime/, gitignore) qua GetProcAddress; audio loop + mixer chung. add_library(sf_host_bridge SHARED SFHost.cpp ) target_include_directories(sf_host_bridge PRIVATE native_host) target_compile_definitions(sf_host_bridge PRIVATE _CRT_SECURE_NO_WARNINGS NOMINMAX WIN32_LEAN_AND_MEAN ) target_link_libraries(sf_host_bridge PRIVATE audio_engine native_mixer)