refaci.blogg.se

Cmake tutorial
Cmake tutorial











cmake tutorial
  1. Cmake tutorial install#
  2. Cmake tutorial full#

So, for example the CMake command target_link_libraries will link a library (such as a testing framework like Catch2) to your plugin target. Modern CMake loosely refers to CMake being not quite as shitty to work with any more (vs. The Toolchain is your complier, debugger, and so on.

cmake tutorial

Your IDE might let you setup build configurations for each target. If you have a plugin, each plugin version (AU, VST3) is actually its own target. You might have your app target and then a test target. They might have dependencies on each other. These can be configured and built discretely. Or your testing library like Google Test or Catch2.Ī Target is an executable or library that gets configured and compiled. It could be a juce module or some cool library you found on github. Ok, so let’s define a few things you’ll need to know.Ī Library is a chunk of code. The documentation often assumes you know the basics (what “configuration” means, what a “target” is, etc.) Some Jargon In my opinion, this is the reason CMake has the (deserved) reputation for being “hard”: a lot of complexity results from all the implicit coupling between these different concerns.ĬMake also builds on an long historical foundation of Makefiles, etc. You’ll just have to get used to what flags you should be passing, it’s not too tough! The CLI commands you’ll issue on the command line are also all mashed together in one tool. Instead, it’s all mashed together in one big happy festival of configuration directives.

cmake tutorial

Unfortunately, these discrete jobs are not separated in CMake’s config. So, CMake seems to do a lot of different jobs. You might also see CMakeList.txt files in sub directories and oh boy then things start to get really complicated. This makes it really useful for running on the command line in CI environments.Īll of these things are configured by a CMakeLists.txt file that sits in the root directory. It also configures and builds executables. So one main thing CMake does is exports “build tool files.” What role does CMake play?ĬMake is the “glue” that lets you configure and build your JUCE project for multiple platforms.īefore the CMake integration was announced the only way to do this was via JUCE’s custom app, the Projucer. You can also out Pamplejuce, a GitHub template I made for JUCE + CMake + Catch2 + GitHub actions. I’ll explain what I can here in hopes it’ll help future plugin devs. You don’t need to be an expert, but it’s worth knowing the basics. However it’s a very useful tool to get up to speed on.

Cmake tutorial full#

Plus the ecosystem is full of jargon, naming disasters, legacy cruft… I wasn’t totally clear on a few high level concepts at first. That covers the basic use case, but for more info, see the Conan docs.CMake took me a bit of wrestling ( especially on Xcode). or make to build your program using the generated Makefile in the build directory.

cmake tutorial

Run the build system, cmake, passing the directory containing your CMakeLists.txt, to create the Makefile. if your conanfile.txt is in the parent directory.

Cmake tutorial install#

To download and install dependencies and generate the conanbuildinfo.cmake used by CMakeLists.txt.įor example, run conan install. Run conan install, passing the directory where your conanfile.txt is, If you would like to learn more about using CMake, see the CMake tutorial.Ĭreate a build directory with mkdir build, and cd build. Note that I will be using $variable syntax to show what you'll need to replace.Īlso note that $) # Specifies what libraries to link, using Conan.Ībove is the bare minimum for a CMakeLists.txt file. ConanĬonan installs dependencies listed in a conanfile.txt,Īnd also prepares the build system to link with the dependencies. Of course, developers may use another build system (which might not require Make),īut for this tutorial, we'll focus on CMake. It can be tedious to write Makefiles, so developers use CMake to automatically create one from a CMakeLists.txt. CMakeĬMake is a build system, among other things. You only need to understand its purpose in relation to CMake. Make runs commands defined in a Makefile,įor example, to build and install programs with the compiler and linker.įor our purposes, we won't worry about what this looks like Package Management in C++ with Conan for BeginnersĬ++ package management can be complicated.













Cmake tutorial