csound / plugins

Repository for Csound plugins which were originally in the main repository, and for new plugins as well.
GNU Lesser General Public License v2.1
11 stars 11 forks source link

Building ableton-link opcode on Windows #24

Open giohappy opened 5 months ago

giohappy commented 5 months ago

I'm trying to build the ableton-link opcode with MSVC (Visual Studio 2022).I've turned off all the other opcodes.

When I build the Debug configuration I get link errors because of the --Wno-multichar and the --std=gnu++11 flags. I suppose these configurations are meant for MinGW.

I've tried to adapt the CMake files for MSVC but with no luck.

I have also tried enabling vpkg but (I don't understand why) triggers the EIGEN3 requirement. I've downloaded it and configured the path but FindEIGEN3 still complains...

In the end, what's the proper setup to have these plugins compiled on Windows?

stekyne commented 5 months ago

Hi @giohappy. I have a branch #19 that has this working better than what's in the main branch. Maybe you can try this? I should merge this PR for the Windows build. Please let me know how it goes

giohappy commented 5 months ago

Thanks @stekyne. I'll give it a try later today.

giohappy commented 5 months ago

@stekyne FYI I've tried a build of vcpkg_linux (the branch of your PR #19) with the github workflow on my fork but it fails. By the way I see that the automated build uses MSYS. It seems that Csound, in general, uses MSYS for Windows. If it's the case I will switch to it.

stekyne commented 5 months ago

@giohappy I think the faust plugin is failing to build on Windows but the rest should be ok. It has been a while since I checked to be honest.

Where are you seeing MSYS? We only use MSVC for Windows these days.

giohappy commented 5 months ago

@stekyne I had to take a crash course on vcpkg to get my head around the build system :). I never used it before. After bootstrapping vcpkg I was able to have the requirements built and installed. I was confused by the MSYS packages I see when vcpkg builds some of the dependencies.

At the moment I'm stuck at the end of the CMake configuration process, with a missing CMAKE_INCLUDE_DIR error. I'm not sure if CSound should come from vcpkg too, I thought yes.

-- CSOUND_LIBRARY (missing: CSOUND_INCLUDE_DIR)
CMake Error at CMakeLists.txt:44 (message):
  Csound header files are required

These are the stpes I do to execute CMake:

./vcpkg/bootstrap-vcpkg.bat
cmake -S . -B build -DUSE_VCPKG=1
giohappy commented 5 months ago

After settings CMAKE_INCLUDE_DIR I was able to complete the configturation. There a few parts that have been configured disabled but it's a step ahead...

