admsyn / ofxAudioUnit

An openFrameworks addon which makes it easy to work with Audio Units on OSX and iOS
MIT License
120 stars 24 forks source link

ARC Compatibility #38

Open dimitre opened 1 year ago

dimitre commented 1 year ago

Hello @admsys thanks for this great addon. I'm just writing to notify OF project transitioned to ARC and next release will be out soon. Thank you

dimitre commented 11 months ago

OF 0.12.0 is out finally !

admsyn commented 10 months ago

Hi @dimitre! thanks for the nudge, I don't have a mac development system around these days unfortunately. This will have to sit for a while unless someone can open a PR for it.

dimitre commented 10 months ago

Thank you! I'll copy @2bbb and @artificiel here, in the case they have time to have a look.

2bbb commented 10 months ago

@dimitre

maybe supporting ARC is not so hard. we need to fix only ofxAudioUnitCocoaUtilties.mm.

but those codes are not regular method names or implementations of Objective-C style, about initXXX. basically methods named as initXXX need to returns instancetype (i.e. class itself). and I can't understand enough what those codes want to do actually and relations.

so, I can support to fix but I can't do by myself. sorry!

roymacdonald commented 7 months ago

Hi, I've found that the easiest way to support ARC and for this addon to work with OF0.12 is to add the -fno-objc-arc flag to ofxAudioUnitCocoaUtilties.mm. Check this screenshot on where to click and just paste there the -fno-objc-arc flag. compile as usual.

Screen Shot 2023-12-16 at 21 09 58
dimitre commented 7 months ago

this would be a great addition to projectGenerator, if we could configure compiler flags to specific files.

artificiel commented 7 months ago

I think a generic post-processing step would be great as it allows to solve a variety of problems.

there is already a proposal for a post-compile step: https://github.com/openframeworks/projectGenerator/pull/217 perhaps a similar ADDON_AFTER_PROJECT_GENERATED that allows an addon author to script actions to be performed right after generation?

(that being said, robustly scripting modifications to xcodeproj is not a solved problem by itself, unless some new methods appeared in the past year or so?)

roymacdonald commented 7 months ago

@artificiel certainly it would be great, but it falls out of the scope of this. Although a post compile would not fix this issue as it is a compilation issue.

artificiel commented 7 months ago

@roymacdonald about scope maybe i misunderstood @dimitre's idea but it requires some changes to to have instructions in addon.make so PG can mark some files as no-objc-arc — my suggestion was to investigate a generic post-processing step (beyond something specific to project file attributes).

as for the reference to https://github.com/openframeworks/projectGenerator/pull/217 it was to give an example of a design that could serve as inspiration, but yeah a post-compile would not fix this issue hence my suggestion of implementing something like ADDON_AFTER_PROJECT_GENERATED

roymacdonald commented 7 months ago

@artificiel I get what you mean. :) I just meant that discussing any fix to the PG was out of the scope of this issue and addon. But for sure it would be great if we already had something in PG that would allow to set something in the addon_config.mk file that would allow to put those flags in it.