Transition to ZMusic as DLL

Sat Feb 15, 2020 3:31 am

I just pushed a commit that completes the transition of the entire music playback code as a separate DLL.
This was done to avoid maintaining this code in separate project, both public and private.

The new project will still out of the box on Windows but you will now need to get the DLL from here, until these are available in GZDoom release packages.
For Linux and Mac users the following needs to be run before compiling GZDoom:

Code:
git clone https://github.com/coelckers/ZMusic.git
cd ZMusic
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=`pwd`/../build_install ..
make install


You may have to delete your CMake cache and rebuild it for the changes to work because it may happen that the dependencies will not be fully updated.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 4:22 am

Most likely, removal of cache is needed if you want to use CMAKE_PREFIX_PATH for ZMusic header and library discovery.
Code:
cmake -DCMAKE_PREFIX_PATH=/path/to/build_install ...

Setting ZMUSIC_INCLUDE_DIR and ZMUSIC_LIBRARIES directly should not require this.
Code:
cmake -DZMUSIC_INCLUDE_DIR=/path/to/build_install/include -DZMUSIC_LIBRARIES=/path/to/build_install/lib/libzmusic.so ... # Linux
cmake -DZMUSIC_INCLUDE_DIR=/path/to/build_install/include -DZMUSIC_LIBRARIES=/path/to/build_install/lib/libzmusic.dylib ... # macOS

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 4:35 am

The problem I had was that the cache retained the old dependencies and I couldn't make it forget about them.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 9:47 am

OK, so how does this work? I tried building gzdoom on devuan this afternoon having not seen this post, did what the post says, but I still get this:

Code:
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29")
CMake Error at /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find ZMusic (missing: ZMUSIC_LIBRARIES ZMUSIC_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindZMusic.cmake:21 (find_package_handle_standard_args)
  src/CMakeLists.txt:20 (find_package)


is there some way to tell the gzdoom stuff where ZMusic is? Or is ZMusic expected to be in a specific relative path to gzdoom?

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 10:11 am

If all else fails you have to specify the path manually, I think _mental_ can give you better help, he wrote the script for the dependency.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 10:12 am

MartinHowe wrote:is there some way to tell the gzdoom stuff where ZMusic is?

Read my post above, it's exactly about how to do this.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 12:35 pm

Does the ZMusic DLL replace the lib*.dll files from previous distributions?

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 12:50 pm

Now when i try to compile with MinGW i get the following error:
Code:
CMake Error at C:/DEV/cmake-3.12.4-win64-x64/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find ZMusic (missing: ZMUSIC_LIBRARIES ZMUSIC_INCLUDE_DIR)
Call Stack (most recent call first):
  C:/DEV/cmake-3.12.4-win64-x64/share/cmake-3.12/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/FindZMusic.cmake:21 (find_package_handle_standard_args)
  src/CMakeLists.txt:20 (find_package)

Edit: it's compiling now.
Last edited by drfrag on Sat Feb 15, 2020 1:05 pm, edited 2 times in total.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 12:51 pm

Nash wrote:Does the ZMusic DLL replace the lib*.dll files from previous distributions?
Simply adds to them, AFAIK.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 1:10 pm

The existing DLLs will remain, it makes little sense to incorporate all that code into zmusic as well - all this did was to offload the entire music system into a reusable subproject.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 1:12 pm

What's the difference between ZMusic.dll and ZMusicLite.dll and should I have both alongside gzdoom.exe?

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 1:28 pm

Okay I have no idea what the hell I'm doing.

Is there a completely idiot-proof step by step way of getting the new dev versions to compile?

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 1:32 pm

Nash wrote:What's the difference between ZMusic.dll and ZMusicLite.dll and should I have both alongside gzdoom.exe?

The lite version is missing the other MIDI players I think.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 1:33 pm

Nash wrote:What's the difference between ZMusic.dll and ZMusicLite.dll and should I have both alongside gzdoom.exe?


No, the lite version is just the GPL free subset - in case someone wants to use this in a non-GPL project, e.g. Raze uses that because it cannot use GPL code with its licensing mess.


Matt wrote:Okay I have no idea what the hell I'm doing.
Is there a completely idiot-proof step by step way of getting the new dev versions to compile?


When it comes to compiling complex projects with dependencies there is no such thing as idiot-proof-ness.
Normally it should work if you follow _mental_*s instructions.

Re: Transition to ZMusic as DLL

Sat Feb 15, 2020 1:51 pm

Working now that I'm no longer trying to think of another thing I'm trying to do and can actually sit down and read and critically process instructions.

In case anyone else has a similar problem: Mental's "-DZMUSIC_INCLUDE_DIR=..." stuff is supposed to be added to the cmake command in Graf's OP not entered as a separate command.