| 1 |
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="Getting_and_Building"> |
| 2 |
<title>Getting or Building GPSBabel</title> |
| 3 |
<section xml:id="Download"> |
| 4 |
<title>Downloading - the easy way.</title> |
| 5 |
<para> |
| 6 |
GPSBabel is distributed "ready to run" on most common |
| 7 |
operating systems via the |
| 8 |
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.gpsbabel.org/download.html">download page</link>. |
| 9 |
</para> |
| 10 |
<para> As GPSBabel runs on a wide variety of operating systems, |
| 11 |
be sure to visit the |
| 12 |
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.gpsbabel.org/osnotes.html">OS-Specific notes</link> for |
| 13 |
additional information. |
| 14 |
</para> |
| 15 |
</section> |
| 16 |
<section xml:id="Source"> |
| 17 |
<title>Building from source.</title> |
| 18 |
<para> |
| 19 |
For operating systems where no binary is provided, or if |
| 20 |
you want the latest development version, you will have to build it from |
| 21 |
source. The code should be compilable on any system with |
| 22 |
ISO C++17. It's tested on Ubuntu, macOS, and Windows. |
| 23 |
Less frequently, someone will build on FreeBSD, OpenBSD, Solaris, |
| 24 |
etc. Clang/LLVM, GNU C++, and MSVC are regularly exercised via automation. |
| 25 |
</para> |
| 26 |
<para> |
| 27 |
You can grab a release from the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.gpsbabel.org/download.html">GPSBabel download page</link>, but if you're going to be doing any development, you'll find that working from the <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://github.com/gpsbabel/gpsbabel">GPSBabel Github repo</link> is easier. Checkouts via Git, HTTPS, SSH, and Subversion are supported. |
| 28 |
</para> |
| 29 |
<para>There are external requirements for bulding.</para> |
| 30 |
<variablelist> |
| 31 |
<varlistentry> |
| 32 |
<term> |
| 33 |
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://qt-project.org">Qt</link> |
| 34 |
</term> |
| 35 |
<listitem> |
| 36 |
<para> |
| 37 |
Qt version 5.12 or newer is required for all builds. MacOS and Windows users can download |
| 38 |
binaries from <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://qt-project.org/downloads">Qt Downloads</link> |
| 39 |
Fedora or CentOS users may need to 'dnf install qt5-qtbase-devel'. When in doubt, 'dnf search qt' or 'dnf search qt5' may help you find the correct package name. Ubuntu users may need to 'apt-get install qt5-default'. Package names |
| 40 |
and versions in Linux frequently change, so you may need to ask your Linux vendor |
| 41 |
for help or look in tools/Docker* for inspiration for our automated builds that |
| 42 |
use Docker. |
| 43 |
</para> |
| 44 |
</listitem> |
| 45 |
</varlistentry> |
| 46 |
<varlistentry> |
| 47 |
<term> |
| 48 |
<link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://libusb.info">libusb 1.0</link> |
| 49 |
</term> |
| 50 |
<listitem> |
| 51 |
<para> |
| 52 |
is needed to communicate with use with older USB Garmins. |
| 53 |
For macOS, we use an included copy. |
| 54 |
Fedora users may need to 'yum install libusb-devel'. Ubuntu users may |
| 55 |
need to 'apt install libusb-dev' or look in tools/Docker* for inspiration |
| 56 |
from our automated Docker builds.</para> |
| 57 |
</listitem> |
| 58 |
</varlistentry> |
| 59 |
</variablelist> |
| 60 |
<section xml:id="Internal_History"> |
| 61 |
<title>Brief history of internals</title> |
| 62 |
<para> |
| 63 |
Parts of GPSBabel have been public since 2002, with some of the original |
| 64 |
design and original code came from 2001. It was originally in C89, not C++ |
| 65 |
and while we strongly encourage modern C++ code where we can use it, we've |
| 66 |
not gone back to those older formats - some of which we don't have |
| 67 |
the hardware to test and have fallen out of touch with original authors - and |
| 68 |
rewritten them in Modern C++ style. There are this void*'s everywhere, C String |
| 69 |
use, gross buffer abuse, and other things that look more like a C program from the 80's than a C++ program of modern date. Code that's earned it's own wings can |
| 70 |
continue to fly with us as long as it passes the tests we have. We've additionally |
| 71 |
not enforced style rules as strongly across modules as we could have. Fixing |
| 72 |
both of these is a goal for us in 2020. |
| 73 |
</para> |
| 74 |
</section> |
| 75 |
<section xml:id="Qt"> |
| 76 |
<title>Building with Qt Creator</title> |
| 77 |
<para> |
| 78 |
Qt provides a lovely IDE (Integrated Development Environment) with an |
| 79 |
editor and debugger. Its use is strongly encouraged for those new to C++. |
| 80 |
Once you have Qt correctly installed, just opening the <filename> |
| 81 |
CMakeLists.txt</filename> from |
| 82 |
the File->Open menu in an already-running instance of <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://www.qt.io/development-tools">Qt Creator</link> is the fastest and easiest way for most |
| 83 |
people to get to development because it handles things like build dependencies |
| 84 |
changing and class and method compilation. |
| 85 |
</para> |
| 86 |
<para> |
| 87 |
A path of low resistance for some users is to use the CMakeLists.txt file |
| 88 |
from the command line. If you type <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://cmake.org/cmake/help/latest/">cmake .</link> in our working |
| 89 |
directory it will create a buildsystem with the default generator (Unix Makefiles or Visual Studio) which you can use for development. |
| 90 |
</para> |
| 91 |
</section> |
| 92 |
<section xml:id="cmake"> |
| 93 |
<title>Building from the command line</title> |
| 94 |
<para> |
| 95 |
Those familiar with the command line may be more comfortable using cmake from the command line. |
| 96 |
It is important to set the CMAKE_BUILD_TYPE when generating a build system with single configuration generators such as Unix Makefiles and Ninja. |
| 97 |
With multi-configuration generators such as Visual Studio and Xcode the build type is selected at build time instead of when generating the build system. |
| 98 |
</para> |
| 99 |
<simplelist> |
| 100 |
<member> |
| 101 |
To create a buildsystem using Ninja: |
| 102 |
<userinput>cmake -G Ninja -DCMAKE_BUILD_TYPE=Release .</userinput> |
| 103 |
</member> |
| 104 |
<member> |
| 105 |
To create a visual studio project that can be built with msbuild: |
| 106 |
<userinput>cmake -G "Visual Studio 17 2022" .</userinput> |
| 107 |
</member> |
| 108 |
<member> |
| 109 |
To create a Xcode project: |
| 110 |
<userinput>cmake -G Xcode .</userinput> |
| 111 |
</member> |
| 112 |
</simplelist> |
| 113 |
<para> |
| 114 |
</para> |
| 115 |
<para> |
| 116 |
There are additional variables that can be defined cmake on the cmake command line to |
| 117 |
customize your build of GPSBabel. |
| 118 |
</para> |
| 119 |
<variablelist> |
| 120 |
<varlistentry> |
| 121 |
<term>GPSBABEL_WITH_LIBUSB = no|pkgconfig|system*|included*|custom</term> |
| 122 |
<listitem> |
| 123 |
<para>note that libusb is NOT used on windows.</para> |
| 124 |
<variablelist> |
| 125 |
<varlistentry> |
| 126 |
<term>no</term> |
| 127 |
<listitem> |
| 128 |
<para>build without libusb-1.0. functionality will be limited.</para> |
| 129 |
</listitem> |
| 130 |
</varlistentry> |
| 131 |
<varlistentry> |
| 132 |
<term>pkgconfig</term> |
| 133 |
<listitem> |
| 134 |
<para>build with libusb-1.0 found by pkg-config.</para> |
| 135 |
</listitem> |
| 136 |
</varlistentry> |
| 137 |
<varlistentry> |
| 138 |
<term>system</term> |
| 139 |
<listitem> |
| 140 |
<para> |
| 141 |
build with libusb-1.0 found on system library path and under |
| 142 |
libusb-1.0 on system include path (default, linux, openbsd). |
| 143 |
</para> |
| 144 |
</listitem> |
| 145 |
</varlistentry> |
| 146 |
<varlistentry> |
| 147 |
<term>included</term> |
| 148 |
<listitem> |
| 149 |
<para>build with libusb-1.0 included with gpsbabel (default, macOS only).</para> |
| 150 |
</listitem> |
| 151 |
</varlistentry> |
| 152 |
<varlistentry> |
| 153 |
<term>custom</term> |
| 154 |
<listitem> |
| 155 |
<para> |
| 156 |
build with user supplied libusb-1.0. LIBS and INCLUDEPATH may need to |
| 157 |
be set with GPSBABEL_EXTRA_LINK_LIBRARIES and GPSBABEL_EXTRA_INCLUDE_DIRECTORIES. |
| 158 |
</para> |
| 159 |
</listitem> |
| 160 |
</varlistentry> |
| 161 |
</variablelist> |
| 162 |
</listitem> |
| 163 |
</varlistentry> |
| 164 |
<varlistentry> |
| 165 |
<term>GPSBABEL_WITH_SHAPELIB = no|pkgconfig|included*|custom</term> |
| 166 |
<listitem> |
| 167 |
<variablelist> |
| 168 |
<varlistentry> |
| 169 |
<term>no</term> |
| 170 |
<listitem> |
| 171 |
<para>build without shapelib. functionality will be limited.</para> |
| 172 |
</listitem> |
| 173 |
</varlistentry> |
| 174 |
<varlistentry> |
| 175 |
<term>pkgconfig</term> |
| 176 |
<listitem> |
| 177 |
<para>build with shapelib found by pkg-config.</para> |
| 178 |
</listitem> |
| 179 |
</varlistentry> |
| 180 |
<varlistentry> |
| 181 |
<term>included</term> |
| 182 |
<listitem> |
| 183 |
<para>build with shapelib included with gpsbabel (default).</para> |
| 184 |
</listitem> |
| 185 |
</varlistentry> |
| 186 |
<varlistentry> |
| 187 |
<term>custom</term> |
| 188 |
<listitem> |
| 189 |
<para> |
| 190 |
build with user supplied shapelib. LIBS and INCLUDEPATH may need to |
| 191 |
be set with GPSBABEL_EXTRA_LINK_LIBRARIES and |
| 192 |
GPSBABEL_EXTRA_INCLUDE_DIRECTORIES.</para> |
| 193 |
</listitem> |
| 194 |
</varlistentry> |
| 195 |
</variablelist> |
| 196 |
</listitem> |
| 197 |
</varlistentry> |
| 198 |
<varlistentry> |
| 199 |
<term>GPSBABEL_WITH_ZLIB = no|pkgconfig|included*|custom</term> |
| 200 |
<listitem> |
| 201 |
<variablelist> |
| 202 |
<varlistentry> |
| 203 |
<term>no</term> |
| 204 |
<listitem> |
| 205 |
<para>build without zlib. functionality will be limited.</para> |
| 206 |
</listitem> |
| 207 |
</varlistentry> |
| 208 |
<varlistentry> |
| 209 |
<term>pkgconfig</term> |
| 210 |
<listitem> |
| 211 |
<para>build with zlib found by pkg-config.</para> |
| 212 |
</listitem> |
| 213 |
</varlistentry> |
| 214 |
<varlistentry> |
| 215 |
<term>included</term> |
| 216 |
<listitem> |
| 217 |
<para>build with zlib included with gpsbabel (default).</para> |
| 218 |
</listitem> |
| 219 |
</varlistentry> |
| 220 |
<varlistentry> |
| 221 |
<term>custom</term> |
| 222 |
<listitem> |
| 223 |
<para> |
| 224 |
build with user supplied zlib. LIBS and INCLUDEPATH may need to |
| 225 |
be set with GPSBABEL_EXTRA_LINK_LIBRARIES and |
| 226 |
GPSBABEL_EXTRA_INCLUDE_DIRECTORIES.</para> |
| 227 |
</listitem> |
| 228 |
</varlistentry> |
| 229 |
</variablelist> |
| 230 |
</listitem> |
| 231 |
</varlistentry> |
| 232 |
<varlistentry> |
| 233 |
<term>GPSBABEL_MAPPREVIEW</term> |
| 234 |
<listitem> |
| 235 |
<para> |
| 236 |
This options enables the map preview feature. With the feature disabled |
| 237 |
QtWebEngine and QtWebEngineWdigets are not used. Note that QtWebKit and |
| 238 |
QtWebKitWidgets are not longer supported. |
| 239 |
</para> |
| 240 |
</listitem> |
| 241 |
</varlistentry> |
| 242 |
<varlistentry> |
| 243 |
<term>GPSBABEL_EMBED_MAP</term> |
| 244 |
<listitem> |
| 245 |
<para> |
| 246 |
Embed gmapbase.html for map preview. When using this option gmapbase.html |
| 247 |
will be compiled into the executable and does not need to be distributed. |
| 248 |
</para> |
| 249 |
</listitem> |
| 250 |
</varlistentry> |
| 251 |
<varlistentry> |
| 252 |
<term>GPSBABEL_EMBED_TRANSLATIONS</term> |
| 253 |
<listitem> |
| 254 |
<para> |
| 255 |
Embed translations. When using this option the gpsbabel provided |
| 256 |
translations will be compiled into the executable and do not need to be |
| 257 |
distributed. The Qt provided translations still need to be distributed. |
| 258 |
</para> |
| 259 |
</listitem> |
| 260 |
</varlistentry> |
| 261 |
<varlistentry> |
| 262 |
<term>GPSBABEL_ENABLE_PCH</term> |
| 263 |
<listitem> |
| 264 |
<para>Enable precompiled headers when building the target gpsbabel.</para> |
| 265 |
</listitem> |
| 266 |
</varlistentry> |
| 267 |
<varlistentry> |
| 268 |
<term>GPSBABEL_EXTRA_COMPILE_OPTIONS</term> |
| 269 |
<listitem> |
| 270 |
<para>Extra compile options when building the target gpsbabel.</para> |
| 271 |
</listitem> |
| 272 |
</varlistentry> |
| 273 |
<varlistentry> |
| 274 |
<term>GPSBABEL_EXTRA_INCLUDE_DIRECTORIES</term> |
| 275 |
<listitem> |
| 276 |
<para>Extra directories to include when building the target gpsbabel.</para> |
| 277 |
</listitem> |
| 278 |
</varlistentry> |
| 279 |
<varlistentry> |
| 280 |
<term>GPSBABEL_LINK_LIBRARIES</term> |
| 281 |
<listitem> |
| 282 |
<para>Extra libraries to link when building the target gpsbabel.</para> |
| 283 |
</listitem> |
| 284 |
</varlistentry> |
| 285 |
<varlistentry> |
| 286 |
<term>GPSBABEL_LINK_OPTIONS</term> |
| 287 |
<listitem> |
| 288 |
<para>Extra link options when building the target gpsbabel.</para> |
| 289 |
</listitem> |
| 290 |
</varlistentry> |
| 291 |
<varlistentry> |
| 292 |
<term>GPSBABEL_DOCVERSION</term> |
| 293 |
<listitem> |
| 294 |
<para> |
| 295 |
string appended to documentation location for www.gpsbabel.org. The default |
| 296 |
value is the version string, e.g. "1.7.0". This is used by the gpsbabel.org |
| 297 |
target, you are unlikely to need it unless you are maintaining |
| 298 |
www.gpsbabel.org. |
| 299 |
</para> |
| 300 |
</listitem> |
| 301 |
</varlistentry> |
| 302 |
<varlistentry> |
| 303 |
<term>GPSBABEL_WEB</term> |
| 304 |
<listitem> |
| 305 |
<para> |
| 306 |
Path where the documentation will be stored for www.gpsbabel.org. This is |
| 307 |
used by the gpsbabel.org target, you are unlikely to need it unless you are |
| 308 |
maintaining www.gpsbabel.org. The default location is "gpsbabel.org". |
| 309 |
</para> |
| 310 |
</listitem> |
| 311 |
</varlistentry> |
| 312 |
</variablelist> |
| 313 |
<para> |
| 314 |
Additional targets are available for special purposes. |
| 315 |
</para> |
| 316 |
<variablelist> |
| 317 |
<varlistentry> |
| 318 |
<term>check</term> |
| 319 |
<listitem> |
| 320 |
<para>Run the basic test suite.</para> |
| 321 |
</listitem> |
| 322 |
</varlistentry> |
| 323 |
<varlistentry> |
| 324 |
<term>check-vtesto</term> |
| 325 |
<listitem> |
| 326 |
<para>Run valgrind memcheck.</para> |
| 327 |
</listitem> |
| 328 |
</varlistentry> |
| 329 |
<varlistentry> |
| 330 |
<term>gpsbabel</term> |
| 331 |
<listitem> |
| 332 |
<para>Build the command line tool.</para> |
| 333 |
</listitem> |
| 334 |
</varlistentry> |
| 335 |
<varlistentry> |
| 336 |
<term>gpsbabel.hmtl</term> |
| 337 |
<listitem> |
| 338 |
<para>Create the html documentation.</para> |
| 339 |
</listitem> |
| 340 |
</varlistentry> |
| 341 |
<varlistentry> |
| 342 |
<term>gpsbabel.org</term> |
| 343 |
<listitem> |
| 344 |
<para>Create documentation for use on www.gpsbabel.org.</para> |
| 345 |
</listitem> |
| 346 |
</varlistentry> |
| 347 |
<varlistentry> |
| 348 |
<term>gpsbabel.pdf</term> |
| 349 |
<listitem> |
| 350 |
<para>Create the pdf documentation.</para> |
| 351 |
</listitem> |
| 352 |
</varlistentry> |
| 353 |
<varlistentry> |
| 354 |
<term>package_app</term> |
| 355 |
<listitem> |
| 356 |
<para> |
| 357 |
Collect the components for distribution. |
| 358 |
On Linux the gpsbabel generated components will be under |
| 359 |
gui/GPSBabelFE, any dynamically linked required libraries are not included. |
| 360 |
On macOS an app bundle will be created at gui/GPSBabelFE.app and an apple disk |
| 361 |
image will be created at gui/GPSBabelFE.dmg. |
| 362 |
On windows an image will be created in the directory gui/package, and an |
| 363 |
installer will be created gui/Setup-x.y.z-Setup.exe. |
| 364 |
</para> |
| 365 |
</listitem> |
| 366 |
</varlistentry> |
| 367 |
</variablelist> |
| 368 |
</section> |
| 369 |
<section xml:id="Runtime_Dependencies"> |
| 370 |
<title>Runtime Dependencies:</title> |
| 371 |
<para> |
| 372 |
On non-macOS unix builds by default we now compile in the gpsbabel generated |
| 373 |
translation files, i.e. gpsbabelfe_*.qm, gpsbabel_*.qm, as well as |
| 374 |
gmapbase.html. When compiled in these files do not need to be distributed. |
| 375 |
These are used by the GUI. Additional translation files from Qt will also be |
| 376 |
used if they are found. They may be in a package such as qt6-translations-l10n. |
| 377 |
</para> |
| 378 |
</section> |
| 379 |
</section> |
| 380 |
</chapter> |