Suggestion - Getting rid of ruby dependency for Audio Unit

The auwrapper CMakeLists.txt file uses ruby to generate a file which contains a define based on the current time.

My question is: why is this necessary exactly? Why generate a different namespace (SMTG_AU_NAMESPACE) every time cmake is run? (which also means that no 2 builds will be identical even if NOTHING changes).

If it is absolutely necessary, here is how you can do it WITHOUT depending on ruby (using cmake):

file(WRITE "${CMAKE_CURRENT_LIST_DIR}/aucocoaclassprefix.h" "#define SMTG_AU_NAMESPACE SMTGAUCocoa${MY_TIMESTAMP}_\n")


Hi Yan,
the SMTG_AU_NAMESPACE macro needs to be different for every build because Objective-C has no two-level namespace mechanism as c++. When a dynamic library is loaded with the same Objective-C class names then the last dynamic lib is using the class from the first dynamic lib.

We use ruby here, because we use this script also independently from cmake.

I hope this makes this clear,

I guess I understand why it would have to be different from plugin to plugin but I don’t understand why it would have to be from build to build:

  • I start Logic load my plugin… need to make some changes
  • I close Logic, rebuild my plugin, deploy my plugin in the same location with the same name
  • I reopen Logic, reload my plugin… why would Logic load an old one?

If you are trying to prevent the use case close/open, then I am not sure it is worth it… even with only C++ that never seems to work: if I build and deploy a VST plugin, I must close/reopen Maschine or Reason, in order for it to be reloaded since they only scan plugins when they open.

I think it is overkill to do it at every build and makes builds non reproducible since even if you don’t change a single line of code, you will have a different binary. I ended up changing for my own use to be the md5 of the main target of the project… That way it is different for every plugin but not build to build.

I understand that you use this script outside cmake so you can’t rely on cmake. But I think it is unfortunate to have to depend on ruby for doing such a simple task which can be accomplished with a simple shell script…

#!/usr/bin/env bash

if [ -z "$1" ]; then
  echo "Cannot resolve output directory"
  exit 1

NOW=`date "+%s"`
echo "#define SMTG_AU_NAMESPACE SMTGAUCocoa${NOW}_\n" > $1/aucocoaclassprefix.h


Hi Yan,
we have requirements here to have more than one version of a plugin to work in a host at the same time. So we absolutely make sure that at every build the Objective-C class names are different, to prevent issues in this area, which did cost us a few days in the past.