[CMake] Running OSX Bundle via open after creation with CMake/CPack
Scott Klum
scott.klum at gmail.com
Mon Jun 23 09:48:32 EDT 2014
I figured out the issue. I have CPACK_BUNDLE_STARTUP_COMMAND to my startup
bash script. This script modifies a bunch of library paths via
install_name_tool. I cd into the directory containing the actual
executable (MyApp.app/Contents/Resources/bin/) and work from there.
This is pretty darn inefficient doing this every time the app starts, but I
couldn't find a way to do it AFTER the package (I looked into
execute_process, add_custom_command, etc. and nothing seemed to work after
the myapp executable was put in the bin directory), so if anyone has a
suggestion there it would be appreciated.
After modifying the paths, I have a ./myapp command at the end of the
script. I expected this to work because I had cd'd into the directory
which contained myapp. However, switching this command to one with an
absolute path (/Applications/MyApp.app/Contents/Resources/bin/myapp)
resulted in everything working. I'm not sure if it's because this isn't
the standard structure for a bundle or what but there you have it.
Thanks for the suggestions.
Regards,
Scott
On Mon, Jun 23, 2014 at 9:04 AM, Scott Klum <scott.klum at gmail.com> wrote:
> Also, I forgot to mention that using the Console Utility gives nondescript
> errors: it just says MyApp exited with code 127.
>
>
> On Mon, Jun 23, 2014 at 8:56 AM, Scott Klum <scott.klum at gmail.com> wrote:
>
>> Lucas and David,
>>
>> Thank you for your responses.
>>
>> *Does anything get printed in the terminal if you type and enter: *
>> */Applications/MyApp.app/Contents/MacOS/MyApp**?*
>>
>> This is what I mean when I say I can run it through the terminal. If I
>> enter the above command the app starts properly.
>>
>> *Does your app launch a lot of sub-processes at startup?*
>>
>> Nope - and as far as I can tell the code in my main.cpp isn't even
>> reached.
>>
>>
>> *Are you saying that you *can* run the app from the terminal window, but
>> that you cannot run the app by double-clicking or by using "open"? (And
>> that it's the exact same executable...?) What command line do you use if
>> you're not using "open"? *
>> That's correct. I use the command described in the first response.
>>
>>
>> *Is there an environment difference (maybe LD_LIBRARY_PATH or
>> DYLD_LIBRARY_PATH?) between your Terminal, and your overall environment?*
>>
>> Not that I can tell.
>>
>> *Can you launch a debug build in a debugger?*
>>
>> Building in debug mode doesn't seem to make any difference.
>>
>> The fundamental problem seems to be whatever the open command does in the
>> background, I haven't set things up properly in terms of open knowing that
>> the when I run open MyApp.app, it should run
>> MyApp.app/Contents/MacOS/MyApp. I've got CFBundleExecutable set to
>> MyApp... in fact my .plist looks like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "
>> http://www.apple.com/DTDs/PropertyList-1.0.dtd">
>> <plist version="1.0">
>> <dict>
>> <key>CFBundleDevelopmentRegion</key>
>> <string>English</string>
>> <key>CFBundleExecutable</key>
>> <string>MyApp</string>
>> <key>CFBundleIdentifier</key>
>> <string>com.MyApp</string>
>> <key>CFBundleInfoDictionaryVersion</key>
>> <string>6.0</string>
>> <key>CFBundleName</key>
>> <string> MyApp</string>
>> <key>CFBundleIconFile</key>
>> <string> MyApp</string>
>> <key>CFBundlePackageType</key>
>> <string>APPL</string>
>> <key>CFBundleShortVersionString</key>
>> <string>2.1.0</string>
>> <key>CFBundleVersion</key>
>> <string>2.1.0</string>
>> <key>CSResourcesFileMapped</key>
>> <true/>
>> <key>LSRequiresCarbon</key>
>> <true/>
>> <key>NSHighResolutionCapable</key>
>> <true/>
>> </dict>
>> </plist>
>>
>> Again, not sure how to proceed. But, I really appreciate the help.
>>
>> Regards,
>> Scott
>>
>>
>> On Mon, Jun 23, 2014 at 6:13 AM, David Cole <dlrdave at aol.com> wrote:
>>
>>> Also, you may find extra hints about what's going wrong in the output of
>>> the "Console" application. (Usually found in "/Applications/Utilities") --
>>> see if there's anything in the "system.log" in there, or poke around and
>>> see if it has a crash report related to your app.
>>>
>>>
>>> HTH,
>>> David C.
>>>
>>>
>>
>>
>> --
>> Scott Klum
>> B.S. in Computer Science, Michigan State University 2012
>> M.S. in Computer Science, Michigan State University 2014
>>
>
>
>
> --
> Scott Klum
> B.S. in Computer Science, Michigan State University 2012
> M.S. in Computer Science, Michigan State University 2014
>
--
Scott Klum
B.S. in Computer Science, Michigan State University 2012
M.S. in Computer Science, Michigan State University 2014
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140623/617a26c3/attachment-0001.html>
More information about the CMake
mailing list