Plug-in built on MacOS doesn't load on Windows (JUCE 7.0.3)

Hi everyone,

The plug-in I’ve built by using the CMake on Mac works perfectly on MacOS but for some reason doesn’t work on Windows. I’ve checked the contents of the .vst3 file and it only contains MacOS/Resources folder with a binary, and lacks all folder structure by Steinberg (someone posted this on this forum).

Here’s the CMakeLists file I’m using:

cmake_minimum_required(VERSION 3.22)

# On M1 Macs, uncomment to enable universal binaries
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum macOS version required")

set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: Debug Release")

project(computer VERSION 1.1.0)

set(CMAKE_CXX_STANDARD 14) #JUCE requires 14
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_COLOR_MAKEFILE ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)

set(RNBO_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/export/rnbo/" CACHE FILEPATH "The path to the the RNBO c++ source directory")
set(RNBO_EXPORT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/export/" CACHE FILEPATH "path to your export directory")
set(RNBO_CLASS_FILE_NAME "rnbo_computer.cpp" CACHE STRING "the name of your rnbo class file")
mark_as_advanced(RNBO_CLASS_FILE_NAME)

set(RNBO_CLASS_NAME "rnbomatic")
set(RNBO_CLASS_FILE "${RNBO_EXPORT_DIR}/${RNBO_CLASS_FILE_NAME}")
set(RNBO_DESCRIPTION_FILE "${RNBO_EXPORT_DIR}/description.json")
set(RNBO_PRESETS_FILE "${RNBO_EXPORT_DIR}/presets.json")
set(RNBO_BINARY_DATA_FILE "${RNBO_EXPORT_DIR}/${RNBO_CLASS_NAME}_binary.cpp")
set(RNBO_BINARY_DATA_STORAGE_NAME "${RNBO_CLASS_NAME}_binary")
set(PLUGIN_PARAM_DEFAULT_NOTIFY ON CACHE BOOL "Should parameter changes from inside your rnbo patch send output by default?")

#write description header file if description.json exists, sets RNBO_INCLUDE_DESCRIPTION_FILE if the file exists
include(${RNBO_CPP_DIR}/cmake/RNBODescriptionHeader.cmake)
set(DESCRIPTION_INCLUDE_DIR ${CMAKE_BINARY_DIR}/include)
rnbo_write_description_header_if_exists(${RNBO_DESCRIPTION_FILE} ${DESCRIPTION_INCLUDE_DIR} ${RNBO_PRESETS_FILE})
include_directories(${DESCRIPTION_INCLUDE_DIR})

if (EXISTS ${RNBO_BINARY_DATA_FILE})
	add_definitions(-DRNBO_BINARY_DATA_STORAGE_NAME=${RNBO_BINARY_DATA_STORAGE_NAME})
endif()

# Include the JUCE submodule, needed for JUCE-based CMake definitions
add_subdirectory(
  ${CMAKE_CURRENT_LIST_DIR}/thirdparty/juce
  ${CMAKE_BINARY_DIR}/juce
  EXCLUDE_FROM_ALL #don't build examples etc, also don't install
)

add_compile_definitions(JUCE_VST3_EMULATE_MIDI_CC_WITH_PARAMETERS=0)

include(${CMAKE_CURRENT_LIST_DIR}/Plugin.cmake)

And the Plugin file:

# build VST3 for all platforms, add AU on MacOS
set(PLUGIN_FORMATS VST3)
if (CMAKE_SYSTEM_NAME STREQUAL Darwin)
  LIST(APPEND PLUGIN_FORMATS AU)
endif()

juce_add_plugin(computer
  VERSION 1.1                      # Set this if the plugin version is different to the project version
  # ICON_BIG ...                       # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
  # ICON_SMALL ...
  COMPANY_NAME "bloops"     # Specify the name of the plugin's author
  IS_SYNTH TRUE                        # Is this a synth or an effect?
  NEEDS_MIDI_INPUT TRUE                # Does the plugin need midi input?
  NEEDS_MIDI_OUTPUT FALSE               # Does the plugin need midi output?
  IS_MIDI_EFFECT FALSE                 # Is this plugin a MIDI effect?
  EDITOR_WANTS_KEYBOARD_FOCUS FALSE    # Does the editor need keyboard focus?
  COPY_PLUGIN_AFTER_BUILD FALSE        # Should the plugin be installed to a default location after building?
  PLUGIN_MANUFACTURER_CODE "BLPS"      # A four-character manufacturer id with at least one upper-case character
  PLUGIN_CODE "COM1"                   # A unique four-character plugin id with at least one upper-case character
  FORMATS ${PLUGIN_FORMATS}            # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
  PRODUCT_NAME "computer")          # The name of the final executable, which can differ from the target name

juce_generate_juce_header(computer)

target_sources(computer PRIVATE
  "${RNBO_CPP_DIR}/adapters/juce/RNBO_JuceAudioProcessor.cpp"
  "${RNBO_CPP_DIR}/adapters/juce/RNBO_JuceAudioProcessorEditor.cpp"
  "${RNBO_CPP_DIR}/RNBO.cpp"
  ${RNBO_CLASS_FILE}
  src/Plugin.cpp
  src/CustomAudioEditor.cpp
  src/CustomAudioProcessor.cpp
  src/RootComponent.cpp
  # src/MidiLogger.cpp
  )

if (EXISTS ${RNBO_BINARY_DATA_FILE})
  target_sources(computer PRIVATE ${RNBO_BINARY_DATA_FILE})
endif()

target_include_directories(computer
  PRIVATE
  ${RNBO_CPP_DIR}/
  ${RNBO_CPP_DIR}/src
  ${RNBO_CPP_DIR}/common/
  ${RNBO_CPP_DIR}/adapters/juce/
  ${RNBO_CPP_DIR}/src/3rdparty/
  src
  binaries
)

set(RNBO_JUCE_PARAM_DEFAULT_NOTIFY 1)
if (NOT PLUGIN_PARAM_DEFAULT_NOTIFY)
	set(RNBO_JUCE_PARAM_DEFAULT_NOTIFY 0)
endif()

target_compile_definitions(computer
  PUBLIC
  # JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
  JUCE_DISPLAY_SPLASH_SCREEN=0
  JUCE_WEB_BROWSER=0  # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
  JUCE_USE_CURL=0     # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
  JUCE_VST3_CAN_REPLACE_VST2=0
  RNBO_JUCE_NO_CREATE_PLUGIN_FILTER=1 #don't have RNBO create its own createPluginFilter function, we'll create it ourselves
  RNBO_JUCE_PARAM_DEFAULT_NOTIFY=${RNBO_JUCE_PARAM_DEFAULT_NOTIFY}
  )

juce_add_binary_data(ComputerBinaryData SOURCES
  binaries/texturelr.png
  binaries/plugfont.ttf
  )

target_link_libraries(computer
  PRIVATE
  ComputerBinaryData
  juce::juce_audio_utils
  PUBLIC
  juce::juce_recommended_config_flags
  juce::juce_recommended_lto_flags
  juce::juce_recommended_warning_flags
  )

#TODO windows and linux
if(APPLE)
  install(
    TARGETS computer_VST3
    DESTINATION ~/Library/Audio/Plug-Ins/VST3/
    )
  install(
    TARGETS computer_AU
    DESTINATION ~/Library/Audio/Plug-Ins/Components/
    )
endif()

I haven’t read through the CMake yet. FYI, if you want to build a plugin for macOS/Windows, you have to build it on a macOS/Windows machine.

In other words, you can’t build a Windows plugin on a Mac. You have to build it on a Windows machine.

1 Like

Thanks guys! Yep, realised that after finding out on forums that JUCE is cross-platform but not cross-compilatable. A little weird coming from JS world, but anyway.