[Insight-users] Re: CMake to set up resources for executables on OSX ?

Bill Hoffman bill.hoffman@kitware.com
Fri, 17 Jan 2003 09:28:52 -0500


--=====================_863345734==.ALT
Content-Type: text/plain; charset="us-ascii"

Note quite.   The VTK_APPLE_RESOURCE is defined in the FIND_PROGRAM command.
So, you can just change the name to ITK_APPLE_RESOURCE.

The custom command must be done for each executable that you want to run
the resource program on.   


So, for RegionGrowingSegmentation , you would do this:

IF(APPLE) 
  FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) 
  IF(ITK_APPLE_RESOURCE) 
    ADD_CUSTOM_COMMAND( 
      SOURCE RegionGrowingSegmentation 
      COMMAND ${VTK_APPLE_RESOURCE} 
      ARGS -t APPL /usr/local/include/FL/mac.r -o ${EXECUTABLE_OUTPUT_PATH}/RegionGrowingSegmentation 
      TARGET RegionGrowingSegmentation 
      ) 
  ENDIF(ITK_APPLE_RESOURCE) 
ENDIF(APPLE) 


I guess the FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) could
be in the top CMakeLists.txt file for the Applications directory, and
then used by each application.

With CMake 1.6 we could use a macro to make this a bit shorter.
Why don't you try and see if it works, and when we get it working we
can create the macro.   Cmake 1.6 should be out of beta soon, and we
can then use Macros in the ITK files.

-Bill

-Bill

At 03:11 PM 1/17/2003 +0100, Jon Harald Kaspersen wrote:
>Bill, 
>
>So, I will have to add something like this to my CMakeLists.txt file in Insight/Applications/ directory : 
>
>Is there a ITK_APPLE_RESOURCE parameter in CMake ? 
>
>IF(APPLE) 
>  FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools) 
>  IF(VTK_APPLE_RESOURCE) 
>    ADD_CUSTOM_COMMAND( 
>      SOURCE itk 
>      COMMAND ${VTK_APPLE_RESOURCE} 
>      ARGS -t APPL /usr/local/include/FL/mac.r -o ${EXECUTABLE_OUTPUT_PATH} 
>      TARGET itk 
>      ) 
>  ENDIF(VTK_APPLE_RESOURCE) 
>ENDIF(APPLE) 
>
>
>Regards 
>Jon 
>
>On Friday, January 17, 2003, at 02:54 PM, Bill Hoffman wrote: 
>
>>Yes, this can be done, and is being done in VTK, here is 
>>what the code looks like in VTK: 
>>
>>
>>IF(VTK_USE_CARBON) 
>>  FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools) 
>>  IF(VTK_APPLE_RESOURCE) 
>>    ADD_CUSTOM_COMMAND( 
>>      SOURCE vtk 
>>      COMMAND ${VTK_APPLE_RESOURCE} 
>>      ARGS Carbon.r -o ${EXECUTABLE_OUTPUT_PATH}/vtk 
>>      TARGET vtk 
>>      ) 
>>  ENDIF(VTK_APPLE_RESOURCE) 
>>ENDIF(VTK_USE_CARBON) 
>======================================================== 
>Jon Harald Kaspersen                    Tel:            +47 73 59 75 89 
>Ph.D. Mechanical Engineering            Mob:            +47 93 03 65 90 
>Senior Scientist                                Pager   +47 96 84 29 94 
>SINTEF Unimed - Ultralyd                Fax:            +47 73 59 78 73 
>N-7465 Trondheim 
>NORWAY                  e-mail: Jon.H.Kaspersen@unimed.sintef.no 
>                                WEB:    <http://www.us.unimed.sintef.no/>http://www.us.unimed.sintef.no/ 
>======================================================== 
>
></blockquote></x-html> 

