mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
commit
21efa92c91
25
.github/workflows/amalgamate-ubuntu20.yml
vendored
Normal file
25
.github/workflows/amalgamate-ubuntu20.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: Amalgamate Ubuntu 20.04 CI (GCC 9, 8)
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ubuntu-build:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
# Legacy/x86 compilers cause CI failures.
|
||||||
|
#- {cxx: -DCMAKE_CXX_COMPILER=g++-8, arch: }
|
||||||
|
- {cxx: , arch: } # default=gcc9
|
||||||
|
#- {cxx: , arch: -DCMAKE_CXX_FLAGS="-m32"} # default=gcc9
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Compile with amalgamation
|
||||||
|
run: |
|
||||||
|
mkdir build &&
|
||||||
|
mkdir build/fast_float &&
|
||||||
|
python3 ./script/amalgamate.py > build/fast_float/fast_float.h &&
|
||||||
|
cp tests/string_test.cpp build/ &&
|
||||||
|
cd build &&
|
||||||
|
g++ string_test.cpp
|
||||||
@ -3,3 +3,4 @@ Maksim Kita
|
|||||||
Marcin Wojdyr
|
Marcin Wojdyr
|
||||||
Neal Richardson
|
Neal Richardson
|
||||||
Tim Paine
|
Tim Paine
|
||||||
|
Fabio Pellacini
|
||||||
|
|||||||
@ -141,6 +141,13 @@ target_link_libraries(myprogram PUBLIC fast_float)
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Using as single header
|
||||||
|
|
||||||
|
The script `script/amalgamate.py` may be used to generate a single header
|
||||||
|
version of the library if so desired.
|
||||||
|
Just run the script from the root directory of this repository.
|
||||||
|
You can customize the license type and output file if desired as described in
|
||||||
|
the command line help.
|
||||||
|
|
||||||
## Credit
|
## Credit
|
||||||
|
|
||||||
|
|||||||
56
script/amalgamate.py
Normal file
56
script/amalgamate.py
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
# text parts
|
||||||
|
processed_files = { }
|
||||||
|
|
||||||
|
# authors
|
||||||
|
for filename in ['AUTHORS', 'CONTRIBUTORS']:
|
||||||
|
with open(filename) as f:
|
||||||
|
text = ''
|
||||||
|
for line in f:
|
||||||
|
if filename == 'AUTHORS':
|
||||||
|
text += '// fast_float by ' + line
|
||||||
|
if filename == 'CONTRIBUTORS':
|
||||||
|
text += '// with contributions from ' + line
|
||||||
|
processed_files[filename] = text
|
||||||
|
|
||||||
|
# licenses
|
||||||
|
for filename in ['LICENSE-MIT', 'LICENSE-APACHE']:
|
||||||
|
with open(filename) as f:
|
||||||
|
text = ''
|
||||||
|
for line in f:
|
||||||
|
text += '// ' + line
|
||||||
|
processed_files[filename] = text
|
||||||
|
|
||||||
|
# code
|
||||||
|
for filename in [ 'fast_float.h', 'float_common.h', 'ascii_number.h',
|
||||||
|
'fast_table.h', 'decimal_to_binary.h', 'ascii_number.h',
|
||||||
|
'simple_decimal_conversion.h', 'parse_number.h']:
|
||||||
|
with open('include/fast_float/' + filename) as f:
|
||||||
|
text = ''
|
||||||
|
for line in f:
|
||||||
|
if line.startswith('#include "'): continue
|
||||||
|
text += line
|
||||||
|
processed_files[filename] = text
|
||||||
|
|
||||||
|
# command line
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser(description='Amalgamate fast_float.')
|
||||||
|
parser.add_argument('--license', default='MIT', help='choose license')
|
||||||
|
parser.add_argument('--output', default='', help='output file (stdout if none')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
text = '\n\n'.join([
|
||||||
|
processed_files['AUTHORS'], processed_files['CONTRIBUTORS'],
|
||||||
|
processed_files['LICENSE-' + args.license],
|
||||||
|
processed_files['fast_float.h'], processed_files['float_common.h'],
|
||||||
|
processed_files['ascii_number.h'], processed_files['fast_table.h'],
|
||||||
|
processed_files['decimal_to_binary.h'], processed_files['ascii_number.h'],
|
||||||
|
processed_files['simple_decimal_conversion.h'],
|
||||||
|
processed_files['parse_number.h']])
|
||||||
|
|
||||||
|
if args.output:
|
||||||
|
with open(args.output, 'wt') as f:
|
||||||
|
f.write(text)
|
||||||
|
else:
|
||||||
|
print(text)
|
||||||
Loading…
x
Reference in New Issue
Block a user