diff options
author | Param Reddy <param@spinorx.com> | 2017-10-15 13:06:58 -0700 |
---|---|---|
committer | Param Reddy <param@spinorx.com> | 2017-10-15 20:27:43 -0700 |
commit | 3130ce03fd0439e17d30b98833568a0eb9bc1a2b (patch) | |
tree | 0b60295285c6c23e3ee6eb972052618f6e2e7612 | |
parent | bd798dfc81443cb95ff3b6e0b787c92031b113e5 (diff) | |
download | protobuf-3130ce03fd0439e17d30b98833568a0eb9bc1a2b.tar.gz protobuf-3130ce03fd0439e17d30b98833568a0eb9bc1a2b.tar.bz2 protobuf-3130ce03fd0439e17d30b98833568a0eb9bc1a2b.zip |
Fix iOS cc_library build for protobuf.
The SDK and os versions were hard coded. Archs were mixed up.
Because of this, Was getting errors with latest SDK:
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/' [-Wmissing-sysroot]
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/' [-Wmissing-sysroot]
In file included from external/com_google_protobuf/src/google/protobuf/io/printer.cc:35:
In file included from external/com_google_protobuf/src/google/protobuf/io/printer.h:40:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string:470:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string_view:171:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/algorithm:638:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
^~~~~~~~~~
1 error generated.
Currently none of these are needed when using bazel with https://github.com/bazelbuild/rules_apple.
-target arm64-apple-ios is passed properly to clang. So -arch armv7 etc are not needed.
OS_IOS is not used anywhere.
Sources have: GOOGLE_PROTOBUF_NO_THREADLOCAL defined in src/google/protobuf/stubs/platform_macros.h for iOS. So __thread= is not needed. In fact now that bazel is using C++11 by default, __thread should ideally be moved to thread_local.
-miphoneos-version-min is passed by rules_apple.
-rw-r--r-- | BUILD | 45 |
1 files changed, 2 insertions, 43 deletions
@@ -59,37 +59,6 @@ load( "internal_protobuf_py_tests", ) -config_setting( - name = "ios_armv7", - values = { - "ios_cpu": "armv7", - }, -) - -config_setting( - name = "ios_armv7s", - values = { - "ios_cpu": "armv7s", - }, -) - -config_setting( - name = "ios_arm64", - values = { - "ios_cpu": "arm64", - }, -) - -IOS_ARM_COPTS = [ - "-DOS_IOS", - "-miphoneos-version-min=7.0", - "-arch armv7", - "-arch armv7s", - "-arch arm64", - "-D__thread=", - "-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/", -] - cc_library( name = "protobuf_lite", srcs = [ @@ -121,12 +90,7 @@ cc_library( "src/google/protobuf/wire_format_lite.cc", ], hdrs = glob(["src/google/protobuf/**/*.h"]), - copts = select({ - ":ios_armv7": IOS_ARM_COPTS, - ":ios_armv7s": IOS_ARM_COPTS, - ":ios_arm64": IOS_ARM_COPTS, - "//conditions:default": [], - }) + COPTS, + copts = COPTS, includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], @@ -193,12 +157,7 @@ cc_library( "src/google/protobuf/wrappers.pb.cc", ], hdrs = glob(["src/**/*.h"]), - copts = select({ - ":ios_armv7": IOS_ARM_COPTS, - ":ios_armv7s": IOS_ARM_COPTS, - ":ios_arm64": IOS_ARM_COPTS, - "//conditions:default": [], - }) + COPTS, + copts = COPTS, includes = ["src/"], linkopts = LINK_OPTS, visibility = ["//visibility:public"], |