How to compile a project with app and library in the same workspace with different configuration names?

前端 未结 3 1200
渐次进展
渐次进展 2020-12-04 13:25

I am developing an app and I am using an open source component.

I have a workspace containing both MyApp.xcodeproj and Component.xcodeproj. My app

3条回答
  •  眼角桃花
    2020-12-04 13:55

    I solved it in the following way,

    In my dependency project, Project -> Target -> Build Phases, added new Run Script

    TARGET_DIR="Build"
    TARGET_FILE="${TARGET_DIR}/${FULL_PRODUCT_NAME}"
    mkdir -p ${TARGET_DIR}
    rm -rf ${TARGET_FILE}
    cp -rf "${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}" ${TARGET_DIR}
    

    After the every build, I copy the build to my Build directory inside the project. And from the main project, Project -> Target -> General, I drag and dropped the dependency Framework (which is inside dependency project's Build folder) then, Project -> Target -> Build Settings -> Framework Search Paths, under my custom Build Configuration, I added the following

    $(PROJECT_DIR)/../DependencyProject/Build
    

    The folder is relative to my main project, and this should be relative to your project. Then in my all the schemes, I added a Pre-actions script for Build with

    rm -Rf "${PROJECT_DIR}/../DependencyProject/Build"
    

    Also you need to select the app against Provide build settings from drop down.

提交回复
热议问题