Skip to content

Commit

Permalink
Matthew Leverton added build instructions for DMC.
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Wang committed Jul 22, 2007
1 parent 12e5721 commit dad2c29
Show file tree
Hide file tree
Showing 3 changed files with 196 additions and 2 deletions.
192 changes: 192 additions & 0 deletions docs/src/build/dmc._tx
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
@html_text_substitution=readme.txt|<a href="../readme.html">readme.txt</a>
@external-css=../allegro.css
@document_title=Allegro DMC-specific information
@<pre>
______ ___ ___
/\ _ \ /\_ \ /\_ \
\ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
\ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
\ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
\ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
\/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
/\____/
\_/__/


DMC-specific information.

See readme.txt for a more general overview.
@</pre>



@heading
DMC notes

Status: complete.

Caveats: The DMC port does not support assembly, so ALLEGRO_USE_C must be
set when compiling. The DMC runtime library does not support unicode paths.

DMC is the only Windows compiler that can build a static library that can
be used with DAllegro.

The instructions at <link>http://wiki.allegro.cc/Build/DMC</a> might be
more up to date.



@heading
Required software

<ul><li>Digital Mars C/C++ Compiler - <link>http://www.digitalmars.com/d/1.0/download.html</a>
<li>Digital Mars Basic Utilities - <link>http://ftp.digitalmars.com/bup.zip</a>
<li>GNU Make - <link>http://sourceforge.net/project/showfiles.php?group_id=9328</a>
<li>Recent set of DirectX and other Windows SDK headers. - <link>http://alleg.sourceforge.net/files/dx70_dmc.zip</a>
</ul>



@heading
Setting up DMC

<ol><li>Unzip the Digital Mars compiler (dmc.zip) and place the files in c:\dmc.
<li>Unzip the Basic Utilities (bup.zip) and place them in the same folder.
(The exe files should all be in the c:\dmc\bin folder.)
<li>Unzip the DirectX 7 package (dx70_dmc.zip) and place the include files
in c:\dmc\include and the library files in c:\dmc\lib. (This will overwrite
some of DMC's default DX files.)
<li>Extract only the usr/local/wbin/make.exe file from UnxUtils.zip to your
desktop, rename it to gmake.exe, and copy it to c:\dmc\bin.
<li>Add c:\dmc\bin to your PATH environment variable.
<li>Create the DMCDIR environment variable and set it to c:\dmc
</ol>



@heading
Building Allegro

@hnode Step by Step Instructions

<ul><li>Extract the Allegro source zip file to c:\allegro
<li>Open up a MS-DOS prompt and type the following commands.
</ul>
<textblock>
cd\allegro
fix dmc
gmake obj\dmc\plugins.h
gmake all ALLEGRO_USE_C=1 STATICLINK=1
gmake installall ALLEGRO_USE_C=1 STATICLINK=1
gmake all ALLEGRO_USE_C=1
gmake installall ALLEGRO_USE_C=1
<endblock>

@hnode Advanced Build Options

The above instructions build six versions of Allegro, the Demo, tools,
examples, and the documentation. If you don't need all of that, you can
customize what gets built. Obviously, if you don't need both the static or
dynamic libraries, simply don't run the associated commands. If you don't
care about the Debugging or Profiling versions, you can remove the word all
from the command line. For example:

<textblock>
gmake ALLEGRO_USE_C=1
gmake install ALLEGRO_USE_C=1
<endblock>

builds and installs the optimized, dynamic Allegro library along with all of
the examples, documents, etc. Or if you want to specifically build and
install the debug and profiling versions:

<textblock>
gmake ALLEGRO_USE_C=1 DEBUGMODE=1
gmake install ALLEGRO_USE_C=1 DEBUGMODE=1
gmake ALLEGRO_USE_C=1 PROFILEMODE=1
gmake install ALLEGRO_USE_C=1 PROFILEMODE=1
<endblock>

If you only want to build the library (without the extra stuff), specifically
request to make the lib target:

<textblock>
gmake lib ALLEGRO_USE_C=1
<endblock>

That would only build the optimized, dynamic Allegro library. Other targets
besides lib exist; refer to Makefile.all and Makefile.dmc for more
information. All of the options can be mixed and matched where it makes
sense.

Note that DMC can only build the C version of Allegro (as opposed to using
some assembly), so the ALLEGRO_USE_C=1 option is mandatory.



@heading
Using Allegro

@hnode Hello World

For a simple example, consider hello.c:

<codeblock>
#include &ltallegro.h>

int main(void)
{
allegro_init();
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0,0);
allegro_message("Hello, World!");
return 0;
}
END_OF_MAIN()
<endblock>

