# Carthage

* **依照需求 build 出需要的指令集的方法**
  * 首先在 Xcode 專案的 Build Settings 設定 Architectures
  * 再執行 Carthage build --archive，Carthage 就會按照該專案的架構設定來建置出需要的指令集
* [**Add Option for ignoring architecture i386**](https://github.com/Carthage/Carthage/issues/1771)
* **以下的例子是去除 i386 指令集的做法**
*   **原本架構是這樣**

    ````
      xcodebuild -showBuildSettings -scheme CathayCoreSDK -sdk iphonesimulator | grep ARCHS```shell
          ARCHS = x86_64
          ARCHS_STANDARD = i386 x86_64
          ARCHS_STANDARD_32_64_BIT = i386 x86_64
          ARCHS_STANDARD_32_BIT = i386
          ARCHS_STANDARD_64_BIT = x86_64
          ARCHS_STANDARD_INCLUDING_64_BIT = i386 x86_64
          ARCHS_UNIVERSAL_IPHONE_OS = i386 x86_64
          VALID_ARCHS = i386 x86_64
    ````

    ```
      lipo -info CathayCoreSDK.framework/CathayCoreSDK
          Architectures in the fat file: CathayCoreSDK.framework/CathayCoreSDK are: i386 x86_64 armv7 arm64
    ```
* **經過以下處理**

![](https://1934061725-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M4XrCDvjc3xNfiB-3eT%2F-M4Y-TstkTXMD9Y8W9l7%2F-M4Y03b5EzFVI4ZBeyzP%2FArchitectureSettings.png?alt=media\&token=063132ca-8434-4454-8096-61f9641e0f88)

````
xcodebuild -showBuildSettings -scheme CathayCoreSDK -sdk iphonesimulator | grep ARCHS```shell
  ARCHS = x86_64
  ARCHS_STANDARD = i386 x86_64
  ARCHS_STANDARD_32_64_BIT = i386 x86_64
  ARCHS_STANDARD_32_BIT = i386
  ARCHS_STANDARD_64_BIT = x86_64
  ARCHS_STANDARD_INCLUDING_64_BIT = i386 x86_64
  ARCHS_UNIVERSAL_IPHONE_OS = i386 x86_64
  VALID_ARCHS = x86_64
````

```
  carthage build --archive
```

```
  lipo -info CathayCoreSDK.framework/CathayCoreSDK
      Architectures in the fat file: CathayCoreSDK.framework/CathayCoreSDK are: x86_64 armv7 arm64
```
