Xcode 4使用不同的配置设置构建静态库依赖项

时间:2021-12-09 19:58:50

I was wondering whether it is possible to have dependant static library compiled with different configuration settings.

我想知道是否可以使用不同的配置设置编译依赖静态库。

My case was I have a project (project.pbxproj) which is dependant on a static library (cocoa touch) project (libStatic.pbxproj). My project has let say 3 configuration settings, like debug, release and ad-hoc, while my libStatic will only have 2 which is debug and release. So my question is, it is possible to have the ad-hoc configuration settings on the main project to cause the static library compiled under the release settings?

我的情况是我有一个项目(project.pbxproj),它依赖于静态库(cocoa touch)项目(libStatic.pbxproj)。我的项目已经说了3个配置设置,比如debug,release和ad-hoc,而我的libStatic只有2个是调试和发布。所以我的问题是,可以在主项目上进行临时配置设置,以便在发布设置下编译静态库吗?

Currently I have errors on building(compiling) the project only for the ad-hoc settings, while everything runs perfectly with both the release and debug settings.

目前,我只为ad-hoc设置构建(编译)项目时出错,而一切都与发布和调试设置完美匹配。

My reference on building the static library was http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/

关于构建静态库的参考资料是http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4/

Thanks before

谢谢你

Cheers,

干杯,

2 个解决方案

#1


0  

I do not know of a way to trigger different configuration builds, but what you are trying to achieve can be done with different targets. A target of the dependent project can trigger a specific target of the dependency project. You can set this in the Target Dependencies build phase.

我不知道触发不同配置构建的方法,但是您尝试实现的目标可以使用不同的目标。依赖项目的目标可以触发依赖项目的特定目标。您可以在Target Dependencies构建阶段设置此项。

#2


0  

To extend what rage said, you'll want to use targets instead of configurations. Targets are all about what is built where as configurations is how to build.

为了扩展愤怒所说的内容,你需要使用目标而不是配置。目标都是建立在配置如何构建的地方。

You may also want to look at lipo. Its useful for combining static libs such as simulator and device into 1 static lib resource. I haven't played with it extensively but maybe there is a way to have different configs as well and somehow use the right config when the parent project is built.

你可能也想看看脂肪。它可用于将静态库(如模拟器和设备)组合到1个静态lib资源中。我没有广泛使用它,但也许有一种方法可以有不同的配置,并在构建父项目时以某种方式使用正确的配置。

#1


0  

I do not know of a way to trigger different configuration builds, but what you are trying to achieve can be done with different targets. A target of the dependent project can trigger a specific target of the dependency project. You can set this in the Target Dependencies build phase.

我不知道触发不同配置构建的方法,但是您尝试实现的目标可以使用不同的目标。依赖项目的目标可以触发依赖项目的特定目标。您可以在Target Dependencies构建阶段设置此项。

#2


0  

To extend what rage said, you'll want to use targets instead of configurations. Targets are all about what is built where as configurations is how to build.

为了扩展愤怒所说的内容,你需要使用目标而不是配置。目标都是建立在配置如何构建的地方。

You may also want to look at lipo. Its useful for combining static libs such as simulator and device into 1 static lib resource. I haven't played with it extensively but maybe there is a way to have different configs as well and somehow use the right config when the parent project is built.

你可能也想看看脂肪。它可用于将静态库(如模拟器和设备)组合到1个静态lib资源中。我没有广泛使用它,但也许有一种方法可以有不同的配置,并在构建父项目时以某种方式使用正确的配置。