Add the tracktion_engine module automatically via CMake

Hi,
I’m currently setting up a new repo including a CMake environment based loosely on Eyal Amir’s CMake repo prototype.
I’m currently using his implementation of the update_from_git function to get JUCE from its repo and add the dependencies to the project within the IDE to make it a ‘clone and go’ kind of thing, since I’m working on different machines from time to time and my partner has to as well.

Now we need the tracktion engine for some of our functionalities and I would like to get this module from git just like we do with JUCE to keep the modularity.
So here’s my question:
Is there an elegant way to get (just) the tracktion_engine module from its git repo and add it to the (fetched from git via Cmake’s FetchContent) Juce/modules folder using CMake?

I know that the tracktion repo contains a JUCE submodule, but said submodule does not contain any CMakeLists.txt (it’s probably not the newest JUCE branch) and as mentioned above I want to have it build automatically. And even if I would just take the whole tracktion repo: I am not sure if I really should use the tracktion repo as a supply for the actual JUCE framework, rather than just the tracktion_engine module.

Thanks in advance for your advice!

1 Like

You need dev-branch of both. tracktion engine and juce6.

Here is my CMakeLists.txt

cmake_minimum_required(VERSION 3.12)
project(MyProj)

#adding my own custom git functions, to save some boilerplate::
include (CMake/GitFunctions.cmake)

#calling my custom function to grab JUCE 6 from git:
update_from_git(juce "https://github.com/juce-framework/juce" juce6)
update_from_git(tracktion_engine "https://github.com/Tracktion/tracktion_engine.git" develop)

#set any of these to "ON" if you want to build one of the juce examples
#or extras (Projucer/AudioPluginHost, etc):
option(JUCE_BUILD_EXTRAS "Build JUCE Examples" OFF)
option(JUCE_BUILD_EXAMPLES "Build JUCE Extras" OFF)

#adding juce as a subdirectory:
add_subdirectory(${juce_SOURCE_DIR})

juce_add_modules(${tracktion_engine_SOURCE_DIR}/modules/tracktion_engine)
juce_add_modules(${tracktion_engine_SOURCE_DIR}/modules/tracktion_graph)

#adding project folders:
add_subdirectory(App)
2 Likes

That definitely helped. Thanks!