The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
6.8KB

  1. # Example Audio Plugin CMakeLists.txt
  2. # To get started on a new plugin, copy this entire folder (containing this file and C++ sources) to
  3. # a convenient location, and then start making modifications.
  4. # The first line of any CMake project should be a call to `cmake_minimum_required`, which checks
  5. # that the installed CMake will be able to understand the following CMakeLists, and ensures that
  6. # CMake's behaviour is compatible with the named version. This is a standard CMake command, so more
  7. # information can be found in the CMake docs.
  8. cmake_minimum_required(VERSION 3.15)
  9. # The top-level CMakeLists.txt file for a project must contain a literal, direct call to the
  10. # `project()` command. `project()` sets up some helpful variables that describe source/binary
  11. # directories, and the current project version. This is a standard CMake command.
  12. project(AUDIO_PLUGIN_EXAMPLE VERSION 0.0.1)
  13. # If you've installed JUCE somehow (via a package manager, or directly using the CMake install
  14. # target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
  15. # included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
  16. # include that subdirectory as part of the build.
  17. # find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system
  18. # or
  19. # add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE
  20. # If you are building a VST2 or AAX plugin, CMake needs to be told where to find these SDKs on your
  21. # system. This setup should be done before calling `juce_add_plugin`.
  22. # juce_set_vst2_sdk_path(...)
  23. # juce_set_aax_sdk_path(...)
  24. # `juce_add_plugin` adds a static library target with the name passed as the first argument
  25. # (AudioPluginExample here). This target is a normal CMake target, but has a lot of extra properties set
  26. # up by default. As well as this shared code static library, this function adds targets for each of
  27. # the formats specified by the FORMATS arguments. This function accepts many optional arguments.
  28. # Check the readme at `docs/CMake API.md` in the JUCE repo for the full list.
  29. juce_add_plugin(AudioPluginExample
  30. # VERSION ... # Set this if the plugin version is different to the project version
  31. # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone
  32. # ICON_SMALL ...
  33. # COMPANY_NAME ... # Specify the name of the plugin's author
  34. # IS_SYNTH TRUE/FALSE # Is this a synth or an effect?
  35. # NEEDS_MIDI_INPUT TRUE/FALSE # Does the plugin need midi input?
  36. # NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output?
  37. # IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect?
  38. # EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus?
  39. # COPY_PLUGIN_AFTER_BUILD TRUE/FALSE # Should the plugin be installed to a default location after building?
  40. PLUGIN_MANUFACTURER_CODE Juce # A four-character manufacturer id with at least one upper-case character
  41. PLUGIN_CODE Dem0 # A unique four-character plugin id with exactly one upper-case character
  42. # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case
  43. FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3
  44. PRODUCT_NAME "Audio Plugin Example") # The name of the final executable, which can differ from the target name
  45. # `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated
  46. # into your build tree. This should be included with `#include <JuceHeader.h>`. The include path for
  47. # this header will be automatically added to the target. The main function of the JuceHeader is to
  48. # include all your JUCE module headers; if you're happy to include module headers directly, you
  49. # probably don't need to call this.
  50. # juce_generate_juce_header(AudioPluginExample)
  51. # `target_sources` adds source files to a target. We pass the target that needs the sources as the
  52. # first argument, then a visibility parameter for the sources which should normally be PRIVATE.
  53. # Finally, we supply a list of source files that will be built into the target. This is a standard
  54. # CMake command.
  55. target_sources(AudioPluginExample
  56. PRIVATE
  57. PluginEditor.cpp
  58. PluginProcessor.cpp)
  59. # `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
  60. # project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
  61. # of compile definitions to switch certain features on/off, so if there's a particular feature you
  62. # need that's not on by default, check the module header for the correct flag to set here. These
  63. # definitions will be visible both to your code, and also the JUCE module code, so for new
  64. # definitions, pick unique names that are unlikely to collide! This is a standard CMake command.
  65. target_compile_definitions(AudioPluginExample
  66. PUBLIC
  67. # JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
  68. JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
  69. JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
  70. JUCE_VST3_CAN_REPLACE_VST2=0)
  71. # If your target needs extra binary assets, you can add them here. The first argument is the name of
  72. # a new static library target that will include all the binary resources. There is an optional
  73. # `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally,
  74. # the SOURCES argument should be followed by a list of source files that should be built into the
  75. # static library. These source files can be of any kind (wav data, images, fonts, icons etc.).
  76. # Conversion to binary-data will happen when your target is built.
  77. # juce_add_binary_data(AudioPluginData SOURCES ...)
  78. # `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here,
  79. # we're linking our executable target to the `juce::juce_audio_utils` module. Inter-module
  80. # dependencies are resolved automatically, so `juce_core`, `juce_events` and so on will also be
  81. # linked automatically. If we'd generated a binary data target above, we would need to link to it
  82. # here too. This is a standard CMake command.
  83. target_link_libraries(AudioPluginExample
  84. PRIVATE
  85. # AudioPluginData # If we'd created a binary data target, we'd link to it here
  86. juce::juce_audio_utils
  87. PUBLIC
  88. juce::juce_recommended_config_flags
  89. juce::juce_recommended_lto_flags
  90. juce::juce_recommended_warning_flags)