[vtkusers] vtk 4.2 (carbon) on MacOS X Tiger doesn't work

Christopher Knox reasonant at pohewa.ws
Fri Jul 15 10:03:43 EDT 2005


Hi,

I am using cmake from cvs and I have no problems getting it to create  
makefiles that automatically produce .app bundles.

Here is a modified version of the Rendering demos CMakeLists.txt file
                                  
------------------------------------------------------------------
PROJECT (Rendering)

FIND_PACKAGE(VTK REQUIRED)
IF(NOT VTK_USE_RENDERING)
   MESSAGE(FATAL_ERROR "Example ${PROJECT_NAME} requires  
VTK_USE_RENDERING.")
ENDIF(NOT VTK_USE_RENDERING)
INCLUDE(${VTK_USE_FILE})


ADD_EXECUTABLE(Cylinder MACOSX_BUNDLE Cylinder.cxx)
TARGET_LINK_LIBRARIES(Cylinder vtkRendering "-framework Carbon")

ADD_EXECUTABLE(SpecularSpheres MACOSX_BUNDLE SpecularSpheres.cxx)
TARGET_LINK_LIBRARIES(SpecularSpheres vtkRendering "-framework Carbon")

ADD_EXECUTABLE(DiffuseSpheres MACOSX_BUNDLE DiffuseSpheres.cxx)
TARGET_LINK_LIBRARIES(DiffuseSpheres vtkRendering "-framework Carbon")

ADD_EXECUTABLE(AmbientSpheres MACOSX_BUNDLE AmbientSpheres.cxx)
TARGET_LINK_LIBRARIES(AmbientSpheres vtkRendering "-framework Carbon")
                         ---------------------------------------------

Basically it is just a adding the MACOSX_BUNDLE and linking against  
the carbon framework.

If you want to have slightly nicer app bundles you can also use the  
SET command with MACOSX_BUNDLE_INFO_STRING, and  
MACOSX_BUNDLE_ICON_FILE - and probably a few others.

Note that I have only ever worked with the carbon stuff and not cocoa 
+vtk. However, if you are not planning to link in any cocoa/objective  
c specific stuff then working with cocoa just seems like extra trouble.

I had a look at the bug linked from Sean's bug that says the  
MACOSX_BUNDLE stuff doesn't work and it looks like it is only about  
the XCode generator part - which I must concur does not work.  
However, if you just want to build .app bundles with make then there  
is no problem. I suspect that it will be a long time before the XCode  
generation is solved. In the past I have found that it works  
sufficiently well to have two directories in which you run cmake one  
of which generates makefiles and the other an xcode project - then  
you can edit away in xcode then go to the terminal and compile the  
make files. Having said that, now I just create my own XCode project  
for developing of OSX then I make a CMakeLists file so that it will  
build on other platforms.

Hope that helps,
Chris

PS Some of the demos seem to need to be clicked on before you see any  
graphics.

On Jul 14, 2005, at 9:53 AM, P Bai wrote:

> Thanks both of you for the reply. It works now.
>
> P
>
> --- Sean McBride <sean at rogue-research.com> wrote:
>
>
>> On 2005-07-14 11:39, Kalpathi Subramanian said:
>>
>>
>>> On OSX, you need to build it as a "Mac
>>>
>> Application". This
>>
>>> is what little I know (I am very new to OSX, as
>>>
>> well):
>>
>>>
>>> If your executable is called Cone, then create
>>> the following tree of directories:
>>>
>>> Cone.app/Contents/MacOS/Cone
>>>
>>> where the last Cone is the executable. Then the Mac
>>> understands this is an application (or you can
>>>
>> simply
>>
>>> execute the it by typing in the above path from
>>> a terminal. Once you do this, all events are
>>>
>> properly
>>
>>> recognized and handled.
>>>
>>
>> That's exactly right.  The thing is that on Mac OS X
>> command line
>> applications (like the vtk samples) cannot have a
>> GUI (that is, they
>> cannot bring up windows).  vtk tries anyway.  And as
>> you see it sorta
>> works, the window appears, but is broken in many
>> ways.
>>
>> I wrote up a bug for this, and encourage you to vote
>> for it: :)
>>
>>
> <http://www.vtk.org/Bug/bug.php?op=show&bugid=2025&pos=4>
>
>>
>> The bug has some links to the details, if it
>> interests you.
>>
>> BTW, a better way to open GUI apps from terminal is:
>>
>> open /path/to/MyApp.app
>>
>> --
>>
>>
> ____________________________________________________________
>
>> Sean McBride, B. Eng
>> sean at rogue-research.com
>> Rogue Research
>> www.rogue-research.com
>> Mac Software Developer              Montréal,
>> Québec, Canada
>>
>>
>>
>>
>
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/ 
> Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050715/1ef9cd55/attachment.htm>


More information about the vtkusers mailing list