[CMake] building an OSX app release
Mike Jackson
imikejackson at gmail.com
Thu Nov 1 23:09:31 EDT 2007
On Nov 1, 2007, at 9:52 PM, Alan W. Irwin wrote:
> On 2007-11-01 20:17-0500 Peter Crowley wrote:
>
>> How can I tell cmake to take the libraries and include them in the
>> build app? Does it matter if it is statically or dynamically
>> linked? Is this as simple as copying the dylib over, or am I
>> missing something?
>>
>> If you have attempted to do something like this, I would greatly
>> appreciate your advice.
>
> Haven't done this myself, but I have thought about this possibility
> for
> PLplot. If we ever implement it (as an option), I would simply use
> the
> CMake INSTALL(FILES... command to install the external libraries to
> some
> appropriate location in our install tree with appropriate
> permissions. I
> believe this would work because the files to be installed can have
> absolute
> pathnames. CMake just sets up the install. The actual installation
> normally occurs as the result of the "make install" command. That's
> relevant to your problem because if you make a binary distribution
> with
> CPack, it will put all files normally installed with "make install"
> into a
> binary distribution file (compressed tarball or whatever you choose)
> instead, and I believe that such a binary distribution file is what
> you are
> really asking for.
>
> Alan
> __________________________
> Alan W. Irwin
>
There are some issues that Alan is skirting around. If you use dylibs
for your support libraries AND you want a self contained App bundle
that can be distributed there are a number of issues that you need to
overcome.
0. Are you going to produce a Universal Binary or single arch
applciation
1. The "install_name" of the dylibs need to be changed to something
like "@executable_path/../PlugIns/[Library Name]
2. You need to copy these libraries into the App package
3. You will need to change the install_name paths of each library
that the executable links against to point to the path in #1.
4. You will need to package your final application in a tar ball, zip
file or Disk Image.
There are lots of ways to get to these accomplished. You can use
cmake for some of it. You can write a shell script that does all. You
can use a combination of the two.
I have an application that relies on HDF5, Expat, Tiff and Qt4. I
have cmake configure a shell script and then run the shell script.
The shell script copies all the files from their installed locations
around my system, reconfigures the "install_name" of each library and
reconfigures the executable to properly find those libraries in the
App bundle.
If you have control over the compilation of all your support
libraries (minus those found on the OS X System itself) then I would
probably build as static libraries then link against those static
libraries. Takes all the dylib confusion out of the equation.
You can see my scripts and projects at the following location:
http://titanium.imts.us/viewvc/Task_7/MXATools/
which references this project:
http://titanium.imts.us/viewvc/Task_7/MXADataModel/
The scripts are located in the "Resources" folder of each project.
--
Mike Jackson Senior Research Engineer
Innovative Management & Technology Services
More information about the CMake
mailing list