root/branches/Derelict2/doc/build.html

Revision 563, 6.2 kB (checked in by aldacron, 11 months ago)

[Derelict2 - docs]
* added preliminary documentation for DerelictAL, DerelictFT and DerelictODE.
* corrected some errors and touched up formatting in existing docs.

  • Property svn:mime-type set to text/html
Line 
1 <html lang="en">
2 <head>
3     <title>Building the Derelict Bindings</title>
4     <link rel="stylesheet" type="text/css" href="styles.css">
5 </head>
6 <body>
7
8 <h2>Building the Derelict Packages</h2>
9 It is recommended that when you use Derelict you first build the packages you need via the supplied
10 makefiles or supported IDE project files, even if you are using a build tool that allows you to bypass
11 this step. Doing so places all of the Derelict libraries in one convenient location and generates D Interface (.di)
12 files in a hierarchy, independent of the package tree, that make it easier to import Derelict into your applications.
13
14 <h3>All Platforms</h3>
15 Make files have been created for the platforms Derelict currently supports. They are designed to be
16 configurable to some degree. Configuration options will be discussed shortly. First, let's get straight into
17 compiling.
18
19 <p>
20 In order to build the packages via the make files, you must execute the make command with the -f command line
21 option to specify the platform-specific make file. You must also specify a compiler to use via the DC variable.
22 Henceforth, this documentation will refer to the top-level Derelict directory as $(DERELICT).
23
24 <pre><code>
25 cd $(DERELICT)
26
27 # on Windows
28 make -fwin32.mak DC=dmd
29
30 #on Linux or FreeBSD
31 make -flinux.mak DC=dmd
32
33 #on MacOS X
34 make -fmac.mak DC=dmd
35 </code></pre>
36
37 This will build all Derelict packages into several libraries in the $(DERELICT)/lib directory. It will also create
38 a hierarchy of .di files in $(DERELICT)/import. When compiling your application, you can easily add these
39 paths to your build so that your compiler can find the files. The output path for both the libraries and the
40 .di files is configurable.
41 </p>
42 <p>
43 The following table shows supported compilers and the values that should be passed as the DC parameter when executing make.
44 </p>
45
46 <table border="1" cellpadding="5">
47 <tr><th>Compiler</th><th>DC Value</th></tr>
48 <tr><td>DMD</td><td>dmd</td></tr>
49 <tr><td>LDC</td><td>ldc</td></tr>
50 <tr><td>GDC</td>><td>gdmd</td></tr>
51 </table>
52
53 <p>
54 The default name of each compiled library is that of the package (DerelictGL.lib, DerelictOgg.lib, etc..., on Windows,
55 and libDerelictGL.a, libDerelictOgg.a, etc..., on other platforms). However, some Derelict packages bind to multiple shared libraries.
56 For example, DerelictGL includes bindings for both OpenGL and GLU. Issuing the above make commands without
57 specifying any targets results in all bindings in a package being compiled into a single library file. But there are
58 targets to build each binding into separate libraries. Doing so will result in some libraries named differently than
59 the package. They will be named the same as the make target instead.
60 </p>
61
62 <pre><code>
63 make -fwin32.mak DerelictGL DerelictGLU DC=dmd
64 </code></pre>
65
66 <p>
67 This results in two libraries being generated, DerelictGL.lib and DerelictGLU.lib. You can also build both libraries
68 by using, in this case, the DerelictGL_ALL make target. Each package has a $(PACKAGENAME)_ALL target that will build all libraries
69 implemented by that package. The individual make targets supported for each package can be found in the package-specific
70 documentation.
71 </p>
72 <p>
73 There are also four cleanup targets.
74 <ul>
75 <li><pre>cleanlib</pre> Removes all compiled libraries from the configured library output path.</li>
76 <li><pre>cleandi</pre> Removes all generated .di files from the configured .di output path.</li>
77 <li><pre>clean</pre> A synonym for >cleanlib</li>
78 <li><pre>cleanall</pre> Executes both the cleanlib and cleandi targets.</li>
79 </ul>
80 </p>
81 <p>
82 Configuring the make-based build system can be done by modifying the files found in $(DERELICT).inc. There, you
83 will find the following files:
84 <ul>
85 <li><pre>dmd_inc.mak</pre> Configuration options for the DMD compiler.</li>
86 <li><pre>ldc_inc.mak</pre> Configuration options for the LDC compiler.</li>
87 <li><pre>linux_inc.mak</pre> Configuration options for Linux and FreeBSD.</li>
88 <li><pre>mac_inc.mak</pre> Configuration options for MacOS X.</li>
89 <li><pre>win32_inc.mak</pre> Configuration options for Windows.</li>
90 </ul>
91 </p>
92
93 <h4>Compiler Config</h4>
94 There is only one configurable option in the compiler include files: DFLAGS. Consider the other options hardcoded. The DFLAGS
95 variable allows you to specify compiler options to control the build output. By default, it is set to fully optimize the generated
96 code. This is where you would make the changes necessary to build debug versions of the libraries, or to add any other option
97 that <em>directly affects the generated code</em>. This is <em>not</em> where you adjust the locations of the .di files or
98 the libraries themselves. That is handled in the platform configuration files.
99
100 <h4>Platform Config</h4>
101 There are two configurable options in each platform-specific include: LIB_DEST and IMPORT_DEST. The former determines where
102 the compiled library files will be output, while the latter specifies the output path for the generated .di files. You can change these
103 to any valid path on your system.
104
105 <h3>Windows</h3>
106 Aside from the make file build system described above, project files are also provided for the <a href="http://www.dsource.org/projects/visuald/wiki/">VisualD IDE</a>.
107 To build via VisualD, follow these steps.
108 <ol>
109 <li>From within VisualD, go to File->Open->Project/Solution (or pres Ctrl-Shift-O).</li>
110 <li>In the file selection window, navigate to $(DERELICT)/project/visuald and select the file Derelict.sln.</li>
111 <li>In the toolbar, selecte the build configuration you want (Release or Debug -- usually you'll want Release).</li>
112 <li>You can alternatively press Ctrl-Shift-B or right-click on the solution in the Solution Explorer window and select 'Build Solution
113 from the popup menu to build all packages, or you can right click on any of the project names in the Solution Explorer window and
114 select 'Build' to build individual packages.</li>
115 </ol>
116 As with the make-based build system, libraries are created in $(DERELICT)/lib and .di files in $(DERELICT)/import by default.
117 You can change this for each build configuration in the settings dialog for each project. Unfortunately, I don't know of a way
118 to configure this globally.
119
120 </body>
121 </html>
Note: See TracBrowser for help on using the browser.