Tested the engine on linux

This commit is contained in:
2022-10-02 16:18:13 +11:00
parent cf76513c8a
commit b59696bebc
5 changed files with 22 additions and 5 deletions

View File

@@ -14,8 +14,8 @@ ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN)
LIBLINE =-Wl,--out-implib=$(CORE_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
OUT=$(CORE_OUTDIR)/$(OUTNAME).dll
else ifeq ($(shell uname),Linux)
LIBLINE=-Wl,--out-implib=../$(CORE_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
OUT=../$(CORE_OUTDIR)/lib$(OUTNAME).so
LIBLINE=-Wl,--out-implib=./$(CORE_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
OUT=./$(CORE_OUTDIR)/lib$(OUTNAME).so
CFLAGS += -fPIC
else ifeq ($(OS),Windows_NT)
LIBLINE =-Wl,--out-implib=$(CORE_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive

View File

@@ -5,7 +5,13 @@ export CORE_OUTDIR = ../$(LIBDIR)
all: $(OUTDIR) $(LIBDIR) toy core
$(MAKE) -C source
ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN)
cp $(LIBDIR)/*.dll $(OUTDIR)
else ifeq ($(shell uname),Linux)
cp $(LIBDIR)/*.so $(OUTDIR)
else ifeq ($(OS),Windows_NT)
cp $(LIBDIR)/*.dll $(OUTDIR)
endif
toy: $(LIBDIR)
$(MAKE) -C Toy/source

View File

@@ -11,7 +11,7 @@ OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o))
OUT=../$(OUTDIR)/airport
all: $(OBJ)
$(CC) $(CFLAGS) -o $(OUT) $(OBJ) -L../$(LIBDIR) $(LIBS)
$(CC) $(CFLAGS) -o $(OUT) $(OBJ) -Wl,-rpath,. -L../$(LIBDIR) $(LIBS)
$(OBJ): | $(ODIR)

View File

@@ -14,11 +14,13 @@ OBJ = $(addprefix $(ODIR)/,$(TARGETS:../core/%.c=%.o)) $(addprefix $(ODIR)/,$(TE
all: $(OBJ) $(TESTS:%.c=../$(OUTDIR)/%.exe)
../$(OUTDIR)/%.exe: $(ODIR)/%.o
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS)
cp ../$(LIBDIR)/*.dll ../$(OUTDIR)
ifeq ($(shell uname),Linux)
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -Wl,-rpath,../out -L../$(LIBDIR) $(LIBS)
cp ../$(LIBDIR)/*.so ../$(OUTDIR)
valgrind --leak-check=full --track-origins=yes $@
else
@$(CC) -o $@ $< $(TARGETS:../core/%.c=$(ODIR)/%.o) $(CFLAGS) -L../$(LIBDIR) $(LIBS)
cp ../$(LIBDIR)/*.dll ../$(OUTDIR)
$@
endif

View File

@@ -10,6 +10,11 @@
#include <stdlib.h>
#include <string.h>
//suppress the print keyword
static void noPrintFn(const char* output) {
//NO OP
}
//compilation functions
char* readFile(char* path, size_t* fileSize) {
FILE* file = fopen(path, "rb");
@@ -87,6 +92,7 @@ int main() {
//setup interpreter
Interpreter interpreter;
initInterpreter(&interpreter);
setInterpreterPrint(&interpreter, noPrintFn);
size_t size = 0;
@@ -113,6 +119,7 @@ int main() {
//setup interpreter
Interpreter interpreter;
initInterpreter(&interpreter);
setInterpreterPrint(&interpreter, noPrintFn);
size_t size = 0;
@@ -134,6 +141,8 @@ int main() {
resetInterpreter(&interpreter);
pushEngineNode(&node, &child);
free((void*)source);
}
//test the calls