1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- Created by texi2html 1.64 -->
<!--
Written by: Lionel Cons <Lionel.Cons@cern.ch> (original author)
Karl Berry <karl@freefriends.org>
Olaf Bachmann <obachman@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman@mathematik.uni-kl.de>
Send bugs and suggestions to <texi2html@mathematik.uni-kl.de>
-->
<HTML>
<HEAD>
<TITLE>Crystal Space: HOWTO CS Project</TITLE>
<META NAME="description" CONTENT="Crystal Space: HOWTO CS Project">
<META NAME="keywords" CONTENT="Crystal Space: HOWTO CS Project">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META NAME="Generator" CONTENT="texi2html 1.64">
</HEAD>
<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
<A NAME="SEC273"></A>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_125.html#SEC266"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_127.html#SEC280"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_108.html#SEC209"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_116.html#SEC225"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<HR SIZE=1>
<H3> 5.8.10 Creating an External Crystal Space Application </H3>
<!--docid::SEC273::-->
<P>
This section describes one easy way to use the Crystal Space development kit
for your application without having to place your application in the Crystal
Space source code tree. Your application's source code can reside wherever you
like.
</P><P>
<A NAME="SEC274"></A>
<H4> External Application Requirements </H4>
<!--docid::SEC274::-->
<P>
For this to work you need to have a sufficiently Unix-like environment.
The environments provided by the MingW and Cygwin compilers are usually
okay, but you must use the `<SAMP>bash</SAMP>' shell.
</P><P>
<A NAME="SEC275"></A>
<H4> The `<TT>cs-config</TT>' Script </H4>
<!--docid::SEC275::-->
<P>
The first thing you need to do is to go to the Crystal Space directory and
type:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>make csconfig
</pre></td></tr></table></P><P>
This will create a script called `<TT>cs-config</TT>'. Copy that script unmodified
to the directory where your project is located. Note that this script is
platform dependent so you should not put it in your project's CVS
repository. Everyone who uses your project will have to generate their own
`<TT>cs-config</TT>' script by invoking `<SAMP>make csconfig</SAMP>' from within the
Crystal Space project directory.
</P><P>
<A NAME="SEC276"></A>
<H4> Makefile </H4>
<!--docid::SEC276::-->
<P>
In the Crystal Space directory you will find the following file:
</P><P>
`<TT>scripts/cs-config/Makefile.template</TT>'.
</P><P>
Copy this file to the directory where your project is located and rename it to
`<TT>Makefile</TT>'.
</P><P>
<A NAME="SEC277"></A>
<H4> `<TT>Makefile</TT>' </H4>
<!--docid::SEC277::-->
<P>
In the Crystal Space project directory you will find the following file:
</P><P>
<CODE>scripts/cs-config/Makefile.template</CODE>
</P><P>
Copy this file to the directory where your project is located and rename it to
`<TT>Makefile</TT>'. You need to edit this file for your own project. It is
recommended that you change at least the following variables:
</P><P>
<UL>
<LI>
`<SAMP>EXECUTABLE</SAMP>' should be the name of your executable. The .exe suffix
is automatically appended if needed on the platform.
<LI>
`<SAMP>OBJSRC</SAMP>' should point to the source code of your project.
<LI>
`<SAMP>LINKFLAGS</SAMP>' should be modified to list all the Crystal Space libraries
that you want to use.
</UL>
<P>
This will enable the makefile to compile an executable for you.
If, in addition, you want to compile a plugin for Crystal Space, you
have to change these variables:
</P><P>
<UL>
<LI>
`<SAMP>PLUGIN</SAMP>' should be the name of your plugin. The .dll suffix
is automatically appended if needed on the platform.
<LI>
`<SAMP>PLUGIN.OBJSRC</SAMP>' should point to the source code of your plugin.
<LI>
`<SAMP>PLUGIN.LINKFLAGS</SAMP>' should be modified to list all the Crystal Space
libraries that you want to use for your plugin.
</UL>
<P>
<A NAME="SEC278"></A>
<H4> Larger Changes to the Makefile </H4>
<!--docid::SEC278::-->
<P>
If you do not wish to make an executable at all, delete, or comment
out with a `<SAMP>#</SAMP>' sign the following lines:
</P><P>
<UL>
<LI>
`<SAMP>EXECUTABLE=</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>OBJSRC=</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>OBJS=</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>LINKFLAGS =</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>all: $(CSCONFIG.MAK) $(EXECUTABLE) $(PLUGIN)</SAMP>' change this line to read:
`<SAMP>all: $(CSCONFIG.MAK) $(PLUGIN)</SAMP>'.
<LI>
`<SAMP>$(EXECUTABLE): </SAMP>' ... and its following line
`<SAMP>$(DO.EXEC)</SAMP>' need to be commented out or deleted.
<LI>
`<SAMP>$(RM) $(OBJS) $(PLUGIN.OBJS)</SAMP>' change this to read:
`<SAMP>$(RM) $(PLUGIN.OBJS)</SAMP>'.
<LI>
`<SAMP>gcc -MM $(CXXFLAGS $(OBJSRC) > makefile.dep</SAMP>' remove this line, and
in the next line change `<SAMP>>></SAMP>' to `<SAMP>></SAMP>'.
</UL>
<P>
If, on the other hand you wish to compile only an application executable,
and not a plugin, do the following:
</P><P>
<UL>
<LI>
`<SAMP>PLUGIN=</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>PLUGIN.OBJSRC=</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>PLUGIN.OBJS=</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>PLUGIN.LINKFLAGS =</SAMP>' ..., comment or delete this line.
<LI>
`<SAMP>all: $(CSCONFIG.MAK) $(EXECUTABLE) $(PLUGIN)</SAMP>' change this line to read:
`<SAMP>all: $(CSCONFIG.MAK) $(EXECUTABLE)</SAMP>'.
<LI>
`<SAMP>$(PLUGIN): </SAMP>' ... and its following line
`<SAMP>$(DO.PLUGIN)</SAMP>' need to be commented out or deleted.
<LI>
`<SAMP>$(RM) $(OBJS) $(PLUGIN.OBJS)</SAMP>' change this to read:
`<SAMP>$(RM) $(OBJS)</SAMP>'.
<LI>
`<SAMP>gcc -MM $(CXXFLAGS $(PLUGIN.OBJSRC) >> makefile.dep</SAMP>' remove this line.
</UL>
<P>
Note that the difference between compiling an executable and a plugin
is the change of `<SAMP>$(DO.EXEC)</SAMP>' to `<SAMP>$(DO.PLUGIN)</SAMP>', and vice
versa. Of course, an application must have a main routine and initialize
Crystal Space, and a plugin needs to declare its SCF class table and
interfaces.
</P><P>
<A NAME="SEC279"></A>
<H4> Using the Makefile </H4>
<!--docid::SEC279::-->
<P>
If you installed Crystal Space (usually in `<TT>/usr/local/crystal</TT>'), then
this is all you need to do. If not, then you must set the `<SAMP>CRYSTAL</SAMP>'
environment variable to point to the location where Crystal Space
resides. For instance, using the Bourne shell, you can do this with the
following command:
</P><P>
<TABLE><tr><td> </td><td class=example><pre>export CRYSTAL=/home/cs_user/CS
</pre></td></tr></table></P><P>
The following targets are supported by this makefile:
</P><P>
<UL>
<LI>
`<SAMP>all</SAMP>' builds the application.
<LI>
`<SAMP>depend</SAMP>' calculates dependency information.
<LI>
`<SAMP>clean</SAMP>' removes object files and other detritus.
</UL>
<A NAME="HOWTO Creating External MSVC Application"></A>
<HR SIZE=1>
<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0>
<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_125.html#SEC266"> < </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_127.html#SEC280"> > </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_108.html#SEC209"> << </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_116.html#SEC225"> Up </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_128.html#SEC290"> >> </A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="index.html#SEC_Top">Top</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_toc.html#SEC_Contents">Contents</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_285.html#SEC711">Index</A>]</TD>
<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="cs_abt.html#SEC_About"> ? </A>]</TD>
</TR></TABLE>
<BR>
<FONT SIZE="-1">
This document was generated
using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html
"><I>texi2html</I></A>
</BODY>
</HTML>
|