summaryrefslogtreecommitdiff
path: root/docs/INSTALL.txt
blob: d3aefbf575ab22bacd680ee30393ebf59b5ead0a (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

                     fpGUI Toolkit

                   INSTALLATION NOTES



 Building fpGUI from the Command Line
 ====================================

This is still a work in progress until I can find a suitable solution. I'm
not 100% satisfied with this, but it's a quick and dirty way to get things
to compile. I'll assume you have the 'fpc' executable setup in your PATH so it
can be run from any location on your computer. I'll also assume your global
fpc.cfg file has been setup correctly so the FPC compiler can find the RTL and
FCL units.

Under Linux run:
   cd <fpgui>/src
   build.sh

Under Windows run:
   cd <fpgui>\src
   build.bat


The extrafpc.cfg file located in the src directory is combined with your global
fpc.cfg file. The local extrafpc.cfg file sets up all the required search and
include paths to compile the CoreLib and GUI directories.

All compiled units (*.o and *.ppu) are saved in the <fpgui>/lib directory. This 
makes the search paths for you applications a little easier to setup.


 Building fpGUI using Lazarus
 ============================

I use a Lazarus feature call Packages that compiles the required 
units and keeps track of the compiled units and paths when creating 
applications.  

 * Start Lazarus
 * Select Components->Open Package File (*.lpk) and select the
    src/corelib/<your platform>/fpgui_toolkit.lpk
   Under Linux/FreeBSD the .lpk file will be in the 'x11' directory.
   Under Windows the .lpk file will be in the 'gdi' directory.
   A new dialog will appear - click Compile.
 * Lazarus has now compiled the package and will keep track of
   all the compiled units and paths.
 * Now lets open a project. Select Project->Open Project and select
   any project in the examples/gui directory. Select the *.lpi file.
 * Now select Run->Build and Lazarus will compile the project for
   you. The executable will be located in the same directory as the
   source. The compiled units will be placed in the <project>/units
   directory.

When you create you own project, all you need to do is tell Lazarus to 
associate the 'fpgui_package.lpk' with your project and it will automatically 
find all the fpGUI compiled units and source for you.

 * Creating a new project. Select Project->New Project.  Select
   Program and click the Create button.
 * Save the project in your preferred directory.
 * Associate fpGUI with your project. Select Project->Project Inspector.
   An new dialog will appear. Select Add then New Requirements. In the
   Package Name combobox, select the 'fpgui_package' package and
   click OK.
 * You can now write your program and use any fpGUI units. Lazarus will
   automatically include the paths to the fpGUI compiled units for you.


 Building fpGUI from the Free Pascal Text IDE
 ============================================

First you would need to setup the 'fp' IDE to find the related files.
As far as I understand the text mode IDE has it's own built-in compiler
so doesn't read the standard fpc.cfg file.

 * Run the text mode IDE from the command line:  fp
 * Navigate the menus to: Options|Directories and select the 'Units'
   tab.
 * Now enter the following directories replacing the relevant parts with
   your actual paths. The example below is valid on my system only.
   I was using FPC 2.2.0 under Linux and the X11 corelib backend.

    /opt/fpc_2.2.0/lib/fpc/2.2.0/units/i386-linux/*
    /opt/fpc_2.2.0/lib/fpc/2.2.0/units/i386-linux/rtl
    /home/graemeg/programming/fpGUI/src/corelib
    /home/graemeg/programming/fpGUI/src/corelib/x11
    /home/graemeg/programming/fpGUI/src/gui

 * Now select the 'Include files' tab and enter the following paths.
   Again change the paths to point to your actual directories and
   X11 or GDI corelib backend.

    /home/graemeg/programming/fpGUI/src/corelib  
    /home/graemeg/programming/fpGUI/src/corelib/x11

 * Now changes to 'Miscellaneous' tab, PPU output directory. Type in
   the edit box:  units

   NOTE:
   This will place all the compiled *.ppu and *.o files into a 'units'
   directory inside you current directory. So make sure you create it
   before you try to compile for the first time. FPC doesn't create
   directories for you!

 * Now you are ready to open your projects main program unit (F3) and
   compiling it by pressing (F9). 


 Compiling any of the examples from the Command Line
 ===================================================

You need to compile fpGUI first as mentioned above!
Every project in the ../examples directory has it's own extrafpc.cfg file.
You only need to specify that config file and the project unit to compile
it.

fpc @extrafpc.cfg <project unit>

Example:
  fpc @extrafpc.cfg docedit.lpr


 MacOSX instructions and known issues
 ====================================

NOTE:
  MacOSX is still an unsupported platform, but some users have reported
  that it works, so I decided to add some of their notes here for any other
  Mac users that want to try fpGUI.

To run fpGUI based application under MacOSX, you use the X11 backend. X11
is included with all recent MacOSX versions (in older OSX versions it was
a separate install - but included on the install DVD).

An example workflow to work with any fpgui app is:
a) launch X11 (Applications -> Utilities)
b) start the X11 console xterm (Cmd+N or from the X11 menu)
c) type the path to your fpgui application ( example: cd
./Documents/fpgui/examples/apps   if you put fpgui in your Documents
folder)
d) type ./appname to start the application "appname"

 * Apparently starting fpGUI apps from an icon on the desktop requires that you
   double click the icon twice. This issue seems to be common with other X11
   apps under OSX as well. eg: Gimp, any GTK2 app etc.. Alternatively, start it
   from a X11 console, then it runs first time.

 * This issue is more about FPC then fpGUI specific, but it's handy to know. In
   many standard Xcode + X11 installation, the linker could not find the X11
   libraries. So changing the fpc.cfg by adding
      -Fl/usr/X11/lib
   in the search library path solved the problem. Mac usually doesn't let you
   choose the path during installation, so probably other Snow Leopard users
   will have to double check the correct X11 library path.

 * Compiling from the command line, the compiler cannot create the 
   sub-directory "units" used by most demos inluded with fpGUI. So remember to
   create such a directory if the compiler fails. When using Lazarus IDE to
   compile fpGUI projects, the IDE normally creates the missing unit output 
   path for you.



                =================[  END  ]===================