Skip to content

Commit

Permalink
Fix meson/ninja build
Browse files Browse the repository at this point in the history
  • Loading branch information
pjotrp committed Aug 15, 2023
1 parent 9f29d2e commit 3a9205f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,15 +219,31 @@ meson build
cd build
ninja
ninja test

time ./build/sambamba sort HG00100.chrom20.ILLUMINA.bwa.GBR.low_coverage.20130415.bam
sambamba 1.0.1
by Artem Tarasov and Pjotr Prins (C) 2012-2023
LDC 1.32.0 / DMD v2.102.2 / LLVM14.0.6 / bootstrap LDC - the LLVM D compiler (1.32.0)
real 0m13.343s
user 2m11.663s
sys 0m4.232s
```

or possibly with some additional tuning
or possibly with some additional tuning runtimes get close to the optimized static build (see [benchmarks](test/benchmark/stats.org).

```sh
rm -rf build/ ; env D_LD=gold CC=gcc meson build --buildtype release
cd build/
env CC=gcc ninja
env CC=gcc ninja test

time ./build/sambamba sort HG00100.chrom20.ILLUMINA.bwa.GBR.low_coverage.20130415.bam
sambamba 1.0.1
by Artem Tarasov and Pjotr Prins (C) 2012-2023
LDC 1.32.0 / DMD v2.102.2 / LLVM14.0.6 / bootstrap LDC - the LLVM D compiler (1.32.0)
real 0m10.227s
user 2m7.203s
sys 0m4.039s
```

## Compiling for MacOS
Expand Down
13 changes: 6 additions & 7 deletions guix.scm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
;;
;; guix shell -C -D -f guix.scm -- bash --init-file <(echo "ln -s /bin/sh /bin/bash")
;;
;; and build
;;
;; find -name CMakeCache.txt|xargs rm -v
;; cd build
;; cmake -DCMAKE_BUILD_TYPE=Debug ..
;; cmake --build . --verbose -- -j 14 && ctest . --verbose
;;
;; For the tests you may need /usr/bin/env. In a container create it with
;;
;; mkdir -p /usr/bin ; ln -s $GUIX_ENVIRONMENT/bin/env /usr/bin/env
Expand All @@ -27,12 +20,15 @@
(guix gexp)
(gnu packages base)
(gnu packages bioinformatics) ; for samtools in sambamba
(gnu packages build-tools) ; for meson
(gnu packages compression)
(gnu packages curl)
(gnu packages dlang)
(gnu packages gcc)
(gnu packages pkg-config)
(gnu packages perl)
(gnu packages python)
(gnu packages ninja)
(gnu packages ruby)
(gnu packages tls)
(gnu packages version-control)
Expand Down Expand Up @@ -77,6 +73,9 @@
(inputs
`(("samtools" ,samtools) ; for pileup
("bcftools" ,bcftools) ; for pileup
("meson" ,meson) ; for testing meson build system
("ninja" ,ninja)
("pkg-config" ,pkg-config)
("lz4" ,lz4)
("lz4-static" ,lz4 "static")
("zlib-static" ,zlib "static")
Expand Down
18 changes: 14 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

project('Sambamba', ['c','d'],
license : 'GPL-2.0',
version : '1.0.0',
version : '1.0.1',
# default_options : ['buildtype=debugoptimized']
)

Expand All @@ -29,7 +29,7 @@ endif

# The optimized flags are
# ldc2 -singleobj -wi -I. -IBioD -g -J. -O3 -release -enable-inlining -boundscheck=off -L-lz -c -of=bin/sambamba-0.8.2.o
extra_dflags = [ '-I../BioD','-g','-release','-boundscheck=off']
extra_dflags = [ '-I../BioD','-I../BioD/contrib/msgpack-d/src','-g','-release','-boundscheck=off','-enable-inlining','-singleobj']
extra_ldflags = ['-L=-flto=full']

#
Expand Down Expand Up @@ -176,8 +176,18 @@ cram_src = [
]

thirdparty_src = [
'thirdparty/mergesort.d',
'thirdparty/unstablesort.d'
'thirdparty/mergesort.d',
'thirdparty/unstablesort.d',
'BioD/contrib/msgpack-d/src/msgpack/attribute.d',
'BioD/contrib/msgpack-d/src/msgpack/common.d',
'BioD/contrib/msgpack-d/src/msgpack/package.d',
'BioD/contrib/msgpack-d/src/msgpack/register.d',
'BioD/contrib/msgpack-d/src/msgpack/unpacker.d',
'BioD/contrib/msgpack-d/src/msgpack/buffer.d',
'BioD/contrib/msgpack-d/src/msgpack/exception.d',
'BioD/contrib/msgpack-d/src/msgpack/packer.d',
'BioD/contrib/msgpack-d/src/msgpack/streaming_unpacker.d',
'BioD/contrib/msgpack-d/src/msgpack/value.d',
]

manpages = [
Expand Down
7 changes: 7 additions & 0 deletions test/benchmark/stats.org
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ sys 0m0.240s

time ./bin/sambamba-1.0.0 sort HG00100.chrom20.ILLUMINA.bwa.GBR.low_coverage.20130415.bam

sambamba 1.0.1
by Artem Tarasov and Pjotr Prins (C) 2012-2023
LDC 1.32.0 / DMD v2.102.2 / LLVM14.0.6 / bootstrap LDC - the LLVM D compiler (1.32.0)
real 0m9.599s
user 2m1.039s
sys 0m3.834s

sambamba 1.0.0
by Artem Tarasov and Pjotr Prins (C) 2012-2022
LDC 1.32.0 / DMD v2.102.2 / LLVM14.0.6 / bootstrap LDC - the LLVM D compiler (1.32.0)
Expand Down

0 comments on commit 3a9205f

Please sign in to comment.