-- Running vcpkg install - done
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- Found CSOUND: D:/me/MUSICA/dev/csound/csound/include
-- Performing Test HAS_TREE_VECTORIZE
-- Performing Test HAS_TREE_VECTORIZE - Failed
-- Performing Test HAS_CXX_TREE_VECTORIZE
-- Performing Test HAS_CXX_TREE_VECTORIZE - Failed
-- Performing Test HAS_FAST_MATH
-- Performing Test HAS_FAST_MATH - Failed
-- Performing Test HAS_CXX_FAST_MATH
-- Performing Test HAS_CXX_FAST_MATH - Failed
-- Performing Test HAS_FPMATH_SSE
-- Performing Test HAS_FPMATH_SSE - Failed
-- Performing Test HAS_CXX_FPMATH_SSE
-- Performing Test HAS_CXX_FPMATH_SSE - Failed
-- Performing Test HAS_SSE2
-- Performing Test HAS_SSE2 - Failed
-- Performing Test HAS_CXX_SSE2
-- Performing Test HAS_CXX_SSE2 - Failed
-- Performing Test HAS_OMIT_FRAME_POINTER
-- Performing Test HAS_OMIT_FRAME_POINTER - Failed
-- Performing Test HAS_CXX_OMIT_FRAME_POINTER
-- Performing Test HAS_CXX_OMIT_FRAME_POINTER - Failed
-- Performing Test HAS_VISIBILITY_HIDDEN
-- Performing Test HAS_VISIBILITY_HIDDEN - Failed
-- Performing Test HAS_CXX_VISIBILITY_HIDDEN
-- Performing Test HAS_CXX_VISIBILITY_HIDDEN - Failed
-- Performing Test HAS_GNU99
-- Performing Test HAS_GNU99 - Failed
-- Building with 64-bit floats
-- Csound headers: D:/me/MUSICA/dev/csound/csound/include
-- Plugins to be installed at: C:\Users\giohappy\AppData\Local/csound/6.0/plugins64
-- BUILD_CHUA_OPCODES is enabled.
-- FAUST_INCLUDE_DIR (missing: FAUST_LIBRARY)
-- FAUST_FOUND="FALSE", so disabling BUILD_FAUST_OPCODES
-- BUILD_FAUST_OPCODES is disabled.
-- Found ZLIB: optimized;D:/me/MUSICA/dev/csound/csound-plugins/build/vcpkg_installed/x64-windows-csound/lib/zlib.lib;debug;D:/me/MUSICA/dev/csound/csound-plugins/build/vcpkg_installed/x64-windows-csound/debug/lib/zlibd.lib (found version "1.2.13")
-- Found PNG: optimized;D:/me/MUSICA/dev/csound/csound-plugins/build/vcpkg_installed/x64-windows-csound/lib/libpng16.lib;debug;D:/me/MUSICA/dev/csound/csound-plugins/build/vcpkg_installed/x64-windows-csound/debug/lib/libpng16d.lib (found version "1.6.39")
-- BUILD_IMAGE_OPCODES is enabled.
-- Found Python3: C:/Users/giohappy/AppData/Local/Programs/Python/Python312/python.exe (found version "3.12.2") found components: Interpreter Development Development.Module Development.Embed
-- BUILD_PYTHON_OPCODES is enabled.
-- Python include dirs: C:/Users/giohappy/AppData/Local/Programs/Python/Python312/include
-- Python libraries: C:/Users/giohappy/AppData/Local/Programs/Python/Python312/libs/python312.lib
-- USE_FLTK is enabled.
-- Ableton Link home:
-- Dependency asio found in D:/me/MUSICA/dev/csound/csound-plugins/build/vcpkg_installed/x64-windows-csound/share/asio
-- Building STK opcodes for MSVC
-- Not building the CUDA opcodes
-- BUILD_OPENCL_OPCODES is disabled.
-- Found HDF5: hdf5::hdf5-static (found version "1.14.0")
-- BUILD_HDF5_OPCODES is enabled.
-- Could NOT find GMM (missing: GMM_INCLUDE_DIR)
-- GMM_FOUND="FALSE", so disabling BUILD_LINEAR_ALGEBRA_OPCODES
-- BUILD_LINEAR_ALGEBRA_OPCODES is disabled.
-- Building MP3 opcodes
-- WIIUSE_LIB="WIIUSE_LIB-NOTFOUND", so disabling BUILD_WIIMOTE_OPCODES
-- BUILD_WIIMOTE_OPCODES is disabled.
-- P5GLOVE_LIB="P5GLOVE_LIB-NOTFOUND", so disabling BUILD_P5GLOVE_OPCODES
-- BUILD_P5GLOVE_OPCODES is disabled.
-- JACK_LIB="JACK_LIB-NOTFOUND", so disabling BUILD_JACK_OPCODES
-- BUILD_JACK_OPCODES is disabled.
-- Found FLUIDSYNTH: D:/me/MUSICA/dev/csound/csound-plugins/build/vcpkg_installed/x64-windows-csound/debug/lib/fluidsynth.lib
-- BUILD_FLUID_OPCODES is enabled.
-- Configuring done (26.6s)
-- Generating done (0.2s)
-- Build files have been written to: D:/me/MUSICA/dev/csound/csound-plugins/build
giohappy commented 5 months ago

After a few trials I was able to build from the vcpkg_linux, except fluidOpcodes becase it couldn't link glib

stekyne commented 5 months ago

If using that branch, it should include the csound headers. Maybe delete your cmake build dir and try again. I've added some to this repo, which isn't ideal but the API is pretty stable and not changing frequently. It prevents the need for the csound install. Ideally csound would be a vcpkg itself but we haven't got around to doing that.

Fluid opcodes have issues yeah. I think that's one of the reasons I didn't merge this yet. Unfortunately the less used packages in VCPKG don't always have great testing. It seems glib, which is a dependency of fluidsynth, is not so good as a static lib for certain platforms.

giohappy commented 5 months ago

I was able to build and load the ableton-link pugin in the end (btw it's not very usable at the moment since it has a very high jitter). Thanks for your support @stekyne.

As I said I also tried setting the CSOUND_INCLUDE_DIR (with the develop) branch, and the CMake configuration went fine. However, it couldn't compile because I was using the include from Csound's source code (where many header files are input files, like version.h.in), instead of the one bundled with the Csound binaries. Maybe I'll try again the next days, with the right include dir.

I'm aware that managing such a complex cross-platform codebase is hard!

Feel free to close this issue if you want. Or maybe let's wait to have your PR merged.