File: liblzma.h

package info (click to toggle)
wxwidgets3.2 3.2.8%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 179,460 kB
  • sloc: cpp: 992,335; ansic: 102,143; makefile: 51,623; sh: 11,572; python: 5,590; perl: 1,563; php: 326; xml: 200; javascript: 181
file content (146 lines) | stat: -rw-r--r-- 6,340 bytes parent folder | download | duplicates (4)
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
/////////////////////////////////////////////////////////////////////////////
// Name:        liblzma.h
// Purpose:     Documentation of the use of liblzma with wxWidgets
// Author:      Vadim Zeitlin <vadim@wxwidgets.org>
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**

@page page_build_liblzma Using LZMA compression with liblzma

To use wxLZMAInputStream and wxLZMAOutputStream classes, a public domain
liblzma library is required when building wxWidgets. This guide explains how to
make liblzma available and let wxWidgets build system use it. The exact steps
depend on the operating system and compiler used, please refer to the
section appropriate for your environment below.

@section page_build_liblzma_unix Unix-like operating system (including Cygwin)

Under many Unix or Unix-like (including Cygwin) systems, liblzma is available
as a system package and the simplest thing to do is to just install it using
the system-specific tool (apt, yum, ...). Just note that you need to install
the liblzma-dev or liblzma-devel package in order to obtain the library headers
and not just the library itself.

If your system doesn't provide such package or you need to use a newer version
than is available in the system repositories, it is also simple to build
liblzma from sources: basically, just download the library sources from
https://tukaani.org/xz/ or clone its repository and perform the usual

@code
    $ ./configure
    $ make
    $ make install
@endcode

commands sequence.

@subsection page_build_liblzma_configure Use liblzma with configure

Pass @c --with-liblzma option to configure to enable liblzma and check the end
of configure output to confirm that it was found. If this is not the case
because the library was installed in some non-default location, you need to
provide @c CPPFLAGS and @c LDFLAGS on configure command line, e.g.:

@code
    $ ../configure --with-liblzma CPPFLAGS=-I/opt/liblzma/include LDFLAGS=-L/opt/liblzma/lib
@endcode

@subsection page_build_liblzma_cmake Use liblzma with CMake

When using CMake, add @c -DwxUSE_LIBLZMA=ON to CMake command line to enable
using liblzma.


@section page_build_liblzma_msw MSW not using configure

When not using configure, you must edit @c wx/msw/setup.h file and change the
value of @c wxUSE_LIBLZMA option to @c 1 manually in order to enable LZMA
support, which is disabled by default.

Next, you need to actually ensure that the library is available to be able to
build wxWidgets:

@subsection page_build_liblzma_msw_vcpkg MSW using MSVS 2015 with Vcpkg

If you build wxWidgets with Microsoft Visual Studio 2015.3 or later, you can
use Microsoft vcpkg tool (see https://github.com/Microsoft/vcpkg) to install
liblzma as any other library and integrate it with Microsoft Visual Studio
automatically. Please see vcpkg documentation for details, but, basically, it's
as simple as executing the following commands:

@code
    > git clone https://github.com/Microsoft/vcpkg.git
    > cd vcpkg
    > .\bootstrap-vcpkg.bat
    > .\vcpkg integrate install
    > .\vcpkg install liblzma
    > .\vcpkg install liblzma:x64-windows
@endcode

Afterwards, liblzma headers and libraries (in DLL form) will be available to
all C++ Visual Studio projects, including wxWidgets, so you just need to build
it as usual, i.e. by opening @c build/msw/wx_vcXX.sln file and building it.


@section page_build_liblzma_msw_manual MSW manual setup

First of all, you need to either build or download liblzma binaries. Building
the library from source with gcc requires configure, and as you don't use an
environment capable of running it (if you're, you're reading the wrong section
of this guide, please go to the first one instead), it might be simpler to just
download the binaries from https://tukaani.org/xz/

However these binaries don't provide import libraries for MSVC, so you may
prefer building from source when using this compiler, provided it is at least
2013.2 or later (otherwise, you must use the binaries and create the import
library from the DLL). To do it, simply open the MSVS solution provided under
@c windows directory of the source archive corresponding to your compiler
version and build all the relevant configurations. Notice that you may build it
as either a static or a dynamic library, but if you choose the former, you must
also predefine @c LZMA_API_STATIC when building wxWidgets.


Second, you need to let wxWidgets build system know about the liblzma headers
and libraries location. When using makefiles, with either gcc or MSVC compiler,
this can be done simply by specifying @c CPPFLAGS and @c LDFLAGS on make
command line, e.g.

@code
    > make -f makefile.gcc CPPFLAGS=-Ic:/dev/include LDFLAGS=-Lc:/dev/lib
@endcode

If you built liblzma as a static library, change @c CPPFLAGS to also include @c
-DLZMA_API_STATIC.


When building wxWidgets with MSVC project files, you must update them to use
liblzma. For this, start by copying build\\msw\\wx_setup.props file to
build\\msw\\wx_local.props, if you don't have the latter file yet. Then open
this file in your favourite editor and locate the @c Link tag inside an @c
ItemDefinitionGroup tag and add a new @c AdditionalIncludeDirectories line
inside the @c ClCompile tag as well as add @c liblzma.lib to the @c
AdditionalDependencies tag under @c Link itself. The result should look like
the following, assuming liblzma sources are in c:\\src\\liblzma:

@code{.unparsed}
  <ItemDefinitionGroup>
    <ClCompile>
      ... any existing lines here ...
      <AdditionalIncludeDirectories>c:\src\liblzma\src\liblzma\api;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <!--
        Uncomment this line if, and only if, you link with liblzma statically.
      <PreprocessorDefinitions>LZMA_API_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        -->
    </ClCompile>
    <Link>
      <AdditionalDependencies>... all the previously listed libraries;c:\src\liblzma\windows\vs2017\$(Configuration)\$(Platform)\liblzma_dll\liblzma.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
@endcode

Afterwards, build wxWidgets as usual and don't forget to provide @c liblzma.dll
when distributing your application unless you have decided to link it
statically.
 */