for better windows compatibility

This commit is contained in:
Heng Li 2017-09-02 17:52:33 -04:00
parent b97620afed
commit 0a3ebdc916
7 changed files with 16 additions and 17 deletions

View File

@ -30,8 +30,8 @@ minimap2-lite:example.o libminimap2.a
libminimap2.a:$(OBJS)
$(AR) -csru $@ $(OBJS)
sdust:sdust.c kalloc.o kalloc.h kdq.h kvec.h kseq.h sdust.h
$(CC) -D_SDUST_MAIN $(CFLAGS) $< kalloc.o -o $@ -lz
sdust:sdust.c getopt.o kalloc.o kalloc.h kdq.h kvec.h kseq.h sdust.h
$(CC) -D_SDUST_MAIN $(CFLAGS) $< getopt.o kalloc.o -o $@ -lz
clean:
rm -fr gmon.out *.o a.out $(PROG) $(PROG_EXTRA) *~ *.a *.dSYM session*
@ -46,6 +46,7 @@ bseq.o: bseq.h kseq.h
chain.o: minimap.h mmpriv.h bseq.h kalloc.h
example.o: minimap.h kseq.h
format.o: kalloc.h mmpriv.h minimap.h bseq.h
getopt.o: getopt.h
hit.o: mmpriv.h minimap.h bseq.h kalloc.h
index.o: kthread.h bseq.h minimap.h mmpriv.h kvec.h kalloc.h khash.h
kalloc.o: kalloc.h
@ -53,7 +54,7 @@ ksw2_extd2_sse.o: ksw2.h kalloc.h
ksw2_exts2_sse.o: ksw2.h kalloc.h
ksw2_extz2_sse.o: ksw2.h kalloc.h
ksw2_ll_sse.o: ksw2.h kalloc.h
main.o: bseq.h minimap.h mmpriv.h
main.o: bseq.h minimap.h mmpriv.h getopt.h
map.o: kthread.h kvec.h kalloc.h sdust.h mmpriv.h minimap.h bseq.h
misc.o: minimap.h ksort.h
sdust.o: kalloc.h kdq.h kvec.h sdust.h

View File

@ -1,7 +1,7 @@
#include <stdlib.h>
#include <assert.h>
#ifdef WIN32
#include <io.h>
#if defined(WIN32) || defined(_WIN32)
#include <io.h> // for open(2)
#else
#include <unistd.h>
#endif

View File

@ -3,7 +3,7 @@
#include <limits.h>
#include <stdint.h>
#ifdef WIN32
#if defined(WIN32) || defined(_WIN32)
#include <malloc.h>
#define alloca _alloca
#define __sync_fetch_and_add(ptr, addend) _InterlockedExchangeAdd((void*)ptr, addend)

14
main.c
View File

@ -1,12 +1,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef WIN32
#include <time.h>
#else
#include <sys/resource.h>
#include <sys/time.h>
#endif
#include "bseq.h"
#include "minimap.h"
#include "mmpriv.h"
@ -14,15 +8,19 @@
#define MM_VERSION "2.1-r316-dirty"
#ifdef __linux__
#include <sys/resource.h>
#include <sys/time.h>
void liftrlimit()
{
#ifdef __linux__
struct rlimit r;
getrlimit(RLIMIT_AS, &r);
r.rlim_cur = r.rlim_max;
setrlimit(RLIMIT_AS, &r);
#endif
}
#else
void liftrlimit() {}
#endif
static struct option long_options[] = {
{ "bucket-bits", required_argument, 0, 0 },

2
misc.c
View File

@ -96,7 +96,7 @@ double cputime()
getrusage(RUSAGE_SELF, &r);
return r.ru_utime.tv_sec + r.ru_stime.tv_sec + 1e-6 * (r.ru_utime.tv_usec + r.ru_stime.tv_usec);
}
#endif /* WIN32 */
#endif /* WIN32 || _WIN32 */
double realtime()
{

View File

@ -176,7 +176,7 @@ uint64_t *sdust(void *km, const uint8_t *seq, int l_seq, int T, int W, int *n)
#ifdef _SDUST_MAIN
#include <zlib.h>
#include <stdio.h>
#include <unistd.h>
#include "getopt.h"
#include "kseq.h"
KSEQ_INIT(gzFile, gzread)

View File

@ -5,7 +5,7 @@
#include "kvec.h"
#include "minimap.h"
#ifdef WIN32
#if defined(WIN32) || defined(_WIN32)
#include <malloc.h>
#define alloca _alloca
#endif