Skip to content

Commit d30059b

Browse files
committed
Proof of concept build
1 parent 1979352 commit d30059b

9 files changed

Lines changed: 109 additions & 16 deletions

File tree

JavaGUI/jni/TSDRLibraryNDK.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#include <jni.h>
22
#include <stdio.h>
33
#include "TSDRLibraryNDK.h"
4+
#include "include\TSDRLibrary.h"
45

56
JNIEXPORT void JNICALL Java_martin_tempest_core_TSDRLibrary_test(JNIEnv *env, jobject thisObj)
67
{
7-
printf("Hello World!\n");
8-
return;
8+
test();
99
}

JavaGUI/jni/include/TSDRLibrary.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _TSDRLibrary
2+
#define _TSDRLibrary
3+
4+
void test(void);
5+
6+
#endif

JavaGUI/jni/makefile

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,40 @@
11
# TODO! Make this platform independent!
22
INC = "C:\PROGRA~2\Java\jdk1.7.0_45\include" "C:\PROGRA~2\Java\jdk1.7.0_45\include\win32"
3-
EXT = .dll
43

5-
all : TSDRLibraryNDK$(EXT)
4+
ifeq ($(OS),Windows_NT)
5+
EXT = .dll
6+
else
7+
UNAME_S := $(shell uname -s)
8+
ifeq ($(UNAME_S),Linux)
9+
EXT = .so
10+
endif
11+
endif
612

7-
# $@ matches the target, $< matches the first dependancy
8-
TSDRLibraryNDK$(EXT) : TSDRLibraryNDK.o
9-
gcc -Wl,--add-stdcall-alias -shared -o $@ $<
13+
all : ../TSDRLibraryNDK$(EXT)
14+
15+
# $@ matches the target, $< matches the firs8t dependancy
16+
../TSDRLibraryNDK$(EXT) : TSDRLibraryNDK.o rebuildtempestsdr
17+
gcc -L../../TempestSDR/bin/ -lTSDRLibrary -Wl,--add-stdcall-alias -shared -o $@ $<
18+
19+
rebuildtempestsdr :
20+
@$(MAKE) -C ../../TempestSDR bin/TSDRLibrary$(EXT)
21+
@cp -f ../../TempestSDR/bin/TSDRLibrary$(EXT) ../TSDRLibrary$(EXT)
1022

1123
# $@ matches the target, $< matches the first dependancy
12-
TSDRLibraryNDK.o : TSDRLibraryNDK.c TSDRLibraryNDK.h
24+
TSDRLibraryNDK.o : TSDRLibraryNDK.c TSDRLibraryNDK.h include/TSDRLibrary.h
1325
gcc $(foreach d, $(INC), -I$d) -c $< -o $@
26+
27+
include/TSDRLibrary.h : ../../TempestSDR/src/include/TSDRLibrary.h
28+
mkdir -p include
29+
@cp -f $< $@
1430

15-
# $* matches the target filename without the extension
1631
TSDRLibraryNDK.h : ../bin/martin/tempest/core/TSDRLibrary.class
1732
javah -classpath ../bin -o TSDRLibraryNDK.h -jni martin.tempest.core.TSDRLibrary
33+
34+
../bin/martin/tempest/core/TSDRLibrary.class : ../src/martin/tempest/core/TSDRLibrary.java
35+
mkdir -p include ../bin/martin/tempest/core/
36+
javac $< -d ../bin/
1837

1938
clean :
20-
rm -f *.h *.o *.dll *.so *.exe
39+
rm -f TSDRLibraryNDK.h *.o ../TSDRLibraryNDK$(EXT) ../TSDRLibrary$(EXT) include/*.h
40+
rm -rf include/

JavaGUI/makefile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
all : jnilib java
2+
3+
java :
4+
#TODO! Implement java compilation from here
5+
echo Not implemented
6+
7+
jnilib :
8+
@$(MAKE) -C jni/ all
9+
10+
cleanjni:
11+
@$(MAKE) -C jni/ clean
12+
13+
clean : cleanjni
14+
rm -rf bin/

TempestSDR/makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
ifeq ($(OS),Windows_NT)
2+
EXT = .dll
3+
else
4+
UNAME_S := $(shell uname -s)
5+
ifeq ($(UNAME_S),Linux)
6+
EXT = .so
7+
endif
8+
endif
9+
10+
all : bin/TSDRLibrary$(EXT)
11+
12+
# $@ matches the target, $< matches the first dependancy
13+
bin/TSDRLibrary$(EXT) : bin/TSDRLibrary.o
14+
gcc -Wl,--add-stdcall-alias -shared -o $@ $<
15+
16+
# $@ matches the target, $< matches the first dependancy
17+
bin/TSDRLibrary.o : src/TSDRLibrary.c src/include/TSDRLibrary.h
18+
mkdir -p bin
19+
gcc $(foreach d, $(INC), -I$d) -c $< -o $@
20+
21+
clean :
22+
rm -f bin/*.o bin/TSDRLibrary$(EXT)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef _TSDRAvailableSources
2+
#define _TSDRAvailableSources
3+
4+
#include "TSDRLibrarySource.h"
5+
6+
/**
7+
* Here new sources need to be registered in order to be used.
8+
*/
9+
10+
struct available_sources {
11+
int id;
12+
} typedef sources_t;
13+
14+
sources_t sources;
15+
#endif

TempestSDR/src/TSDRLibrary.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
============================================================================
33
Name : TSDRLibrary.c
44
Author : Martin Marinov
5-
Version :
6-
Copyright : Your copyright notice
7-
Description : Hello World in C, Ansi-style
5+
Description : This is the TempestSDR library. More information will follow.
86
============================================================================
97
*/
108

9+
#include "include/TSDRLibrary.h"
10+
#include "TSDRAvailableSources.h"
1111
#include <stdio.h>
1212
#include <stdlib.h>
1313

14-
int main(void) {
15-
puts("!!!Hello World!!!"); /* prints !!!Hello World!!! */
16-
return EXIT_SUCCESS;
14+
void test(void) {
15+
sources.id = 123;
16+
printf("Dobre! Number is %d", sources.id);
1717
}

TempestSDR/src/TSDRLibrarySource.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#ifndef _TSDRLibrarySource
2+
#define _TSDRLibrarySource
3+
4+
/**
5+
* This is the interface that SDR input frontends should follow.
6+
*/
7+
8+
void test(void);
9+
10+
#endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#ifndef _TSDRLibrary
2+
#define _TSDRLibrary
3+
4+
void test(void);
5+
6+
#endif

0 commit comments

Comments
 (0)