First, you must include the Allegro header file. Inside the main function,
you should call allegro_init() to set up Allegro. You must do that before
calling (almost) any of the other Allegro functions. (This program will
create a 640x480 window and then pop-up the message "Hello, World!".)
At the end of the main function, you must include the END_OF_MAIN()
macro (no semicolon is needed).

@hnode Dynamic Version (DLL)

To compile this program, type:

<textblock>
dmc -c test.c
<endblock>

This will create the object file. It will then need to be linked to Allegro
when you create the executable:

<textblock>
dmc test.obj alleg.lib -otest.exe
<endblock>

That will build test.exe, which will require the Allegro DLL (eg: alleg42.dll)
to run. Alternatively you could use allp.lib for profiling or alld.lib for
debugging.

@hnode Static Version

If you wanted to statically link this program so that the Allegro DLL is not
required, you must first compile it like:

<textblock>
dmc -c test.c -DALLEGRO_STATICLINK=1
<endblock>

Then you can link it against any of the static versions of Allegro:

<textblock>
dmc test.obj alleg_s.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib
ole32.lib dinput.lib ddraw.lib winmm.lib dsound.lib dxguid.lib
<endblock>

(All of that should be entered on one line.) Note that you have to include a
bunch of Windows libraries when you statically link! As before, you can also
use allp_s.lib for profiling and alld_s.lib for debugging.

3 changes: 2 additions & 1 deletion makefile.all
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ EXAMPLES = $(basename $(notdir $(ALLEGRO_EXAMPLE_FILES)))
EXAMPLE_FILES = $(addprefix examples/, $(addsuffix $(EXE), $(EXAMPLES)))

ifdef HTML
# XXX this is duplicated in makefile.in
DOCBASEFILES = ahack changes faq mistakes help thanks allegro const abi api packfile \
readme makedoc datafile grabber dat dat2c dat2s license
DOCBUILDFILES = bcc32 beos darwin djgpp linux macosx mingw32 msvc qnx unix watcom
DOCBUILDFILES = bcc32 beos darwin djgpp dmc linux macosx mingw32 msvc qnx unix watcom
DOCTXTBUILDFILES = $(addprefix docs/build/,$(addsuffix .txt,$(DOCBUILDFILES)))

DOCS = $(addprefix docs/txt/,$(addsuffix .txt,$(filter-out changes thanks readme, $(DOCBASEFILES))))
Expand Down
3 changes: 2 additions & 1 deletion makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,10 @@ endif

# -------- documentation --------

# XXX this is duplicated in makefile.all
DOCBASEFILES = ahack changes faq mistakes help thanks allegro const abi api packfile \
readme makedoc datafile grabber dat dat2c dat2s license
DOCBUILDFILES = bcc32 beos darwin djgpp linux macosx mingw32 msvc qnx unix watcom
DOCBUILDFILES = bcc32 beos darwin djgpp dmc linux macosx mingw32 msvc qnx unix watcom
DOCTXTBUILDFILES = $(addprefix docs/build/,$(addsuffix .txt,$(DOCBUILDFILES)))

DOCS = $(addprefix docs/txt/,$(addsuffix .txt,$(filter-out changes thanks readme, $(DOCBASEFILES))))
Expand Down

0 comments on commit dad2c29

Please sign in to comment.