examples: ecl_demo: make example more portable

This commit is contained in:
Daniel Kochmański 2016-08-13 09:02:15 +02:00
parent 4e45a82e2b
commit 2f2b3defd1
4 changed files with 40 additions and 20 deletions

5
.gitignore vendored
View file

@ -62,3 +62,8 @@ regressions/eformat-tests/*.txt
/src/doc/new-doc/new-doc.fts
/src/doc/new-doc/new-doc.cf
/src/doc/new-doc/new-doc.cfs
/examples/ecl_qt/qt/ecl_qtdemo
/examples/ecl_qt/hello-lisp-system--all-systems.fasb
/examples/ecl_qt/lisp-envi.a
/examples/ecl_qt/qt/.qmake.stash
/examples/ecl_qt/qt/Makefile

View file

@ -1,4 +1,6 @@
This demo shows how to embed ECL into Qt5 and serve as kernel. This also discuss how to compile ECL with C++(14). You can extend on this demo to form a more complicate and productive project.
This demo shows how to embed ECL into Qt5 and serve as kernel. This
also discuss how to compile ECL with C++(14). You can extend on this
demo to form a more complicate and productive project.
# Preparation
Before you build the demo, make sure you have those dependencies installed:
@ -8,24 +10,35 @@ Before you build the demo, make sure you have those dependencies installed:
4. Qt5.x with Qt Creator.
5. Quicklisp installed on your ECL.
We use the external Lisp package :lparallel so you better download that package in advance using (ql:quickload :lparallel).
We use the external Lisp package :lparallel so you better download
that package in advance using `(ql:quickload :lparallel)`.
# Build
# Build
## Build CL Library and FASB
Run `make` in current directory and you get two files, if successful. `lisp-envi.a` and `hello-lisp-system--all-systems.fasb`.
## Configure your Qt Project
cd to the directory `qt` and open that Qt project with your Qt Creator. Change the three paths I marked for you, if necessary.
1. `INCLUDEPATH`: The path that contains ecl/ecl.h.
In Linux it may be `/usr/include/`.
2. `LIBS`:The path that leads to the shared library of ECL.
In Linux, it may be `/usr/lib/libecl.so/`.
## Build Qt Project
Build your Qt Project. This will generate an executable file for you.
## Engage `fasb` file
After your Qt project is built, move the `hello-lisp-system--all-systems.fasb` file that generated in build step 1 into the directory containing the executable file.
Run `make` in current directory and you get two files, if
successful. `lisp-envi.a` and `hello-lisp-system--all-systems.fasb`.
## Configure and build your Qt Project
To build the example it is enough to change to the `qt/` directory,
generate a Makefile with `qmake` and to call `make`.
```shell
cd qt/
qmake
make
```
If you want to change your Qt project, open it with the `Qt
Creator`. It can build the executable for you (instead of manually
working with make).
# Run
After you go through the steps above, go for the executable file and try that demo.
After you go through the steps above, go for the executable file and
try that demo.
Happy hacking with ECL!

View file

@ -22,11 +22,13 @@ HEADERS += hybrid_main.h \
FORMS += hybrid_main.ui
#The include path that contains ecl/ecl.h
INCLUDEPATH += /usr/local/include
#The ECL shared library directory.
LIBS += /usr/local/lib/libecl.dylib
# The include path that contains ecl/ecl.h
QMAKE_CFLAGS += `ecl-config --cflags`
# The ECL shared library directory.
QMAKE_LFLAGS += `ecl-config --ldflags` -lecl
# Lisp library written by a user
LIBS += $$_PRO_FILE_PWD_/../lisp-envi.a

View file

@ -2,7 +2,7 @@
#include <QApplication>
#include "cl_bridge_utils.hpp"
string CL_MAIN_FASB = "\"hello-lisp-system--all-systems.fasb\"";
string CL_MAIN_FASB = "\"../hello-lisp-system--all-systems.fasb\"";
string CL_MAIN_PACKAGE_NAME = "hello-lisp";
/* Initialization.