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.

549 lines
28KB

  1. # The JUCE CMake API
  2. ## System Requirements
  3. - Console and GUI projects require CMake 3.12 or higher.
  4. - Plugin projects require CMake 3.15 or higher.
  5. - All iOS targets require CMake 3.14 or higher (3.15 or higher for plugins targeting iOS).
  6. - Android targets are not currently supported.
  7. Most system package managers have packages for CMake, but we recommend using the most recent release
  8. from https://cmake.org/download. You should always use a CMake that's newer than your build
  9. toolchain, so that CMake can identify your build tools and understand how to invoke them.
  10. In addition to CMake you'll need a build toolchain for your platform, such as Xcode or MSVC.
  11. ## Getting Started
  12. In this directory, you'll find example projects for a GUI app, a console app, and an audio plugin.
  13. You can simply copy one of these subdirectories out of the JUCE repo, add JUCE as a submodule, and
  14. uncomment the call to `add_subdirectory` where indicated in the CMakeLists.txt. Alternatively, if
  15. you've installed JUCE using a package manager or the CMake install target, you can uncomment the
  16. call to `find_package`.
  17. Once your project is set up, you can generate a build tree for it in the normal way. To get started,
  18. you might invoke CMake like this, from the new directory you created.
  19. cmake -Bbuild (-GgeneratorName) (-DJUCE_BUILD_EXTRAS=ON) (-DJUCE_BUILD_EXAMPLES=ON)
  20. This will create a build tree in a directory named 'build', using the CMakeLists in the current
  21. working directory, using the default generator (makefiles on mac/linux, and the most recent Visual
  22. Studio on Windows). You can choose a specific generator to use with the `-G` flag (call `cmake -G`
  23. to see a full list of generators on your platform). If you included JUCE as a subdirectory, you can
  24. enable the Extras and Examples targets by including the last two arguments (they're off by default).
  25. There's quite a lot of example projects, and generating project files might take a bit longer when
  26. these options are on, so you probably won't want to include them most of the time.
  27. Then, to build the project:
  28. cmake --build build (--target targetNameFromCMakeLists) (--config Release/Debug/...)
  29. This tells cmake to build the target named `targetNameFromCMakeLists`, in the specified
  30. configuration, using the appropriate tool. Of course, if you generated makefiles or ninja files, you
  31. could call `make` or `ninja` in the build directory. If you generated an IDE project, like an Xcode
  32. or Visual Studio project, then you could open the generated project in your IDE.
  33. ### Building for iOS
  34. To build for iOS, you'll need CMake 3.14 or higher. Using the Xcode generator is highly recommended,
  35. as other generators may not automatically find the correct SDK for the iPhone simulator, and may
  36. fail to run certain parts of the build, such as compiling icons and processing the app's plist. By
  37. default, CMake will build for the same system that originally configured the project, so to enable
  38. cross-compilation for iOS, a few extra flags must be passed to the initial CMake invocation:
  39. cmake -Bbuild-ios -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3
  40. Here we create a build tree in the directory named 'build-ios', using the Xcode generator. The
  41. `-DCMAKE_SYSTEM_NAME=iOS` option tells CMake to enable cross-compiling for iOS. The
  42. `-DCMAKE_OSX_DEPLOYMENT_TARGET=9.3` option sets the minimum deployment target (it applies to iOS
  43. despite the 'OSX' in the variable name!).
  44. Once the project has generated, we can open it as normal in Xcode (look for the project file in the
  45. build directory). Alternatively, to build from the command-line, we could run this command:
  46. cmake --build build-ios --target <targetName> -- -sdk iphonesimulator
  47. Here, we're building the target named `<targetName>` from the build tree in the directory
  48. `build-ios`. All the arguments after `--` are ignored by CMake, and are passed through to the
  49. underlying build tool. In this case, the build tool will be `xcodebuild` because we used the Xcode
  50. generator above. We tell xcodebuild that we're building the app for the iOS simulator, which doesn't
  51. require special code signing.
  52. If we wanted to build for a real device, we would need to pass some extra signing details to the
  53. initial CMake configuration command:
  54. cmake -Bbuild-ios -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_DEPLOYMENT_TARGET=9.3 \
  55. -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY="iPhone Developer"
  56. -DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=<10 character id>
  57. The `CODE_SIGN_IDENTITY` is the kind of certificate you want to use (iPhone Developer is appropriate
  58. for development) and `DEVELOPMENT_TEAM` is the 10-character ID that can be found by opening the
  59. Keychain Access app, finding your development certificate, and checking its 'Organizational Unit'
  60. info field.
  61. When building the target, you may also need to tell Xcode that it can automatically update
  62. provisioning profiles, which is achieved by passing the `-allowProvisioningUpdates` flag:
  63. cmake --build build-ios --target <targetName> -- -allowProvisioningUpdates
  64. ### A note about compile definitions
  65. Module options and plugin options that would previously have been set in the Projucer can be set on
  66. a target-by-target basis in CMake, via `target_compile_definitions`. To find the options exposed by
  67. a particular module, check its module header for sections with the following structure:
  68. /** Config: NAME_OF_KEY
  69. Docs go here...
  70. */
  71. #ifndef NAME_OF_KEY
  72. #define NAME_OF_KEY ...
  73. #endif
  74. To override the default config option, use the following CMake code, replacing `<value>` as
  75. appropriate:
  76. target_compile_definitions(my_target PUBLIC NAME_OF_KEY=<value>)
  77. The `JucePlugin_PreferredChannelConfig` preprocessor definition for plugins is difficult to specify
  78. in a portable way due to its use of curly braces, which may be misinterpreted in Linux/Mac builds
  79. using the Ninja/Makefile generators. It is recommended to avoid this option altogether, and to use
  80. the newer buses API to specify the desired plugin inputs and outputs.
  81. ## API Reference
  82. ### `juce_add_<target>`
  83. juce_add_gui_app(<target> [KEY value]...)
  84. juce_add_console_app(<target> [KEY value]...)
  85. juce_add_plugin(<target> [KEY value]...)
  86. `juce_add_gui_app` and `juce_add_console_app` add an executable target with name `<target>`.
  87. `juce_add_plugin` adds a 'shared code' static library target with name `<target>`, along with extra
  88. targets for each of the specified plugin formats. Each of these functions also takes a number of
  89. optional arguments in the form of a `KEY` followed by one or more `value`s which can be used to set
  90. additional attributes of the target. If these optional arguments aren't specified, their values will
  91. fall back to sensible defaults.
  92. Each of these arguments adds a property to the resulting target in the form `JUCE_paramName`, where
  93. `paramName` is one of the parameter keys below. For example, after a call to
  94. `juce_add_gui_app(my_target PRODUCT_NAME "Target")`, the target `my_target` will have a property
  95. named `JUCE_PRODUCT_NAME` with the value `"Target"`. After creating a target with one of these
  96. commands, properties beginning with `JUCE_` can be _queried_, but changing their values might not
  97. have any effect (or might even break things in unexpected ways!), so always pass JUCE target
  98. attributes directly to these creation functions, rather than adding them later.
  99. - `PRODUCT_NAME`
  100. - The name of the output built by this target, similar to CMake's `OUTPUT_NAME` property. If not
  101. specified, this will default to the target name.
  102. - `VERSION`
  103. - A version number string in the format "major.minor.bugfix". If not specified, the `VERSION` of
  104. the project containing the target will be used instead.
  105. - `BUNDLE_ID`
  106. - An identifier string in the form "com.yourcompany.productname" which should uniquely identify
  107. this target. Mainly used for macOS builds. If not specified, a default will be generated using
  108. the target's `COMPANY_NAME` and `PRODUCT_NAME`.
  109. - `MICROPHONE_PERMISSION_ENABLED`
  110. - May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist.
  111. - `MICROPHONE_PERMISSION_TEXT`
  112. - The text your app will display when it requests microphone permissions.
  113. - `CAMERA_PERMISSION_ENABLED`
  114. - May be either TRUE or FALSE. Adds the appropriate entries to an app's Info.plist.
  115. - `CAMERA_PERMISSION_TEXT`
  116. - The text your app will display when it requests camera permissions.
  117. - `BLUETOOTH_PERMISSION_ENABLED`
  118. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist.
  119. - `BLUETOOTH_PERMISSION_TEXT`
  120. - The text your iOS app will display when it requests bluetooth permissions.
  121. - `SEND_APPLE_EVENTS_PERMISSION_ENABLED`
  122. - May be either TRUE or FALSE. Enable this to allow your app to send Apple events.
  123. - `SEND_APPLE_EVENTS_PERMISSION_TEXT`
  124. - The text your app will display when it requests permission to send Apple events.
  125. - `FILE_SHARING_ENABLED`
  126. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist.
  127. - `DOCUMENT_BROWSER_ENABLED`
  128. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist.
  129. - `STATUS_BAR_HIDDEN`
  130. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist.
  131. - `BACKGROUND_AUDIO_ENABLED`
  132. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist.
  133. - `BACKGROUND_BLE_ENABLED`
  134. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's Info.plist.
  135. - `APP_GROUPS_ENABLED`
  136. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's entitlements.
  137. - `APP_GROUP_IDS`
  138. - The app groups to which your iOS app belongs. These will be added to your app's entitlements.
  139. - `ICLOUD_PERMISSIONS_ENABLED`
  140. - May be either TRUE or FALSE. Adds the appropriate entries to an iOS app's entitlements.
  141. - `IPHONE_SCREEN_ORIENTATIONS`
  142. - May be one or more of `UIInterfaceOrientationUnknown`, `UIInterfaceOrientationPortrait`,
  143. `UIInterfaceOrientationPortraitUpsideDown`, `UIInterfaceOrientationLandscapeLeft`, or
  144. `UIInterfaceOrientationLandscapeRight`. Adds appropriate entries to an iOS app's plist.
  145. - `IPAD_SCREEN_ORIENTATIONS`
  146. - May be one or more of `UIInterfaceOrientationUnknown`, `UIInterfaceOrientationPortrait`,
  147. `UIInterfaceOrientationPortraitUpsideDown`, `UIInterfaceOrientationLandscapeLeft`, or
  148. `UIInterfaceOrientationLandscapeRight`. Adds appropriate entries to an iOS app's plist.
  149. - `LAUNCH_STORYBOARD_FILE`
  150. - A custom launch storyboard file to use on iOS. If not supplied, a default storyboard will be
  151. used.
  152. - `CUSTOM_XCASSETS_FOLDER`
  153. - A path to an xcassets directory, containing icons and/or launch images for this target. If this
  154. is specified, the ICON_BIG and ICON_SMALL arguments will not have an effect on iOS, and a launch
  155. storyboard will not be used.
  156. - `ICON_BIG`, `ICON_SMALL`
  157. - Paths to image files that will be used to generate app icons. If only one of these parameters
  158. is specified, then that image will be used for all icon resolutions. If both arguments are
  159. specified, then the appropriate image will be picked for each icon resolution.
  160. - `COMPANY_COPYRIGHT`
  161. - Copyright text which will be added to the app/plugin's Info.plist. The value of this argument
  162. will be inherited from the `JUCE_COMPANY_COPYRIGHT` property, so if you want to use the same
  163. `COMPANY_COPYRIGHT` for several targets in a build tree, you can call
  164. `set_directory_properties(PROPERTIES JUCE_COMPANY_COPYRIGHT ...)` after including JUCE but
  165. before adding the targets, and then omit the `COMPANY_COPYRIGHT` argument when creating the
  166. individual targets.
  167. - `COMPANY_NAME`
  168. - The name of this target's author. Will be added to the app/plugin's Info.plist, and may be used
  169. to generate part of the `BUNDLE_ID` if no ID was given explicitly. The value of this argument
  170. will be inherited from the `JUCE_COMPANY_NAME` property, so if you want to use the same
  171. `COMPANY_NAME` for several targets in a build tree, you can call
  172. `set_directory_properties(PROPERTIES JUCE_COMPANY_NAME ...)` after including JUCE but before
  173. adding the targets, and then omit the `COMPANY_NAME` argument when creating the individual
  174. targets.
  175. - `COMPANY_WEBSITE`
  176. - The address of a website related to this target in some way. The value of this argument will be
  177. inherited from the `JUCE_COMPANY_WEBSITE` property, so if you want to use the same
  178. `COMPANY_WEBSITE` for several targets in a build tree, you can call
  179. `set_directory_properties(PROPERTIES JUCE_COMPANY_WEBSITE ...)` after including JUCE but before
  180. adding the targets, and then omit the `COMPANY_WEBSITE` argument when creating the individual
  181. targets.
  182. - `COMPANY_EMAIL`
  183. - An email address for this target's author. The value of this argument will be inherited from the
  184. `JUCE_COMPANY_EMAIL` property, so if you want to use the same `COMPANY_EMAIL` for several
  185. targets in a build tree, you can call `set_directory_properties(PROPERTIES JUCE_COMPANY_EMAIL
  186. ...)` after including JUCE but before adding the targets, and then omit the `COMPANY_EMAIL`
  187. argument when creating the individual targets.
  188. - `DOCUMENT_EXTENSIONS`
  189. - File extensions that should be associated with this target. For example, the Projucer passes
  190. the string `jucer` because it wants to open `.jucer` files. If your target has several different
  191. document types, you can pass them as multiple arguments, e.g. `DOCUMENT_EXTENSIONS wav mp3 aif`.
  192. - `NEEDS_CURL`
  193. - On Linux, JUCE may or may not need to link to Curl depending on the compile definitions that are
  194. set on a JUCE target. By default, we don't link Curl because you might not need it, but if you
  195. get linker or include errors that reference Curl, just set this argument to `TRUE`.
  196. - `NEEDS_WEB_BROWSER`
  197. - On Linux, JUCE may or may not need to link to Webkit depending on the compile definitions that
  198. are set on a JUCE target. By default, we don't link Webkit because you might not need it, but
  199. if you get linker or include errors that reference Webkit, just set this argument to `TRUE`.
  200. - `NEEDS_STORE_KIT`
  201. - On macOS, JUCE may or may not need to link to StoreKit depending on the compile definitions that
  202. are set on a JUCE target. By default, we don't link StoreKit because you might not need it, but
  203. if you get linker or include errors that reference StoreKit, just set this argument to `TRUE`.
  204. - `PUSH_NOTIFICATIONS_ENABLED`
  205. - Sets app entitlements to allow push notifications. False by default.
  206. - `HARDENED_RUNTIME_ENABLED`
  207. - Enables macOS' hardened runtime for this target. Required for notarisation. False by default.
  208. - `HARDENED_RUNTIME_OPTIONS`
  209. - A set of space-separated entitlement keys that will be added to this target's entitlements
  210. plist if `HARDENED_RUNTIME_ENABLED` is `TRUE`. Each key should be in the form
  211. `com.apple.security.*` where `*` is a specific entitlement.
  212. - `APP_SANDBOX_ENABLED`
  213. - Enables macOS' app sandbox for this target. False by default.
  214. - `APP_SANDBOX_INHERIT`
  215. - Allows child processes to inherit the static entitlements of their parent process. If this
  216. is set to `TRUE`, no other app sandbox entitlements will be set on this target.
  217. - `APP_SANDBOX_OPTIONS`
  218. - A set of space-separated entitlement keys that will be added to this target's entitlements
  219. plist if `APP_SANDBOX_ENABLED` is `TRUE`. Each key should be in the form `com.apple.security.*`
  220. where `*` is a specific entitlement.
  221. - `PLIST_TO_MERGE`
  222. - A string to insert into an app/plugin's Info.plist.
  223. - `FORMATS`
  224. - For plugin targets, specifies the plugin targets to build. Should be provided as a
  225. space-separated list. Valid values are `Standalone Unity VST3 AU AUv3 AAX VST`. `AU` and `AUv3`
  226. plugins will only be enabled when building on macOS. It is an error to pass `AAX` or `VST`
  227. without first calling `juce_set_aax_sdk_path` or `juce_set_vst2_sdk_path` respectively.
  228. - `PLUGIN_MANUFACTURER_CODE`
  229. - A four-character unique ID for your company. For AU compatibility, this must contain at least
  230. one upper-case letter.
  231. - `PLUGIN_CODE`
  232. - A four-character unique ID for your plugin. For AU compatibility, this must contain at least
  233. one upper-case letter.
  234. - `DESCRIPTION`
  235. - A short description of your plugin.
  236. - `IS_SYNTH`
  237. - Whether the plugin is a synth. Will be used to set sensible plugin category values if they
  238. are not provided explicitly.
  239. - `NEEDS_MIDI_INPUT`
  240. - Whether the plugin should provide a midi input.
  241. - `NEEDS_MIDI_OUTPUT`
  242. - Whether the plugin should provide a midi output.
  243. - `IS_MIDI_EFFECT`
  244. - Whether the plugin is a MIDI effect (some hosts provide a special channel-strip location for
  245. MIDI effect plugins).
  246. - `EDITOR_WANTS_KEYBOARD_FOCUS`
  247. - Whether the plugin requires keyboard focus, or should defer all keyboard handling to the host.
  248. - `DISABLE_AAX_BYPASS`
  249. - Whether the AAX bypass function should be disabled.
  250. - `DISABLE_AAX_MULTI_MONO`
  251. - Whether the AAX multi mono bus layout should be disabled.
  252. - `AAX_IDENTIFIER`
  253. - The bundle ID for the AAX plugin target. Matches the `BUNDLE_ID` by default.
  254. - `VST_NUM_MIDI_INS`
  255. - For VST2 and VST3 plugins that accept midi, this allows you to configure the number of inputs.
  256. - `VST_NUM_MIDI_OUTS`
  257. - For VST2 and VST3 plugins that produce midi, this allows you to configure the number of outputs.
  258. - `VST2_CATEGORY`
  259. - Should be one of: `kPlugCategUnknown`, `kPlugCategEffect`, `kPlugCategSynth`,
  260. `kPlugCategAnalysis`, `kPlugCategMatering`, `kPlugCategSpacializer`, `kPlugCategRoomFx`,
  261. `kPlugSurroundFx`, `kPlugCategRestoration`, `kPlugCategOfflineProcess`, `kPlugCategShell`,
  262. `kPlugCategGenerator`.
  263. - `VST3_CATEGORIES`
  264. - Should be one or more, separated by spaces, of the following: `Fx`, `Instrument`, `Analyzer`,
  265. `Delay`, `Distortion`, `Drum`, `Dynamics`, `EQ`, `External`, `Filter`, `Generator`, `Mastering`,
  266. `Modulation`, `Mono`, `Network`, `NoOfflineProcess`, `OnlyOfflineProcess`, `OnlyRT`,
  267. `Pitch Shift`, `Restoration`, `Reverb`, `Sampler`, `Spatial`, `Stereo`, `Surround`, `Synth`,
  268. `Tools`, `Up-Downmix`
  269. - `AU_MAIN_TYPE`
  270. - Should be one of: `kAudioUnitType_Effect`, `kAudioUnitType_FormatConverter`,
  271. `kAudioUnitType_Generator`, `kAudioUnitType_MIDIProcessor`, `kAudioUnitType_Mixer`,
  272. `kAudioUnitType_MusicDevice`, `kAudioUnitType_MusicEffect`, `kAudioUnitType_OfflineEffect`,
  273. `kAudioUnitType_Output`, `kAudioUnitType_Panner`
  274. - `AU_EXPORT_PREFIX`
  275. - A prefix for the names of entry-point functions that your component exposes. Typically this
  276. will be a version of your plugin's name that can be used as part of a C++ token. Defaults
  277. to your plugin's name with the suffix 'AU'.
  278. - `AU_SANDBOX_SAFE`
  279. - May be either TRUE or FALSE. Adds the appropriate entries to an AU plugin's Info.plist.
  280. - `AAX_CATEGORY`
  281. - Should be one of: `AAX_ePlugInCategory_None`, `AAX_ePlugInCategory_EQ`,
  282. `AAX_ePlugInCategory_Dynamics`, `AAX_ePlugInCategory_PitchShift`, `AAX_ePlugInCategory_Reverb`,
  283. `AAX_ePlugInCategory_Delay`, `AAX_ePlugInCategory_Modulation`, `AAX_ePlugInCategory_Harmonic`,
  284. `AAX_ePlugInCategory_NoiseReduction`, `AAX_ePlugInCategory_Dither`,
  285. `AAX_ePlugInCategory_SoundField`, `AAX_ePlugInCategory_HWGenerators`,
  286. `AAX_ePlugInCategory_SWGenerators`, `AAX_ePlugInCategory_WrappedPlugin`,
  287. `AAX_ePlugInCategory_Effect`
  288. - `PLUGINHOST_AU`
  289. - May be either TRUE or FALSE (defaults to FALSE). If TRUE, will add the preprocessor definition
  290. `JUCE_PLUGINHOST_AU=1` to the new target, and will link the macOS frameworks necessary for
  291. hosting plugins. Using this parameter should be preferred over using
  292. `target_compile_definitions` to manually set the `JUCE_PLUGINHOST_AU` preprocessor definition.
  293. - `COPY_PLUGIN_AFTER_BUILD`
  294. - Whether or not to install the plugin to the current system after building. False by default.
  295. If you want all of the plugins in a subdirectory to be installed automatically after building,
  296. you can set the property `JUCE_COPY_PLUGIN_AFTER_BUILD` on the directory before adding the
  297. plugins, rather than setting this argument on each individual target. Note that on Windows,
  298. the default install locations may not be writable by normal user accounts.
  299. - `VST_COPY_DIR`
  300. - The location to which VST2 (legacy) plugins will be copied after building if
  301. `COPY_PLUGIN_AFTER_BUILD` is set on this target. If you want to install all of the VST2 plugins
  302. in a subdirectory to a non-default location, you can set the `JUCE_VST_COPY_DIR` property on
  303. the directory before adding the plugin targets, rather than setting this argument on each
  304. individual target.
  305. - `VST3_COPY_DIR`
  306. - The location to which VST3 plugins will be copied after building if `COPY_PLUGIN_AFTER_BUILD`
  307. is set on this target. If you want to install all of the VST3 plugins in a subdirectory to a
  308. non-default location, you can set the `JUCE_VST3_COPY_DIR` property on the directory before
  309. adding the plugin targets, rather than setting this argument on each individual target.
  310. - `AAX_COPY_DIR`
  311. - The location to which AAX plugins will be copied after building if `COPY_PLUGIN_AFTER_BUILD`
  312. is set on this target. If you want to install all of the AAX plugins in a subdirectory to a
  313. non-default location, you can set the `JUCE_AAX_COPY_DIR` property on the directory before
  314. adding the plugin targets, rather than setting this argument on each individual target.
  315. - `AU_COPY_DIR`
  316. - The location to which AU plugins will be copied after building if `COPY_PLUGIN_AFTER_BUILD`
  317. is set on this target. If you want to install all of the AU plugins in a subdirectory to a
  318. non-default location, you can set the `JUCE_AU_COPY_DIR` property on the directory before
  319. adding the plugin targets, rather than setting this argument on each individual target.
  320. - `UNITY_COPY_DIR`
  321. - The location to which Unity plugins will be copied after building if `COPY_PLUGIN_AFTER_BUILD`
  322. is set on this target. If you want to install all of the Unity plugins in a subdirectory to a
  323. non-default location, you can set the `JUCE_UNITY_COPY_DIR` property on the directory before
  324. adding the plugin targets, rather than setting this argument on each individual target.
  325. Unlike the other `COPY_DIR` arguments, this argument does not have a default value so be sure
  326. to set it if you have enabled `COPY_PLUGIN_AFTER_BUILD` and the `Unity` format.
  327. ### `juce_add_binary_data`
  328. juce_add_binary_data(<name>
  329. [HEADER_NAME ...]
  330. [NAMESPACE ...]
  331. SOURCES ...)
  332. Create a static library that embeds the contents of the files passed as arguments to this function.
  333. Adds a library target called `<name>` which can be linked into other targets using
  334. `target_link_libraries`.
  335. The `HEADER_NAME` argument is optional. If provided, the generated header will be given the
  336. requested name, otherwise the generated header will be named "BinaryData.h". In completely new
  337. projects, you should provide a unique name here, so that projects containing more than one binary
  338. data target are able to include the binary data headers without ambiguity.
  339. The `NAMESPACE` argument is also optional. If not provided, the generated files will use the default
  340. namespace `BinaryData`. Each of the files located at the paths following `SOURCES` will be encoded
  341. and embedded in the resulting static library. This library can be linked as normal using
  342. `target_link_libraries(<otherTarget> PRIVATE <name>)`, and the header can be included using
  343. `#include <BinaryData.h>`.
  344. ### `juce_add_bundle_resources_directory`
  345. juce_add_bundle_resources_directory(<target> <folder>)
  346. Copy the entire directory at the location `<folder>` into an Apple bundle's resource directory, i.e.
  347. the `Resources` directory for a macOS bundle, and the top-level directory of an iOS bundle.
  348. ### `juce_generate_juce_header`
  349. juce_generate_juce_header(<target>)
  350. Introspects the JUCE modules that have been linked to `<target>` and generates a `JuceHeader.h`
  351. which contains `#include` statements for each of the module headers. This header also contains an
  352. optional `using namespace juce` statement, and an optional `ProjectInfo` block, each of which can be
  353. disabled by setting the compile definitions `DONT_SET_USING_JUCE_NAMESPACE` and
  354. `JUCE_DONT_DECLARE_PROJECTINFO` respectively. The resulting header can be included with `#include
  355. <JuceHeader.h>`. In plain CMake projects which don't require Projucer compatibility, the use of
  356. JuceHeader.h is optional. Instead, module headers can be included directly in source files that
  357. require them.
  358. ### `juce_set_<kind>_sdk_path`
  359. juce_set_aax_sdk_path(<absolute path>)
  360. juce_set_vst2_sdk_path(<absolute path>)
  361. Call these functions from your CMakeLists to set up your local AAX and/or VST2 SDKs. These functions
  362. should be called *before* adding any targets that may depend on the AAX/VST2 SDKs (plugin
  363. hosts, VST2/AAX plugins etc.).
  364. ### `juce_add_module`
  365. juce_add_module(<path to module>)
  366. juce_add_modules(<names of module>...)
  367. `juce_add_module` adds a library target for the JUCE module located at the provided path. `<path>`
  368. must be the path to a module directory (e.g. /Users/me/JUCE/modules/juce_core). This will add an
  369. interface library with a name matching the directory name of the module. The resulting library can
  370. be linked to other targets as normal, using `target_link_libraries`.
  371. Due to the way that `INTERFACE` libraries work in CMake, linking to a module added in this way
  372. *must* be done using `PRIVATE` visibility. Using `PUBLIC` will cause the module sources to be added
  373. both to the target's `SOURCES` and `INTERFACE_SOURCES`, which may result in many copies of the
  374. module being built into a single target, which would cause build failures in the best case and
  375. silent ODR violations in the worst case. Scary stuff!
  376. This command has a few optional arguments: `INSTALL_PATH` is a path, relative to the install prefix,
  377. to which the module sources will be copied during installation of the module. ALIAS_NAMESPACE will
  378. add an alias for the module target(s) with the provided namespace. For example, the following
  379. invocation will add a module target named `my_module`, along with an alias named
  380. `company::my_module`. ``` juce_add_module(my_module ALIAS_NAMESPACE company)` ```
  381. `juce_add_modules` is a convenience function that can be used to add multiple JUCE modules at once.
  382. This version accepts many module paths, rather than just one. For an example of usage, see the
  383. CMakeLists in the `modules` directory.
  384. ### `juce_add_pip`
  385. juce_add_pip(<header>)
  386. This function parses the PIP metadata block in the provided header, and adds appropriate build
  387. targets for a console app, GUI app, or audio plugin. For audio plugin targets, it builds as many
  388. plugin formats as possible. To build AAX or VST2 targets, call `juce_set_aax_sdk_path` and/or
  389. `juce_set_vst2_sdk_path` *before* calling `juce_add_pip`.
  390. This is mainly provided to build the built-in example projects in the JUCE repo, and for building
  391. quick proof-of-concept demo apps with minimal set-up. For any use-case more complex than a
  392. proof-of-concept, you should prefer the `juce_add_gui_app`, `juce_add_plugin`, or
  393. `juce_add_console_app` functions, which provide more fine-grained control over the properties of
  394. your target.
  395. ### `juce_disable_default_flags`
  396. juce_disable_default_flags()
  397. This function sets the `CMAKE_<LANG>_FLAGS_<MODE>` to empty in the current directory and below,
  398. allowing alternative optimisation/debug flags to be supplied without conflicting with the
  399. CMake-supplied defaults.
  400. ### `juce::juce_recommended_warning_flags`
  401. target_link_libraries(myTarget PRIVATE juce::juce_recommended_warning_flags)
  402. This is a target which can be linked to other targets using `target_link_libraries`, in order to
  403. enable the recommended JUCE warnings when building them.
  404. ### `juce::juce_recommended_config_flags`
  405. target_link_libraries(myTarget PRIVATE juce::juce_recommended_config_flags)
  406. This is a target which can be linked to other targets using `target_link_libraries`, in order to
  407. enable the recommended JUCE optimisation and debug flags.
  408. ### `juce::juce_recommended_lto_flags`
  409. target_link_libraries(myTarget PRIVATE juce::juce_recommended_lto_flags)
  410. This is a target which can be linked to other targets using `target_link_libraries`, in order to
  411. enable the recommended JUCE link time optimisation settings.