summaryrefslogtreecommitdiff
path: root/README.abi-version.txt
blob: f6a87019f65daead18ea90e363190b10ded9a218 (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
Configuration of the ABI Version for the Fast Light Toolkit (FLTK)
------------------------------------------------------------------

FLTK preserves the application binary interface (ABI) throughout
patch versions, for instance all 1.4.x versions (x = patch version).

This basically means that a program compiled and linked with FLTK 1.4.0
can run with a FLTK shared library (fltk.dll, fltk.so.1.4.x) of a later
FLTK version 1.4.x, but not with a shared library of FLTK 1.5.0 or later.

Since FLTK 1.3.1 the FLTK team began to introduce ABI-breaking features
wrapped in so-called ABI guards in the library code, using a preprocessor
macro. Since FLTK 1.4.0 the macro name is FL_ABI_VERSION:

    #if FL_ABI_VERSION >= 10401
        ... new, ABI breaking code ...
    #else
        ... old, ABI preserving code ...
    #endif

This documentation was written for FLTK 1.4.x but it applies to all later
versions as well. Replace the version numbers given here with the version
numbers of the version you are using. FLTK version 1.4.1 was chosen as an
example only.


How to Define the FLTK ABI Version
----------------------------------

To define the ABI version the preprocessor macro FL_ABI_VERSION must be
defined as a number representing the ABI version in the form

    #define FL_ABI_VERSION 1xxyy

where xx and yy are the minor and patch versions, resp. with leading zeroes,
and '1' is the major version number. CMake generates the file FL/fl_config.h
in the build folder given the version you select (see below).

For instance, the default ABI version for all FLTK 1.4.x versions is 10400
(the binary version of FLTK 1.4.0) but you can select another version,
e.g. 10401 for FLTK 1.4.1 to enable the ABI features of FLTK 1.4.1 and all
previous versions. The same applies to all higher FLTK versions.

The default ABI version is always the lowest version (e.g. 10400). All
following examples are written for FLTK 1.4.1, hence we use "10401" for
the version number.


How to select the ABI version with CMake
----------------------------------------

    Use CMake to build the Makefile's and run 'make' or use any other CMake
    generator of your choice. To select the ABI version use one of the CMake
    configuration tools (cmake-gui or ccmake), or run CMake with these or
    similar commands:

        cd /path/to/fltk
        cmake . -B build [-G <GENERATOR>] -D FLTK_ABI_VERSION:STRING=10401

    The optional part '[-G <GENERATOR>]' can be used to select a particular
    build tool that is not the default for the build platform, for instance
    '-G Ninja'. Further CMake options can be appended.

    Then execute

        cmake --build build

    or the selected build tool (-G <GENERATOR>), e.g. `make`.

    For more information on how to use CMake with FLTK see README.CMake.txt.


General Note on CMake
---------------------

    CMake generates FL/fl_config.h in the build tree. You may run
    'make install' to install the FLTK library including all headers in
    the chosen installation directory (set CMAKE_INSTALL_PREFIX to do this),
    although this is not necessary.

    The FLTK team recommends to use the FLTK library directly from the
    build folder. See README.CMake.txt for more information.