Skip to content

Commit

Permalink
moc test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpoirier committed Dec 16, 2015
1 parent 49b321c commit 6169d27
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 16 deletions.
19 changes: 10 additions & 9 deletions moc_test/Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#


all:
cd gortlsdr_moc && gcc -Wall -c librtlsdr_moc.c -o librtlsdr_moc.o
cd gortlsdr_moc && ar rcs librtlsdr_moc.a librtlsdr_moc.o
cd gortlsdr_moc && cp ../../rtlsdr.go .
cd gortlsdr_moc && cp ../../exports.go .
cd gortlsdr_moc && 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
cd gortlsdr_moc && rm ./rtlsdr.go ./exports.go
# cd gortlsdr && gcc -fPIC -shared -Wl,-soname,librtlsdr.so.0 -o librtlsdr.so.0 librtlsdr.c
cd gortlsdr && gcc -Wall -c librtlsdr.c -o librtlsdr.o
cd gortlsdr && ar rcs librtlsdr.a librtlsdr.o
cd gortlsdr && cp ../../rtlsdr.go .
cd gortlsdr && cp ../../exports.go .
cd gortlsdr && CC="gcc -DMOCK_TEST" go build --ldflags '-extldflags "-static" "-L."' -o gortlsdr.a rtlsdr.go exports.go
# cd gortlsdr && CC="gcc -Dmock" go build -o gortlsdr.a rtlsdr.go exports.go
go build --ldflags '-extldflags "-L./gortlsdr"' main.go
rm ./gortlsdr/rtlsdr.go ./gortlsdr/exports.go

clean:
rm -f main_moc ./gortlsdr_moc/*.o ./gortlsdr_moc/*.a ./gortlsdr_moc/rtlsdr.go ./gortlsdr_moc/exports.go
rm -f main ./gortlsdr/*.o ./gortlsdr/*.a ./gortlsdr/rtlsdr.go ./gortlsdr/exports.go ./gortlsdr/*.0 ./gortlsdr/*.so



File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion moc_test/main_moc.go → moc_test/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package main
import (
"log"

rtl "./gortlsdr_moc"
rtl "./gortlsdr"
)

func GetDeviceCount() int {
Expand Down
9 changes: 3 additions & 6 deletions rtlsdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ import (
// If building libusb from source, to regenerate the configure file use:
// $ autoreconf -fvi
#cgo MOC_TEST LDFLAGS: -L. -lrtlsdr_moc
#cgo linux LDFLAGS: -lrtlsdr
#cgo darwin LDFLAGS: -lrtlsdr
#cgo !windows 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>
#ifdef mock
#include "rtl-sdr_moc.h"
#else
#include <rtl-sdr.h>
#endif
Expand Down

0 comments on commit 6169d27

Please sign in to comment.