Build VCVRack with Conan and CMake + add CI

Hello,

I like VCVRack and because of beeing also a software developer, I once looked into the sources to see what is going on under the hood.
But somehow I didn’t like the provided build setup/instructions and therefore I never built VCVRack this way.
I was aware of the Conan C/C++ Package Manager and intended for some time to adopt Conan for C++ development.
So I was thinking to give it a try with VCVRack.

Now I want to present/discuss here the current state I have so far.

In case you don’t know Conan, I suggest to read the Get Started documentation
or watch the Conan Webinar(s).

As a short overview I have done so far the following steps:

  • determining the VCVRack build dependencies
  • searched for existing Conan packages and in case packages were missing I created and published these packages by myself
  • created conanfile.py recipe to manage dependencies for VCVRack
  • Translated build instructions from Makefiles into CMakeLists.txt to build VCVRack with CMake for
    • Linux (Gcc and Clang)
    • MacOS (Clang)
    • Windows (MinGW Gcc)
  • added Azure CI pipeline setup for automated building of VCVRack on Azure for Linux, MacOS and Windows with Conan and CMake
  • added Conan and CMake build + Azure CI setup for public available plugins

The work is based on the current v1 branch development.
I created a Pull Request in my own repository https://github.com/qno/Rack/pull/5 so you can take a look at the current state.

For now I don’t want to go into too much details, but it will have the following advantages:

  • No more messing up with dependencies handled via git submodules (they could just be removed)
  • No more Makefiles nedded anymore
  • No complicated setup of build environment anymore
  • CMake based build (so you can also generate a project for your favourite IDE)
  • No need to build VCVRack anymore before beeing able to build a Plugin
  • Faster builds, as prebuilt binary artifacts of dependencies will be downloaded (and cached) by Conan
  • Native Windows build with MSVC compiler should be possible (will requires some changes VCVRack code through use of platform abstraction), all dependencies can already be build with MSVC

So here is what you basically need to do:

  • Install Build Environment (Git, Cmake, Compiler) (for Windows no MinGW installation is required anymore :wink:).
  • Under Linux you also don’t need to install any required dependecies with the package manager anymore.
  • Install the Conan Package Manager for your development Platform.
  • Setup Conan repositories for retrieving artifacts:
    • conan remote add conan-community https://api.bintray.com/conan/conan-community/conan
    • conan remote add qno https://api.bintray.com/conan/qno/conan-public
    • conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
  • For Windows create a Conan MinGW profile under your USER directory in .conan\profiles, called e.g. mingw with the following content:
[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=8
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
build_type=Release
[options]
[build_requires]
mingw_installer/1.0@conan/stable
msys2_installer/latest@bincrafters/stable
[env]
  • If you are under Windows also add the following change under your USER directory to the .conan/conan.conf file to avoid trouble with spaces in path names:
[storage]
# This is the default path, but you can write your own. It must be an absolute path or a
# path beginning with "~" (if the environment var CONAN_USER_HOME is specified, this directory, even
# with "~/", will be relative to the conan user home, not to the system user home)
path = C:\.conan/data
  • Clone repository git clone https://github.com/qno/Rack.git and switch to feature branch git checkout feature/add_conan
  • Create a build directory and cd into it
  • Execute conan install ../Rack - under Windows please use conan install ..\Rack --profile mingw
  • Execute cmake -DCMAKE_BUILD_TYPE=Release ../Rack - under Windows please call activate_run.bat and cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..\Rack
  • Build VCVRack with cmake --build . -j

Thats it!
In case the Conan build fails - just add --build=missing to the conan command, as it is possible that prebuilt binary artifacts are missing.

These steps are also reflected in the CI pipeline setup, so you can take a look there.

To test and run the VCVRack executable run the Rack executable in the bin directory.

Still open points are:

  • add missing deploy steps for VCVRack inside Conan (package VCVRack, create installer packages etc.)
  • automated upload of Azure build artifacts (to github pages for nightly builds for example, etc.)
  • create some kind of Conan VCVRack SDK package to ease Plugin development (I have it already but yet not published)
  • improve Plugin building with Conan and CMake
  • native Windows build with MS Visual Studio Compiler

If someone is interested in the work, feel free to check out the branch to test it and give some feedback here.
But please keep in mind - it is still work in progress and I would really like to get some feedback about the current state.

Build the VCVRack Fundamental Plugin

As without Plugins you basically can’t do anything useful with VCVRack, here is what you need to do for now to build it.

Build the VCVRackSDK and publish it to your local Conan cache:

  • cd into the Rack source directory
  • Execute conan create . qno/testing - under Windows please use conan create . qno/testing --profile mingw

Build the Plugin:
Note - The CMAKE_INSTALL_PREFIX points here to the default Rack Plugin folder, so the Plugin is published during the build process.

  • Clone the Fundamental Plugin git clone https://github.com/VCVRack/Fundamental.git and switch to the feature/add_conan_cmake branch git checkout feature/add_conan_cmake
  • Create a build directory and cd into it
  • Execute conan install ../Fundamental - under Windows please use conan install ..\Fundamental --profile mingw
  • Execute CMake cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/.Rack/plugins-v1 ../Fundamental - under Windows please call activate_run.bat and cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="%HOMEPATH%\Documents\Rack\plugins-v1" ..\Fundamental
  • Build Fundamental Plugin cmake --build . -j --target install
  • run the Rack executable and select Plugins from the Plugin Manager

The following Plugins were also adapted, so you can build them exactly as the Fundamental Plugin (just replace in the above steps the name of the Plugin):

  • Befaco Plugin - https://github.com/qno/Befaco
  • ESeries Plugin - https://github.com/qno/ESeries
  • AudibleInstruments Plugin - https://github.com/qno/AudibleInstruments
  • HetrickCV Plugin - https://github.com/qno/hetrickcv
  • JW-Modules Plugin - https://github.com/qno/JW-Modules
  • Bacon Music Plugin - https://github.com/qno/BaconPlugs

They work under Windows and Linux, for MacOS I couldn’t build and test, as I don’t have a Mac.

Download Build artifacts from Github

For demonstration purpose I created a special Github repository which contains all uploaded Azure CI build artifacts (Rack and Plugins)

Rack and Plugin binaries can be downloaded from VCVRack-Release-Demo/releases and tested. The artifacts are updated automatically after CI builds.

This is how the UI issue looks like for me

probably you are building against an obsolete Rack code v1
do a git pull and rebuild Rack

No, sources and dependencies are up-to-date.

Hm, OK - I just realised that a modified fork of oui-blendish is used. I’ll try to use the fork as dependency and create a Conan package for this.

But using this fork doesn’t fix anything in UI.

I have updated the first post and added more information.

Now I figured out the cause of the UI issue. Somehow the Font for the Scope Plugin res/sudo/Sudo.ttf got corrupted on my machine. Now everything works perfect.

After improving the CMake build configuration, I have updated the first post again.
All changes are now published to the Github repositories, so the manual steps aren’t necessary anymore.
I also adapted the build process for the Befaco, ESeries and AudibleInstruments Plugins.

I added the HetrickCV Plugin.

I added JW-Modules and Bacon Music Plugins.

After further improvements and fixes, I updated the first post with information about downloading CI build artifacts from VCVRack-Release-Demo/releases.

1 Like