Browse Source

CMake: Update example projects to use recommended targets

tags/2021-05-28
reuk 5 years ago
parent
commit
a98dc7553b
4 changed files with 51 additions and 31 deletions
  1. +16
    -10
      examples/CMake/AudioPlugin/CMakeLists.txt
  2. +1
    -0
      examples/CMake/AudioPlugin/PluginProcessor.h
  3. +15
    -9
      examples/CMake/ConsoleApp/CMakeLists.txt
  4. +19
    -12
      examples/CMake/GuiApp/CMakeLists.txt

+ 16
- 10
examples/CMake/AudioPlugin/CMakeLists.txt View File

@@ -66,9 +66,10 @@ juce_add_plugin(AudioPluginExample
# although it doesn't really affect executable targets). Finally, we supply a list of source files
# that will be built into the target. This is a standard CMake command.

target_sources(AudioPluginExample PRIVATE
PluginEditor.cpp
PluginProcessor.cpp)
target_sources(AudioPluginExample
PRIVATE
PluginEditor.cpp
PluginProcessor.cpp)

# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
@@ -79,10 +80,10 @@ target_sources(AudioPluginExample PRIVATE

target_compile_definitions(AudioPluginExample
PUBLIC
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
JUCE_VST3_CAN_REPLACE_VST2=0)
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call
JUCE_VST3_CAN_REPLACE_VST2=0)

# If your target needs extra binary assets, you can add them here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
@@ -99,6 +100,11 @@ target_compile_definitions(AudioPluginExample
# linked automatically. If we'd generated a binary data target above, we would need to link to it
# here too. This is a standard CMake command.

target_link_libraries(AudioPluginExample PRIVATE
# AudioPluginData # If we'd created a binary data target, we'd link to it here
juce::juce_audio_utils)
target_link_libraries(AudioPluginExample
PRIVATE
# AudioPluginData # If we'd created a binary data target, we'd link to it here
juce::juce_audio_utils
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)

+ 1
- 0
examples/CMake/AudioPlugin/PluginProcessor.h View File

@@ -17,6 +17,7 @@ public:
bool isBusesLayoutSupported (const BusesLayout& layouts) const override;
void processBlock (juce::AudioBuffer<float>&, juce::MidiBuffer&) override;
using AudioProcessor::processBlock;
//==============================================================================
juce::AudioProcessorEditor* createEditor() override;


+ 15
- 9
examples/CMake/ConsoleApp/CMakeLists.txt View File

@@ -48,8 +48,9 @@ juce_add_console_app(ConsoleAppExample
# although it doesn't really affect executable targets). Finally, we supply a list of source files
# that will be built into the target. This is a standard CMake command.

target_sources(ConsoleAppExample PRIVATE
Main.cpp)
target_sources(ConsoleAppExample
PRIVATE
Main.cpp)

# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
@@ -58,10 +59,11 @@ target_sources(ConsoleAppExample PRIVATE
# definitions will be visible both to your code, and also the JUCE module code, so for new
# definitions, pick unique names that are unlikely to collide! This is a standard CMake command.

target_compile_definitions(ConsoleAppExample PRIVATE
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_console_app` call
JUCE_USE_CURL=0) # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_console_app` call
target_compile_definitions(ConsoleAppExample
PRIVATE
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_console_app` call
JUCE_USE_CURL=0) # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_console_app` call

# If the target needs extra binary assets, they can be added here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
@@ -77,6 +79,10 @@ target_compile_definitions(ConsoleAppExample PRIVATE
# resolved automatically. If you'd generated a binary data target above, you would need to link to
# it here too. This is a standard CMake command.

target_link_libraries(ConsoleAppExample PRIVATE
# ConsoleAppData # If you'd created a binary data target, you'd link to it here
juce::juce_core)
target_link_libraries(ConsoleAppExample
PRIVATE
# ConsoleAppData # If you'd created a binary data target, you'd link to it here
juce::juce_core
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_warning_flags)

+ 19
- 12
examples/CMake/GuiApp/CMakeLists.txt View File

@@ -57,9 +57,10 @@ juce_add_gui_app(GuiAppExample
# although it doesn't really affect executable targets). Finally, we supply a list of source files
# that will be built into the target. This is a standard CMake command.

target_sources(GuiAppExample PRIVATE
Main.cpp
MainComponent.cpp)
target_sources(GuiAppExample
PRIVATE
Main.cpp
MainComponent.cpp)

# `target_compile_definitions` adds some preprocessor definitions to our target. In a Projucer
# project, these might be passed in the 'Preprocessor Definitions' field. JUCE modules also make use
@@ -68,12 +69,13 @@ target_sources(GuiAppExample PRIVATE
# definitions will be visible both to your code, and also the JUCE module code, so for new
# definitions, pick unique names that are unlikely to collide! This is a standard CMake command.

target_compile_definitions(GuiAppExample PRIVATE
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_gui_app` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_gui_app` call
JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:GuiAppExample,JUCE_PRODUCT_NAME>"
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:GuiAppExample,JUCE_VERSION>")
target_compile_definitions(GuiAppExample
PRIVATE
# JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them.
JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_gui_app` call
JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_gui_app` call
JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:GuiAppExample,JUCE_PRODUCT_NAME>"
JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:GuiAppExample,JUCE_VERSION>")

# If your target needs extra binary assets, you can add them here. The first argument is the name of
# a new static library target that will include all the binary resources. There is an optional
@@ -90,6 +92,11 @@ target_compile_definitions(GuiAppExample PRIVATE
# linked automatically. If we'd generated a binary data target above, we would need to link to it
# here too. This is a standard CMake command.

target_link_libraries(GuiAppExample PRIVATE
# GuiAppData # If we'd created a binary data target, we'd link to it here
juce::juce_gui_extra)
target_link_libraries(GuiAppExample
PRIVATE
# GuiAppData # If we'd created a binary data target, we'd link to it here
juce::juce_gui_extra
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)

Loading…
Cancel
Save