Repository navigation
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
157 lines (137 loc) · 6.85 KB
/
Copy pathCMakeLists.txt
File metadata and controls
157 lines (137 loc) · 6.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cmake_minimum_required(VERSION 3.22)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "" FORCE)
endif()
# These MUST stay before project(): that is where CMake configures the Apple
# toolchain and reads them. Set after project(), the deployment target is
# ignored outright and the architectures are unreliable, which on GitHub's
# Apple-Silicon runners yields a silently arm64-only "universal" build.
# 10.13 (not 11.0) because 11.0 excludes Catalina even with a good x86_64
# slice; the arm64 slice is clamped up to 11.0 by the toolchain anyway.
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Minimum macOS deployment version")
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "Target architectures")
endif()
project(MechanOdd VERSION 0.1.0 LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# JUCE is expected as a sibling of this repo, mirroring the FxmeFX layout:
# ../JUCE/ (juce-framework/JUCE checkout)
add_subdirectory(../JUCE JUCE)
# FxmeTools (shared GUI controls, look-and-feel, DSP, and the WDL convolution
# engine) ships inside the FxmeFX submodule. Including its .cmake registers the
# `FxmeTools` JUCE module and the fxmetools_attach() helper.
include(${CMAKE_CURRENT_SOURCE_DIR}/lib/FxmeFX/lib/FxmeTools/cmake/FxmeTools.cmake)
juce_add_plugin(MechanOdd
COMPANY_NAME "FX-Mechanics"
COMPANY_WEBSITE "www.fx-mechanics.com"
PLUGIN_MANUFACTURER_CODE FXME
PLUGIN_CODE MECO
FORMATS AU VST3 Standalone
COPY_PLUGIN_AFTER_BUILD TRUE
PRODUCT_NAME "MechanOdd"
DESCRIPTION "FX-Mechanics modular physical-modelling synth"
IS_SYNTH TRUE
NEEDS_MIDI_INPUT TRUE
NEEDS_MIDI_OUTPUT FALSE
IS_MIDI_EFFECT FALSE
EDITOR_WANTS_KEYBOARD_FOCUS TRUE
VST3_CATEGORIES Instrument Synth
BUNDLE_ID "com.FXMechanics.MechanOdd"
)
# Source files are discovered recursively so adding a new module/component
# does not require editing this file. Re-run CMake configure after adding files.
file(GLOB_RECURSE MECHANODD_SOURCES CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/Source/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Source/*.h
)
target_sources(MechanOdd PRIVATE ${MECHANODD_SOURCES})
# Link the FxmeTools module and compile + expose the WDL convolution engine
# (used by the reused Cab / ConvolReverb effects and FxmeTools' FirFilter).
fxmetools_attach(MechanOdd)
# Make every subdirectory under Source/ an include root so headers can be
# included by name regardless of where a module lives.
file(GLOB MECHANODD_INCLUDE_DIRS LIST_DIRECTORIES true
${CMAKE_CURRENT_SOURCE_DIR}/Source
${CMAKE_CURRENT_SOURCE_DIR}/Source/*
)
list(FILTER MECHANODD_INCLUDE_DIRS EXCLUDE REGEX "\\.(c|cc|cpp|cxx|h|hpp|hxx|mm)$")
target_include_directories(MechanOdd PRIVATE ${MECHANODD_INCLUDE_DIRS})
# ── Reused FxmeFX effects ─────────────────────────────────────────────────────
# Compile each effect's DSP class and its component (not the standalone plugin
# wrappers PluginProcessor/PluginEditor/PdMain) into MechanOdd.
# The effect *Component.cpp files include Common/TopBar.h for the shared header
# sizing constants and paintComponentBackground(). That header also pulls in
# <FxmeCommonBinaryData.h> (the FX-Mechanics logo), whose generated header only
# lands on the include path via the FxmeCommonBinaryData target. Registering and
# linking it is what every FxmeFX plugin CMakeLists does; without it the build
# fails on all platforms with "'FxmeCommonBinaryData.h' file not found".
include(${CMAKE_CURRENT_SOURCE_DIR}/lib/FxmeFX/Source/Common/CommonAssets.cmake)
target_link_libraries(MechanOdd PRIVATE FxmeCommonBinaryData)
set(FXMEFX_EFFECTS StereoDelay Tube Equalizer Oct VuMeter Compressor Limiter Transient Cab ConvolReverb)
set(FXMEFX_ASSETS "")
foreach(_fx IN LISTS FXMEFX_EFFECTS)
set(_fxdir ${CMAKE_CURRENT_SOURCE_DIR}/lib/FxmeFX/Source/${_fx})
file(GLOB _fxsrcs ${_fxdir}/*.cpp)
list(FILTER _fxsrcs EXCLUDE REGEX "(PluginProcessor|PluginEditor|PdMain)\\.cpp$")
target_sources(MechanOdd PRIVATE ${_fxsrcs})
target_include_directories(MechanOdd PRIVATE ${_fxdir})
# Collect image assets and IR WAV files (Cab uses IR/, ConvolReverb uses ir/).
file(GLOB _fxassets
${_fxdir}/img/*.png ${_fxdir}/img/*.jpg ${_fxdir}/Assets/*.png
${_fxdir}/IR/*.wav ${_fxdir}/ir/*.wav)
list(APPEND FXMEFX_ASSETS ${_fxassets})
endforeach()
# Add MechanOdd's own image assets and factory preset XML files.
file(GLOB MECHANODD_ASSETS ${CMAKE_CURRENT_SOURCE_DIR}/Source/Assets/*.png
${CMAKE_CURRENT_SOURCE_DIR}/Source/Assets/*.jpg
${CMAKE_CURRENT_SOURCE_DIR}/Source/Assets/*.xml)
list(APPEND FXMEFX_ASSETS ${MECHANODD_ASSETS})
# Factory module presets of the embedded effects (FxmeFX's
# Source/<Effect>/Presets/<Effect>_<Name>.xml), in their own binary-data
# namespace (FxmeModulePresets); also defines FXMEFX_HAS_MODULE_PRESETS. The
# effects' user presets live in FX-Mechanics/Modules/<Effect>/Presets, shared
# with FxmeFX's own plugins. VuMeter is a helper, not a slot effect.
include(${CMAKE_CURRENT_SOURCE_DIR}/lib/FxmeFX/cmake/FxmeModulePresets.cmake)
fxmefx_add_module_presets(MechanOdd
StereoDelay Tube Equalizer Oct Compressor Limiter Transient Cab ConvolReverb)
if(FXMEFX_ASSETS)
juce_add_binary_data(MechanOddBinaryData SOURCES ${FXMEFX_ASSETS})
# Embedded WAV byte arrays don't benefit from LTO and can exhaust RAM at
# compile time — disable both for the binary-data target only.
set_target_properties(MechanOddBinaryData PROPERTIES
INTERPROCEDURAL_OPTIMIZATION OFF)
target_compile_options(MechanOddBinaryData PRIVATE
$<$<CXX_COMPILER_ID:GNU,Clang,AppleClang>:-O0 -fno-lto>
$<$<CXX_COMPILER_ID:MSVC>:/Od>)
target_link_libraries(MechanOdd PRIVATE MechanOddBinaryData)
endif()
juce_generate_juce_header(MechanOdd)
target_compile_definitions(MechanOdd
PUBLIC
JUCE_STRICT_REFCOUNTEDPOINTER=1
JUCE_VST3_CAN_REPLACE_VST2=0
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_DISPLAY_SPLASH_SCREEN=0
)
target_link_libraries(MechanOdd
PRIVATE
juce::juce_audio_basics
juce::juce_audio_devices
juce::juce_audio_formats
juce::juce_audio_plugin_client
juce::juce_audio_processors
juce::juce_audio_utils
juce::juce_core
juce::juce_data_structures
juce::juce_dsp
juce::juce_events
juce::juce_graphics
juce::juce_gui_basics
juce::juce_gui_extra
PUBLIC
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags
)