re: How do I link with copied libs?
re: How do I link with copied libs?
- Subject: re: How do I link with copied libs?
- From: George Warner <email@hidden>
- Date: Tue, 23 Dec 2008 07:56:01 -0800
- Thread-topic: How do I link with copied libs?
On Mon, 22 Dec 2008 13:21:50 -0700, David Springer <email@hidden>
wrote:
> Folks,
> I have a set of 3rd party dylibs to link against. But, before I link
> against them I need to do install_name_tool. So here is how I have all that
> set up:
>
> 1. Create an aggregate target called "Copy dylibs" that copies the dylibs
> from the distro to ${BUILT_PRODUCTS_DIR}/dylibs.
> 2. In that target, I have run script phase that does the install_name_tool.
> 3. In my main framework target, I link against the modified 3rd party
> dylibs. I do this by adding the modified dylibs as products, then dragging
> them into the Link phase of my main target.
>
> Problem: How to I get it so my Deployment config to link against release 3rd
> party dylibs, but the Development config links against debug dylibs?
Step one would have to copy the appropriate set of libs depending on the
configuration (debug or release) that you're currently building. I'd use a
"New Run Scrip Phase":
[BEGIN]
#if this is a debug build configuration
if ("${CONFIGURATION}" == "Debug" ) then
# copy our debug dylb to our build products dylib directory
cp -Rfv "${PROJECT_DIR}/dylibs/Debug/*" \
"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}/Contents/dylibs"
#if this is a release build configuration
else if ("${CONFIGURATION}" == "Release" ) then
# copy our release dylb to our build products dylib directory
cp -Rfv "${PROJECT_DIR}/dylibs/Release/*" \
"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}/Contents/dylibs"
else # otherwise it's an unknown build configuration
echo "WARNING: Unknown build configuration: ${CONFIGURATION}"
endif
[END]
Or, if you've named your dylib directories to match your configurations:
[BEGIN]
#if this is a debug or release build configuration
if (("${CONFIGURATION}" == "Debug") || ("${CONFIGURATION}" == "Release"))
then
# copy our dylb to our build products dylib directory
cp -Rfv "${PROJECT_DIR}/dylibs/${CONFIGURATION}/*" \
"${BUILT_PRODUCTS_DIR}/${FULL_PRODUCT_NAME}/Contents/dylibs"
else # otherwise it's an unknown build configuration
echo "WARNING: Unknown build configuration: ${CONFIGURATION}"
endif
[END]
I'd probably also add the install_name_tool steps to this script also.
--
Enjoy,
George Warner,
Schizophrenic Optimization Scientist
Apple Developer Technical Support (DTS)
_______________________________________________
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