libgme / game-music-emu

Blargg's video game music emulation library, which allows audio applications to easily add playback support for the music of many classic video game consoles.
GNU Lesser General Public License v2.1
68 stars 12 forks source link

Does this support CMake find_package? #25

Open Wohlstand opened 6 years ago

Wohlstand commented 6 years ago

Original report by jimbo1qaz (Bitbucket: jimbo1qaz, ).


I'm new to CMake, and am trying to setup CMake for towave in order to link statically with this library (instead of Ubuntu's bundled gme with poor ym2612 emulation). Does this library support find_package?

https://www.youtube.com/watch?v=eC9-iRN2b04 ?

https://stackoverflow.com/questions/22450776/generate-find-cmake-automatically-and-install-it-for-importing ?

Wohlstand commented 6 years ago

Original comment by jimbo1qaz (Bitbucket: jimbo1qaz, ).


OS: Ubuntu 18.04.

Ended up importing the library using add_subdirectory(game-music-emu) which worked.

Configuring static linking was difficult for me to find how to work. After much suffering, I found that SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared GME library") worked.

However, static linking ended up triggering thousands of linker errors, since -static-libubsan wasn't passed to GCC. To fix this issue, I partially modernized CMakeLists:

Now, target_link_libraries(towave PRIVATE gme) automatically inherits -static-libubsan.

https://github.com/jimbo1qaz/towave-j/commits/master/game-music-emu I think I should squash the 2 commits before sending a PR here.

Wohlstand commented 6 years ago

Original comment by Michael Pyne (Bitbucket: mpyne, GitHub: mpyne).


I added the CMake support before I realized that there was a difference between CMake config mode and module mode for FindPackage.

Although I'm mainly a C++ dev myself, the pkg-config interface is currently the only supported export interface (and that's in the gme/CMakeLists.txt, not the toplevel). That's mostly just due to lack of time, I'd be happy to add the proper CMake bits.