问题
I'm currently using the theos build system to write applications and tweaks for jailbroken iPhones. Is there a way for me to enable automatic reference counting for specific projects with theos?
I've Googled and tried to decipher the theos makefiles, but I haven't been able to find anything.
回答1:
See https://github.com/Maxner/BrightnessFix/blob/master/Makefile
ARCHS=armv7 armv7s
TARGET_IPHONEOS_DEPLOYMENT_VERSION = 6.0
TARGET_CC = xcrun -sdk iphoneos clang
TARGET_CXX = xcrun -sdk iphoneos clang++
TARGET_LD = xcrun -sdk iphoneos clang++
SHARED_CFLAGS = -fobjc-arc
include theos/makefiles/common.mk
TWEAK_NAME = BrightnessFix
BrightnessFix_FILES = Tweak.xm
BrightnessFix_FRAMEWORKS = UIKit
include $(THEOS_MAKE_PATH)/tweak.mk
SHARED_CFLAGS = -fobjc-arc
is what you are looking for.
回答2:
I'm not going to unaccept the above answer, because I suspect that this might just have to do with having different versions of theos
, and the answer above definitely put me on the right track to finding what I needed. It turns out, at least for my version of theos
, the environment variable to set is
ADDITIONAL_OBJCFLAGS = -fobjc-arc
(ADDITIONAL_CFLAGS
is also an option, but I don't think there's an opportunity where it matters whether you enable ARC on straight-C code anyways).
来源:https://stackoverflow.com/questions/15628108/enable-arc-for-theos-build-system