문제

I'm working on a project which will use an open source cross-plateform library. This library is a huge one, built using the Makefile system (or even Rakefile 😉). I would love to build a podspec to be able to integrate this lib using CocoaPods. But I cannot find a way to do this.

I thought about adding a run script to the pod install phase, or (maybe better) add a run script phase to the Xcode target which would launch the proper make […] command to have this open source lib build for the right platform.

Any idea or pointers on that? Thanks!

도움이 되었습니까?

해결책

다른 팁

Thank alloy. Here is an example.

Pod::Spec.new do |s|
     s.prepare_command = <<-CMD
        cd MySDK
        sh ./build.sh debug  # run shell or makefile to generate the mysdk.h and libmysdk.a
     CMD

    s.name = "MySDK"
    s.version = "1.0.0"

    s.source_files = "MySDK/output/debug/ios/arm/*.h"
    s.vendored_libraries = "MySDK/output/debug/ios/arm/libmysdk.a", 
#    s.public_header_files = "MySDK/output/debug/ios/arm/mysdk.h"

    s.authors = "xxxx"
    s.homepage = "xx"
    s.license = { :type => 'MIT', :file => 'LICENSE' }
    s.source = { :git => 'https://github.com/<GITHUB_USERNAME>/podTestLibrary.git', :tag => s.version.to_s }
    s.summary = "my sdk"


end

I find a problem afterwards. The s.prepare_command cannot execute and build again if update the sub project sourcecode after we install once. So I have to use pre_install. When we update subproject, just pod install

pre_install do |installer|

  `cd ./MySDK; sh ./build.sh debug;`

end
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top