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