Skip to content

Commit

Permalink
fix moc test build
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoirier committed Dec 16, 2015
1 parent b1a24d0 commit da23e0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion moc_test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
all:
gcc -Wall -c librtlsdr_moc.c -o librtlsdr_moc.o
ar rcs librtlsdr_moc.a librtlsdr_moc.o
CC="gcc -DMOCK_TEST" go build --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go
CC="gcc -DMOCK_TEST" go build -tags 'MOC_TEST' --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go
go build main_moc.go

clean:
Expand Down
16 changes: 9 additions & 7 deletions rtlsdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@ import (
// If building libusb from source, to regenerate the configure file use:
// $ autoreconf -fvi
//
#ifdef MOC_TEST
// to build:
// to build the moc test:
// $ gcc -Wall -c librtlsdr_moc.c -o librtlsdr_moc.o
// $ ar rcs librtlsdr_moc.a librtlsdr_moc.o
// $ CC="gcc -DMOCK_TEST" go build --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go
// $ CC="gcc -DMOCK_TEST" go build -tags 'MOC_TEST' --ldflags '-extldflags "-static"' -o gortlsdr_moc.a ../rtlsdr.go ../exports.go
//
#cgo LDFLAGS: -L./moc_test -lrtlsdr_moc
#include <stdlib.h>
#include <rtl-sdr_moc.h>
#else
#cgo MOC_TEST LDFLAGS: -L./moc_test -lrtlsdr_moc
#cgo linux LDFLAGS: -lrtlsdr
#cgo darwin LDFLAGS: -lrtlsdr
#cgo windows CFLAGS: -IC:/WINDOWS/system32
#cgo windows LDFLAGS: -lrtlsdr -LC:/WINDOWS/system32
#include <stdlib.h>
#ifdef MOC_TEST
#include <rtl-sdr_moc.h>
#else
#include <rtl-sdr.h>
#endif
Expand Down

0 comments on commit da23e0b

Please sign in to comment.