Debian Codegraph @

docs/README.CMAKE

raw
1 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2
3 To build GD using CMake, all you need is (add the cmake options if you need any
4 or if the default libs and include paths are not the default) :
5
6 In a sub directory of the top level:
7 $ mkdir bld
8 $ cd bld
9 $ cmake -DBUILD_TEST=1 <options> ..
10 $ make
11
12 The available options are:
13 ENABLE_GD_FORMATS=1
14 ENABLE_PNG=1
15 ENABLE_LIQ=1
16 ENABLE_JPEG=1
17 ENABLE_TIFF=1
18 ENABLE_ICONV=1
19 ENABLE_FREETYPE=1
20 ENABLE_FONTCONFIG=1
21 ENABLE_XPM=1
22 ENABLE_WEBP=1
23 ENABLE_AVIF=1
24 ENABLE_RAQM=1
25
26 You can optionally run our tests suite using:
27 $ ctest .
28
29 Or if you like to build in the source tree:
30 $ cmake -DBUILD_TEST=1 .
31 $ make
32 $ ctest .
33
34 Add "-DCMAKE_BUILD_TYPE=DEBUG" if you like to have a debug version.
35
36 To install, just run:
37 $ make install
38 Or to to install to a different path:
39 $ make install DESTDIR=/some/other/place
40
41 Typical usage with only PNG enabled:
42
43 This command generates VS7 project files and add some custom libraries and
44 includes directories (libpng in this case):
45
46 cmake -DCMAKE_GENERATOR="Visual Studio 7 .NET 2003"
47 -DENABLE_PNG=1 -DCMAKE_LIBRARY_PATH=c:\gd_build\gd_deps\lib
48 -DCMAKE_INCLUDE_PATH=c:\gd_build\gd_deps\include c:\libgd_src
49
50 A typical CMake call to build using the MinGW tools:
51
52 cmake -G"MinGW Makefiles" -DCMAKE_LIBRARY_PATH=c:\mingw\lib -DCMAKE_INCLUDE_PATH=c:\MinGW\include -DENABLE_JPEG=On -DBUILD_TEST=On -DCMAKE_RELEASE_TYPE=DEBUG ..\libgd_head
53
54 Given that your MinGW install is under c:\mingw and that you install all libraries using the /usr prefix
55
56 vcpkg support add dependencies and library on Windows (or Linux/Mac/etc)
57 ------------------------------------------------------------------------
58
59 Inside the development console, in the desired mode (see https://docs.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160), to install
60 the required libraries, vcpkg can install them automatically. The steps are:
61
62 1. Install vcpkg, see https://vcpkg.io/en/getting-started.html
63 2. Choose the vcpkg architecture
64 SET VCPKG_DEFAULT_TRIPLET=x64-windows (or add pkgname:x64-windows)
65 3. install the dependencies needed for the build. F.e.
66 C:\vcpkg\vcpkg.exe install libpng libjpeg-turbo freetype tiff libheif libwebp
67 4. add -DCMAKE_TOOLCHAIN_FILE=[path to c:\path\to\vcpkg]\scripts\buildsystems\vcpkg.cmake
68 with the other desired cmake options
69
70 It is then not needed to manually add CMAKE_INCLUDE_PATH or CMAKE_LIBRARY_PATH as options.
71
72 See the https://vcpkg.io for more informations about vcpkg and how to customize an install.
73
74 Randomly, you may cmake may fail to find the dependencies, with vcpkg at least up to 2021-08-12-85ab112d5ee102bc6eac8cdbbfdd173a71374e04 (as of the time of writing).
75 So far the only way to fix it is to reinstall vcpkg and then install the dependencies again. See https://github.com/microsoft/vcpkg/issues/13614,
76 especially my comment on the 27th of August 2021 and follow ups.