<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Fixup_bundle works very well for app bundles and seems to be the way to go! The problem I was previously seeing was fixed by setting CMAKE_INSTALL_RPATH_USE_LINK_PATH to True. This fills in the rpath on the installed executable with enough
 paths to resolve all the dylibs.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I also added a merge request to cmake to fail more obviously if the file cannot be found as in previous message.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My next question is: Is there a way to do a fixup bundle without a bundle?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">i.e. I want to fixup (copy required dylibs, fix otool ids and rpaths etc) a structure like this:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">/usr/local/myapp/bin/myapp<o:p></o:p></p>
<p class="MsoNormal">/usr/local/myapp/lib/libA.dylib<o:p></o:p></p>
<p class="MsoNormal">/usr/local/myapp/lib/libB.dylib # etc<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is there a sensible way to do this without rewriting a lot of Bundle Utilities?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Best,<o:p></o:p></p>
<p class="MsoNormal">Harry<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:36.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Harry Mallon <Harry.Mallon@codex.online><br>
<b>Date: </b>Thursday, 19 July 2018 at 19:04<br>
<b>To: </b>Stephen McDowell <sjm324@cornell.edu><br>
<b>Cc: </b>CMake MailingList <cmake@cmake.org><br>
<b>Subject: </b>Re: [CMake] Packaging dylibs into app bundles<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-left:36.0pt">Hi,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt">I have been messing arounds with fixup_bundle (which seems to be the correct function). It worked for a small test case, but only if the dylibs required had otool ids of their full path. Ours currently have rpath
 based ones (e.g. @rpath/libcrypto.dylib). So I get a lot of:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt">/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/objdump: '@rpath/ libcrypto.dylib’: No such file or directory 
<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt">Hmm, seems like the stuff is there somewhere to make this work…<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"> <o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt">Best,<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt">Harry<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"> <o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-left:72.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Stephen McDowell <sjm324@cornell.edu><br>
<b>Date: </b>Thursday, 19 July 2018 at 17:35<br>
<b>To: </b>Harry Mallon <Harry.Mallon@codex.online><br>
<b>Cc: </b>CMake MailingList <cmake@cmake.org><br>
<b>Subject: </b>Re: [CMake] Packaging dylibs into app bundles</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">Hi Harry, <o:p></o:p></p>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">I don't know how useful this will be, but the Instant Meshes application creates an app bundle that has always worked reliably for me. Looking at the code, it doesn't appear like there's much custom stuff going
 on either. It starts here<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"><a href="https://github.com/wjakob/instant-meshes/blob/011fa44ab72037cbc16535090a63ead41963c1e5/CMakeLists.txt#L151">https://github.com/wjakob/instant-meshes/blob/011fa44ab72037cbc16535090a63ead41963c1e5/CMakeLists.txt#L151</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">And there's an if APPLE block below that appears to be the core.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">Hope that is useful :) I've never actually done this for any of my own projects though. And I'm pretty sure them setting the underlying GUI library and TBB to be static (as opposed to shared) is skirting around
 the issue that you are trying to solve (dylib stuff)...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">-Stephen<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-left:72.0pt"> <o:p></o:p></p>
<div>
<div>
<p class="MsoNormal" style="margin-left:72.0pt">On Thu, Jul 19, 2018, 9:03 AM Harry Mallon <Harry.Mallon@codex.online> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt">
Hello all,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt">
Is there a good tutorial/article on getting CMake to package required dylibs and frameworks into an app bundle for you on mac. We have a lot of custom stuff to do it and it is fragile and breaks a lot.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt">
Thanks,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:72.0pt">
Harry<o:p></o:p></p>
</div>
<p style="mso-margin-top-alt:7.5pt;margin-right:0cm;margin-bottom:1.5pt;margin-left:72.0pt;line-height:12.0pt" id="m_2507027356817711930c1-id-6">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">Harry Mallon</span><o:p></o:p></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.5pt;margin-left:72.0pt;line-height:12.0pt">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:gray">Senior Software Engineer</span><o:p></o:p></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.5pt;margin-left:72.0pt;line-height:12.0pt">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black"><a href="https://codex.online/" title=""Visit our website" t "><span style="color:black;text-decoration:none"><span style="color:blue;border:solid windowtext 1.0pt;padding:0cm"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="_x0000_i1026" src="cid:~WRD000.jpg" alt="Image removed by sender."></span></span></a></span><o:p></o:p></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:3.0pt;margin-left:72.0pt;line-height:12.0pt" id="m_2507027356817711930c1-id-14">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">T</span><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:gray">
<a href="callto:+44%20203%207000%20989" target="_blank"><span style="color:gray;text-decoration:none">+44 203 7000 989</span></a> </span><o:p></o:p></p>
<p style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:7.5pt;margin-left:72.0pt;line-height:12.0pt">
<span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:gray">60 Poland Street | London | England | W1F 7NT
</span><o:p></o:p></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="385" style="width:288.75pt;margin-left:72.0pt;border-collapse:collapse;OUTLINE-WIDTH:0px;OUTLINE-STYLE:none;OUTLINE-COLOR:invert">
<tbody>
<tr>
<td colspan="3" style="border:none;border-top:solid gray 1.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="margin-top:10.5pt"><span style="border:solid windowtext 1.0pt;padding:0cm"><img border="0" width="32" height="32" style="width:.3333in;height:.3333in" id="_x0000_i1025" src="cid:~WRD000.jpg" alt="Image removed by sender."></span><o:p></o:p></p>
</td>
</tr>
<tr>
<td width="125" style="width:93.75pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="line-height:11.0pt"><span style="font-size:6.5pt;font-family:"Arial",sans-serif;color:gray">Three Billboards</span><o:p></o:p></p>
</td>
<td width="131" style="width:98.25pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="line-height:11.0pt"><span style="font-size:6.5pt;font-family:"Arial",sans-serif;color:gray">Blade Runner 2049
</span><o:p></o:p></p>
</td>
<td width="129" style="width:96.75pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" style="line-height:11.0pt"><span style="font-size:6.5pt;font-family:"Arial",sans-serif;color:gray"> I, Tonya</span><o:p></o:p></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal" style="mso-margin-top-alt:0cm;margin-right:0cm;margin-bottom:12.0pt;margin-left:72.0pt">
 <o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-left:72.0pt">-- <br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">
http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">
http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">
http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">
http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</body>
</html>