Cygwin/Babun support

This commit is contained in:
ha7ilm 2016-06-29 22:34:56 +02:00
parent ef39d8dc27
commit a0b836e61c
3 changed files with 24 additions and 11 deletions

View file

@ -42,12 +42,14 @@ PARAMS_LIBS = -g -lm -lrt -lfftw3f -DUSE_FFTW -DLIBCSDR_GPL -DUSE_IMA_ADPCM
PARAMS_SO = -fpic PARAMS_SO = -fpic
PARAMS_MISC = -Wno-unused-result PARAMS_MISC = -Wno-unused-result
FFTW_PACKAGE = fftw-3.3.3 FFTW_PACKAGE = fftw-3.3.3
SO_EXT = $(if $(findstring CYGWIN,$(shell uname -a)),dll,so)
all: clean-vect all: clean-vect
@echo NOTE: you may have to manually edit Makefile to optimize for your CPU \(especially if you compile on ARM, please edit PARAMS_NEON\). @echo NOTE: you may have to manually edit Makefile to optimize for your CPU \(especially if you compile on ARM, please edit PARAMS_NEON\).
@echo Auto-detected optimization parameters: $(PARAMS_SIMD) @echo Auto-detected optimization parameters: $(PARAMS_SIMD)
@echo @echo
gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.so gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) $(LIBSOURCES) $(PARAMS_LIBS) $(PARAMS_MISC) -fpic -shared -o libcsdr.$(SO_EXT)
-./parsevect dumpvect*.vect -./parsevect dumpvect*.vect
gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) csdr.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o csdr gcc -std=gnu99 $(PARAMS_LOOPVECT) $(PARAMS_SIMD) csdr.c $(PARAMS_LIBS) -L. -lcsdr $(PARAMS_MISC) -o csdr
arm-cross: clean-vect arm-cross: clean-vect
@ -56,17 +58,17 @@ arm-cross: clean-vect
clean-vect: clean-vect:
rm -f dumpvect*.vect rm -f dumpvect*.vect
clean: clean-vect clean: clean-vect
rm -f libcsdr.so csdr rm -f libcsdr.$(SO_EXT) csdr
install: install:
install -m 0755 libcsdr.so /usr/lib install -m 0755 libcsdr.$(SO_EXT) /usr/lib
install -m 0755 csdr /usr/bin install -m 0755 csdr /usr/bin
install -m 0755 csdr-fm /usr/bin install -m 0755 csdr-fm /usr/bin
ldconfig ldconfig
uninstall: uninstall:
rm /usr/lib/libcsdr.so /usr/bin/csdr /usr/bin/csdr-fm rm /usr/lib/libcsdr.$(SO_EXT) /usr/bin/csdr /usr/bin/csdr-fm
ldconfig ldconfig
disasm: disasm:
objdump -S libcsdr.so > libcsdr.disasm objdump -S libcsdr.$(SO_EXT) > libcsdr.disasm
emcc-clean: emcc-clean:
-rm sdr.js/sdr.js -rm sdr.js/sdr.js
-rm sdr.js/sdrjs-compiled.js -rm sdr.js/sdrjs-compiled.js

6
csdr.c
View file

@ -321,9 +321,11 @@ int main(int argc, char *argv[])
if(argc<=1) return badsyntax(0); if(argc<=1) return badsyntax(0);
if(!strcmp(argv[1],"--help")) return badsyntax(0); if(!strcmp(argv[1],"--help")) return badsyntax(0);
#ifndef CSDR_NOLINUX
fcntl(STDIN_FILENO, F_SETPIPE_SZ, 65536*32); fcntl(STDIN_FILENO, F_SETPIPE_SZ, 65536*32);
fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 65536*32); fcntl(STDOUT_FILENO, F_SETPIPE_SZ, 65536*32);
//fprintf(stderr, "csdr: F_SETPIPE_SZ\n"); //fprintf(stderr, "csdr: F_SETPIPE_SZ\n");
#endif
if(!strcmp(argv[1],"setbuf")) if(!strcmp(argv[1],"setbuf"))
{ {
@ -1386,6 +1388,7 @@ int main(int argc, char *argv[])
#define TIME_TAKEN(start,end) ((end.tv_sec-start.tv_sec)+(end.tv_nsec-start.tv_nsec)/1e9) #define TIME_TAKEN(start,end) ((end.tv_sec-start.tv_sec)+(end.tv_nsec-start.tv_nsec)/1e9)
#ifndef CSDR_NOLINUX
if(!strcmp(argv[1],"fft_benchmark")) if(!strcmp(argv[1],"fft_benchmark"))
{ {
if(argc<=3) return badsyntax("need required parameters (fft_size, fft_cycles)"); if(argc<=3) return badsyntax("need required parameters (fft_size, fft_cycles)");
@ -1424,6 +1427,7 @@ int main(int argc, char *argv[])
fprintf(stderr,"fft_benchmark: %d transforms of %d processed in %g seconds, %g seconds each.\n",fft_cycles,fft_size,time_taken_fft,time_taken_fft/fft_cycles); fprintf(stderr,"fft_benchmark: %d transforms of %d processed in %g seconds, %g seconds each.\n",fft_cycles,fft_size,time_taken_fft,time_taken_fft/fft_cycles);
return 0; return 0;
} }
#endif
if(!strcmp(argv[1],"bandpass_fir_fft_cc")) //this command does not exist as a separate function if(!strcmp(argv[1],"bandpass_fir_fft_cc")) //this command does not exist as a separate function
{ {
@ -1663,6 +1667,7 @@ int main(int argc, char *argv[])
} }
#endif #endif
#ifndef CSDR_NOLINUX
if(!strcmp(argv[1],"through")) if(!strcmp(argv[1],"through"))
{ {
struct timespec start_time, end_time; struct timespec start_time, end_time;
@ -1700,6 +1705,7 @@ int main(int argc, char *argv[])
TRY_YIELD; TRY_YIELD;
} }
} }
#endif
if(!strcmp(argv[1],"dsb_fc")) if(!strcmp(argv[1],"dsb_fc"))
{ {

View file

@ -31,6 +31,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#define MIN_M(x,y) (((x)>(y))?(y):(x)) #define MIN_M(x,y) (((x)>(y))?(y):(x))
#ifdef __CYGWIN__
#define CSDR_NOLINUX
#endif
/* /*
_____ _ _____ _
/ ____| | | / ____| | |