Debian Codegraph @

cmake_install.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 </head>
5
6
7 <body>
8
9 <h1><youros>Cmake to generate projects files or makefile.</youros></h1>
10
11 <youros><br>
12
13 You start with downloading and installing Cmake &nbsp;<a href="http:://www.cmake.org">http:://www.cmake.org </a><br>
14 <br>
15 </youros>
16 <ul>
17 <li><a href="#On_windows">On Windows</a></li>
18 <li><a href="#On_Unix_alikes">On Unix alikes</a></li>
19 <li><a href="#My_Own_Application">My Own Application</a></li>
20 <li><a href="#Cpack_to_make_distributions">Cpack for making distribution</a></li>
21 </ul>
22 <youros>
23 </youros>
24 <h2 style="font-style: italic; text-decoration: underline;">On windows</h2>
25
26 <youros>On windows call the program CmakeSetup.exe, distributed with
27 Cmake.<br>
28
29 This has a graphical interface used to generate your project files or
30 makefiles.<br>
31
32 <br>
33
34 Asumming Agg is installed at </youros>C:\agg\agg-2.4<br>
35
36 <youros><br>
37
38 </youros>In CmakeSetup.exe choose:<br>
39
40 <youros><br>
41
42 Where is the source code: </youros>C:\agg\agg-2.4<br>
43
44 Where to build the binaries: C:\agg\agg-2.4_Build<br>
45
46 <br>
47
48 The options:<br>
49 <ul>
50 <li>
51 agg_USE_EXPAT</li>
52 <ul>
53 <li>At <a href="http://expat.sourceforge.net/">http://expat.sourceforge.net/&nbsp;</a></li>
54 <li>you will find&nbsp;<a href="http://garr.dl.sourceforge.net/sourceforge/expat/expat-win32bin-2.0.1.exe">expat-win32bin-2.0.1.exe</a> &nbsp;</li>
55 <li>This will add a key to your registry, which is searched for by Cmake, if not oke, use next step.</li>
56 <li><span style="font-family: monospace;">Do set EXPAT_DIR in your environment to the location where you installed the above.</span></li>
57 </ul>
58 <li>
59 agg_USE_FREETYPE</li>
60 <ul>
61 <li>Get the library + headers from: <a href="http://gnuwin32.sourceforge.net/packages/freetype.htm">http://gnuwin32.sourceforge.net/packages/freetype.htm</a></li>
62 <li>tested with the download called: "Complete package, except sources"&nbsp;</li>
63 <li>This will add a key to your registry, which is searched for by Cmake, if not oke, use next step.</li>
64 <li><span style="font-family: monospace;">Do set FREETYPE_DIR in your environment to the location where you installed the above.<br>
65 </span></li>
66 </ul>
67 <li>
68 agg_USE_GPC</li>
69 <ul>
70 <li>Internal files, but GPL, so an option.</li>
71 </ul>
72 <li>
73 agg_USE_SDL_PLATFORM</li>
74 <ul>
75 <li>Todo</li>
76 </ul>
77 <li>agg_USE_PACK</li>
78 <ul>
79 <li><a href="cmake_install.html#Cpack_to_make_distributions">See Cpack for making distribution</a></li>
80 </ul>
81 </ul>
82 For windows the routines to find expat and freetype are script found in
83 C:\agg\agg-2.4\bin. They are available in Cmake itself, but the ones
84 here are better.<br>
85 In case of problem, un-comment the MESSAGE statements in those script, to see what is going on.
86
87 <h2 style="font-style: italic; text-decoration: underline;">On Unix alikes</h2>
88
89 Asumming Agg is installed at /home/me/agg/agg-2.4<br>
90
91 <youros><br>
92
93 </youros><span style="font-family: monospace; font-weight: bold;">cd /home/me/agg</span><br style="font-family: monospace; font-weight: bold;">
94 <span style="font-family: monospace; font-weight: bold;">
95 mkdir agg_build</span><br style="font-family: monospace; font-weight: bold;">
96 <span style="font-family: monospace; font-weight: bold;">
97 cd /home/me/agg/agg_build</span><br>
98 <br>
99 Here you generate makefiles with a GUI with:<br>
100 <br>
101 <span style="font-family: monospace; font-weight: bold;">ccmake ../agg-2.4</span><br>
102 <br>
103 OR using commandline for example:<br>
104 <br>
105 <span style="font-family: monospace; font-weight: bold;">cmake &nbsp;-Dagg_USE_FREETYPE:BOOL=ON -Dagg_USE_EXPAT:BOOL=ON ../agg-2.4</span><br style="font-family: monospace;">
106 <br>
107
108 The options:<br>
109 <ul>
110 <li>
111 agg_USE_EXPAT</li>
112 <ul>
113 <li>Requires expat to be installed.</li>
114 </ul>
115 <li>
116 agg_USE_FREETYPE</li>
117 <ul>
118 <li>Requires freetype-devel to be installed. (e.g. on Fedora:&nbsp; yum install freetype-devel&nbsp;)</li>
119 </ul>
120 <li>
121 agg_USE_GPC</li>
122 <ul>
123 <li>Part of Agg for the moment, but GPL, that is why its optional.</li>
124 </ul>
125 <li>
126 agg_USE_SDL_PLATFORM</li>
127 <ul>
128 <li>SDL needs to be installed.</li>
129 </ul>
130 <li>agg_USE_PACK</li>
131 <ul>
132 <li><a href="cmake_install.html#Cpack_to_make_distributions">See Cpack for making distribution</a></li>
133 </ul>
134 </ul>
135 After generating the makefiles, you just type:<br>
136 <span style="font-weight: bold; font-family: monospace;">make</span>
137 You can also build directly in the agg checkout dircetory, but that is bad habit.<br>
138 <br>
139 When all is compiled, you can execute the samples already from the examples directory in your build tree.<br>
140 Now you can login as root and install Agg as you compiled it.<br>
141 So you type:<br>
142 <br>
143 <span style="font-weight: bold;">make install</span><br>
144 <br>
145 This installes your file in <span style="font-weight: bold;">/usr/local.</span><br>
146 <h2><span style="font-weight: bold;"></span><span style="font-style: italic; text-decoration: underline;">My Own Application</span></h2>
147 Nice but what if i want to detect Agg libraries and headers etc. for
148 use in &nbsp;my own application. For that you find in the resulting
149 build directory created by Cmake, &nbsp;a template directory called
150 myapp, containing a simple application. This show you how to do it for
151 your own application. In there you see CMakeLists.txt, this file you
152 can use in CMakeSetup.exe/ccmake as the&nbsp;source directory. Again
153 choose your build directory, and configure.<br>
154 This will result in project/make files for the demo application contained in my_demo.cpp.<br>
155 <br>
156 In principle this is needed ( see myapp/CMakeLists.txt ):<br>
157 <br>
158 FIND_PACKAGE( Agg )<br>
159 IF( AGG_FOUND )<br>
160 &nbsp;&nbsp;&nbsp; INCLUDE_DIRECTORIES(${AGG_INCLUDE_DIRS})<br>
161 &nbsp;&nbsp;&nbsp; LINK_LIBRARIES(${AGG_LIBRARIES})<br>
162 &nbsp;&nbsp;&nbsp; INCLUDE(${AGG_USE_FILE})<br>
163 ELSE( AGG_FOUND )<br>
164 &nbsp;&nbsp;&nbsp; MESSAGE( "AGG library was not found" )<br>
165 ENDIF( AGG_FOUND )<br>
166 <br>
167 If you look in your&nbsp;C:\agg\agg-2.4_Build you will see that <span style="font-weight: bold;">AggConfig.cmake</span> and <span style="font-weight: bold;">UseAgg.cmake</span>, they contain all the information you need to have to use Agg in your application. Study <span style="font-weight: bold;">FindAgg.cmake</span> to know who Agg install dir is found.<br>
168 Also be aware &nbsp;that the file C:\agg\agg-2.4_Build\bin\<span style="font-weight: bold;">AggConfigOutBuild.cmake</span> is installed as&nbsp;<span style="font-weight: bold;">AggConfig.cmake</span> by <span style="font-weight: bold;">make install</span> are inside the packages.<br>
169 The file C:\agg\agg-2.4_Build<span style="font-weight: bold;">\AggConfig.cmake </span>is setup such that you can use it from with in the build directory itself, using the Agg header files from the source directory.<br>
170 This is the same as when building the agg libraries itself.<br>
171 Only when packaging and/or doing a <span style="font-weight: bold;">make install</span>, the headers will be really installed. <br>
172 On windows you need to set the environment variable AGG_DIR, if
173 automatic detection via the registry fails. But if you use a package
174 like <span style="font-weight: bold;">antigrain-0.1.1-win32.exe </span>to install on windows<span style="font-weight: bold;">, </span>a registry key<span style="font-weight: bold;">&nbsp; "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Agg\\antigrain 0.1.1]/bin" </span>is generated, which is used by FindAgg.cmake to find the installation.<br>
175 <br>
176 On Unix you can, after installing Agg, go to <span style="font-family: monospace; font-weight: bold;">/home/me/agg/agg_build/myapp </span><span style="font-family: monospace;">and type this for an inside build:<br>
177 <br>
178 </span><span style="font-family: monospace; font-weight: bold;">cmake .<br>
179 </span><span style="font-family: monospace;"><br>
180 or for an outside build:<br>
181 <br>
182 </span><span style="font-family: monospace; font-weight: bold;">mkdir ../buildmyapp<br>
183 cd </span><span style="font-family: monospace; font-weight: bold;">../buildmyapp</span><br>
184 <span style="font-family: monospace; font-weight: bold;">cmake ../myapp</span><span style="font-weight: bold;"><br>
185 </span><br>
186 If you do not want to install, you can set<span style="font-weight: bold;"> </span>AGG_DIR first, to use the build without installing, like:<br>
187 <br>
188 <span style="font-weight: bold;">export AGG_DIR=</span><span style="font-family: monospace; font-weight: bold;">/home/me/agg/agg_build<br>
189 <br>
190 </span>
191 <h2 style="font-style: italic; text-decoration: underline;">Cpack to make distributions</h2>
192 If enabled agg_USE_PACK, you get an extra target.<br>
193 On windows have gzip and nsis installed, they are used to generate the
194 setup/installer script and zip files, and found automatically:<br>
195 <br style="font-weight: bold;">
196 <span style="font-weight: bold;">http://nsis.sourceforge.net</span><br style="font-weight: bold;">
197 <span style="font-weight: bold;">http://www.7-zip.org</span><br>
198 <br>
199 Parts of the Cmake system &nbsp;is Cpack. After a build of Agg,
200 &nbsp;you get an extra target to PACKAGE, but you can do it by hand
201 also.<br>
202 Calling the Cmake tool:&nbsp;<span style="font-weight: bold;">cpack.exe -C debug </span>or<span style="font-weight: bold;"> </span><span style="font-weight: bold;">cpack.exe -C &nbsp;release </span>on the command line, will result in files like:<br>
203 <br style="font-weight: bold;">
204 <span style="font-weight: bold;">antigrain-0.1.1-win32.exe &nbsp; &nbsp; </span>&nbsp;# this is the installers script for Agg on windows.<br style="font-weight: bold;">
205 <span style="font-weight: bold;">antigrain-0.1.1-win32.zip &nbsp; &nbsp; &nbsp; </span>#contains the same, and can be installed by hand<span style="font-weight: bold;"><br>
206 <br>
207 </span><span style="font-weight: bold;"></span>The first gives you a
208 registery key like this: [HKEY_LOCAL_MACHINE\SOFTWARE\Agg\antigrain
209 0.1.1] And that is used to detect Agg in <span style="font-weight: bold;">FindAgg.cmake</span>, if you use the zip file, you will need to set AGG_DIR in your environment to reach the same.<br>
210 <br>
211 On unix you type:<br>
212 <br>
213 <span style="font-weight: bold;">cpack -C debug</span> on the&nbsp;line, and this gives you files like:<br>
214 <br>
215 <span style="font-weight: bold;">antigrain-0.1.1-Linux.sh</span><br style="font-weight: bold;">
216 <span style="font-weight: bold;">antigrain-0.1.1-Linux.tar.gz</span><br style="font-weight: bold;">
217 <span style="font-weight: bold;">antigrain-0.1.1-Linux.tar.Z</span><br style="font-weight: bold;">
218 <span style="font-weight: bold;">antigrain-0.1.1-Linux.tar.bz2</span><br>
219 <br>
220 <br>
221 <br>
222 <br>
223 <br>
224 <br>
225 <br>
226 <br>
227 <br>
228 <br>
229
230 <youros><br>
231
232 </youros>
233 </body>
234 </html>