Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Carthage "workaround"
Browse files Browse the repository at this point in the history
which doesn't quite work for me
  • Loading branch information
ApolloZhu committed Nov 25, 2020
1 parent 2c31718 commit 374dc7f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/carthage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build
run: carthage build --no-skip-current --verbose
run: ./carthage.sh build --no-skip-current --verbose
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Cross-platform QRCode generator written in pure Swift, aiming to solve the awkwa
More details in the [Official Guide](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app),
but in general:

1. Select in the menu bar of Xcode: `File` > `Swift Packages` > `Add Package Dependency`.
1. Select in the menu bar of Xcode: `File` > `Swift Packages` > `Add Package Dependency`
2. Enter https://github.com/ApolloZhu/swift_qrcodejs.git
2. Next, specify the version resolving rule as "Up to Next Major"
3. Finish with choosing `QRCodeSwift` library and add it to your app target.
Expand Down Expand Up @@ -58,12 +58,15 @@ pod 'swift_qrcodejs', '~> 2.2.2'
<details>
<summary><strong>Carthage</strong></summary>

I assume you know what you are doing because I don't, but you probably need something like this:
I assume you know what you are doing (because I don't), but you probably need something like this:

```ruby
github "ApolloZhu/swift_qrcodejs" ~> 2.2.2
```

Note that [Carthage doesn't work with Xcode 12](https://github.com/Carthage/Carthage/issues/3019)
(but here's a [workaround](https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md)).

</details>

<details>
Expand Down
20 changes: 20 additions & 0 deletions carthage.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# carthage.sh
# Usage example: ./carthage.sh build --platform iOS
# Why? https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md

set -euo pipefail

xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
trap 'rm -f "$xcconfig"' INT TERM HUP EXIT

# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
# the build will fail on lipo due to duplicate architectures.

CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3)
echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig

echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig
echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig

export XCODE_XCCONFIG_FILE="$xcconfig"
carthage "$@"
4 changes: 0 additions & 4 deletions swift_qrcodejs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = "$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))";
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = "arm64 arm64e armv7 armv7s armv6 armv8";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
Expand Down Expand Up @@ -348,8 +346,6 @@
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_TESTABILITY = YES;
EXCLUDED_ARCHS = "$(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))";
EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = "arm64 arm64e armv7 armv7s armv6 armv8";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PLATFORM_DIR)/Developer/Library/Frameworks",
Expand Down

0 comments on commit 374dc7f

Please sign in to comment.