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.

89 lines
5.0KB

  1. # Example Console App CMakeLists.txt
  2. # To get started on a new console app, copy this entire folder (containing this file and C++
  3. # sources) to a convenient location, and then start making modifications. For other examples of
  4. # CMakeLists for console apps, check `extras/BinaryBuilder` and `extras/UnitTestRunner` in the JUCE
  5. # repo.
  6. # The first line of any CMake project should be a call to `cmake_minimum_required`, which checks
  7. # that the installed CMake will be able to understand the following CMakeLists, and ensures that
  8. # CMake's behaviour is compatible with the named version. This is a standard CMake command, so more
  9. # information can be found in the CMake docs.
  10. cmake_minimum_required(VERSION 3.15)
  11. # The top-level CMakeLists.txt file for a project must contain a literal, direct call to the
  12. # `project()` command. `project()` sets up some helpful variables that describe source/binary
  13. # directories, and the current project version. This is a standard CMake command.
  14. project(CONSOLE_APP_EXAMPLE VERSION 0.0.1)
  15. # If you've installed JUCE somehow (via a package manager, or directly using the CMake install
  16. # target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
  17. # included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
  18. # include that subdirectory as part of the build.
  19. # find_package(JUCE CONFIG REQUIRED) # If you've installed JUCE to your system
  20. # or
  21. # add_subdirectory(JUCE) # If you've put JUCE in a subdirectory called JUCE
  22. # `juce_add_console_app` adds an executable target with the name passed as the first argument
  23. # (ConsoleAppExample here). This target is a normal CMake target, but has a lot of extra properties
  24. # set up by default. This function accepts many optional arguments. Check the readme at
  25. # `docs/CMake API.md` in the JUCE repo for the full list.
  26. juce_add_console_app(ConsoleAppExample
  27. PRODUCT_NAME "Console App Example") # The name of the final executable, which can differ from the target name
  28. # `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated
  29. # into the build tree. This header should be included with `#include <JuceHeader.h>`. The include
  30. # path for this header will be automatically added to the target. The main function of the
  31. # JuceHeader is to include all the JUCE module headers for a particular target; if you're happy to
  32. # include module headers directly, you probably don't need to call this.
  33. # juce_generate_juce_header(ConsoleAppExample)
  34. # `target_sources` adds source files to a target. We pass the target that needs the sources as the
  35. # first argument, then a visibility parameter for the sources which should normally be PRIVATE.
  36. # Finally, we supply a list of source files that will be built into the target. This is a standard
  37. # CMake command.
  38. target_sources(ConsoleAppExample
  39. PRIVATE
  40. Main.cpp)
  41. # `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
  42. # project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
  43. # of compile definitions to switch certain features on/off, so if there's a particular feature you
  44. # need that's not on by default, check the module header for the correct flag to set here. These
  45. # definitions will be visible both to your code, and also the JUCE module code, so for new
  46. # definitions, pick unique names that are unlikely to collide! This is a standard CMake command.
  47. target_compile_definitions(ConsoleAppExample
  48. PRIVATE
  49. # JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
  50. JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_console_app` call
  51. JUCE_USE_CURL=0) # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_console_app` call
  52. # If the target needs extra binary assets, they can be added here. The first argument is the name of
  53. # a new static library target that will include all the binary resources. There is an optional
  54. # `NAMESPACE` argument that can specify the namespace of the generated binary data class. Finally,
  55. # the SOURCES argument should be followed by a list of source files that should be built into the
  56. # static library. These source files can be of any kind (wav data, images, fonts, icons etc.).
  57. # Conversion to binary-data will happen when the target is built.
  58. # juce_add_binary_data(ConsoleAppData SOURCES ...)
  59. # `target_link_libraries` links libraries and JUCE modules to other libraries or executables. Here,
  60. # we're linking our executable target to the `juce::juce_core` module. Inter-module dependencies are
  61. # resolved automatically. If you'd generated a binary data target above, you would need to link to
  62. # it here too. This is a standard CMake command.
  63. target_link_libraries(ConsoleAppExample
  64. PRIVATE
  65. # ConsoleAppData # If you'd created a binary data target, you'd link to it here
  66. juce::juce_core
  67. PUBLIC
  68. juce::juce_recommended_config_flags
  69. juce::juce_recommended_warning_flags)