Reputation: 6801
I have a Xcode project, that includes a Static Library project, that uses another static library that does not support the iOS simulator architecture (Vuforia SDK: libQCAR.a).
Vuforia SDK documentation states:
Vuforia applications must be deployed to a device to run; they cannot be run in the iOS simulator.
This is my project structure:
My problem is that MyApp.xcodeproj
does not build for the iOS Simulator because libQCAR.a
is not built for the i386 architecture.
Is there anyway to make MyApp.xcodeproj
ignore the libQCAR.a
library when building for i386? I would be able to disable all the code that depends on the library with #if !(TARGET_IPHONE_SIMULATOR)
Upvotes: 10
Views: 6073
Reputation: 69027
You can use a conditional build settings to specify the library you want to link only on a given platform, instead of adding the library to your project in the usual ways. Specifically, you will need to specify:
-lQCAR
in "Other Linker Flags".
Have a look at the attached image that should make things more clear (in the picture I am linking only for the simulator, you will want to select a device, I guess).
Also, do not forget to add the path to the directory containing the library to "Library Search Path" build setting (this does not need to be conditional; it would not do any harm on the simulator).
Upvotes: 6
Reputation: 261
In my case, it should specify clearly which SDK uses which flags.
So in Any iOS Simulator SDK
, you should not include the library.
In Any iOS SDK
, you should include it. In my case, it's -lCloudReco
.
Upvotes: 0
Reputation: 46
This issue seems very similar to: Xcode: Conditional Build Settings based on architecture (Device (ARM) vs Simulator (i386))
I believe sergio's solution is very close, but have you tried specifying the full path to the library under Other Linker Flags (potentially without "-l" - just the path)?
Upvotes: 3