Skip to content

Commit 3ca1038

Browse files
committed
changes to work on nim 2.0 (force refc for gc)
1 parent 7fd4a85 commit 3ca1038

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ jobs:
6060
if: runner.os == 'Linux'
6161
run: |
6262
cd
63-
git clone --recursive https://github.com/samtools/htslib.git
64-
cd htslib && git checkout 1.11 && autoheader && autoconf && ./configure --enable-libcurl
63+
git clone -b 1.18 --recursive https://github.com/samtools/htslib.git
64+
cd htslib && autoheader && autoconf && ./configure --enable-libcurl
6565
sudo make -j 4 install
6666
sudo ldconfig
6767
#echo "::set-env name=LD_LIBRARY_PATH::${LD_LIBRARY_PATH}:${HOME}/htslib"
@@ -72,6 +72,11 @@ jobs:
7272
run: |
7373
brew install htslib
7474
75+
- name: Set DYLD_LIBRARY_PATH
76+
if: runner.os == 'macOS'
77+
run: |
78+
echo "DYLD_LIBRARY_PATH=$(brew --prefix htslib)/lib" >> $GITHUB_ENV
79+
7580
- name: Install d4
7681
run: |
7782
#export HTSLIB=system
@@ -101,7 +106,7 @@ jobs:
101106
run: chmod +x mosdepth && mkdir bin && cp mosdepth bin/mosdepth_debug_${{ matrix.os }}
102107

103108
- name: "Build and Copy release binary"
104-
run: nim c -d:danger -d:release -o:bin/mosdepth_${{ matrix.os }} mosdepth
109+
run: nim c --mm:refc -d:danger -d:release -o:bin/mosdepth_${{ matrix.os }} mosdepth
105110

106111
- name: Functional Tests
107112
env:
@@ -117,5 +122,5 @@ jobs:
117122
if: success()
118123
uses: actions/upload-artifact@v4
119124
with:
120-
name: mosdepth_${{ matrix.os }}_executable
125+
name: mosdepth_${{ matrix.os }}_nim${{ matrix.version }}_executable
121126
path: bin/

functional-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ set -o nounset
1212

1313

1414
set -e
15-
nim c --boundChecks:on -x:on mosdepth.nim
16-
nim c -r tests/funcs.nim
15+
nim c --boundChecks:on -x:on -d:useSysAssert -d:useGcAssert --lineDir:on --debuginfo --mm:refc mosdepth.nim
16+
nim c -x:on --mm:refc -d:useSysAssert -d:useGcAssert --lineDir:on --debuginfo -r tests/funcs.nim
1717
set +e
1818
exe=./mosdepth
1919
bam=/data/human/NA12878.subset.bam

mosdepth.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,8 @@ proc write_thresholds(fh:BGZI, tid:int, arr:var coverage_t, thresholds:seq[int],
504504
return
505505

506506
var counts = new_seq[int](len(thresholds))
507-
shallow(arr)
507+
when NimMajor < 2:
508+
shallow(arr)
508509

509510
# iterate over the region and count bases >= request cutoffs.
510511
for v in arr[start..<stop]:
@@ -630,7 +631,8 @@ proc main(bam: hts.Bam, chrom: region_t, mapq: int, min_len: int, max_len: int,
630631
window = uint32(S.parse_int(region))
631632
else:
632633
bed_regions = bed_to_table(region)
633-
shallow(arr)
634+
when NimMajor < 2:
635+
shallow(arr)
634636

635637
var cs = initCountStat[uint32](size=if use_median: 65536 else: 0)
636638

mosdepth.nimble

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT"
77

88
# Dependencies
99

10-
requires "hts >= 0.3.22", "docopt == 0.7.0", "nim >= 1.0.0", "https://github.com/brentp/d4-nim >= 0.0.3"
10+
requires "hts >= 0.3.22", "docopt == 0.7.1", "nim >= 1.0.0", "https://github.com/brentp/d4-nim >= 0.0.3"
1111

1212
bin = @["mosdepth"]
1313
skipDirs = @["tests"]

0 commit comments

Comments
 (0)