Skip to content

Commit d9fe2f0

Browse files
committed
CMake: Automatically set AAX_EPluginCategory_MIDIEffect when JUCE_MIDI_EFFECT is enabled
1 parent d9ed81b commit d9fe2f0

File tree

2 files changed

+62
-51
lines changed

2 files changed

+62
-51
lines changed

docs/CMake API.md

+3-7
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,9 @@ attributes directly to these creation functions, rather than adding them later.
577577
in GarageBand.
578578

579579
`AAX_CATEGORY`
580-
- Should be one or more of: `AAX_ePlugInCategory_None`, `AAX_ePlugInCategory_EQ`,
581-
`AAX_ePlugInCategory_Dynamics`, `AAX_ePlugInCategory_PitchShift`, `AAX_ePlugInCategory_Reverb`,
582-
`AAX_ePlugInCategory_Delay`, `AAX_ePlugInCategory_Modulation`, `AAX_ePlugInCategory_Harmonic`,
583-
`AAX_ePlugInCategory_NoiseReduction`, `AAX_ePlugInCategory_Dither`,
584-
`AAX_ePlugInCategory_SoundField`, `AAX_ePlugInCategory_HWGenerators`,
585-
`AAX_ePlugInCategory_SWGenerators`, `AAX_ePlugInCategory_WrappedPlugin`,
586-
`AAX_EPlugInCategory_Effect`
580+
- Should be one or more of: `None`, `EQ`, `Dynamics`, `PitchShift`, `Reverb`, `Delay`, `Modulation`,
581+
`Harmonic`, `NoiseReduction`, `Dither`, `SoundField`, `HWGenerators`, `SWGenerators`,
582+
`WrappedPlugin`, `Effect`, and `MIDIEffect`. You may also add the prefix `AAX_ePlugInCategory_`.
587583

588584
`PLUGINHOST_AU`
589585
- May be either TRUE or FALSE (defaults to FALSE). If TRUE, will add the preprocessor definition

extras/Build/CMake/JUCEUtils.cmake

+59-44
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,58 @@ endfunction()
16241624

16251625
# ==================================================================================================
16261626

1627+
# Only sets result if the categories list contains valid entries
1628+
function(_juce_aax_categories_to_int categories_list result)
1629+
set(aax_category_strings
1630+
None
1631+
EQ
1632+
Dynamics
1633+
PitchShift
1634+
Reverb
1635+
Delay
1636+
Modulation
1637+
Harmonic
1638+
NoiseReduction
1639+
Dither
1640+
SoundField
1641+
HWGenerators
1642+
SWGenerators
1643+
WrappedPlugin
1644+
Effect
1645+
placeholder # These placeholders are because there's a gap between Effect
1646+
placeholder # and MIDIEffect in the definition of AAX_EPlugInCategory.
1647+
MIDIEffect)
1648+
1649+
unset(aax_category_int)
1650+
1651+
foreach(category_string IN LISTS categories_list)
1652+
string(REGEX REPLACE "^AAX_[eE]PlugInCategory_" "" category_string "${category_string}")
1653+
list(FIND aax_category_strings ${category_string} aax_index)
1654+
1655+
if(aax_index GREATER_EQUAL 0)
1656+
if(aax_index EQUAL 0)
1657+
set(aax_category_bit 0)
1658+
else()
1659+
set(aax_category_bit "1 << (${aax_index} - 1)")
1660+
endif()
1661+
1662+
if(NOT DEFINED aax_category_int)
1663+
set(aax_category_int 0)
1664+
endif()
1665+
1666+
math(EXPR aax_category_int "${aax_category_int} | (${aax_category_bit})")
1667+
else()
1668+
message(WARNING "Unrecognised AAX category: '${category_string}'. See the `CMake API.md` entry for `AAX_CATEGORY` for valid values.")
1669+
endif()
1670+
endforeach()
1671+
1672+
if(DEFINED aax_category_int)
1673+
set(${result} "${aax_category_int}" PARENT_SCOPE)
1674+
endif()
1675+
endfunction()
1676+
1677+
# ==================================================================================================
1678+
16271679
function(_juce_set_generic_property_if_not_set target property)
16281680
list(LENGTH ARGN num_extra_args)
16291681

@@ -1803,57 +1855,20 @@ function(_juce_set_fallback_properties target)
18031855

18041856
# AAX category
18051857

1806-
# The order of these strings is important, as the index of each string
1807-
# will be used to set an appropriate bit in the category bitfield.
1808-
set(aax_category_strings
1809-
ePlugInCategory_None
1810-
ePlugInCategory_EQ
1811-
ePlugInCategory_Dynamics
1812-
ePlugInCategory_PitchShift
1813-
ePlugInCategory_Reverb
1814-
ePlugInCategory_Delay
1815-
ePlugInCategory_Modulation
1816-
ePlugInCategory_Harmonic
1817-
ePlugInCategory_NoiseReduction
1818-
ePlugInCategory_Dither
1819-
ePlugInCategory_SoundField
1820-
ePlugInCategory_HWGenerators
1821-
ePlugInCategory_SWGenerators
1822-
ePlugInCategory_WrappedPlugin
1823-
ePlugInCategory_Effect)
1824-
1825-
if(is_synth)
1826-
set(default_aax_category ePlugInCategory_SWGenerators)
1858+
if(is_midi_effect)
1859+
set(default_aax_category AAX_ePlugInCategory_MIDIEffect)
1860+
elseif(is_synth)
1861+
set(default_aax_category AAX_ePlugInCategory_SWGenerators)
18271862
else()
1828-
set(default_aax_category ePlugInCategory_None)
1863+
set(default_aax_category AAX_ePlugInCategory_None)
18291864
endif()
18301865

18311866
_juce_set_property_if_not_set(${target} AAX_CATEGORY ${default_aax_category})
18321867

1833-
# Replace AAX category string with its integral representation
18341868
get_target_property(actual_aax_category ${target} JUCE_AAX_CATEGORY)
1869+
_juce_aax_categories_to_int("${actual_aax_category}" aax_category_int)
18351870

1836-
set(aax_category_int "")
1837-
1838-
foreach(category_string IN LISTS actual_aax_category)
1839-
list(FIND aax_category_strings ${category_string} aax_index)
1840-
1841-
if(aax_index GREATER_EQUAL 0)
1842-
if(aax_index EQUAL 0)
1843-
set(aax_category_bit 0)
1844-
else()
1845-
set(aax_category_bit "1 << (${aax_index} - 1)")
1846-
endif()
1847-
1848-
if(aax_category_int STREQUAL "")
1849-
set(aax_category_int 0)
1850-
endif()
1851-
1852-
math(EXPR aax_category_int "${aax_category_int} | (${aax_category_bit})")
1853-
endif()
1854-
endforeach()
1855-
1856-
if(NOT aax_category_int STREQUAL "")
1871+
if(DEFINED aax_category_int)
18571872
set_target_properties(${target} PROPERTIES JUCE_AAX_CATEGORY ${aax_category_int})
18581873
endif()
18591874

0 commit comments

Comments
 (0)