CMakeLists.txt 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974
  1. cmake_minimum_required(VERSION 3.22)
  2. # macOS: Big Sur or newer (universal builds pass -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"); set before project()
  3. set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS version")
  4. project(LYNX VERSION 0.1.32 LANGUAGES C CXX)
  5. set(CMAKE_CXX_STANDARD 20)
  6. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  7. # The same float results with every compiler and CPU: no fused multiply-add contraction (arm64 and newer x86 have
  8. # FMA; the exact FL engines rely on the plain operation order, as the Windows build compiles them)
  9. if(NOT MSVC)
  10. add_compile_options(-ffp-contract=off)
  11. endif()
  12. # Sanitizer builds (round 190rb, the 0.1.32 quality release): -DLYNX_SANITIZE=address,undefined (any -fsanitize= list:
  13. # address, undefined, thread, leak ...) for every target, app, tests and tools alike. GCC / Clang only. Use with
  14. # -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O1 -g -DNDEBUG" -DLYNX_LTO=OFF (scripts/build-sanitize.sh).
  15. # UBSan reports and goes on (the run lists every report); ASan stops at its first error, as always.
  16. set(LYNX_SANITIZE "" CACHE STRING "Build everything with -fsanitize=<list> (e.g. address,undefined); empty = off")
  17. if(LYNX_SANITIZE AND NOT MSVC)
  18. add_compile_options(-fsanitize=${LYNX_SANITIZE} -fno-omit-frame-pointer -fno-optimize-sibling-calls)
  19. add_link_options(-fsanitize=${LYNX_SANITIZE})
  20. add_compile_definitions(LYNX_SANITIZER_BUILD=1)
  21. # tests/tests.cpp is one huge translation unit: at -O1 under ASan + UBSan g++ 15 passed 20 GB for it alone (round
  22. # 190rb), so it is compiled without optimisation there (the code it tests, lynx_core, keeps -O1)
  23. set_source_files_properties(tests/tests.cpp PROPERTIES COMPILE_OPTIONS "-O0")
  24. endif()
  25. # Linux on ARM makes a plain `char` unsigned (x86 and Apple arm64: signed). The readers of FL's, Live's and the other
  26. # formats were written and tested with a signed char: Linux arm64 builds keep it (round 190oy)
  27. if(NOT MSVC AND NOT APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64|ARM64")
  28. add_compile_options(-fsigned-char)
  29. endif()
  30. # FL Slayer's exact engine (x87 arithmetic under its own control word): with GCC 15 at -O1 and above, inlining in this
  31. # file breaks it (some presets silent or NaN against the DLL goldens; Clang and GCC -O0 / -fno-inline are exact; root
  32. # cause not isolated, REA round 117). Linux GCC builds compile it without inlining (Slayer about 1.7x slower there).
  33. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64|i.86")
  34. set_source_files_properties(src/core/Slayer.cpp PROPERTIES COMPILE_OPTIONS "-fno-inline")
  35. endif()
  36. # Round 190pz: the FL engines whose files say `#pragma GCC optimize ("fp-contract=off", "rounding-math")` give their own
  37. # functions other optimisation settings than the header templates they call (std::min / std::max / std::clamp ...), and
  38. # GCC does not inline across that: Kepler called std::min / std::max out of line for ~9 % of its time. The whole file
  39. # with -frounding-math has one setting, so they inline again (the arithmetic is the same: bit-identical renders).
  40. if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  41. set_source_files_properties(src/core/Kepler.cpp src/core/ChorusFx.cpp src/core/MultibandDelayFx.cpp src/core/LovePhilter.cpp
  42. src/core/FlangusFastDist.cpp PROPERTIES COMPILE_OPTIONS "-frounding-math")
  43. endif()
  44. # The plugins are shared libraries: everything they link must be position independent (the option is declared below)
  45. if(LYNX_BUILD_PLUGINS)
  46. set(CMAKE_POSITION_INDEPENDENT_CODE ON)
  47. if(NOT MSVC)
  48. add_compile_options(-ffunction-sections -fdata-sections) # (what the plugins' --gc-sections can drop)
  49. endif()
  50. endif()
  51. # ---------------------------------------------------------------------------
  52. # JUCE-free core: model, sequencer, built-in instruments and .flp reader
  53. add_library(lynx_core STATIC
  54. src/flp/Flp.cpp
  55. src/core/Song.cpp
  56. src/core/Scheduler.cpp
  57. src/core/MarkerPlan.cpp
  58. src/core/Performance.cpp
  59. src/core/ClipLauncher.cpp
  60. src/core/SessionOps.cpp
  61. src/core/TrackClips.cpp
  62. src/core/TrackerGrid.cpp
  63. src/core/ModuleImport.cpp
  64. src/core/CrossPaste.cpp
  65. src/core/TrackVersions.cpp
  66. src/core/TrackImport.cpp
  67. src/core/RemoteMap.cpp
  68. src/core/DrawMode.cpp
  69. src/core/AutoPointEdit.cpp
  70. src/core/Groove.cpp
  71. src/core/Patcherize.cpp
  72. src/core/Instruments.cpp
  73. src/core/RackRenderer.cpp
  74. src/core/RenderAhead.cpp
  75. src/core/RollingAudioLog.cpp
  76. src/core/ChordReadout.cpp
  77. src/core/LoadTrace.cpp
  78. src/core/ModuleWarmup.cpp
  79. src/core/FlpImport.cpp
  80. src/core/FlpExport.cpp
  81. src/core/XmlLite.cpp
  82. src/core/Gzip.cpp
  83. src/core/AlsImport.cpp
  84. src/core/AlsDevices.cpp
  85. src/core/AlsDevicesLot2.cpp
  86. src/core/AlsDevicesLot3.cpp
  87. src/core/AlsDevicesLot4.cpp
  88. src/core/AlsDevicesLot5.cpp
  89. src/core/FlmFormat.cpp
  90. src/core/FlmImport.cpp
  91. src/core/FlmExport.cpp
  92. src/core/BandFormat.cpp
  93. src/core/BandImport.cpp
  94. src/core/BlxImport.cpp
  95. src/core/RegionLoop.cpp
  96. src/core/SmartControls.cpp
  97. src/core/FactoryContent.cpp
  98. src/core/FlmEffects.cpp
  99. src/core/FlmNoteFx.cpp
  100. src/core/FlmDwSampler.cpp
  101. src/core/FlmSlicer.cpp
  102. src/core/AlsExport.cpp
  103. src/core/DawProject.cpp src/core/ZipLite.cpp
  104. src/flp/FlpWrite.cpp
  105. src/core/Effects.cpp
  106. src/core/NoteEdit.cpp
  107. src/core/Recorder.cpp
  108. src/core/TakeRecording.cpp
  109. src/core/Comping.cpp
  110. src/core/Pdc.cpp
  111. src/core/WorkerPool.cpp
  112. src/core/OverloadGuard.cpp
  113. src/core/TimeStretch.cpp
  114. src/core/WarpEngines.cpp
  115. src/core/Arpeggiator.cpp
  116. src/core/SynthPresets.cpp
  117. src/core/Slicer.cpp
  118. src/core/AudioToMidi.cpp
  119. src/core/PolyEdit.cpp
  120. # PitchNet's polyphonic engine (round 190lk; AGPL-3.0, third_party/pitchnet-poly/README-LYNX.md)
  121. third_party/pitchnet-poly/PolyEngine.cpp
  122. third_party/pitchnet-poly/PolyExtraction.cpp
  123. third_party/pitchnet-poly/PolyPurifier.cpp
  124. third_party/pitchnet-poly/PolyRenderer.cpp
  125. third_party/pitchnet-poly/PolySoundModel.cpp
  126. third_party/pitchnet-poly/PolySpectral.cpp
  127. third_party/pitchnet-poly/PolyLazy.cpp
  128. src/core/Templates.cpp
  129. src/core/FlWrapper.cpp
  130. src/core/FlPluginDb.cpp
  131. src/core/MissingFiles.cpp
  132. src/core/PluginCatalog.cpp
  133. src/core/PluginDbFolder.cpp
  134. src/core/FolderWatcher.cpp
  135. src/core/ProjectSafety.cpp
  136. src/core/SessionIds.cpp
  137. src/core/SessionParts.cpp
  138. src/core/StandIns.cpp
  139. src/core/LiveSession.cpp
  140. src/core/LiveCrypto.cpp
  141. src/core/RemotePlugins.cpp
  142. src/core/PluginSubstitutes.cpp
  143. src/core/Preferences.cpp
  144. src/core/MidiSync.cpp
  145. src/core/ThemePalette.cpp
  146. src/core/LoopStarter.cpp
  147. src/core/SimpleTracks.cpp
  148. src/core/SimplePads.cpp
  149. src/core/SimpleSteps.cpp
  150. src/core/KeyFollow.cpp
  151. src/core/LoopAnalysis.cpp
  152. src/core/LoopKeywords.cpp
  153. src/core/GoalKnobs.cpp
  154. src/core/ChainPresets.cpp
  155. src/core/SoundLibrary.cpp
  156. src/core/GamepadMap.cpp
  157. src/core/ControllerProfile.cpp
  158. src/core/ControllerSession.cpp
  159. src/core/ExportBundle.cpp
  160. src/core/PluginLayout.cpp
  161. src/core/StateParams.cpp
  162. src/core/FlEffects.cpp
  163. src/core/Effector.cpp
  164. src/core/FlSamplers.cpp
  165. src/core/Fpc.cpp
  166. src/core/FpcInstrument.cpp
  167. src/core/FpcEnvelope.cpp
  168. src/core/FlSynths.cpp
  169. src/core/FlSytrus.cpp
  170. src/core/FlGenerators.cpp
  171. src/core/PhysicalModels.cpp
  172. src/core/DrumSynthLive.cpp
  173. src/core/Harmless.cpp
  174. src/core/Harmor.cpp
  175. src/core/HarmorResynth.cpp
  176. src/core/Gms.cpp
  177. src/core/GmsMobile.cpp
  178. src/core/PocketSuperSaw.cpp
  179. src/core/FmSynth.cpp
  180. src/core/physmod/ModalBank.cpp
  181. src/core/physmod/LynxModel.cpp
  182. src/core/AlsDevicesFm.cpp
  183. src/core/WavetableSynth.cpp
  184. src/core/WavetableTables.cpp
  185. src/core/WavetableUser.cpp
  186. src/core/AlsDevicesWt.cpp
  187. src/core/Braid.cpp
  188. src/core/BraidParams.cpp
  189. src/core/AlsDevicesLot6.cpp
  190. src/core/Morphine.cpp
  191. src/core/FruitKick.cpp
  192. src/core/BassDrum.cpp
  193. src/core/Ogun.cpp
  194. src/core/MiniSynth.cpp
  195. src/core/SimSynth.cpp
  196. src/core/Wasp.cpp
  197. src/core/Granulizer.cpp
  198. src/core/WaveTraveller.cpp
  199. src/core/FruitySlicer.cpp
  200. src/core/Slicex.cpp
  201. src/core/SlicexEngine.cpp
  202. src/core/SlicexInstrument.cpp
  203. src/core/Drumaxx.cpp
  204. src/core/Slayer.cpp
  205. src/core/Dx10.cpp
  206. src/core/Kepler.cpp
  207. src/core/TransistorBass.cpp
  208. src/core/PoiZone.cpp
  209. src/core/Toxic.cpp
  210. src/core/ToxicFx.cpp
  211. src/core/HarmlessFx.cpp
  212. src/core/SytrusEngine.cpp
  213. src/core/VintagePhaser.cpp
  214. src/core/EmphasizerFx.cpp
  215. src/core/EmphasisFx.cpp
  216. src/core/EmphasisEngine.cpp
  217. src/core/FreqShifterFl.cpp
  218. src/core/LowLifterFl.cpp
  219. src/core/TransporterFl.cpp
  220. src/core/FlLegacyFx.cpp
  221. src/core/PocketFx.cpp
  222. src/core/PocketMultiFx.cpp
  223. src/core/PocketFxA.cpp src/core/PocketFxB.cpp src/core/PocketFxC.cpp src/core/PocketFxD.cpp src/core/PocketFxE.cpp src/core/PocketReverb.cpp
  224. src/core/VisualFx.cpp
  225. src/core/FlExtraFx.cpp
  226. src/core/Scratcher.cpp
  227. src/core/Dvs.cpp
  228. src/core/Transmitter.cpp
  229. src/core/VideoPlayer.cpp
  230. src/core/VideoTime.cpp
  231. src/core/VideoTrack.cpp
  232. src/core/Adr.cpp
  233. src/core/DialogueAlign.cpp
  234. src/core/FruityDance.cpp
  235. src/core/Reeverb2.cpp
  236. src/core/LuxeVerb.cpp
  237. src/core/IldspMath.cpp
  238. src/core/ConvolverFx.cpp
  239. src/core/Vocodex.cpp
  240. src/core/MaximusFx.cpp
  241. src/core/GrossBeat.cpp
  242. src/core/LovePhilter.cpp
  243. src/core/FruityDynamics.cpp
  244. src/core/ParametricEqFl.cpp
  245. src/core/ParametricEqLinear.cpp
  246. src/core/EquoFx.cpp
  247. src/core/MultibandDelayFx.cpp
  248. src/core/PitchShifterFl.cpp
  249. src/core/FruityShapers.cpp
  250. src/core/FruityDelay.cpp
  251. src/core/StereoFx.cpp
  252. src/core/FrequencySplitter.cpp
  253. src/core/DistructorFx.cpp
  254. src/core/ChorusFx.cpp
  255. src/core/FruityBasicFx.cpp
  256. src/core/FruityDelayBank.cpp
  257. src/core/FruityVocoder.cpp
  258. src/core/DelphiMath.cpp
  259. src/core/FruityMultiband.cpp
  260. src/core/FlangusFastDist.cpp
  261. src/core/FruityPhaser.cpp
  262. src/core/FruityFilters.cpp
  263. src/core/NewtoneFx.cpp
  264. src/core/EdisonFx.cpp
  265. src/core/MixSuite.cpp
  266. src/core/EmberClassic.cpp
  267. src/core/VoxStrip.cpp
  268. src/core/RhythmPan.cpp
  269. src/core/VoiceMatch.cpp
  270. src/core/EchoSuite.cpp
  271. src/core/VocalPitch.cpp
  272. src/core/LynxTune.cpp
  273. src/core/LynxVerbs.cpp
  274. src/core/NebulaCloud.cpp
  275. src/core/FlPatcher.cpp
  276. src/core/Patcher.cpp
  277. src/core/Rack.cpp
  278. src/core/Vfx.cpp
  279. src/core/VfxSequencer.cpp
  280. src/core/ThreeOsc.cpp
  281. src/core/Plucked.cpp
  282. src/core/SoundFont.cpp
  283. src/core/SoundFontLoad.cpp
  284. src/core/SoundFontIndex.cpp
  285. src/core/HardcoreFx.cpp
  286. src/core/FacetEq.cpp
  287. src/core/ApexLimiter.cpp
  288. src/core/Mastering.cpp
  289. src/core/MasterLooks.cpp
  290. src/core/DynamicsSuite.cpp
  291. src/core/VoiceTools.cpp
  292. src/core/MidiControls.cpp
  293. src/core/LinkFormula.cpp
  294. src/core/MidiOut.cpp
  295. src/core/FormulaController.cpp
  296. src/core/VoiceShift.cpp
  297. src/core/NativeEngines.cpp
  298. src/core/LynxBanks.cpp
  299. src/core/HelixBank.cpp
  300. src/core/LynxModelBank.cpp
  301. src/core/ModelParams.cpp
  302. src/core/ToxicBank.cpp
  303. src/core/BeepMapBank.cpp
  304. src/core/GranulizerBank.cpp
  305. src/core/EngineLayouts.cpp
  306. src/core/PoiZoneBank.cpp
  307. src/core/ModelParamsSynths.cpp
  308. src/core/PluginLayoutSynths.cpp
  309. src/core/HarmlessBank.cpp
  310. src/core/Dx10Bank.cpp
  311. src/core/SimSynthBank.cpp
  312. src/core/Layer.cpp
  313. src/core/XyController.cpp
  314. src/core/FlCurve.cpp
  315. src/core/ControlSurface.cpp
  316. src/core/VoltageController.cpp
  317. src/core/FabFilterStates.cpp
  318. src/core/FlResampler.cpp
  319. src/core/FlKeys.cpp
  320. src/core/DirectWave.cpp
  321. src/core/DirectWaveState.cpp
  322. src/core/OggVorbis.cpp
  323. src/core/BeepMap.cpp
  324. src/core/Sawer.cpp
  325. src/core/Inflate.cpp
  326. src/core/SamplerImport.cpp
  327. src/core/GigFile.cpp
  328. src/core/Ncw.cpp
  329. src/core/KontaktFile.cpp
  330. src/core/WavPack.cpp)
  331. target_include_directories(lynx_core PUBLIC src third_party/sse2neon)
  332. # workflow shell (key map, workspace layout, rack operations)
  333. target_sources(lynx_core PRIVATE
  334. src/core/KeyMap.cpp
  335. src/core/PresetCycle.cpp
  336. src/core/DrumControls.cpp
  337. src/core/DrumBanks.cpp
  338. src/core/BankStates.cpp
  339. src/core/Sfz.cpp
  340. src/core/Workspace.cpp
  341. src/core/RackOps.cpp
  342. src/core/PlaylistTrackOps.cpp
  343. src/core/ChannelMiscFx.cpp
  344. src/core/MidiImport.cpp
  345. src/core/StartupSound.cpp
  346. src/core/Speech.cpp
  347. src/core/SpeechRules.cpp)
  348. # workflow P2 (note tools, mixer operations, history labels, browser search)
  349. target_sources(lynx_core PRIVATE
  350. src/core/NoteTools.cpp
  351. src/core/MidiTools.cpp
  352. src/core/MidiGenerate.cpp
  353. src/core/PianoRollTools.cpp
  354. src/core/EventEdit.cpp
  355. src/core/AudioEdit.cpp
  356. src/core/AudioEditTools.cpp
  357. src/core/SampleProps.cpp
  358. src/core/EdisonView.cpp
  359. src/core/FlAutoSlicer.cpp
  360. src/core/MixerOps.cpp
  361. src/core/History.cpp
  362. src/core/EffectPresets.cpp
  363. src/core/PluginPresets.cpp
  364. src/core/GeneratorPresets.cpp
  365. src/core/ParamHelp.cpp
  366. src/core/SearchQuery.cpp src/core/SearchIndex.cpp src/core/SearchService.cpp src/core/BrowserView.cpp)
  367. # spectral waveforms: band analysis and multi-resolution peak cache
  368. target_sources(lynx_core PRIVATE
  369. src/core/WaveAnalysis.cpp
  370. src/core/Spectrogram.cpp)
  371. # export options + MP3, plugin performance monitor, clip properties / arrangements (round 84)
  372. target_sources(lynx_core PRIVATE
  373. src/core/ExportOptions.cpp
  374. src/core/Mp3Encoder.cpp
  375. src/core/Mp3Decoder.cpp
  376. src/core/PluginMonitor.cpp
  377. src/core/ProjectContents.cpp
  378. src/core/PlaylistOps.cpp
  379. src/core/ModulatorExport.cpp
  380. src/core/QuickRender.cpp
  381. src/core/TempoDetect.cpp
  382. src/core/AutoWarp.cpp
  383. src/core/ScoreLog.cpp
  384. src/core/ChannelLoops.cpp
  385. src/core/PatternBlocks.cpp
  386. src/core/ChannelBurn.cpp
  387. src/core/AutoSampler.cpp)
  388. # crash / freeze reports: consent, anonymiser, report JSON, GitHub issue URL (round 159)
  389. target_sources(lynx_core PRIVATE
  390. src/core/CrashReport.cpp)
  391. # in-app update check: versions, release list, build flavours, checksums, release notes (round 166b)
  392. target_sources(lynx_core PRIVATE
  393. src/core/UpdateCheck.cpp)
  394. # the first-start audio check: verdict and the devices to try (round 190gh, B23)
  395. target_sources(lynx_core PRIVATE
  396. src/core/AudioCheck.cpp)
  397. # the Browser's "Find similar samples" (round 190as)
  398. target_sources(lynx_core PRIVATE
  399. src/core/SampleSimilarity.cpp)
  400. # the embedded Python (pocketpy) and FL's VFX Script (round 165d)
  401. target_sources(lynx_core PRIVATE
  402. src/core/Python.cpp
  403. src/core/VfxScript.cpp
  404. src/core/EdisonScript.cpp
  405. src/core/ScriptDialog.cpp
  406. src/core/PianoRollScript.cpp)
  407. # JSFX scripts' identity, file policy and saved state (round 190pj, issue #241; core/Jsfx.h)
  408. target_sources(lynx_core PRIVATE
  409. src/core/Jsfx.cpp)
  410. # pocketpy 2.2 (MIT; third_party/pocketpy, LYNX's changes marked "LYNX"): a small embeddable Python 3 interpreter,
  411. # sandboxed (no os module / files) and interruptible (the watchdog)
  412. add_library(pocketpy STATIC third_party/pocketpy/pocketpy.c)
  413. target_include_directories(pocketpy PUBLIC third_party/pocketpy)
  414. target_compile_definitions(pocketpy PUBLIC PK_ENABLE_OS=0 PK_ENABLE_WATCHDOG=1)
  415. set_target_properties(pocketpy PROPERTIES C_STANDARD 11)
  416. target_compile_options(pocketpy PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-w>)
  417. target_link_libraries(lynx_core PUBLIC pocketpy)
  418. # ysfx 0.0.47 (Apache-2.0; third_party/ysfx at JoepVanlier/ysfx 5c3452fe, trimmed: no @gfx, no plugin; LYNX's changes
  419. # marked "LYNX"), with WDL's EEL2 (zlib-style; y.tab.c GPL-2+ with the Bison exception) and dr_libs (Unlicense / MIT-0):
  420. # the JSFX runtime behind engine/JsfxFormat.h (issue #241, round 190pj). Flags as ysfx's cmake.wdl.txt / cmake.ysfx.txt.
  421. set(YSFX_DIR third_party/ysfx)
  422. set(YSFX_WDL ${YSFX_DIR}/thirdparty/WDL/source/WDL)
  423. file(GLOB YSFX_SOURCES ${YSFX_DIR}/sources/ysfx*.cpp)
  424. add_library(lynx_ysfx STATIC ${YSFX_SOURCES} ${YSFX_WDL}/fft.c
  425. ${YSFX_WDL}/eel2/nseel-caltab.c ${YSFX_WDL}/eel2/nseel-cfunc.c ${YSFX_WDL}/eel2/nseel-compiler.c ${YSFX_WDL}/eel2/nseel-eval.c
  426. ${YSFX_WDL}/eel2/nseel-lextab.c ${YSFX_WDL}/eel2/nseel-ram.c ${YSFX_WDL}/eel2/nseel-yylex.c)
  427. if(WIN32)
  428. target_sources(lynx_ysfx PRIVATE ${YSFX_WDL}/win32_utf8.c)
  429. endif()
  430. if(NOT MSVC)
  431. # the GAS port of EEL2's x86-64 code generator (empty on other CPUs, which have theirs in nseel-compiler.c)
  432. target_sources(lynx_ysfx PRIVATE ${YSFX_DIR}/sources/eel2-gas/sources/asm-nseel-x64-sse.S)
  433. enable_language(ASM)
  434. endif()
  435. target_include_directories(lynx_ysfx PUBLIC ${YSFX_DIR}/include PRIVATE ${YSFX_DIR}/sources ${YSFX_DIR}/thirdparty/WDL/source ${YSFX_DIR}/thirdparty/dr_libs)
  436. target_compile_definitions(lynx_ysfx PUBLIC YSFX_API= PRIVATE YSFX_NO_GFX WDL_FFT_REALSIZE=8 WDL_LINEPARSE_ATOF=ysfx_wdl_atof NSEEL_ATOF=ysfx_wdl_atof
  437. $<$<BOOL:${WIN32}>:NOMINMAX YSFX_NO_FTS _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS> $<$<NOT:$<BOOL:${WIN32}>>:_FILE_OFFSET_BITS=64>)
  438. set_target_properties(lynx_ysfx PROPERTIES CXX_STANDARD 17 C_STANDARD 11 POSITION_INDEPENDENT_CODE ON
  439. C_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden)
  440. target_compile_options(lynx_ysfx PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-fsigned-char -w>)
  441. find_package(Threads REQUIRED)
  442. target_link_libraries(lynx_ysfx PRIVATE Threads::Threads ${CMAKE_DL_LIBS})
  443. target_link_libraries(lynx_core PUBLIC lynx_ysfx)
  444. # Monocypher 4.0.2 (BSD-2 / CC0; third_party/monocypher): Argon2id, BLAKE2b and XChaCha20-Poly1305 for the live
  445. # sessions' end-to-end encryption (round 169b)
  446. add_library(monocypher STATIC third_party/monocypher/monocypher.c)
  447. target_include_directories(monocypher PUBLIC third_party/monocypher)
  448. target_compile_options(monocypher PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-w>)
  449. target_link_libraries(lynx_core PUBLIC monocypher)
  450. # libxmp-lite 4.7.4 (MIT; third_party/libxmp-lite, LYNX's read-only accessors in src/lynx_xmp_extra.c): reads .mod, .xm,
  451. # .s3m and .it for the module import (round 190nw, core/ModuleImport.h)
  452. file(GLOB LIBXMP_SOURCES third_party/libxmp-lite/src/*.c third_party/libxmp-lite/src/loaders/*.c)
  453. add_library(libxmp_lite STATIC ${LIBXMP_SOURCES})
  454. target_include_directories(libxmp_lite PUBLIC third_party/libxmp-lite/include/libxmp-lite PRIVATE third_party/libxmp-lite/src)
  455. target_compile_definitions(libxmp_lite PUBLIC LIBXMP_STATIC PRIVATE LIBXMP_CORE_PLAYER $<IF:$<C_COMPILER_ID:MSVC>,_USE_MATH_DEFINES,_REENTRANT>)
  456. set_target_properties(libxmp_lite PROPERTIES C_STANDARD 99)
  457. target_compile_options(libxmp_lite PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-w>)
  458. target_link_libraries(lynx_core PUBLIC libxmp_lite)
  459. # LAME's libmp3lame (LGPL; third_party/lame, encoder only, configured by third_party/lame/src/config.h)
  460. file(GLOB LAME_SOURCES third_party/lame/src/*.c)
  461. add_library(lame_encoder STATIC ${LAME_SOURCES})
  462. target_include_directories(lame_encoder PUBLIC third_party/lame/include PRIVATE third_party/lame/src)
  463. target_compile_definitions(lame_encoder PRIVATE HAVE_CONFIG_H)
  464. target_compile_options(lame_encoder PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-w>)
  465. target_link_libraries(lynx_core PUBLIC lame_encoder)
  466. # WavPack decoder (BSD; read-only) for the .wv samples in the FL packs
  467. file(GLOB WAVPACK_SOURCES third_party/wavpack/src/*.c)
  468. add_library(wavpack_decoder STATIC ${WAVPACK_SOURCES})
  469. target_include_directories(wavpack_decoder PUBLIC third_party/wavpack/include PRIVATE third_party/wavpack/src)
  470. target_compile_definitions(wavpack_decoder PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:HAVE___BUILTIN_CLZ=1>)
  471. target_link_libraries(lynx_core PUBLIC wavpack_decoder)
  472. # libogg + libvorbis decoder (BSD; third_party/vorbis, mdct.c modified as FL builds it, REA_rodada77) for FL's
  473. # Ogg-in-WAV samples; no FMA contraction so the float operation order stays libvorbis'
  474. file(GLOB VORBIS_SOURCES third_party/vorbis/src/*.c)
  475. list(FILTER VORBIS_SOURCES EXCLUDE REGEX "/lookup\\.c$") # (included by lsp.c)
  476. add_library(vorbis_decoder STATIC ${VORBIS_SOURCES})
  477. target_include_directories(vorbis_decoder PUBLIC third_party/vorbis/include PRIVATE third_party/vorbis/src)
  478. target_compile_options(vorbis_decoder PRIVATE $<$<NOT:$<C_COMPILER_ID:MSVC>>:-ffp-contract=off -w>
  479. # every symbol gets a lynx_ prefix (JUCE links its own copy with the same C names)
  480. $<IF:$<C_COMPILER_ID:MSVC>,/FI${CMAKE_CURRENT_SOURCE_DIR}/third_party/vorbis/include/lynx_vorbis_prefix.h,-include${CMAKE_CURRENT_SOURCE_DIR}/third_party/vorbis/include/lynx_vorbis_prefix.h>)
  481. target_link_libraries(lynx_core PUBLIC vorbis_decoder)
  482. add_executable(lynx_tests tests/tests.cpp)
  483. target_link_libraries(lynx_tests PRIVATE lynx_core)
  484. add_executable(lynx_remote_playlist_tests tests/RemotePlaylistEditsTests.cpp)
  485. target_link_libraries(lynx_remote_playlist_tests PRIVATE lynx_core)
  486. add_executable(lynx_remote_instrument_tests tests/RemoteInstrumentEditsTests.cpp)
  487. target_link_libraries(lynx_remote_instrument_tests PRIVATE lynx_core)
  488. add_executable(lynx_remote_pattern_tests tests/RemotePatternEditsTests.cpp)
  489. target_link_libraries(lynx_remote_pattern_tests PRIVATE lynx_core)
  490. add_executable(flpdump tools/flpdump.cpp)
  491. target_link_libraries(flpdump PRIVATE lynx_core)
  492. add_executable(renderwav tools/renderwav.cpp)
  493. target_link_libraries(renderwav PRIVATE lynx_core)
  494. # a tracker module rendered by libxmp-lite's own player (round 190nw): the reference for the module import's renders
  495. add_executable(modrender tools/modrender.cpp)
  496. target_link_libraries(modrender PRIVATE libxmp_lite)
  497. # the audio engine's CPU per block, headless (round 190ge): perfbench <scenario> [--block N] [--threads N] ...
  498. add_executable(perfbench tools/perfbench.cpp)
  499. target_link_libraries(perfbench PRIVATE lynx_core)
  500. target_include_directories(perfbench PRIVATE tools)
  501. # every LYNX native effect and instrument: CPU per block, silence, automation, memory (round 190pz): nativebench [--fl <Data>] ...
  502. add_executable(nativebench tools/nativebench.cpp)
  503. target_link_libraries(nativebench PRIVATE lynx_core)
  504. target_include_directories(nativebench PRIVATE tools)
  505. # the recording path (take streams + WAV writers) without an audio device (round 190pz): recbench --dir <folder> [--takes N] ...
  506. add_executable(recbench tools/recbench.cpp)
  507. target_link_libraries(recbench PRIVATE lynx_core)
  508. # LYNX Model (round 190ni): renders notes for the timbre score / calibration and measures the cost per voice
  509. add_executable(physmodrender tools/physmodrender.cpp)
  510. target_link_libraries(physmodrender PRIVATE lynx_core)
  511. enable_testing()
  512. add_test(NAME lynx_tests COMMAND lynx_tests)
  513. add_test(NAME lynx_remote_playlist_tests COMMAND lynx_remote_playlist_tests)
  514. add_test(NAME lynx_remote_instrument_tests COMMAND lynx_remote_instrument_tests)
  515. add_test(NAME lynx_remote_pattern_tests COMMAND lynx_remote_pattern_tests)
  516. # ---------------------------------------------------------------------------
  517. # App (JUCE)
  518. option(LYNX_BUILD_APP "Build the app with JUCE" ON)
  519. if(LYNX_BUILD_APP)
  520. include(FetchContent)
  521. FetchContent_Declare(
  522. JUCE
  523. GIT_REPOSITORY https://github.com/juce-framework/JUCE.git
  524. GIT_TAG 8.0.4
  525. GIT_SHALLOW ON)
  526. FetchContent_MakeAvailable(JUCE)
  527. # JUCE fixes LYNX needs (Linux drag & drop from Wayland file managers, issue #11); see the file for details
  528. option(LYNX_PATCH_JUCE "Apply cmake/LynxPatchJuce.cmake to the JUCE sources" ON)
  529. if(LYNX_PATCH_JUCE)
  530. include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LynxPatchJuce.cmake)
  531. lynx_patch_juce("${juce_SOURCE_DIR}")
  532. endif()
  533. juce_add_gui_app(LYNX
  534. PRODUCT_NAME "LYNX"
  535. COMPANY_NAME "Ka1-S"
  536. COMPANY_COPYRIGHT "Copyright (C) 2026 Ka1-S. Licensed under the GNU AGPL-3.0."
  537. DESCRIPTION "LYNX SHARE digital audio workstation"
  538. # macOS bundle (Info.plist, .icns made from the 1024 and 256 px icons on Apple's icon grid, written by
  539. # tools/make_logo.py); ignored elsewhere
  540. BUNDLE_ID "com.ka1-s.lynx"
  541. ICON_BIG "${CMAKE_CURRENT_SOURCE_DIR}/resources/macos/lynx-icon-1024.png"
  542. ICON_SMALL "${CMAKE_CURRENT_SOURCE_DIR}/resources/macos/lynx-icon-256.png"
  543. MICROPHONE_PERMISSION_ENABLED TRUE
  544. MICROPHONE_PERMISSION_TEXT "LYNX SHARE records audio from your microphone or audio interface when you arm a track and press Record."
  545. DOCUMENT_EXTENSIONS lynx flp mid
  546. HARDENED_RUNTIME_ENABLED FALSE
  547. PLIST_TO_MERGE "<plist><dict><key>CFBundleName</key><string>LYNX SHARE</string><key>CFBundleDisplayName</key><string>LYNX SHARE</string><key>LSMinimumSystemVersion</key><string>11.0</string><key>NSHighResolutionCapable</key><true/></dict></plist>")
  548. # (a list: the plugin build, cmake/LynxPlugins.cmake, compiles the same sources without Main.cpp)
  549. set(LYNX_APP_SOURCES
  550. src/platform/FileTypes.cpp
  551. src/platform/CrashGuard.cpp
  552. src/platform/Paths.cpp
  553. src/platform/Package.cpp
  554. src/platform/NativeEmbed.cpp
  555. src/engine/AudioEngine.cpp
  556. src/engine/RemoteControl.cpp
  557. src/engine/RemoteProjectControl.cpp
  558. src/engine/RemoteProjectDocument.cpp
  559. src/ui/RemoteControlSettings.cpp
  560. src/engine/RemotePluginControl.cpp
  561. src/engine/RemoteInstrumentControl.cpp
  562. src/engine/RemotePatternControl.cpp
  563. src/engine/GeneratorCatalog.cpp
  564. src/engine/RemotePlaylistControl.cpp
  565. src/engine/AudioEngineSession.cpp
  566. src/engine/ChannelRackProcessor.cpp
  567. src/engine/Metronome.cpp
  568. src/engine/SampleLibrary.cpp
  569. src/engine/WavPackFormat.cpp
  570. src/engine/NcwFormat.cpp
  571. src/engine/Mp3Format.cpp
  572. src/engine/ProjectFile.cpp
  573. src/engine/ProjectDowngrade.cpp
  574. src/engine/ProjectPackage.cpp
  575. src/engine/SessionPack.cpp
  576. src/ui/SessionDialogs.cpp
  577. src/engine/LiveLink.cpp
  578. src/engine/LiveSessions.cpp
  579. src/engine/MediaPack.cpp
  580. src/engine/LiveTest.cpp
  581. src/engine/DeviceChangeTest.cpp
  582. src/engine/ShortExportTest.cpp
  583. src/engine/ExportParityTest.cpp
  584. src/engine/DeviceGuard.cpp
  585. src/engine/RecoveryTest.cpp
  586. src/engine/SampleZeroTest.cpp
  587. src/engine/MidiHotplugTest.cpp
  588. src/engine/MidiOutPortTest.cpp
  589. src/engine/PadRecordTest.cpp
  590. src/engine/ShareMemoryTest.cpp
  591. src/ui/LiveSessionUi.cpp
  592. src/ui/LiveChat.cpp
  593. src/engine/LiveRemotePlugins.cpp
  594. src/ui/LiveRemoteUi.cpp
  595. src/engine/PluginHost.cpp
  596. src/engine/AraHost.cpp
  597. src/engine/AraTest.cpp
  598. src/engine/FlStudio.cpp
  599. src/engine/PluginSandbox.cpp
  600. src/engine/SandboxWorker.cpp
  601. src/engine/Bridge32Test.cpp
  602. src/engine/ClapTeardownTest.cpp
  603. src/engine/RenderAgainTest.cpp
  604. src/engine/Determinism190poTest.cpp
  605. src/engine/HostingTests.cpp
  606. src/engine/Modulators190oxTest.cpp
  607. src/engine/Exporter.cpp
  608. # M4A export through the system's AAC encoder (owner decision D5): each file compiles on its own platform only
  609. # (Windows: Media Foundation, linked below; macOS: AudioToolbox; elsewhere: not available)
  610. src/engine/AacEncoder.cpp
  611. src/engine/AacEncoderWindows.cpp
  612. src/engine/AacEncoderMac.cpp
  613. src/engine/FlStudioExport.cpp
  614. src/engine/StreamPrefetcher.cpp
  615. src/engine/DllAsioDevice.cpp
  616. src/engine/PipeWireDevice.cpp
  617. src/platform/LinuxRealtime.cpp
  618. src/engine/ClapFormat.cpp
  619. src/engine/Vst2Format.cpp
  620. src/engine/JsfxFormat.cpp
  621. src/ui/JsfxPanel.cpp
  622. src/engine/MidiFileIo.cpp
  623. src/engine/AudioLogger.cpp
  624. src/engine/MidiSyncIo.cpp
  625. src/engine/AbletonLink.cpp
  626. src/engine/ControllerIo.cpp
  627. src/engine/PreviewPlayer.cpp
  628. src/ui/MainComponent.cpp
  629. src/ui/ChannelRackComponent.cpp
  630. src/ui/PianoRollComponent.cpp
  631. src/ui/PlaylistComponent.cpp
  632. src/ui/AraMenu.cpp
  633. src/ui/PatternBlocksView.cpp
  634. src/ui/MixerComponent.cpp
  635. src/ui/QuickPick.cpp
  636. src/ui/PluginWindow.cpp
  637. src/ui/PluginPresetMenu.cpp
  638. src/ui/GeneratorPresetMenu.cpp
  639. src/ui/ProjectLoading.cpp
  640. src/ui/WindowOwner.cpp
  641. src/ui/PluginKeysTest.cpp
  642. src/ui/ZOrder191Test.cpp
  643. src/ui/ParametricEqEditor.cpp
  644. src/ui/FacetEqEditor.cpp
  645. src/ui/ProEditors.cpp
  646. src/ui/PluginHeader.cpp
  647. src/ui/PluginSkin.cpp
  648. src/ui/PluginEditors.cpp
  649. src/ui/PatcherEditor.cpp
  650. src/ui/RackEditor.cpp
  651. src/ui/DrumRackShot.cpp
  652. src/ui/DynamicsDisplays.cpp
  653. src/ui/ExportDialog.cpp
  654. src/ui/FlStudioExportDialog.cpp
  655. src/ui/AlsExportDialog.cpp
  656. src/ui/DawProjectExport.cpp
  657. src/ui/FlmExportDialog.cpp
  658. src/ui/TrackImportDialog.cpp
  659. src/ui/GamepadInput.cpp
  660. src/ui/ControllerBridge.cpp
  661. src/ui/OtherAppsExport.cpp
  662. src/ui/AutoSamplerDialog.cpp
  663. src/ui/AutomationUi.cpp
  664. src/ui/ModRing.cpp
  665. src/ui/RemoteControl.cpp
  666. src/ui/ControllerEditors.cpp
  667. src/ui/MidiOutEditor.cpp
  668. src/ui/VisualEditors.cpp
  669. src/ui/FlExtraEditors.cpp
  670. src/ui/VisualGl.cpp
  671. src/ui/DanceView.cpp
  672. src/ui/VideoPlayerView.cpp
  673. src/ui/VideoMedia.cpp
  674. src/ui/VideoMediaWindows.cpp
  675. src/ui/VideoTracks.cpp
  676. src/ui/AdrWindow.cpp
  677. src/ui/WaveTravellerEditor.cpp
  678. src/ui/FpcEditor.cpp
  679. src/ui/TetraEditor.cpp
  680. src/ui/LynxModelEditor.cpp
  681. src/ui/DirectWaveEditor.cpp
  682. src/ui/HelixEditor.cpp
  683. src/ui/FruitySlicerEditor.cpp
  684. src/ui/FlVoicePanel.cpp
  685. src/ui/SlicexEditor.cpp
  686. src/ui/NewtoneEditor.cpp
  687. src/ui/ChannelSettings.cpp
  688. src/ui/LayerEditor.cpp
  689. src/ui/Controllers164.cpp
  690. src/ui/VoltageEditor.cpp
  691. src/ui/SoundFontEditor.cpp
  692. src/ui/SamplerImportUi.cpp
  693. src/ui/VfxEditors.cpp
  694. src/ui/BrowserComponent.cpp
  695. src/ui/Theme.cpp
  696. src/ui/ThemeSettings.cpp
  697. src/ui/ColourPicker.cpp
  698. src/ui/AutoLookEditor.cpp
  699. src/ui/TrackIcons.cpp
  700. src/ui/Icons.cpp
  701. src/ui/I18n.cpp
  702. src/ui/EditorTools.cpp)
  703. # workflow shell: workspace desktop, control contract, dialogs
  704. list(APPEND LYNX_APP_SOURCES
  705. src/ui/Workspace.cpp
  706. src/ui/NativeChild.cpp
  707. src/ui/DockPaintCheck.cpp
  708. src/ui/MotionOverlay.cpp
  709. src/ui/ExternalDrag.cpp
  710. src/ui/ExternalDragX11.cpp
  711. src/ui/ValueControl.cpp
  712. src/ui/Dialogs.cpp
  713. src/ui/SetupWizard.cpp
  714. src/ui/Onboarding.cpp
  715. src/ui/MainOnboarding.cpp
  716. src/ui/DemoMode.cpp
  717. src/ui/Splash.cpp)
  718. # main window chrome: hint bar and toolbar widgets
  719. list(APPEND LYNX_APP_SOURCES
  720. src/ui/HintBar.cpp
  721. src/ui/Toolbar.cpp)
  722. # spectral waveforms: background analysis cache and drawing
  723. list(APPEND LYNX_APP_SOURCES
  724. src/ui/WaveformView.cpp)
  725. # workflow P2: note tool dialogs, tool windows, undo history, quick-add palette
  726. list(APPEND LYNX_APP_SOURCES
  727. src/ui/NoteToolDialogs.cpp
  728. src/ui/PianoRollScripts.cpp
  729. src/ui/MidiClipboard.cpp
  730. src/ui/WindowClipboard.cpp
  731. src/ui/LynxWindows.cpp
  732. src/ui/WindowAudio.cpp
  733. src/engine/CrossClipboard.cpp
  734. src/ui/AudioClipboard.cpp
  735. src/ui/EventEditor.cpp
  736. src/ui/TrackerComponent.cpp
  737. src/ui/AudioEditor.cpp
  738. src/ui/AudioEditorTools.cpp
  739. src/ui/ArticulatorTools.cpp
  740. src/ui/SampleProperties.cpp
  741. src/ui/ToolWindow.cpp
  742. src/ui/DeleteFade.cpp
  743. src/ui/StartPage.cpp
  744. src/ui/SpeechDialog.cpp
  745. src/ui/TempoTapper.cpp
  746. src/ui/TempoDetectionDialog.cpp
  747. src/ui/LoopStarterWindow.cpp
  748. src/ui/SimpleWorkflow.cpp
  749. src/ui/LoopInfo.cpp
  750. src/ui/FinishDock.cpp
  751. src/ui/SimpleDock.cpp
  752. src/ui/SimpleTuner.cpp
  753. src/ui/HistoryPanel.cpp
  754. src/ui/VersionsPanel.cpp
  755. src/ui/LyricsPanel.cpp
  756. src/ui/ReferenceMatchPanel.cpp
  757. src/ui/StartFromPanel.cpp
  758. src/ui/FirstSongTour.cpp
  759. src/ui/SupportLynx.cpp
  760. src/ui/PluginsOffPanel.cpp
  761. src/ui/MissingFilesDialog.cpp
  762. src/ui/SettingsDialog.cpp
  763. src/ui/SettingsPages.cpp
  764. src/ui/Notices.cpp
  765. src/ui/HowTo.cpp
  766. src/ui/WorkflowExtras.cpp
  767. src/ui/KeyFocus.cpp
  768. src/ui/PluginManager.cpp
  769. src/ui/ShortcutManager.cpp
  770. src/ui/ActionSearch.cpp
  771. src/ui/NewProjectDialog.cpp
  772. src/ui/ClipProperties.cpp
  773. src/ui/PluginMonitorWindow.cpp
  774. src/ui/ClipGridComponent.cpp
  775. src/ui/GroovePoolComponent.cpp
  776. src/ui/DetailView.cpp
  777. src/ui/ClipAudioPanel.cpp
  778. src/ui/SessionMixer.cpp
  779. src/ui/MapMode.cpp
  780. src/ui/MidiToolsPanel.cpp
  781. src/ui/ChordHelper.cpp
  782. src/ui/TouchKeyboard.cpp
  783. src/ui/TouchInput.cpp
  784. src/ui/QuickAddPalette.cpp
  785. src/ui/PluginPickerView.cpp
  786. src/ui/PickerLook.cpp
  787. src/ui/ProjectPickerView.cpp
  788. src/ui/PluginThumbs.cpp
  789. src/ui/PluginPicker.cpp
  790. src/ui/CrashReporter.cpp
  791. src/ui/Updater.cpp
  792. src/ui/AudioCheck.cpp
  793. src/ui/StemExtract.cpp
  794. src/ui/AudioToMidi.cpp
  795. src/ui/PolyEditor.cpp)
  796. target_sources(LYNX PRIVATE src/Main.cpp ${LYNX_APP_SOURCES})
  797. # Ableton Link 4.1.1 (GPL-2.0-or-later, used under the GPLv3; third_party/link, round 190gl) with its bundled Asio
  798. # (Boost licence): header-only, used by src/engine/AbletonLink.cpp alone (it sets Link's and Asio's macros itself)
  799. set_source_files_properties(src/engine/AbletonLink.cpp PROPERTIES COMPILE_OPTIONS
  800. "$<IF:$<CXX_COMPILER_ID:MSVC>,/external:I${CMAKE_CURRENT_SOURCE_DIR}/third_party/link/include;/external:I${CMAKE_CURRENT_SOURCE_DIR}/third_party/link/asio/include;/external:W0,-isystem;${CMAKE_CURRENT_SOURCE_DIR}/third_party/link/include;-isystem;${CMAKE_CURRENT_SOURCE_DIR}/third_party/link/asio/include>")
  801. target_include_directories(LYNX PRIVATE third_party/onnxruntime) # loaded at run time, never linked
  802. target_include_directories(LYNX PRIVATE third_party/clap/include)
  803. target_include_directories(LYNX PRIVATE third_party/ara) # (ARA_API / ARA_Library, round 190kx)
  804. # the commit the build comes from (crash reports name it, round 159)
  805. execute_process(COMMAND git rev-parse --short=10 HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  806. OUTPUT_VARIABLE LYNX_GIT_COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
  807. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lynx_build/lynx_build.h "#pragma once\n#define LYNX_GIT_COMMIT \"${LYNX_GIT_COMMIT}\"\n")
  808. target_include_directories(LYNX PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/lynx_build)
  809. target_compile_definitions(LYNX PRIVATE
  810. JUCE_WEB_BROWSER=0
  811. JUCE_USE_CURL=0
  812. JUCE_PLUGINHOST_VST3=1
  813. # ARA 2 hosting (round 190kx): Celemony's ARA SDK 2.1 headers and library sources in third_party/ara (Apache-2.0)
  814. JUCE_PLUGINHOST_ARA=1
  815. # MP3 is read by LYNX (src/engine/Mp3Format, minimp3; round 157b), not by JUCE's MP3AudioFormat
  816. JUCE_USE_MP3AUDIOFORMAT=0
  817. JUCE_APPLICATION_NAME_STRING="$<TARGET_PROPERTY:LYNX,JUCE_PRODUCT_NAME>"
  818. JUCE_APPLICATION_VERSION_STRING="$<TARGET_PROPERTY:LYNX,JUCE_VERSION>")
  819. # per-platform audio drivers and plugin formats (docs/PLATFORMS.md)
  820. if(WIN32)
  821. target_include_directories(LYNX PRIVATE third_party/asiosdk/common)
  822. target_compile_definitions(LYNX PRIVATE JUCE_ASIO=1) # ASIO SDK headers in third_party/asiosdk (GPLv3 option)
  823. target_link_libraries(LYNX PRIVATE winhttp bcrypt advapi32) # live sessions' WebSocket (engine/LiveLink.cpp)
  824. target_link_libraries(LYNX PRIVATE ws2_32 iphlpapi) # Ableton Link's sockets and network interfaces (round 190gl)
  825. # the system's video decoder (round 174d) and AAC encoder (M4A export, engine/AacEncoderWindows.cpp)
  826. target_link_libraries(LYNX PRIVATE mfplat mfreadwrite mfuuid propsys)
  827. elseif(APPLE)
  828. target_compile_definitions(LYNX PRIVATE JUCE_PLUGINHOST_AU=1)
  829. # the system's video decoder (round 174d, ui/VideoMediaMac.mm; manual retain / release)
  830. target_sources(LYNX PRIVATE src/ui/VideoMediaMac.mm)
  831. set_source_files_properties(src/ui/VideoMediaMac.mm PROPERTIES COMPILE_OPTIONS "-fno-objc-arc")
  832. # the moving marks as Core Animation layers (round 190jx, ui/MotionOverlayMac.h; off by default: LYNX_OVERLAY_MAC=1)
  833. target_sources(LYNX PRIVATE src/ui/MotionOverlayMac.mm)
  834. set_source_files_properties(src/ui/MotionOverlayMac.mm PROPERTIES COMPILE_OPTIONS "-fno-objc-arc")
  835. target_link_libraries(LYNX PRIVATE "-framework QuartzCore")
  836. target_link_libraries(LYNX PRIVATE "-framework AVFoundation" "-framework CoreMedia" "-framework CoreVideo")
  837. target_link_libraries(LYNX PRIVATE "-framework AudioToolbox" "-framework CoreFoundation") # M4A export (engine/AacEncoderMac.cpp)
  838. target_link_libraries(LYNX PRIVATE ${CMAKE_DL_LIBS}) # (libcurl loaded at run time: engine/LiveLink.cpp)
  839. # the main thread's stack: 32 MB instead of macOS's fixed 8 MB (rollup 0.1.31 step 6). --selftest keeps its items'
  840. # engines and songs on the main thread's stack (round 190mo: 7.4 MB; GCC's frame is 9.2 MB at step 6) and Linux
  841. # raises its limit at run time (platform::allowMainThreadStack); on macOS only the linker sets it, and CI's App
  842. # macOS self-test was killed at its first line. Reserved address space only
  843. target_link_options(LYNX PRIVATE "LINKER:-stack_size,0x2000000")
  844. else()
  845. # ALSA (linked) + JACK (loaded at run time; PipeWire serves JACK clients through pipewire-jack)
  846. target_compile_definitions(LYNX PRIVATE JUCE_ALSA=1 JUCE_JACK=1 JUCE_PLUGINHOST_LV2=1)
  847. # LYNX's own PipeWire driver (round 161): vendored MIT headers, libpipewire-0.3.so.0 loaded at run time
  848. target_include_directories(LYNX SYSTEM PRIVATE third_party/pipewire/include/pipewire-0.3 third_party/pipewire/include/spa-0.2)
  849. target_link_libraries(LYNX PRIVATE ${CMAKE_DL_LIBS})
  850. # the X server draws the moving marks (round 190jx, ui/MotionOverlayX11.h; libX11 / libXrender loaded at run time
  851. # as JUCE loads them: only their headers are needed)
  852. target_sources(LYNX PRIVATE src/ui/MotionOverlayX11.cpp)
  853. endif()
  854. # the UI font on Linux and the BSDs (src/ui/Theme.cpp); Windows and macOS use their own and don't carry the files
  855. if(UNIX AND NOT APPLE)
  856. juce_add_binary_data(LynxFontData
  857. HEADER_NAME LynxFontData.h
  858. NAMESPACE lynxfontdata
  859. SOURCES resources/fonts/OpenSans-Regular.ttf resources/fonts/OpenSans-Bold.ttf)
  860. target_link_libraries(LYNX PRIVATE LynxFontData)
  861. target_compile_definitions(LYNX PRIVATE LYNX_BUNDLED_FONT=1)
  862. endif()
  863. target_link_libraries(LYNX
  864. PRIVATE
  865. lynx_core
  866. juce::juce_audio_utils
  867. juce::juce_audio_processors
  868. juce::juce_dsp
  869. juce::juce_opengl
  870. PUBLIC
  871. juce::juce_recommended_config_flags)
  872. # LTO for the shipped app; the Tests workflow builds without it (round speed185a: the LTO link was 7 of the 8.5
  873. # minutes of a cached CI App build). -DLYNX_LTO=OFF
  874. option(LYNX_LTO "Link the app with link-time optimisation" ON)
  875. if(LYNX_LTO)
  876. target_link_libraries(LYNX PUBLIC juce::juce_recommended_lto_flags)
  877. endif()
  878. add_executable(lynx_remote_project_tests
  879. tests/RemoteProjectControlTests.cpp
  880. src/engine/RemoteProjectDocument.cpp
  881. src/engine/ProjectFile.cpp
  882. tests/TrEnglish.cpp) # (ProjectFile.cpp's tr(), rollup 0.1.32 step 5)
  883. target_include_directories(lynx_remote_project_tests PRIVATE src)
  884. target_compile_definitions(lynx_remote_project_tests PRIVATE JUCE_USE_CURL=0 JUCE_WEB_BROWSER=0
  885. JUCE_APPLICATION_VERSION_STRING="${PROJECT_VERSION}")
  886. target_link_libraries(lynx_remote_project_tests PRIVATE lynx_core juce::juce_core)
  887. if(WIN32)
  888. target_link_libraries(lynx_remote_project_tests PRIVATE bcrypt advapi32)
  889. endif()
  890. add_test(NAME lynx_remote_project_tests COMMAND lynx_remote_project_tests)
  891. # round 190nz (issue #232 stage 2): the cross-window clipboard's documents and side file
  892. add_executable(lynx_crossclipboard_tests
  893. tests/CrossClipboardTests.cpp
  894. src/engine/CrossClipboard.cpp
  895. src/engine/ProjectFile.cpp
  896. tests/TrEnglish.cpp) # (ProjectFile.cpp's tr(), rollup 0.1.32 step 5)
  897. target_include_directories(lynx_crossclipboard_tests PRIVATE src)
  898. target_compile_definitions(lynx_crossclipboard_tests PRIVATE JUCE_USE_CURL=0 JUCE_WEB_BROWSER=0
  899. JUCE_APPLICATION_VERSION_STRING="${PROJECT_VERSION}")
  900. target_link_libraries(lynx_crossclipboard_tests PRIVATE lynx_core juce::juce_core)
  901. if(WIN32)
  902. target_link_libraries(lynx_crossclipboard_tests PRIVATE bcrypt advapi32)
  903. endif()
  904. add_test(NAME lynx_crossclipboard_tests COMMAND lynx_crossclipboard_tests)
  905. endif()
  906. # LYNX's own effects and instruments as VST3 / CLAP plugins for other hosts (round 180b, docs/PLUGIN_EXPORT.md). Off by
  907. # default: nothing of it is configured or compiled in the normal build.
  908. option(LYNX_BUILD_PLUGINS "Build LYNX's own plugins as VST3 and CLAP" OFF)
  909. if(LYNX_BUILD_APP AND LYNX_BUILD_PLUGINS)
  910. include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/LynxPlugins.cmake)
  911. endif()
  912. if(LYNX_BUILD_APP AND UNIX AND NOT APPLE)
  913. # one binary for many distributions: the C++ runtime goes inside (glibc and the desktop libraries stay shared)
  914. target_link_options(LYNX PRIVATE -static-libstdc++ -static-libgcc)
  915. endif()
  916. # LYNX ASIO: universal ASIO driver on WASAPI (REA round 97), an in-process COM DLL registered with regsvr32
  917. if(WIN32)
  918. add_library(lynx-asio SHARED asio/LynxAsio.cpp asio/lynx-asio.def)
  919. target_include_directories(lynx-asio PRIVATE third_party/asiosdk/common)
  920. target_compile_definitions(lynx-asio PRIVATE UNICODE _UNICODE)
  921. target_link_libraries(lynx-asio PRIVATE ole32 uuid avrt user32 gdi32 advapi32)
  922. endif()