4

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.

drewmm
  • 737
  • 6
  • 17
  • I don't think it does, as ARC is supplied by the xcode compiler, and in Theos you have to hardcode everything. I would try iOSOpenDev, because you can make a tweak using Logos, and basically everything you would make with theos. Also, you can make those in Xcode, with code completion and ARC. – Chris Loonam Mar 26 '13 at 02:12
  • I *believe* that theos uses the same compiler as Xcode (llvm), and there should be a way to set up the compiler flags... I think. I've had lots of problems with iOSOpenDev (plus I prefer Sublime Text to Xcode as a code editor.) – drewmm Mar 26 '13 at 03:54

2 Answers2

12

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).

drewmm
  • 737
  • 6
  • 17
4

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.

j_mcnally
  • 6,928
  • 2
  • 31
  • 46