A simple project showcasing the graphics
package of OCaml
To build, run
make clean && make
To run the test application, after building the project execute
./bin/demo
and follow the instructions on the screen.
If you followed the initially provided instructions for installing the OCaml infrastructure on your operating system, the project should be working. Otherwise, follow the instructions below.
This project relies on OCaml's graphics
package, which is somewhat
non-trivial to install, due to native system dependencies. Some
instructions on how make it work are provided below:
-
Install XQuartz.
-
Log-out from the system and log-in again.
-
After that, you will have to re-install all packages you have previously installed via opam. For instance, first try
opam switch
If your version is, for instance
4.10.0
, next runopam switch reinstall 4.10.0
It will take a while, as it re-builds all packages from scratch.
The
graphics
package has been checked to work with OCaml4.06.1
,4.07.1
, and4.10.0
. -
Next, execute
opam update; opam upgrade opam install graphics
After that you should be able to build the project.
-
You might need to install
core
, andbatteries
viaopam
(usingopam install .
).
-
Make sure that x11 window manager is installed (it comes as a part of most of the standard distributions).
-
Proceed to Step 3 for Mac OS X (above).
-
As it seems to be the case, x11 graphic interface is included into Cygwin (https://x.cygwin.com/).
-
Proceed to Step 3 for Mac OS X (above).
You can find more examples of working with graphics in OCaml by following this link and by checking this manuscript.