ft2-clone icon indicating copy to clipboard operation
ft2-clone copied to clipboard

Make CMakeLists.txt work on mac os too

Open fgaz opened this issue 4 years ago • 4 comments

In NixOS we use cmake to build this package, and I noticed that it'd only require a few CMakeLists.txt modifications to make it work on mac os too, namely:

  • define __MACOSX_CORE__ instead of __LINUX_ALSA__ when building on mac os
  • add the -framework CoreAudio -framework CoreMIDI -framework CoreServices -framework Cocoa linking flags when building on mac os (not sure how this is done in cmake)
  • only link asound when building on linux

this would make it possible to drop the ad-hoc make-*.sh scripts

fgaz avatar Jan 02 '21 18:01 fgaz

I don't really know how to make makefiles, so someone else has to do this. Also it's important that CMakeLists.txt still works for Linux...

8bitbubsy avatar Jan 02 '21 18:01 8bitbubsy

I don't really know how to make makefiles, so someone else has to do this

I know how to make basic makefiles, but I also don't really know cmake. On the NixOS package I'm applying the mac fixes externally. @OPNA2608 are you familiar with it and willing to give a hand? Otherwise I guess I can just dive into the docs and figure out something.

Also it's important that CMakeLists.txt still works for Linux

This shouldn't be a problem if all of the above fixes are applied conditionally

fgaz avatar Jan 02 '21 18:01 fgaz

Sorry, I completely missed the ping :sweat_smile:. I pushed a PR that fixes the defines & library linking on macOS without breaking the Linux build.

OPNA2608 avatar Feb 10 '22 10:02 OPNA2608

this would make it possible to drop the ad-hoc make-*.sh scripts

Note that I only fixed the regular build process on macOS. make-macos.sh does much more than just build though - it generates a universal x86_64/arm64 binary, constructs a macOS bundle & fixes up dependency paths with install_name_tool.

All of that can be done with CMake as well, but it would require more changes than I'm able to test properly & have past experience with. As-is, it's not able to deprecate make-macos.sh yet.

OPNA2608 avatar Feb 10 '22 12:02 OPNA2608

This has been fixed in the latest commit. Please let me know if it's still not correct!

8bitbubsy avatar Sep 26 '23 21:09 8bitbubsy