/JUCE.cmake

Build your JUCE projects using CMake instead of the Projucer

Primary LanguageCMakeGNU General Public License v3.0GPL-3.0

Build status Build Status

JUCE.cmake

JUCE.cmake is a collection of tools dedicated to building JUCE projects using CMake instead of the Projucer.

It currently contains:

  • Reprojucer.cmake, a CMake module that provides high-level functions to reproduce how a JUCE project is defined in the Projucer,

  • Jucer2Reprojucer, a console application based on JUCE that converts .jucer project files into CMakeLists.txt files that include and use Reprojucer.cmake,

  • several CMakeLists.txt files to build JUCE's examples and extras projects (in Jucer2Reprojucer/generated/JUCE).

Requirements

  • CMake, version 3.4 minimum
  • JUCE, version 4.2.0 to 4.3.1 (JUCE 5 is not supported yet)

Getting started

Let's consider that you have a copy of JUCE, a copy of JUCE.cmake and a JUCE project called MyGreatProject following this folder structure:

    <root>
    ├── JUCE/
    ├── JUCE.cmake/
    └── MyGreatProject/
        ├── Source/
        └── MyGreatProject.jucer

We first build Jucer2Reprojucer with CMake. Since Jucer2Reprojucer uses the JUCE modules juce_core, juce_data_structures and juce_events, we specify where to find JUCE by defining JUCE_ROOT when calling cmake.

cd <root>/JUCE.cmake/Jucer2Reprojucer

mkdir build && cd build

# On macOS
cmake .. -G Xcode -DJUCE_ROOT=../../../JUCE
# On Linux and on Windows
cmake .. -DJUCE_ROOT=../../../JUCE

cmake --build .

Then we convert MyGreatProject.jucer to a new CMakeLists.txt file:

cd <root>/MyGreatProject

# On macOs and on Windows
../JUCE.cmake/Jucer2Reprojucer/build/Debug/Jucer2Reprojucer MyGreatProject.jucer ../JUCE.cmake/cmake/Reprojucer.cmake
# On Linux
../JUCE.cmake/Jucer2Reprojucer/build/Jucer2Reprojucer MyGreatProject.jucer ../JUCE.cmake/cmake/Reprojucer.cmake

Now we can build MyGreatProject using CMake:

cd <root>/MyGreatProject

mkdir build && cd build

# On macOs
cmake .. -G Xcode -DMyGreatProject_jucer_FILE=../MyGreatProject.jucer
# On Linux and on Windows
cmake .. -DMyGreatProject_jucer_FILE=../MyGreatProject.jucer

cmake --build .

License

JUCE.cmake is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

JUCE.cmake is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details.