Hey,
here is a roadmap to add CMake support for HISE. I don't plan to change the user or developer workflow for others. All changes can exist parallel to the normal "Projucer" workflow. Main reason for the support is to run static analysis tools on the project. CMake can create compile_commands.json
files which can be read by other tools.
I've already done most of the work. The two commits are listed below. See Roadmap. What do you guys think?
Why
Here is a short overview why CMake makes sense:
- Faster builds
- Ninja (Sometime 2/3x, when compared to running MSVC or Xcode from the commandline)
- ccache (Super fast rebuilds, if not many files changed)
- ClangCL/clang on Windows
- IDE Support
- VSCode
- CLion
- Visual Studio (Open Folder)
- Export
compile-commands.json
- Used with static analyzers (clang-tidy and friends)
- Multiple build configurations without changing a file
- Coverage, Sanitizer, Benchmarks, ...
- Package managment (conan/vcpkg/find_package/add_subdirectory)
- faust, kissfft, mir, rlottie, zstd, ...
- This is not realistic anytime soon
- Build each
hi_*
JUCE module in isolation- This will help find/cleanup cycles within the modules
Roadmap
- 10c42ec Update JUCE CMake files, they are not on 6.1.3 currently.
cp JUCE-6.1.3/CMakeLists.txt HISE/JUCE
cp -r JUCE-6.1.3/extras/Build HISE/JUCE/extras/Build
- 0ffc6b8 / c58672a Add
CMakeLists.txt
that can buildprojects/standalone
- Add empty
AppConfig.h
(not needed with CMake builds)
- Add empty
- That's it
Wishlist
Change include style for JUCE module
includes. This change can already be done, without changing any Projucer build settings, because the parent directory of each JUCE modules
is added to the compiler include paths. So the HISE/JUCE/modules
directory in this case.
It would enable to switch the JUCE root directory, if for example one is working on upgrading JUCE, the two directories could co-exist. Not possible currently.
// Convert from
#include "../JUCE/modules/juce_core/juce_core.h"
// to
#include "juce_core/juce_core.h"
// Same here, from
#include "../hi_lac/hi_lac.h"
// to
#include "hi_lac/hi_lac.h"
clang-tidy
Sample output from a clang-tidy run with performance-for-range-copy
check enabled. Found 40 issues.
- performance-for-range-copy (40)
/home/user/HISE/hi_backend/snex_workbench/WorkbenchProcessor.h:321:13: error: loop variable
is copied but only used as const reference; consider making it a const reference
[performance-for-range-copy,-warnings-as-errors]
for (auto f : filesToTest)
^
const &
Try it
git clone -b basic-cmake-support https://github.com/tobiashienzsch/HISE.git HISE-CMake
cd HISE-CMake
# If you have ninja installed
cmake -S . -B build -G "Ninja Multi-Config"
cmake --build build --config Release
# If not, cmake will select VisualStudio/Xcode
cmake -S . -B build
cmake --build build --config Release