DISTRHO / JUCE

The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
Other
34 stars 11 forks source link

Diff to make Surge-XT LV2 Buildable with JUCE6 CMake #14

Closed baconpaul closed 3 years ago

baconpaul commented 3 years ago

If I patch your lib with

paul@ubuntu:~/ldev/surge/libs/distrho-juce-main/juce$ git diff
diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake
index 7f6c910..7f3fa56 100644
--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -333,7 +333,7 @@ endfunction()
 # ==================================================================================================

 function(_juce_get_all_plugin_kinds out)
-    set(${out} AU AUv3 AAX Standalone Unity VST VST3 PARENT_SCOPE)
+    set(${out} AU AUv3 LV2 AAX Standalone Unity VST VST3 PARENT_SCOPE)
 endfunction()

 function(_juce_get_platform_plugin_kinds out)
@@ -348,7 +348,7 @@ function(_juce_get_platform_plugin_kinds out)
     endif()

     if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
-        list(APPEND result AAX Unity VST)
+        list(APPEND result AAX Unity VST LV2)

         if(NOT MINGW AND NOT MSYS)
             list(APPEND result VST3)

then add LV2 to the surge cmakelists formats and also define JucePlugin_LV2URI=Foo in my target_compile_definitions, I get a linked LV2. It's only an SO though, no ttl. But thought I would share.

KottV commented 3 years ago

Here is the PR with LV2 for cmake https://github.com/DISTRHO/JUCE/pull/13 with invocation of ttl generator. It works, but hasn't finally discussed and adopt.

baconpaul commented 3 years ago

Oh ha cool. And it does seem like it's always the same 5 or 6 people kicking around on these issues. jatin has been adding a bunch to surge, etc....

we are moving surge proper to juce after we ship 19 and we hope that will get us an LV2 back. But we have other juce synths. Would be great if the LV2 Cmake stuff was in @falkTX mainline and then maybe I could try TWS or SurgeFXbank or some such?

KottV commented 3 years ago

You can play with that fork https://github.com/lv2-porting-project/JUCE/tree/lv2 just for testing will it work for you.

Would be great if the LV2 Cmake stuff was in @falkTX mainline

Yeah, build with cmake is much easy than by Projucer and it's automated-builds-friendly.

baconpaul commented 3 years ago

cool. i'll look this week.

i also don't really remember how to run an lv2 once i have it. I guess move it to ~/.lv2, start ardour on linux, and hope? I'm sure I can figure it out. Right now I'm a bit up to my neck with new surge 1.9 features (1.9 is gonna be awesome!).

KottV commented 3 years ago

yes, ~/.lv2 is the place simplest way - install jalv https://packages.ubuntu.com/search?suite=all&searchon=names&keywords=jalv, then run (with jackd started): jalv.gtk https://surge-synthesizer.github.io/lv2/surge

or install Carla, rescan lv2 then add surge or any Linux opensource DAW (and even Reaper 6.24-rc) supports it

KottV commented 3 years ago

also look at @jatinchowdhury18 work https://github.com/Chowdhury-DSP/ChowMatrix/

KottV commented 3 years ago

@baconpaul here is the stochas with lv2 https://build.opensuse.org/package/show/home:kill_it:JUCE/stochas if you interested

baconpaul commented 3 years ago

@KottV any chance you can give surge a whirl? There's a (somewhat broken) alpha version that builds at head now and that also builds the (not at all alpha, production) surge effects bank, all using juce cmake.

KottV commented 3 years ago

@KottV any chance you can give surge a whirl? There's a (somewhat broken) alpha version that builds at head now and that also builds the (not at all alpha, production) surge effects bank, all using juce cmake.

Ok, it builds .so but segfaults on generating .ttl

 gdb -ar lv2_ttl_generator ./Surge\ XT.so
GNU gdb (GDB; openSUSE Tumbleweed) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from lv2_ttl_generator...
(gdb) run
Starting program: /home/kv/bin/lv2_ttl_generator ./Surge\ XT.so
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Generate ttl data for './Surge XT.so', basename: 'Surge XT'
Writing manifest.ttl...
Program received signal SIGBUS, Bus error.
0x00007ffff65137b8 in SurgeSynthProcessor::getProgramName(int) () from ./Surge XT.so
(gdb) bt
#0  0x00007ffff65137b8 in SurgeSynthProcessor::getProgramName(int) () from ./Surge XT.so
#1  0x00007ffff6509d74 in createLv2Files(char const*) () from ./Surge XT.so
#2  0x0000000000401348 in main ()
baconpaul commented 3 years ago

Oh that's great to know.

So: How do I get it that far? We could move this to an issue over in surge.

Almost definitely this is happening because surge assumes assets installed to run. In the old surge LV2 generator we have to thread a signal through saying that we are in ttl generating mode; probably have to do same here.

KottV commented 3 years ago

Actually you've got it in the first post.

I did next: replace libs/juce-6.0.7/juce with that fork https://github.com/lv2-porting-project/JUCE/tree/lv2 change from line 1493 in https://github.com/surge-synthesizer/surge/blob/main/CMakeLists.txt#L1493 URI can be any different of course:

            FORMATS AU VST3 Standalone LV2
            LV2_URI https://surge-synthesizer.github.io/lv2/surge_xt

configure:

cmake -Bbuildxt -DBUILD_SURGE_JUCE_PLUGINS=True -DLV2_TTL_GENERATOR=/usr/bin/lv2_ttl_generator

make

cmake --build buildxt --config Debug --target surge-xt_LV2 -j8

/usr/bin/lv2_ttl_generator is from https://github.com/lv2-porting-project/lv2-ttl-generator you might replace it with your own

as it fails to generate .ttl the cmake will delete Surge XT.so so it's worth to comment generation part https://github.com/lv2-porting-project/JUCE/blob/lv2/extras/Build/CMake/JUCEUtils.cmake#L1325 from L1325 to L1339 for testing

baconpaul commented 3 years ago

OK to avoid spamming up @falkTX ’s github, I moved this over to https://github.com/surge-synthesizer/surge/issues/4030 and will close this.