--=====================_863345734==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
Note quite.&nbsp;&nbsp; The VTK_APPLE_RESOURCE is defined in the
FIND_PROGRAM command.<br>
So, you can just change the name to ITK_APPLE_RESOURCE.<br><br>
The custom command must be done for each executable that you want to
run<br>
the resource program on.&nbsp;&nbsp; <br><br>
<br>
So, for RegionGrowingSegmentation , you would do this:<br><br>
IF(APPLE) <br>
&nbsp; FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools) <br>
&nbsp; IF(ITK_APPLE_RESOURCE) <br>
&nbsp;&nbsp;&nbsp; ADD_CUSTOM_COMMAND( <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOURCE RegionGrowingSegmentation <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${VTK_APPLE_RESOURCE} <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ARGS -t APPL /usr/local/include/FL/mac.r
-o ${EXECUTABLE_OUTPUT_PATH}/RegionGrowingSegmentation <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TARGET RegionGrowingSegmentation <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) <br>
&nbsp; ENDIF(ITK_APPLE_RESOURCE) <br>
ENDIF(APPLE) <br><br>
<br>
I guess the FIND_PROGRAM(ITK_APPLE_RESOURCE Rez /Developer/Tools)
could<br>
be in the top CMakeLists.txt file for the Applications directory,
and<br>
then used by each application.<br><br>
With CMake 1.6 we could use a macro to make this a bit shorter.<br>
Why don't you try and see if it works, and when we get it working 
we<br>
can create the macro.&nbsp;&nbsp; Cmake 1.6 should be out of beta soon,
and we<br>
can then use Macros in the ITK files.<br><br>
-Bill<br><br>
-Bill<br><br>
At 03:11 PM 1/17/2003 +0100, Jon Harald Kaspersen wrote:<br>
<blockquote type=cite class=cite cite>Bill, <br><br>
So, I will have to add something like this to my CMakeLists.txt file in
Insight/Applications/ directory : <br><br>
Is there a ITK_APPLE_RESOURCE parameter in CMake ? <br><br>
IF(APPLE) <br>
&nbsp; FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools) <br>
&nbsp; IF(VTK_APPLE_RESOURCE) <br>
&nbsp;&nbsp;&nbsp; ADD_CUSTOM_COMMAND( <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOURCE itk <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${VTK_APPLE_RESOURCE} <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ARGS -t APPL /usr/local/include/FL/mac.r
-o ${EXECUTABLE_OUTPUT_PATH} <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TARGET itk <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) <br>
&nbsp; ENDIF(VTK_APPLE_RESOURCE) <br>
ENDIF(APPLE) <br><br>
<br>
Regards <br>
Jon <br><br>
On Friday, January 17, 2003, at 02:54 PM, Bill Hoffman wrote: <br><br>
<blockquote type=cite class=cite cite>Yes, this can be done, and is being
done in VTK, here is <br>
what the code looks like in VTK: <br><br>
<br>
IF(VTK_USE_CARBON) <br>
&nbsp; FIND_PROGRAM(VTK_APPLE_RESOURCE Rez /Developer/Tools) <br>
&nbsp; IF(VTK_APPLE_RESOURCE) <br>
&nbsp;&nbsp;&nbsp; ADD_CUSTOM_COMMAND( <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SOURCE vtk <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMAND ${VTK_APPLE_RESOURCE} <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ARGS Carbon.r -o
${EXECUTABLE_OUTPUT_PATH}/vtk <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TARGET vtk <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ) <br>
&nbsp; ENDIF(VTK_APPLE_RESOURCE) <br>
ENDIF(VTK_USE_CARBON) <br>
</blockquote>========================================================
<br>
Jon Harald
Kaspersen<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Tel:
<x-tab>&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>+47
73 59 75 89 <br>
Ph.D. Mechanical
Engineering<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Mob:<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>+47
93 03 65 90 <br>
Senior
Scientist<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Pager<x-tab>&nbsp;&nbsp;&nbsp;</x-tab>+47
96 84 29 94 <br>
SINTEF Unimed -
Ultralyd<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Fax:
<x-tab>&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>+47
73 59 78 73 <br>
N-7465 Trondheim <br>
NORWAY<x-tab>&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>e-mail:<x-tab>&nbsp;</x-tab>Jon.H.Kaspersen@unimed.sintef.no
<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>WEB:<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><a href="http://www.us.unimed.sintef.no/"><font color="#1A1AFF"><u>http://www.us.unimed.sintef.no/</a></u></font>
<br>
======================================================== <br><br>
&lt;/blockquote&gt;&lt;/x-html&gt; </blockquote></body>
</html>

--=====================_863345734==.ALT--