Skip to content

Commit 889de31

Browse files
ndmatthewscmumford
ndmatthews
authored andcommitted
Let LevelDB use xcrun to determine Xcode.app path instead of using a hardcoded path.
This allows build agents to select from multiple Xcode installations. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=104859097
1 parent 528c2bc commit 889de31

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Makefile

+6-8
Original file line numberDiff line numberDiff line change
@@ -206,24 +206,22 @@ memenv_test : helpers/memenv/memenv_test.o $(MEMENVLIBRARY) $(LIBRARY) $(TESTHAR
206206
ifeq ($(PLATFORM), IOS)
207207
# For iOS, create universal object files to be used on both the simulator and
208208
# a device.
209-
PLATFORMSROOT=/Applications/Xcode.app/Contents/Developer/Platforms
210-
SIMULATORROOT=$(PLATFORMSROOT)/iPhoneSimulator.platform/Developer
211-
DEVICEROOT=$(PLATFORMSROOT)/iPhoneOS.platform/Developer
212-
IOSVERSION=$(shell defaults read $(PLATFORMSROOT)/iPhoneOS.platform/version CFBundleShortVersionString)
209+
SIMULATORSDK=$(shell xcrun -sdk iphonesimulator --show-sdk-path)
210+
DEVICESDK=$(shell xcrun -sdk iphoneos --show-sdk-path)
213211
IOSARCH=-arch armv6 -arch armv7 -arch armv7s -arch arm64
214212

215213
.cc.o:
216214
mkdir -p ios-x86/$(dir $@)
217-
xcrun -sdk iphonesimulator $(CXX) $(CXXFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -arch x86_64 -c $< -o ios-x86/$@
215+
xcrun -sdk iphonesimulator $(CXX) $(CXXFLAGS) -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64 -c $< -o ios-x86/$@
218216
mkdir -p ios-arm/$(dir $@)
219-
xcrun -sdk iphoneos $(CXX) $(CXXFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk $(IOSARCH) -c $< -o ios-arm/$@
217+
xcrun -sdk iphoneos $(CXX) $(CXXFLAGS) -isysroot "$(DEVICESDK)" $(IOSARCH) -c $< -o ios-arm/$@
220218
xcrun lipo ios-x86/$@ ios-arm/$@ -create -output $@
221219

222220
.c.o:
223221
mkdir -p ios-x86/$(dir $@)
224-
xcrun -sdk iphonesimulator $(CC) $(CFLAGS) -isysroot $(SIMULATORROOT)/SDKs/iPhoneSimulator$(IOSVERSION).sdk -arch i686 -arch x86_64 -c $< -o ios-x86/$@
222+
xcrun -sdk iphonesimulator $(CC) $(CFLAGS) -isysroot "$(SIMULATORSDK)" -arch i686 -arch x86_64 -c $< -o ios-x86/$@
225223
mkdir -p ios-arm/$(dir $@)
226-
xcrun -sdk iphoneos $(CC) $(CFLAGS) -isysroot $(DEVICEROOT)/SDKs/iPhoneOS$(IOSVERSION).sdk $(IOSARCH) -c $< -o ios-arm/$@
224+
xcrun -sdk iphoneos $(CC) $(CFLAGS) -isysroot "$(DEVICESDK)" $(IOSARCH) -c $< -o ios-arm/$@
227225
xcrun lipo ios-x86/$@ ios-arm/$@ -create -output $@
228226

229227
else

0 commit comments

Comments
 (0)