Skip to content

Commit 6c1095d

Browse files
committed
Create OBJECT library for Windows VST3 module compilation
Isolate the Windows module_win32.cpp compilation into a separate OBJECT library with its own compile settings, avoiding potential conflicts with JUCE's compilation environment. The object library: - Uses C++17 (matching SDK's validator) - Has SDK-specific include directories - Sets Windows compatibility definitions - Uses static CRT to match pluginval https://claude.ai/code/session_01AY9chvBEmsCVjNZSUkNcbw
1 parent 2ee3182 commit 6c1095d

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

CMakeLists.txt

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,30 @@ if(PLUGINVAL_VST3_VALIDATOR)
141141
set_source_files_properties(${VST3_MODULE_MAC_FILE} PROPERTIES
142142
COMPILE_FLAGS "-fobjc-arc")
143143
elseif(WIN32)
144-
list(APPEND VST3ValidatorFiles
144+
# Create an OBJECT library for the Windows module to compile it with SDK settings
145+
add_library(vst3_module_win32 OBJECT
145146
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst/hosting/module_win32.cpp)
147+
target_compile_features(vst3_module_win32 PRIVATE cxx_std_17)
148+
target_include_directories(vst3_module_win32 PRIVATE
149+
${vst3sdk_SOURCE_DIR}
150+
${vst3sdk_SOURCE_DIR}/pluginterfaces
151+
${vst3sdk_SOURCE_DIR}/base
152+
${vst3sdk_SOURCE_DIR}/public.sdk
153+
${vst3sdk_SOURCE_DIR}/public.sdk/source
154+
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst
155+
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst/hosting
156+
${vst3sdk_SOURCE_DIR}/public.sdk/source/vst/utility)
157+
target_compile_definitions(vst3_module_win32 PRIVATE
158+
NOMINMAX
159+
WIN32_LEAN_AND_MEAN
160+
_UNICODE
161+
UNICODE
162+
_CRT_SECURE_NO_WARNINGS
163+
_SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING)
164+
target_link_libraries(vst3_module_win32 PRIVATE sdk_hosting)
165+
# Set static CRT for the object library
166+
set_property(TARGET vst3_module_win32 PROPERTY
167+
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
146168
endif()
147169

148170
target_sources(pluginval PRIVATE ${VST3ValidatorFiles})
@@ -211,9 +233,10 @@ if (PLUGINVAL_VST3_VALIDATOR)
211233
sdk_hosting
212234
sdk)
213235

214-
# Windows needs additional libraries for the module loading code
236+
# Windows needs additional libraries and the module object library
215237
if(WIN32)
216238
target_link_libraries(pluginval PRIVATE
239+
vst3_module_win32
217240
Ole32
218241
Shell32)
219242
endif()

0 commit comments

Comments
 (0)