source: rtems-graphics-toolkit/fltk-1.3.0/README.MSWindows.txt @ d280eda

Last change on this file since d280eda was f5c9e9c, checked in by Alexandru-Sever Horin <alex.sever.h@…>, on 07/05/12 at 09:33:03

Aded FLTK 1.3.0

  • Property mode set to 100644
File size: 19.0 KB
Line 
1README.MSWindows.txt - 2010-10-25 - Building FLTK under Microsoft Windows
2-------------------------------------------------------------------------
3
4
5
6 CONTENTS
7==========
8
9  1   INTRODUCTION
10  2   HOW TO BUILD FLTK USING MinGW/Cygwin
11    2.1   The Tools
12    2.2   Recommended Command Line Build Environment
13    2.3   Prerequisites
14    2.4   Downloading and Unpacking
15    2.5   Configuring FLTK
16    2.6   Building FLTK
17    2.7   Testing FLTK
18    2.8   Installing FLTK
19    2.9   Creating new Projects
20  3   HOW TO BUILD FLTK USING VISUAL STUDIO 2008
21    3.1   Prerequisites
22    3.2   Downloading and Unpacking
23    3.3   Configuring FLTK
24    3.4   Building FLTK
25    3.5   Testing FLTK
26    3.6   Installing FLTK
27    3.7   Creating new Projects
28  4   HOW TO BUILD FLTK USING VISUAL STUDIO 2010
29    4.1   Prerequisites
30    4.2   Downloading and Unpacking
31    4.3   Configuring FLTK
32    4.4   Building FLTK
33    4.5   Testing FLTK
34    4.6   Installing FLTK
35    4.7   Creating new Projects
36  5   FREQUENTLY ASKED QUESTIONS
37  7   LINKS
38  6   DOCUMENT HISTORY
39
40
41 INTRODUCTION
42==============
43
44FLTK 1.3 and later is officially supported on Windows (2000,) 2003,
45XP, and later.  Older Windows versions are not officially supported,
46but may still work.  The main reason is that the OS version needs
47to support UTF-8. FLTK 1.3 is known to work on Windows 7 and Vista.
48
49FLTK currently supports the following development
50environments on the Windows platform:
51
52    - Free Microsoft Visual C++ 2008 Express and Visual
53      C++ 2010 Express using the supplied workspace and
54      project files. Older and the commercial versions can
55      be used as well, if they can open the project files.
56      Be sure to get your service packs!
57
58      The project files can be found in the ide/ directory.
59      Please read ide/README.IDE for more info about this.
60
61    - GNU toolsets (Cygwin or MinGW) hosted on Windows.
62
63CAUTION: Libraries built by any one of these environments can not be mixed
64with object files from any other environment!
65
66
67 HOW TO BUILD FLTK USING MinGW and Cygwin
68==========================================
69
70This chapter of this document gives a brief overview of
71compiling and using FLTK with the Cygwin and MinGW compiler
72toolkits.  Both toolkits provide a build environment based
73around the GNU C/C++ compiler. Further information is
74available from the FLTK website at http://www.fltk.org, such
75as this Howto note: http://www.fltk.org/articles.php?L598
76
77The Cygwin build environment supplies a library (the Cygwin
78DLL) that is primarily intended to provide a number of
79Unix-like POSIX facilities for programs being ported to the
80Windows environment (Win32 or WinNT).  Cygwin also supplies
81a very Unix-like build environment for Windows, including
82the "BASH" Bourne-compatible shell and all of the standard
83Unix file utilities (ls, cat, grep, etc.).
84
85Cygwin is developed by Cygnus (now part of RedHat, Inc).
86Although provided for free download under the GPL,
87distributing programs that require the Cygwin DLL under a
88license other than the GPL requires a commercial license for
89the Cygwin DLL.  Native Windows programs that do not require
90the Cygwin DLL (compiled and linked with the "-mno-cygwin"
91option) may be released under any license freely.
92
93Note: Since December 2009, there is a new gcc 4.x compiler
94that doesn't support the -mno-cygwin option anymore. You
95must use the older gcc-3 compiler instead.
96
97An alternative is to install the new (since about Oct. 2010)
98mingw cross tools that support newer gcc compilers for building
99native Windows applications (like -mno-cygwin above).
100Currently you would have to install mingw64-i686-gcc-g++ for
10132-bit Windows applications (despite its name!), and/or
102mingw64-x86_64-gcc-g++ for 64-bit applications. You may also
103need to install the corresponding '-headers' packages as well.
104Currently these tools support gcc 4.5.x or newer, but the
105setup for FLTK is somewhat more complicated and not yet
106completely supported automatically (you may need to edit
107some lines in the generated makeinclude file).
108
109The MinGW distribution (Minimalist GNU for Windows) provides
110a similar toolset but geared solely towards native Windows
111development without the Unix-like POSIX library.  The lack of
112any libraries under the GPL or any other restrictive license
113means that programs built with the MinGW environment may
114always be released under any license freely. MinGW also
115supplies a Unix-like build environment for Windows,
116including MSYS (a Bourne-compatible shell) and the standard
117Unix file utilities (ls, cat, grep, etc.)
118
119If you are not familiar with these GNU-like toolkits please
120refer to the links section later in this note. In particular,
121check out their license conditions carefully before use.
122
123
124 The Tools
125-----------
126
127There are currently three main configurations supported by
128FLTK with the GNU tools:
129
130    1. Cygwin: Built using the Cygwin toolset and using the
131       Unix-like POSIX compatibility layer provided by the
132       Cygwin DLL.
133
134    2. Cygwin using the "-mno-cygwin" option: Built using
135       the Cygwin toolset but not using the Cygwin DLL.
136
137    3. MinGW: Built using the MinGW utilities, compiler and
138       tools. This is, in many aspects, analogous to the
139       Cygwin "-mno-cygwin" option. This is the recommended
140       one if you want to build native Windows programs only.
141
142
143 Recommended Command Line Build Environment
144--------------------------------------------
145
146Our recommendation is to:
147
148    1. Get the current Cygwin toolset.
149
150       This can either produce executables that do or do not
151       rely on the Cygwin DLL (check licensing) at your
152       choice.
153
154    2. Get the latest MinGW toolset. It is recommended that
155       you also get the MSYS shell and the msysDTK developer
156       toolset.
157
158       This will only produce normal Windows native
159       executables without any Unix or POSIX compatibility
160       layer.
161
162
163       See the links section below for more information.
164
165Either option can generate windows-native executables and
166option 1 can provide a Unix-like POSIX portability layer that
167is reliant on a GPLed library.
168
169See the later sections for detailed information about using
170one of these configurations.
171
172
173 Prerequisites
174---------------
175
176In order to build FLTK from the command line, you need to install the MinGW
177environment from www.mingw.org. The graphical installer "mingw-get-inst" can
178be downloaded here for free:
179
180  http://www.mingw.org/wiki/Getting_Started
181
182Launch the installer and follow the instructions. In the "Select Components"
183dialog, add "C++ Compiler", "MSYS Basic System", and "MinGW Developer Toolkit".
184Wait for the installer to finish.
185
186After downloading and installing, you need to launch the MinGW Shell through
187the Start menu.
188
189
190 Downloading and Unpacking
191---------------------------
192
193Download FLTK from here:
194
195  http://www.fltk.org/software.php
196
197into your home folder. The default location as seen from MSWindows is similar
198to
199
200  C:\MinGW\msys\1.0\home\matt\
201
202If you are familiar with "subversion" and like to stay current with your
203version, you will find the subversion access parameters at the bottom of
204that page. Unpack FLTK into a convenient location. I like to have everything
205in my dev directory:
206
207  cd
208  mkdir dev
209  cd dev
210  tar xvfz fltk-1.3.xxxx.tar.gz
211  cd fltk-1.3.xxxx
212
213
214 Configuring FLTK
215------------------
216
217Stay in your FLTK source-code directory. Type:
218
219  autoconf
220
221Now configure your FLTK installation:
222
223  ./configure
224
225ADVANCED: type "./configure --help" to get a complete list of optional
226configuration parameters. These should be pretty self-explanatory. Some
227more details can be found in README.
228:END_ADVANCED
229
230The configuration script will check your machine for the required resources
231which should all have been part of your MinGW installation. Review the
232Configuration Summary, maybe take some notes.
233
234ADVANCED: some versions of MinGW/Msys are broken and complain about a missing
235--enable-auto-import. The solution is to upgrade to the current release. If
236that is not possible, you can include the --enable-auto-import flag when
237linking:
238  ./configure <config flags> LDFLAGS=-Wl,--enable-auto-import
239:END_ADVANCED
240
241
242 Building FLTK
243---------------
244
245Now this is easy. Stay in your FLTK source-code directory and type:
246
247  make
248
249The entire FLTK toolkit including many test programs will be built for you.
250No warnings should appear.
251
252(actually, as of Oct 25 2010, quite a lot of warnings related to suggested
253parentheses and others will appear, this is normal and will be fixed. The
254linker will also spit out a bunch of warnings for every program linked. This
255needs to be fixed. Lastly, there is no generator for man pages in a default
256MinGW installation, but you can install man and groff to fix this.)
257
258
259 Testing FLTK
260--------------
261
262After a successful build, you can test FLTK's capabilities:
263
264  test/demo
265
266
267 Installing FLTK
268-----------------
269
270If you did not change any of the configuration settings, FLTK will be
271installed in "/usr/local/include" and "/usr/local/lib" by typing
272
273  make install
274
275It is possible to install FLTK in user space by changing the installation path
276to a location within the user account by adding the "--prefix=PREFIX" parameter
277to the "./configure" command.
278
279
280 Creating new Projects
281-----------------------
282
283FLTK provides a neat script named "fltk-config" that can provide all the flags
284needed to build FLTK applications using the same flags that were used to build
285the library itself. Running "fltk-config" without arguments will print a list
286of options. The easiest call to compile an FLTK application from a single
287source file is:
288
289  fltk-config --compile myProgram.cxx
290
291"fltk-config" and "fluid" will be installed in "/usr/local/bin/" by default.
292I recommend that you add it to the command search path.
293
294
295
296 HOW TO BUILD FLTK USING VISUAL STUDIO 2008
297============================================
298
299
300 Prerequisites
301---------------
302
303In order to build FLTK from within VisualStudio 2008, you need to install the
304VisualC developer environment from the Microsoft web site. The Express edition
305is free of charge and sufficient to develop FLTK applications:
306
307  http://www.microsoft.com/express/Downloads/
308
309You must make sure that at least VisualStudio 2008 Service Pack 1 is installed
310or building FLTK on a multicore CPU will be very painful!
311
312
313 Downloading and Unpacking
314---------------------------
315
316Download FLTK from here:
317
318  http://www.fltk.org/software.php
319
320If you are familiar with "subversion" and like to stay current with your
321version, you will find the subversion access parameters at the bottom of
322that page.
323
324Unpack FLTK by using an appropriate unpacker and copy the new folder into a
325convenient location. I have set up a "dev" folder in my home folder for all
326my projects.
327
328
329 Configuring FLTK
330------------------
331
332Launch VisualStudio. Open the project file in
333
334  ...\fltk-1.3.xxxx\ide\VisualC2008\fltk.sln
335
336Choose "Debug" or "Release" mode from the "Solution Configurations" menu.
337
338
339 Building FLTK
340---------------
341
342Use the context menu of the "demo" project to "Set as StartUp Project". Then
343select "Build Solution" from the "Build" menu or press F7 to build all
344libraries.
345
346VisualC 2008 has a bug that messes up building a Solution on multicore CPUs.
347Make sure that Visual Studio 2008 Service Pack 1 is installed or, as a
348workaround, set the "maximum number of parallel project builds" to 1 (Tools >
349Options > Projects and Solutions > Build and Run > maximum number of parallel
350project builds). Also, repeating the build command two or three times may
351clear unresolved reference errors.
352
353
354 Testing FLTK
355--------------
356
357Select "Start Debugging" from the "Debug" menu or just press F5 to run the
358Demo program. Use "Demo" to explore all test programs.
359
360
361 Installing FLTK
362-----------------
363
364The default location for VisualC 2008 libraries and headers is here:
365
366  C:\Program Files\Microsoft Visual Studio 9.0\VC\
367
368It is possible to move the FLTK libraries, headers, and Fluid into the
369respective subdirectories, so that they are available for future development
370without adding link and include paths to the solution.
371
372  copy the entire FL directory into the include path
373
374  copy all .lib files from the fltk lib directory to the VC lib directory
375
376  copy fluid.exe in the fluid directory to the bin directory
377
378I highly discourage using dll's (dynamically linking libraries) on MSWindows
379because they will require an installation process and likely cause version
380conflicts. Use the static .lib libraries instead.
381
382
383 Creating new Projects
384-----------------------
385
386This chapter assumes that libraries and headers are copied into
387
388  C:\Program Files\Microsoft Visual Studio 9.0\VC\
389
390Create a new project of type "General", "Empty Project" and add a simple "C++"
391file to it. The FLTK "hello" source code is a good base.
392
393Now open the Project Properties dialog and add "Comctl32.lib" and all the FLTK
394libraries that you want to use (at least "fltk.lib") to Additional Dependencies
395(Configuration Properties > Linker > Additional Dependencies). In the same
396dialog, add "WIN32" to the C++ Preprocessor Definitions (Configuration
397Properties > C/C++ > Preprocessor > Preprocessor Definitions).
398
399Compile and run your test program with F5.
400
401You can also include .fl resources: add a new Header file to your project, but
402let the name end in .fl. Right-click and select "Open with...". Add "fluid.exe"
403from the "bin" directory and set it as the default editor.
404
405To automatically compile .fl files, open the Properties editor and set the
406Custom Build Steps to:
407
408  Command Line: fluid.exe -c $(InputPath)
409  Description: Compiling Fluid .fl file
410  Outputs: $(InputDir)$(InputName).cxx; $(InputDir)$(InputName).h
411
412Now add the generated .cxx file to your project as well. Whenever the .fl file
413is changed, the corresponding .cxx file will be recompiled.
414
415
416
417 HOW TO BUILD FLTK USING VISUAL STUDIO 2010
418============================================
419
420
421 Prerequisites
422---------------
423
424In order to build FLTK from within VisualStudio 2010, you need to install the
425VisualC developer environment from the Microsoft web site. The Express edition
426is free of charge and sufficient to develop FLTK applications:
427
428  http://www.microsoft.com/express/Downloads/
429
430
431 Downloading and Unpacking
432---------------------------
433
434Download FLTK from here:
435
436  http://www.fltk.org/software.php
437
438If you are familiar with "subversion" and like to stay current with your
439version, you will find the subversion access parameters at the bottom of
440that page.
441
442Unpack FLTK by using an appropriate unpacker and copy the new folder into a
443convenient location. I have set up a "dev" folder in my home folder for all
444my projects.
445
446
447 Configuring FLTK
448------------------
449
450Launch VisualStudio. Open the project file in
451
452  .../fltk-1.3.xxxx/ide/VisualC2010/fltk.sln
453
454Choose "Debug" or "Release" mode from the "Solution Configurations" menu.
455
456
457 Building FLTK
458---------------
459
460Use the context menu of the "demo" project to "Set as StartUp Project". Then
461select "Build Solution" from the "Build" menu or press F7 to build all
462libraries.
463
464
465 Testing FLTK
466--------------
467
468Select "Start Debugging" from the "Debug" menu or just press F5 to run the
469Demo program. Use "Demo" to explore all test programs.
470
471
472 Installing FLTK
473-----------------
474
475The default location for VisualC 2010 libraries and headers is here:
476
477  C:\Program Files\Microsoft Visual Studio 10.0\VC\
478
479It is possible to move the FLTK libraries, headers, and Fluid into the
480respective subdirectories, so that they are available for future development
481without adding link and include paths to the solution.
482
483  copy the entire FL directory into the include path
484
485  copy all .lib files from the fltk lib directory to the VC lib directory
486
487  copy fluid.exe in the fluid directory to the bin directory
488
489I highly discourage using dll's (dynamically linking libraries) on MSWindows
490because they will require an installation process and likely cause version
491conflicts. Use the static .lib libraries instead.
492
493
494 Creating new Projects
495-----------------------
496
497This chapter assumes that libraries and headers are copied into
498
499  C:\Program Files\Microsoft Visual Studio 10.0\VC\
500
501Create a new project of type "General", "Empty Project" and add a simple "C++"
502file to it. The FLTK "hello" source code is a good base.
503
504Now open the Project Properties dialog and add "Comctl32.lib" and all the FLTK
505libraries that you want to use (at least "fltk.lib") to Additional Dependencies
506(Configuration Properties > Linker > Additional Dependencies). In the same
507dialog, add "WIN32" to the C++ Preprocessor Definitions (Configuration
508Properties > C/C++ > Preprocessor > Preprocessor Definitions).
509
510Compile and run your test program with F5.
511
512You can also include .fl resources: add a new Header file to your project, but
513let the name end in .fl. Right-click and select "Open with...". Add "fluid.exe"
514from the "bin" directory and set it as the default editor.
515
516To automatically compile .fl files, open the Properties editor and change the
517Element Type to Custom Build and click Apply. Now set the
518Custom Build Steps to:
519
520  Command Line: fluid.exe -c %(FullPath)
521  Description: Compiling Fluid .fl file
522  Outputs: $(InputDir)$(InputName).cxx; $(InputDir)$(InputName).h
523
524Now add the generated .cxx file to your project as well. Whenever the .fl file
525is changed, the corresponding .cxx file will be recompiled.
526
527
528
529 FREQUENTLY ASKED QUESTIONS
530============================
531
532
533 Why does a console window appear when I run my program?
534---------------------------------------------------------
535
536Windows has a flag that determines whether an application
537runs in the foreground with a console or in the background
538without a console.  Use the "-mwindows" option to make your
539application run in the background and "-mconsole" to run in
540the foreground.
541
542Keep in mind that a windows application cannot send output
543to stdout, even if you run it from an existing console
544application.
545(Note: A special case of this exists if running a MinGW
546application from the command line of an MSYS shell, when an
547application is able to write to stdout, even if compiled with
548"-mwindows".  The same applies to Cygwin.)
549
550
551 How do I get OpenGL to work?
552------------------------------
553
554Both builds should automatically support OpenGL.
555
556The configuration file config.h has a number of settings
557which control compile-time compilation.  One such setting is
558"HAVE_GL". This may be set to 0 to disable Open GL operation.
559Changing the line in config.h to
560
561    #define HAVE_GL 1
562
563will change this to compile and link in OpenGL.
564
565
566
567 LINKS
568=======
569
570The following links may be of use:
571
5721. Main Cygwin homepage:
573
574       http://www.cygwin.com/
575
5762. Main Mingw homepage:
577
578       http://www.mingw.org/
579
580   In particular look for the MinGW FAQ at this link for
581   a lot of useful Mingw-native development
582   documentation.
583
584
5853. Check out the FLTK newsgroups at the FLTK homepage:
586
587       http://www.fltk.org/
588
589   Its archival search facilities are EXTREMELY useful
590   to check back through previous problems with this
591   sort of configuration before posting new questions.
592
5934. GNU Compiler Collection (GCC) compiler homepage:
594
595       http://gcc.gnu.org/
596
5975. OpenGL page - for OpenGL and GLUT libs
598
599       http://www.opengl.org/
600
601
602
603 DOCUMENT HISTORY
604==================
605
606Oct 25 2010 - matt: restructured entire document and verified instructions
607Dec 20 2010 - matt: merged with README.win32
608Dec 22 2010 - AlbrechtS: added newer Cygwin (cross/mingw-w64) options
Note: See TracBrowser for help on using the repository browser.