File tree Expand file tree Collapse file tree 9 files changed +164
-0
lines changed Expand file tree Collapse file tree 9 files changed +164
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ if [ "$QEMU" != "" ]; then
8787 export EXIT_STATUS=0;
8888 set +e
8989 # run test in EusLisp/test
90+ make -C test
9091 for test_l in test/* .l; do
9192
9293 travis_time_start euslisp.${test_l##*/ } .test
@@ -235,6 +236,7 @@ if [[ "`uname -m`" == "aarch"* ]]; then
235236fi
236237
237238 # run test in EusLisp/test
239+ make -C $CI_SOURCE_PATH /test
238240 for test_l in $CI_SOURCE_PATH /test/* .l; do
239241
240242 travis_time_start euslisp.${test_l##*/ } .test
Original file line number Diff line number Diff line change 1+ include Makefile.$(ARCHDIR )
2+
3+ ifeq ($(ARCHDIR ) , LinuxARM)
4+ # for LinuxARM, get MACHINE from the following command
5+ # ref: https://github.com/euslisp/EusLisp/blob/89481741541488226fd78a92b2a8d1244169dd7f/lisp/Makefile.LinuxARM#L39
6+ MACHINE =$(shell uname -m | sed 's/\(armv[0-9]\) .*/\1/')
7+ else ifeq ($(ARCHDIR), Darwin)
8+ # for Darwin, depends on OS_VERSION
9+ # ref: https://github.com/euslisp/EusLisp/blob/89481741541488226fd78a92b2a8d1244169dd7f/lisp/Makefile.Darwin#L45-L50
10+ OS_VERSION =$(shell sw_vers -productVersion | sed s/\.[^.]* $$//)
11+ ifeq ($(OS_VERSION), 10.5)
12+ MACHINE =i386
13+ else
14+ MACHINE =x86_64
15+ endif
16+ else
17+ MACHINE =$(shell grep "MACHINE=" $(EUSDIR ) /lisp/Makefile | cut -f2 -d=)
18+ endif
19+
20+ CFLAGS =-I$(EUSDIR ) /include -D$(ARCHDIR ) -D$(MACHINE )
21+ LDFLAGS =
22+
23+ SRC =testdefforeign.c
24+ OBJ =$(basename $(SRC ) ) .o
25+ LIB =$(LPFX )$(basename $(SRC ) ) .$(LSFX )
26+
27+ $(LIB ) : $(OBJ )
28+ $(LD ) $(SOFLAGS ) $(OUTOPT )$(LIB ) $(OBJ ) $(LDFLAGS )
29+
30+ $(OBJ ) : $(SRC )
31+ $(CC ) $(CFLAGS ) -DCOMPILE_LIB -c $(SRC ) $(OBJOPT )$(OBJ )
32+
33+ clean :
34+ rm -f $(LIB ) $(OBJ )
Original file line number Diff line number Diff line change 1+ CC = c++ -O2 -falign-functions=4
2+ OBJOPT = -o
3+ OUTOPT = -o
4+ LD = c++ -shared -falign-functions=4
5+ EXELD = c++ -falign-functions=4
6+ SOFLAGS =
7+ EXESFX = .exe
8+ LSFX = dll
9+ LPFX = lib
10+ LIBS = -L$(ARCHDIR) -lRAPID
Original file line number Diff line number Diff line change 1+ CC = c++ -O2 -falign-functions=8 -fPIC -DDarwin -DGCC -I$(EUSDIR)/include
2+ OBJOPT = -o
3+ OUTOPT = -o
4+ LD = c++
5+ SOFLAGS = -dynamiclib -flat_namespace -undefined suppress
6+ EXELD = c++
7+ EXESFX =
8+ LSFX = so
9+ LPFX = lib
10+ LIBS = -L$(ARCHDIR) -lRAPID
Original file line number Diff line number Diff line change 1+ CC = c++ -O2 -DLinux -DGCC -I$(EUSDIR)/include
2+ OBJOPT = -o
3+ OUTOPT = -o
4+ LD = c++
5+ SOFLAGS = -shared
6+ EXELD = c++
7+ EXESFX =
8+ LSFX = so
9+ LPFX = lib
10+ LIBS = -L$(ARCHDIR) -lRAPID
11+
12+
13+ ifeq ($(shell /bin/uname -m), x86_64)
14+ CC += -m32
15+ LD += -m32
16+ EXELD += -m32
17+ endif
18+
19+
Original file line number Diff line number Diff line change 1+ CC = c++ -O2 -falign-functions=8 -fPIC -DLinux -DGCC -I$(EUSDIR)/include
2+ OBJOPT = -o
3+ OUTOPT = -o
4+ LD = c++
5+ SOFLAGS = -shared
6+ EXELD = c++
7+ EXESFX =
8+ LSFX = so
9+ LPFX = lib
10+ LIBS = -L$(ARCHDIR) -lRAPID
Original file line number Diff line number Diff line change 1+ CC = c++ -O2 -fPIC -falign-functions=4 -DLinux -DGCC -I$(EUSDIR)/include
2+ OBJOPT = -o
3+ OUTOPT = -o
4+ LD = c++
5+ SOFLAGS = -shared
6+ EXELD = c++
7+ EXESFX =
8+ LSFX = so
9+ LPFX = lib
10+ LIBS = -L$(ARCHDIR) -lRAPID
Original file line number Diff line number Diff line change 1+ (require :unittest " lib/llib/unittest.l" )
2+
3+ (init-unit-test)
4+
5+ (deftest test-defforeign
6+ (defvar *testforeign-lib*
7+ (load-foreign (format nil " ~a /test/libtestdefforeign.so" (unix :getenv " EUSDIR" ))))
8+
9+ (defforeign test1
10+ *testforeign-lib*
11+ " test1"
12+ (:integer :float )
13+ :float
14+ )
15+
16+ (defforeign test2
17+ *testforeign-lib*
18+ " test2"
19+ (:string )
20+ :float
21+ )
22+
23+ (setq test1-result (test1 1 2.5 ))
24+ (format t " test1: ~a~% " test1-result)
25+ (assert (= test1-result 3.5 ))
26+
27+ (setq test2-result (test2 (float-vector 1.0 2.5 )))
28+ (format t " test2: ~a~% " test2-result)
29+ (assert (= test2-result 3.5 ))
30+ )
31+
32+ (eval-when
33+ (load eval )
34+ (run-all-tests)
35+ (exit))
Original file line number Diff line number Diff line change 1+ // for eus.h
2+ #include <stdio.h>
3+ #include <stdlib.h>
4+ #include <unistd.h>
5+ #include <string.h>
6+ #include <setjmp.h>
7+ #include <errno.h>
8+ #include <sstream>
9+
10+ #define class eus_class
11+ #define throw eus_throw
12+ #define export eus_export
13+ #define vector eus_vector
14+ #define string eus_string
15+ #include <eus.h> // include eus.h just for eusfloat_t ...
16+ #undef class
17+ #undef throw
18+ #undef export
19+ #undef vector
20+ #undef string
21+
22+ extern "C" {
23+ eusfloat_t test1 (eusinteger_t v1 , eusfloat_t v2 ) {
24+ printf ("// v1: %d\n" , (int )v1 );
25+ printf ("// v2: %f\n" , v2 );
26+ return v1 + v2 ;
27+ }
28+
29+ eusfloat_t test2 (eusfloat_t * v ) {
30+ printf ("// v[0]: %f\n" , v [0 ]);
31+ printf ("// v[1]: %f\n" , v [1 ]);
32+ return v [0 ] + v [1 ];
33+ }
34+ }
You can’t perform that action at this time.
0 commit comments