diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java | 13 | ||||
-rw-r--r-- | src/main/protobuf/xcodegen.proto | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java index 57de1fdd9d..1ea050a779 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java +++ b/src/main/java/com/google/devtools/build/lib/rules/objc/CompilationSupport.java @@ -722,11 +722,11 @@ public final class CompilationSupport { .add(IosSdkCommands.DEFAULT_LINKER_FLAGS) .addBeforeEach("-framework", frameworkNames(objcProvider)) .addBeforeEach("-weak_framework", SdkFramework.names(objcProvider.get(WEAK_SDK_FRAMEWORK))) + .addFormatEach("-l%s", libraryNames(objcProvider)) .addExecPath("-o", linkedBinary) .addExecPaths(objcProvider.get(LIBRARY)) .addExecPaths(objcProvider.get(IMPORTED_LIBRARY)) .addExecPaths(ccLibraries) - .add(dylibPaths(objcProvider)) .addBeforeEach("-force_load", Artifact.toExecPaths(objcProvider.get(FORCE_LOAD_LIBRARY))) .add(extraLinkArgs) .build(); @@ -785,12 +785,15 @@ public final class CompilationSupport { } } - private Iterable<String> dylibPaths(ObjcProvider objcProvider) { - ObjcConfiguration objcConfiguration = ObjcRuleClasses.objcConfiguration(ruleContext); + private Iterable<String> libraryNames(ObjcProvider objcProvider) { ImmutableList.Builder<String> args = new ImmutableList.Builder<>(); for (String dylib : objcProvider.get(SDK_DYLIB)) { - args.add(String.format( - "%s/usr/lib/%s.dylib", IosSdkCommands.sdkDir(objcConfiguration), dylib)); + if (dylib.startsWith("lib")) { + // remove lib prefix if it exists which is standard + // for libraries (libxml.dylib -> -lxml). + dylib = dylib.substring(3); + } + args.add(dylib); } return args.build(); } diff --git a/src/main/protobuf/xcodegen.proto b/src/main/protobuf/xcodegen.proto index 23d3362928..5aa4c593b7 100644 --- a/src/main/protobuf/xcodegen.proto +++ b/src/main/protobuf/xcodegen.proto @@ -172,8 +172,8 @@ message TargetControl { // SDK .dylib files to link with this target. Each name should not include the // the path or the .dylib extension, e.g. "libz" to link in // "SDKROOT/usr/lib/libz.dylib". For all targets, this causes the library to - // appear in the Project Navigator. For binary targets, this causes the - // library to be linked with the final binary. + // appear in the Project Build Settings under OTHER_LDFLAGS. For binary + // targets, this causes the library to be linked with the final binary. repeated string sdk_dylib = 19; } |