2022-10-21 20:04:03 +03:00
|
|
|
README.Unix.txt - Building FLTK on Unix/Linux Systems
|
|
|
|
------------------------------------------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Contents
|
2020-07-01 19:03:10 +03:00
|
|
|
==========
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
1 Introduction
|
|
|
|
|
|
|
|
2 Prerequisites
|
|
|
|
2.1 Debian, Ubuntu, Linux Mint, and more ...
|
|
|
|
2.2 Fedora
|
|
|
|
2.3 NetBSD
|
|
|
|
2.4 OpenSuSE [*]
|
|
|
|
2.5 SunOS / Solaris
|
|
|
|
2.6 SGI [*]
|
|
|
|
2.7 HP-UX
|
|
|
|
2.8 AIX
|
|
|
|
|
|
|
|
3 How to Build FLTK Using GCC
|
|
|
|
3.1 Downloading and Unpacking
|
|
|
|
3.2 Configuration and Build Systems
|
|
|
|
3.3 Configuring FLTK with autoconf and configure
|
2010-10-28 18:13:01 +04:00
|
|
|
3.4 Building FLTK
|
|
|
|
3.5 Testing FLTK
|
|
|
|
3.6 Installing FLTK
|
|
|
|
3.7 Creating new Projects
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
4 Creating a new Project in Code::Blocks
|
|
|
|
|
|
|
|
|
|
|
|
[*] TODO: we still need to write these chapters
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2010-10-30 20:50:44 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
1 Introduction
|
2010-10-30 18:51:32 +04:00
|
|
|
=================
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2016-08-01 15:50:15 +03:00
|
|
|
FLTK currently supports the following development environments on most Unix
|
2022-10-21 20:04:03 +03:00
|
|
|
and Linux platforms:
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
- CMake + the build system of your choice (see README.CMake.txt)
|
2010-10-28 18:13:01 +04:00
|
|
|
- gcc command line tools
|
|
|
|
- Code::Blocks
|
|
|
|
- ...
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2010-10-30 20:50:44 +04:00
|
|
|
The Symbol font and the Zapf Dingbats font do not work on X11. This is correct
|
|
|
|
behavior for UTF-8 platforms.
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
IMPORTANT:
|
|
|
|
|
|
|
|
Please be aware that the following instructions may be outdated because we
|
|
|
|
can't follow the development of current and future Unix/Linux distributions.
|
|
|
|
If you find bugs or want to suggest enhancements please let us know.
|
|
|
|
See https://www.fltk.org/bugs.php for how to do this.
|
|
|
|
|
2010-10-30 20:50:44 +04:00
|
|
|
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2 Prerequisites
|
2010-10-30 18:51:32 +04:00
|
|
|
==================
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2.1 Debian, Ubuntu, Linux Mint, and more ...
|
|
|
|
-----------------------------------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
All Linux distributions based on Debian are similar and use the `apt`
|
|
|
|
package manager.
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
- Ubuntu Linux can be downloaded from https://ubuntu.com/
|
|
|
|
- Debian Linux can be downloaded from https://www.debian.org/
|
|
|
|
- Linux Mint can be downloaded from https://www.linuxmint.com/
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If you have not done so yet, download and install the distribution of your choice.
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Open a shell and install some development software:
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
sudo apt-get install g++
|
|
|
|
sudo apt-get install gdb
|
2021-04-13 17:35:36 +03:00
|
|
|
sudo apt-get install git
|
2023-08-08 18:13:58 +03:00
|
|
|
sudo apt-get install make
|
|
|
|
sudo apt-get install cmake # install CMake...
|
|
|
|
sudo apt-get install autoconf # ...or autoconf (or both)
|
2010-10-28 18:13:01 +04:00
|
|
|
sudo apt-get install libx11-dev
|
|
|
|
sudo apt-get install libglu1-mesa-dev
|
2022-10-21 20:04:03 +03:00
|
|
|
sudo apt-get install libxft-dev
|
|
|
|
sudo apt-get install libxcursor-dev
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2023-08-08 18:13:58 +03:00
|
|
|
# These packages are optional but recommended:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2010-10-28 18:13:01 +04:00
|
|
|
sudo apt-get install libasound2-dev
|
2022-10-21 20:04:03 +03:00
|
|
|
sudo apt-get install freeglut3-dev
|
|
|
|
sudo apt-get install libcairo2-dev
|
|
|
|
sudo apt-get install libfontconfig1-dev
|
|
|
|
sudo apt-get install libglew-dev
|
|
|
|
sudo apt-get install libjpeg-dev
|
|
|
|
sudo apt-get install libpng-dev
|
|
|
|
sudo apt-get install libpango1.0-dev
|
|
|
|
sudo apt-get install libxinerama-dev
|
|
|
|
|
|
|
|
If you want to build FLTK for Wayland (the supposed successor of X) you need
|
|
|
|
some more packages. Please refer to README.Wayland.txt for more information.
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
If you are planning to use the Code::Blocks IDE, also install this
|
|
|
|
|
|
|
|
sudo apt-get install codeblocks
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To install the latest FLTK development (master branch, currently 1.4.x):
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
git clone https://github.com/fltk/fltk.git
|
|
|
|
cd fltk
|
|
|
|
...
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To update to the latest version, just `cd` into the fltk directory and type
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2021-04-13 17:35:36 +03:00
|
|
|
git pull
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2.2 Fedora
|
|
|
|
-------------
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Fedora Linux can be downloaded from https://getfedora.org/
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If you have not done so yet, download and install Fedora.
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Open a terminal window and install some software. In Fedora, the default user
|
|
|
|
has no permission to call "sudo", so we will change user a few times:
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
su root
|
|
|
|
yum groupinstall "Development Tools"
|
|
|
|
yum groupinstall "X Software Development"
|
|
|
|
yum groupinstall "C Development Tools and Libraries"
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If you are planning to use the Code::Blocks IDE, also install this
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
yum install codeblocks.i686 (for 64 bit machines)
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Don't forget to leave root status (Ctrl-D) before loading FLTK. To install FLTK
|
|
|
|
for every user, you either have to set root user again, or use "visudo" to add
|
|
|
|
yourself to the "sudo" list.
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To install the latest FLTK development (master branch, currently 1.4.x):
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
git clone https://github.com/fltk/fltk.git
|
|
|
|
cd fltk
|
|
|
|
...
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To update to the latest version, just `cd` into the fltk directory and type
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
git pull
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2.3 NetBSD
|
|
|
|
--------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
NetBSD can be downloaded from https://www.netbsd.org/
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If you have not done so yet, download and install NetBSD. Ensure that the
|
|
|
|
optional distribution sets "comp" (Compiler, header files, development tools)
|
|
|
|
and x*** (X Window System) are installed.
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Now install and configure pkgsrc. The current version can be downloaded here:
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
http://www.pkgsrc.org/
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To use the current stable version of FLTK, simply install it from pkgsrc:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
cd /usr/pkgsrc/x11/fltk13
|
|
|
|
bmake install
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
For the latest development snapshot, first install the git client from pkgsrc:
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
cd /usr/pkgsrc/devel/git
|
|
|
|
bmake install
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Now fetch the latest FLTK source code:
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
git clone https://github.com/fltk/fltk.git
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To update to the latest version, just `cd` into the fltk directory and type
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
git pull
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If you have installed JPEG and PNG libraries from pkgsrc, configure your
|
|
|
|
environment as follows so that the FLTK configure script can find them:
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
export CPPFLAGS="-I/usr/pkg/include"
|
|
|
|
export LDFLAGS="-L/usr/pkg/lib"
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
To install GNU autoconf from pkgsrc:
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
cd /usr/pkgsrc/devel/autoconf
|
|
|
|
bmake install
|
|
|
|
|
|
|
|
|
|
|
|
2.4 OpenSuSE
|
|
|
|
---------------
|
|
|
|
|
|
|
|
We still need to write this chapter.
|
|
|
|
|
|
|
|
OpenSUSE can be downloaded from https://www.opensuse.org/
|
2010-10-30 18:51:32 +04:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2.5 SunOS / Solaris
|
2013-09-24 01:01:05 +04:00
|
|
|
----------------------
|
|
|
|
|
|
|
|
SunOS is a commercial operating system from Sun Microsystems (in 2009 the
|
|
|
|
company was sold to Oracle). SunOS is also called Solaris since version 5.
|
|
|
|
There was an open source derivative called OpenSolaris (based on Solaris 10)
|
|
|
|
that was cancelled by Oracle. The successor in spirit is called OpenIndiana
|
2022-10-21 20:04:03 +03:00
|
|
|
and can be downloaded from:
|
2013-09-24 01:01:05 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
https://www.openindiana.org/
|
2013-09-24 01:01:05 +04:00
|
|
|
|
|
|
|
For FLTK you need at least SunOS 5.7 (aka Solaris 7). This version supports
|
|
|
|
64 bit machines and POSIX threads. For machines with 64 bit SPARC processors
|
|
|
|
it is highly recommended to use Sun compilers, the 64 bit code generated by
|
|
|
|
older versions of GCC for such machines is unusable (expect something between
|
|
|
|
horribly broken and immediate crash).
|
|
|
|
|
|
|
|
Consider using pkgsrc with this operating system. See the NetBSD section if
|
|
|
|
you want to do so.
|
|
|
|
If you have GCC and Sun compilers installed, configure your environment like
|
|
|
|
this to use the Sun compilers and pkgsrc graphics libraries:
|
|
|
|
|
|
|
|
export CC="cc"
|
|
|
|
export CXX="CC"
|
|
|
|
export CPPFLAGS="-I/usr/pkg/include"
|
|
|
|
export LDFLAGS="-L/usr/pkg/lib -R/usr/pkg/lib"
|
|
|
|
|
|
|
|
To build a 64 bit FLTK library, add the following flags:
|
|
|
|
|
|
|
|
export CFLAGS="-xarch=v9"
|
|
|
|
export CXXFLAGS="-xarch=v9"
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2.6 SGI
|
|
|
|
----------
|
|
|
|
|
|
|
|
We still need to write this chapter.
|
|
|
|
|
|
|
|
|
|
|
|
2.7 HP-UX
|
|
|
|
------------
|
2013-09-24 01:01:05 +04:00
|
|
|
|
|
|
|
HP-UX is a commercial operating system from HP, no free or open source
|
|
|
|
derivatives are available.
|
|
|
|
|
|
|
|
For FLTK you need at least HP-UX 11.11 and the latest patch bundles should be
|
|
|
|
installed.
|
|
|
|
|
|
|
|
Consider using pkgsrc with this operating system. See the NetBSD section if
|
|
|
|
you want to do so.
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
2.8 AIX
|
|
|
|
----------
|
2013-09-24 01:01:05 +04:00
|
|
|
|
|
|
|
AIX is a commercial operating system from IBM, no free or open source
|
|
|
|
derivatives are available.
|
|
|
|
|
|
|
|
For FLTK you need at least AIX 5L, I have tested version 5.1 patched to ML9.
|
|
|
|
|
|
|
|
Consider using pkgsrc with this operating system. See the NetBSD section if
|
|
|
|
you want to do so.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3 How to Build FLTK Using GCC
|
2010-10-30 18:51:32 +04:00
|
|
|
================================
|
|
|
|
|
|
|
|
|
|
|
|
3.1 Downloading and Unpacking
|
|
|
|
--------------------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
The FLTK source code and documentation can be downloaded from:
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
https://www.fltk.org/software.php
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If you are familiar with "git" and like to stay current with your version,
|
|
|
|
you will find the git access parameters at the bottom of that page.
|
|
|
|
Unpack FLTK into a convenient location. I like to have everything in my
|
|
|
|
dev directory. Change the following instructions to fit your preferences.
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
cd
|
|
|
|
mkdir dev
|
|
|
|
cd dev
|
|
|
|
mv ~/Downloads/fltk-1.3.xxxx.tar.gz .
|
|
|
|
tar xvfz fltk-1.3.xxxx.tar.gz
|
|
|
|
cd fltk-1.3.xxxx
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Note: current development version is 1.4.0 (1.4.x).
|
|
|
|
|
|
|
|
|
|
|
|
3.2 Configuration and Build Systems
|
|
|
|
--------------------------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
The following paragraphs describe the "classic" build system with autoconf,
|
|
|
|
configure, and make that has been used to build FLTK up to version 1.3.x
|
|
|
|
and can still be used with FLTK 1.4.x.
|
|
|
|
|
|
|
|
However, the FLTK team recommend using CMake which is the preferred build
|
|
|
|
system since FLTK 1.4.0 used for all platforms (including Windows). CMake
|
|
|
|
is used instead of autoconf and configure to create the build system of your
|
|
|
|
choice, for instance Makefiles, Ninja build files, Visual Studio projects, etc.
|
|
|
|
|
|
|
|
Please see README.CMake.txt for how to build FLTK and your application
|
|
|
|
programs using CMake. You can stop reading here if you do this.
|
|
|
|
|
|
|
|
You can, of course, build FLTK with CMake and your own application(s) with
|
|
|
|
your existing and well-known build system.
|
|
|
|
|
|
|
|
If you like the "classic" build system more, continue reading the following
|
|
|
|
chapters ...
|
|
|
|
|
|
|
|
|
|
|
|
3.3 Configuring FLTK with autoconf and configure
|
|
|
|
---------------------------------------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2021-04-13 17:35:36 +03:00
|
|
|
If you got FLTK via git then you need one extra step. Otherwise skip
|
2022-10-21 20:04:03 +03:00
|
|
|
over this part. Stay in your FLTK source-code directory and type:
|
2013-12-13 14:19:54 +04:00
|
|
|
|
2021-11-24 16:57:41 +03:00
|
|
|
autoconf
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
or
|
|
|
|
|
|
|
|
make configure
|
|
|
|
|
|
|
|
Both commands create the configure script for you.
|
|
|
|
|
2010-10-28 18:13:01 +04:00
|
|
|
Now configure your FLTK installation:
|
|
|
|
|
|
|
|
./configure
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2021-11-24 16:57:41 +03:00
|
|
|
Hint: Instead of executing `autoconf` and `configure` followed by `make`
|
|
|
|
to build FLTK (see next section) you can also run `make` directly which
|
|
|
|
will create and execute the 'configure' script with default parameters
|
|
|
|
and build FLTK with the default configuration.
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
ADVANCED: type "./configure --help" to get a complete list of optional
|
2016-08-01 15:50:15 +03:00
|
|
|
configuration parameters. These should be pretty self-explanatory. Some
|
2022-10-21 20:04:03 +03:00
|
|
|
more details can be found in README.txt.
|
2010-10-28 18:13:01 +04:00
|
|
|
:END_ADVANCED
|
|
|
|
|
|
|
|
The configuration script will check your machine for the required resources
|
2022-10-21 20:04:03 +03:00
|
|
|
which you should have installed as described in the "Prerequisites" chapter.
|
|
|
|
Review the "Configuration Summary", maybe take some notes.
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3.4 Building FLTK
|
2010-10-30 18:51:32 +04:00
|
|
|
--------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
Now this is easy. Stay in your FLTK source-code directory and type:
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
make
|
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
The entire FLTK toolkit including many test programs will be built for you. No
|
2010-10-28 18:13:01 +04:00
|
|
|
warnings should appear. If some do, please let the FLTK developer team know via
|
2022-10-21 20:04:03 +03:00
|
|
|
the mailing list "fltk.general" or view the bug reporting guidelines at
|
|
|
|
https://www.fltk.org/bugs.php
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3.5 Testing FLTK
|
2010-10-30 18:51:32 +04:00
|
|
|
-------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
After a successful build, you can test FLTK's capabilities:
|
|
|
|
|
|
|
|
test/demo
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
3.6 Installing FLTK
|
2010-10-30 18:51:32 +04:00
|
|
|
----------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
If you did not change any of the configuration settings, FLTK will be installed
|
2010-10-28 18:13:01 +04:00
|
|
|
in "/usr/local/include" and "/usr/local/lib" by typing
|
|
|
|
|
|
|
|
sudo make install
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2010-11-14 19:37:34 +03:00
|
|
|
If you are using the KDE, GNOME or XFCE desktop environments and want to call
|
|
|
|
"fluid" from the desktop menu, you will need to install additional files and
|
|
|
|
icons under "/usr/share" by typing:
|
|
|
|
|
|
|
|
sudo make install-desktop
|
2020-07-01 19:03:10 +03:00
|
|
|
|
|
|
|
It is possible to install FLTK without superuser privileges by changing the
|
|
|
|
installation path to a location within the user account by adding the
|
2010-10-28 18:13:01 +04:00
|
|
|
"--prefix=PREFIX" parameters to the "./configure" command.
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
Note: installing FLTK is optional. You can build your own software by using
|
|
|
|
the FLTK build tree directly. This is recommended if you link your application
|
|
|
|
statically (which is recommended as well). This is particularly important if you
|
|
|
|
consider using different FLTK versions on a development system to avoid mixing
|
|
|
|
FLTK versions when building (a well-known problem) or running FLTK applications
|
|
|
|
with installed shared libraries of a different FLTK version. OTOH, if you build
|
|
|
|
shared FLTK libraries you may want to install FLTK, particularly on a production
|
|
|
|
system.
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
|
|
|
|
3.7 Creating new Projects
|
2010-10-30 18:51:32 +04:00
|
|
|
----------------------------
|
2010-10-28 18:13:01 +04:00
|
|
|
|
2016-08-01 15:50:15 +03:00
|
|
|
FLTK provides a neat script named "fltk-config" that can provide all the flags
|
2010-10-28 18:13:01 +04:00
|
|
|
needed to build FLTK applications using the same flags that were used to build
|
|
|
|
the library itself. Running "fltk-config" without arguments will print a list
|
2016-08-01 15:50:15 +03:00
|
|
|
of options. The easiest call to compile an FLTK application from a single
|
|
|
|
source file is:
|
2010-10-28 18:13:01 +04:00
|
|
|
|
|
|
|
fltk-config --compile myProgram.cxx
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
`fltk-config --compile` can not be used to build a program from multiple source
|
|
|
|
files but you can use it in a Makefile to get the required compiler and linker
|
|
|
|
flags.
|
|
|
|
|
2010-10-28 18:13:01 +04:00
|
|
|
"fltk-config" and "fluid" will be installed in "/usr/local/bin/" by default. I
|
|
|
|
recommend that you add it to the command search path.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
4 Creating a new Project in Code::Blocks
|
2010-10-30 22:21:40 +04:00
|
|
|
===========================================
|
|
|
|
|
|
|
|
Code::Blocks is a free and popular C++ IDE in the Linux world. It also runs on
|
2022-10-21 20:04:03 +03:00
|
|
|
macOS and Windows. Configured correctly, it can also cross-compile between
|
2020-07-01 19:03:10 +03:00
|
|
|
these platforms. This chapter focuses on creating a new FLTK project for Linux,
|
|
|
|
assuming that FLTK 1.3 was previously built and installed in its default
|
2010-10-30 22:21:40 +04:00
|
|
|
location from the command line.
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
If not done yet, install Code::Blocks as described in the "Prerequisites"
|
|
|
|
chapter above, or download it from their web site. This description is based
|
|
|
|
on version 10.05:
|
2010-10-30 22:21:40 +04:00
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
https://www.codeblocks.org/
|
2020-07-01 19:03:10 +03:00
|
|
|
|
2010-10-30 22:21:40 +04:00
|
|
|
Start Code::Blocks. Select File > New > Project. In the "New from template"
|
|
|
|
dialog box, click on "FLTK project" and follow the instructions.
|
|
|
|
|
2022-10-21 20:04:03 +03:00
|
|
|
The default project supports basic FLTK. If you would like to add support for
|
2010-10-30 22:21:40 +04:00
|
|
|
images, OpenGL, GLUT, or Forms, add the corresponding flags --use-images,
|
|
|
|
--use-gl, --use-glut, and --use-forms respectively.
|
|
|
|
|
2016-08-01 15:50:15 +03:00
|
|
|
The flags are located in the "Project Build Options" dialog. To change the
|
2010-10-30 22:21:40 +04:00
|
|
|
compiler flags, select your project in the tree view, then select the
|
2016-08-01 15:50:15 +03:00
|
|
|
"Compiler Settings" tab, then "Other Options" and add the flags to
|
|
|
|
`fltk-config --cxxflags` in front of the second "`".
|
2010-10-30 22:21:40 +04:00
|
|
|
|
|
|
|
The linker flags are located in the "Linker Settings" tab under "Other Linker
|
2020-07-01 19:03:10 +03:00
|
|
|
Options". Add the flags to `fltk-config --ldstaticflags` in front of the
|
2010-10-30 22:21:40 +04:00
|
|
|
second "`".
|
2010-10-30 18:51:32 +04:00
|
|
|
|
2022-10-21 20:11:19 +03:00
|
|
|
Code::Blocks can be set up to use fluid to manage modules.
|
2022-10-21 20:04:03 +03:00
|
|
|
The following info is from an FLTK user posted on fltk.general 06/17/2013:
|
2013-06-17 22:41:38 +04:00
|
|
|
|
|
|
|
"""
|
2013-06-17 23:23:49 +04:00
|
|
|
I have these settings in codeblocks on linux:
|
2013-06-17 22:41:38 +04:00
|
|
|
|
2020-07-01 19:03:10 +03:00
|
|
|
Settings ->
|
2013-06-17 22:41:38 +04:00
|
|
|
Compiler and debugging settings ->
|
2020-07-01 19:03:10 +03:00
|
|
|
Other settings ->
|
|
|
|
Advanced options:
|
2013-06-17 22:41:38 +04:00
|
|
|
|
|
|
|
-- Add an extension (in my case "fl")
|
|
|
|
|
|
|
|
-- On command line macro:
|
2020-07-01 19:03:10 +03:00
|
|
|
cd $file_dir; fluid -c $file
|
2013-06-17 22:41:38 +04:00
|
|
|
|
|
|
|
-- Generated files (to be further compiled):
|
2020-07-01 19:03:10 +03:00
|
|
|
$file_dir/$file_name.cxx
|
|
|
|
$file_dir/$file_name.h
|
2013-06-17 22:41:38 +04:00
|
|
|
|
|
|
|
Settings -> Environment -> Files extension handling :
|
2020-07-01 19:03:10 +03:00
|
|
|
Wildcard : *.fl
|
|
|
|
To open file: Launch an external program
|
|
|
|
External program: fluid
|
2013-06-17 22:41:38 +04:00
|
|
|
|
|
|
|
With that I can double click on any fluid file I include on a project
|
2013-06-17 23:23:49 +04:00
|
|
|
and it opens with fluid. When I press "run" or "build" codeblocks
|
|
|
|
calls fluid to generate the c++ files and compiles if needed.
|
2013-06-17 22:41:38 +04:00
|
|
|
"""
|