Re: Creating dynamic and static libs from one target
Re: Creating dynamic and static libs from one target
- Subject: Re: Creating dynamic and static libs from one target
- From: Andreas Grosam <email@hidden>
- Date: Tue, 1 Nov 2005 11:02:43 +0100
On 01.11.2005, at 03:11, eduard wrote:
Hi,
We are finally moving from our makefile based build environment to
Xcode 2.2,
and have a problem setting up the Xcode projects to fit our needs:
Our source tree consists out of several "modules", which are all part
of one
big XCode Project file. One module corresponds to one target in the
project. The modules are build as static libraries in the Deployment
builds, and are
then linked against the final Applications. This works great so far.
To speed up the Edit-Compile-Link-Run cycle, we would like to build
the modules
- depending on the Configuration (while developing only) - as dynamic
libraries
instead of static libraries. Zero-Link doesn't work for us. The
zero-linked
Application crashes on startup.
Is there a possibility to change the product-type dynamically via
Configurations,
so that the same target will be build and linked either statically or
dynamically,
depending on the settings in the Configurations ?
We've tried to change the product-type by setting the build environment
variable PRODUCT_TYPE, but this seems to have no effect on the linker
settings.
Also setting LIBRARY_STYLE to DYNAMIC seems to do nothing at all.
Setting EXECUTABLE_PREFIX to "" and EXECUTABLE_EXTENSION to "dynlib",
and then
passing "-dynamic" to the linker via the OTHER_LDFLAGS works and
builds a
dynamic library, but this will pass "-static" /and/ "-dynamic" at the
end to
ld, which feels like a big hack which just works by accident and might
break as
soon as look a little bit too long at it.
Using two targets per module, where one builds the static variant and
the other
the dynamic will of course also work, but the project is already quite
huge, so we
would like to avoid this if somehow possible. This will also be
harder to maintain
at the end...
Thanks for any help!
Maybe this might work:
1) Create a custom Configuration file for your project, say
MyDylibSet.xcconfig. (see Xcode help how to accomplish this)
2) For each library, in the info panel of your libraries, for the debug
configuration only, make the configuration depend upon your custom
config file MyDylibSet.xcconfig
3) Edit the Configuration file such that it contains all required
settings to build a dynamic lib, especially set
LIBRARY_STYLE = DYNAMIC and appropriate compiler flags and other
settings.
For hints which settings to choose, compare a default dynamic and
static build setting. Just drag the value and key which you would like
to set in your custom file from within the Info Panel into your custom
config file in order to get key and values pairs as text.
4) In the target info panel of your library **delete** all settings
which you added in the assigned Configuration file. This is necessary,
because the target settings would otherwise still override the custom
configuration settings.
If you want to modify or extend the custom settings in the info panel
of the target settings, use this syntax:
In the Info Panel:
KEY $(value) extension
which in this case, adds the value "extension" to the existing setting
represented by the variable "value", which is the value of the base
configuration file. For the Debug Configuration, this is your value set
in the custom config file.
Notice, that the name of the base value is literally "value".
I didn't tested this method, though - you might get unexpected
results, or get some errors.
Would be nice if you have success.
Regards
Andreas
Greets,
eduard mueller
www.ableton.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden