GitXplorerGitXplorer
1

gdtoa-desktop

public
8 stars
3 forks
0 issues

Commits

List of commits on branch master.
Verified
698924a1637897a1a78377e082bb0066696a6b34

Make the renaming defines private to the gdtoa-desktop target (#5)

eeteran committed 4 years ago
Unverified
8d6714f7595c5a9e0bc3a16d81146cdf3e1ef13f

This makes it so the two tools that are built in order to generate needed files

eeteran committed 4 years ago
Unverified
ab5a681a9d6813e06f6c1b5ebec14e04b426a8d0

Update README

110110111 committed 4 years ago
Unverified
b43beb6aab0de7d4c71b499170bcb4c7980df8d3

Some small tweaks to make it cmake subproject friendly

eeteran committed 4 years ago
Verified
c178e2c44d3644440f3502d0934ffce53bcab9b5

Merge pull request #2 from bb010g/master

110110111 committed 5 years ago
Unverified
e81d53950c241437988c7c7d982bb8284dc2c44a

Fix pkg-config generation CMake variables

bbb010g committed 5 years ago

README

The README file for this repository.

Build Status

gdtoa-desktop

This is an adaptation of the binary↔decimal floating-point conversion library by David M. Gay to common desktop/server operating systems like Ubuntu and Fedora.

This adapatation's main objective is to provide an easy way to build the original upstream library in the configuration well-suited for the target systems – with locale and multithreading support, and without conflicts with the system libraries like glibc.

How it compares to the original library

The original library is contained verbatim in the gdtoa directory in the root of the source tree. All the adaptations are made using CMakeLists.txt and source files outside that directory.

Unlike the makefile of the original library, CMake-based build system here enables some options and applies some tweaks:

  • USE_LOCALE, since any glibc-based apps looking for a compatible parsing and formatting of numbers will need it
  • MULTIPLE_THREADS + the required locking functions, since the target OSes are multithreaded, and we intend this library to be usable generically.
  • All the externally-visible function names have been prefixed by gdtoa_ prefix. So, if you wanted to call e.g. g_xfmt(args...), you should instead use gdtoa_g_xfmt(args...).
  • For 32-bit x86 systems SSE2 is used for arithmetic instead of x87 to avoid inconsistent rounding. Then strtodt test passes. If you target a CPU without SSE2 support, set the GDTOA_ENABLE_SSE2 option to OFF. In this case the implementation using integer arithmetic will be compiled into the library.

Installation

Simply doing the following commands should be enough to install the library:

mkdir build
cd build
cmake ..
make
make install

This will install the following files:

/usr/local/lib/libgdtoa-desktop.so
/usr/local/lib/pkgconfig/gdtoa-desktop.pc
/usr/local/include/gdtoa-desktop/arith.h
/usr/local/include/gdtoa-desktop/gdtoa-desktop.h

Running tests

After configuring the package using the cmake command, run

make check

This will run tests from the original library.

Manually upgrading to a newer upstream version

Generally, it's suggested to try doing git pull to see if this repo is already up to date. But if this repo lags behind while you need to use a newer upstream version of the library retaining the tweaks made here, you can upgrade your local copy manually like follows:

  1. Remove old gdtoa/ directory.
  2. Extract the new one in its place.
  3. Build (but don't install) the library, passing -DGDTOA_RENAME_FUNCTIONS=OFF parameter to cmake.
  4. Use the resulting library libgdtoa-desktop.so to generate the list of externally-visible functions. You can find the commands for generation in the comments in rename-functions.sh and CMakeLists.txt (grep for '<nm>' there).
  5. Having generated the two lists, update them in the corresponding places in these two files.
  6. If any new *.c files appeared in the original library, add them to gdtoa_SOURCES in the CMakeLists.txt

Now you should be able to simply build the upgraded library as usual, not forgetting to reset GDTOA_RENAME_FUNCTIONS option back to ON.

NOTE: this procedure totally ignores tests, which may need tweaking of CMakeLists.txt and run-tests.sh after upgrade.