summaryrefslogtreecommitdiff
path: root/README.win32
blob: 04f083dce934d62d2aea32d6f86a13c8cbf4d9b6 (plain)
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
README.win32 - 10/03/2002 - Building FLTK under Windows
-------------------------------------------------------

INTRODUCTION

    This document is split into two main sections.  The first
    describes several possible build environments, while the
    second describes some of the issues associated with using
    the GNU-like build configurations in the "makefiles"
    subdirectory.

    FLTK currently supports the following development
    environments on the Windows platform:

	- Microsoft Visual C++ 6.0 using the supplied workspace
	  and project files.  Be sure to get your service packs!

	- Borland C++ Builder 5 using the supplied IDE file.

	- GNU toolsets (Cygwin or MinGW) hosted on Windows
	  9x/2000/NT/XP.

    This document gives a brief overview of compiling and using
    FLTK with the Cygwin and MinGW compiler toolkits.  Both
    toolkits provide a build environment based around the GNU
    C/C++ compiler.

    The Cygwin build environment supplies a library (the Cygwin
    DLL) that is primarily intended to provide a number of
    Unix-like POSIX facilities for programs being ported to the
    Windows environment (Win32 or WinNT).  Cygwin also supplies
    a very Unix-like build environment for Windows, including
    the "BASH" Bourne-compatible shell and all of the standard
    Unix file utilities (ls, cat, grep, etc.).

    Cygwin is developed by Cygnus (now part of RedHat, Inc). 
    Although provided for free download under the GPL,
    distributing programs that require the Cygwin DLL under a
    license other than the GPL requires a commercial license for
    the Cygwin DLL.  Native Windows programs that do not require
    the Cygwin DLL (compiled and linked with the "-mno-cygwin"
    option) may be released under any license freely.

    The MinGW distribution (Minimalist GNU for Windows) provides
    a similar toolset but geared solely towards native Windows
    development without the Unix-like POSIX library.  The lack
    of any libraries under the GPL or any other restrictive
    license means that programs built with the MinGW environment
    may always be released under any license freely.

    If you are not familiar with these GNU-like toolkits please
    refer to the links section later in this section.  In
    particular, check out their license conditions carefully
    before use.


THE TOOLS

    There are currently three main configurations supported by
    FLTK:

	1. Cygwin: Built using the Cygwin toolset and using the
	   Unix-like POSIX compatibility layer provided by the
	   Cygwin DLL.

	2. Cygwin using the "-mno-cygwin" option: Built using
	   the Cygwin toolset but not using the Cygwin DLL.

	3. MinGW: Mainly based upon the MinGW utilities,
	   compiler and tools but currently needs additional
	   tools from the Cygwin distribution (make.exe and
	   sh.exe).


RECOMMENDED BUILD ENVIRONMENTS

    Our recommendation is to:

	1. Get the current Cygwin toolset (June 20, 2000 or
	   later).

	   Can produce executables that do or do not rely on the
	   Cygwin DLL (check licensing)-- your choice.  No
	   supplementary MinGW files are required.

	2. Get the latest full MinGW toolset and add Cygwin
	   "make.exe" and "sh.exe" to it.

	   Will only normal Windows native executables without
	   any Unix or POSIX compatibility.

	3. Get a pre-built combined toolset that has been tested
	   with FLTK.

	   Carl Thompson has provided a set based upon the B20.1
	   Cygwin release and ~Feb 2000 version of Mingw which
	   has been successfully used for FLTK.

	   This will provide several Cygwin utilities and the
	   MinGW compiler. Compilation will produce executables
	   not reliant on the Cygwin DLL and so are freely
	   redistributable under any license you choose.

	   See the links section below for more information.

    All three options can provide windows-native executables and
    1 can provide a Unix-like POSIX portability layer that is
    reliant on a GPLed library.

    See the later sections for detailed information about using
    one of these configurations.

LINKS

    The following links may be of use:

	1. Main Cygwin homepage:

	       http://sourceware.cygnus.com/cygwin/

	2. Main Mingw homepage:

	       http://www.mingw.org/

	   In particular look for the MinGW FAQ at this link for
	   a lot of useful Mingw-native development
	   documentation.

	3. Mumit Khan's homepage (chief maintainer and driving
	   force behing MinGW):

	       http://www.xraylith.wisc.edu/~khan/software/gnu-win32/index.html

	   This page provides descriptions of Cygwin, Mingw and
	   several other similar packages. This information can
	   sometimes lag the current release however.

	   In particular the insights and recommendations for
	   using Cygwin for MinGW compilation are very useful:

	       http://www.xraylith.wisc.edu/~khan/software/gnu-win32/mno-cygwin-howto.txt

	   (Some of this information may be outdated and inaccurate!)

	4. Check out the FLTK newsgroups at the FLTK homepage:

	       http://www.fltk.org/

	   Its archival search facilities are EXTREMELY useful
	   to check back through previous problems with this
	   sort of configuration before posting new questions.

	5. Carl Thompson (member of the core team responsible
	   for FLTK):

	       http://www.carlthompson.net/

	   Currently a pre-bundled development toolset may be
	   found at:

	       http://www.carlthompson.net/cygwin/

	6. GNU Compiler Collection (GCC) compiler homepage:

	       http://gcc.gnu.org/

	7. OpenGL page - for OpenGL and GLUT libs

	       http://www.opengl.org/
  

BUILDING FLTK WITH CYGWIN OR MINGW

    Please read chapter 1 of the FLTK Programmers Manual for
    compilation instructions.


WHY DOES A CONSOLE WINDOW APPEAR WHEN I RUN MY PROGRAM

    Windows has a flag that determines whether an application
    runs in the foreground with a console or in the background
    without a console.  Use the "-mwindows" option to make your
    application run in the background and "-mconsole" to run in
    the foreground.

    Keep in mind that a windows application cannot send output
    to stdout, even if you run it from an existing console
    application.


HOW DO I GET OPENGL TO WORK?

    The CygWin build automatically supports OpenGL.

    The MingW build disables OpenGL by default, since the
    standard MingW distribution lacks the OpenGL header files.

    The configuration file config.h has a number of settings
    which control compile-time compilation.  One such setting is
    "HAVE_GL" . By default this is set to 0 to disable Open GL
    operation.  Changing the line in config.h to

        #define HAVE_GL 1

    will change this to compile and link in OpenGL.

    In order for it to work you will need a few OpenGL headers
    for both Cygwin and MinGW.  These are not part of the
    official distributions of Cygwin or MinGW, so they need to
    be added.  The following page provides a ZIP file containing
    the OpenGL headers:

	http://www.carlthompson.net/fltk/

    These should be put in a "GL" subdirectory somewhere in your
    compiler's search path.

    You will also need an OpenGL library and an additional set
    of GLUT libraries.

    The OpenGL files are most likely already part of your
    operating system, and the GLUT libraries are in current
    versions of MinGW and Cygwin or may be found at:

        http://www.opengl.org/

    Do a search for 'GLUT windows' and the first couple of
    results will take you to the latest GLUT and OpenGL libs for
    Windows.

    The binaries (DLLs normally) need to be put somewhere on the
    system PATH. Consult the install documentation on the site
    for info.

    Many programs use OpenGL and GLUT so you may already have
    them on your system.