简体   繁体   中英

How to Add file .a to project by xcodegen swift

I want to add 5 file have extension .a to project. I click "+" button then choose 5 file .a add to project is success. But my project use xcodegen so I want to config file project.yml to auto add file .a when genarate new file xcodeproj. Help me config file project.yml

[IMAGE] General xcode project

[IMAGE] File code config project.yml

[Link] Docs Xcodegen

name: App
options:
  postGenCommand: pod install
targets:
  App:
    type: application
    platform: iOS
    deploymentTarget: "12.0"
    dependencies:
      - target: MagickLibrary
    sources:
      - path: App
    settings:
      base:
        INFOPLIST_FILE: MyProject/App/Info.plist
        CODE_SIGN_STYLE: Manual
        DEVELOPMENT_TEAM: I9W3PJNG89
        PROVISIONING_PROFILE_SPECIFIER: company dev
        CODE_SIGN_IDENTITY: iPhone Developer
        DEBUG_INFORMATION_FORMAT: dwarf-with-dsym
        TARGETED_DEVICE_FAMILY: 1
        SWIFT_VERSION: 5.0
        PRODUCT_BUNDLE_IDENTIFIER: com.company.MyProject
        ENABLE_BITCODE: 'NO'
        SWIFT_OBJC_BRIDGING_HEADER: MyProject/imageconverterios-Bridging-Header.h
  
  MagickLibrary:
    deploymentTarget: '12.0'
    platform: iOS
    sources:
      - createIntermediateGroups: true
        path: MyProject/iOSMagick-6.8.8-9-libs
    type: library.static

I think the way you linked static libraries is wrong. You need to define static libraries (.a) in dependencies of App target

dependencies:
      - framework: MyProject/iOSMagick-6.8.8-9-libs/file1.a
      - framework: MyProject/iOSMagick-6.8.8-9-libs/file2.a
      - framework: MyProject/iOSMagick-6.8.8-9-libs/file3.a
      - framework: MyProject/iOSMagick-6.8.8-9-libs/file4.a
      - framework: MyProject/iOSMagick-6.8.8-9-libs/file5.a

and don't forget to define LIBRARY_SEARCH_PATHS in settings of target:

settings:
      base:
        LIBRARY_SEARCH_PATHS: "$(inherited) $(PROJECT_DIR)/MyProject/iOSMagick-6.8.8-9-libs"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM