Carp is mainly developed on macOS, but it also works fine on Linux. Windows is currently not supported - but please get in touch in case you want to help out with that!
- Make sure you have Stack installed.
- Clone this repo to your machine.
- Run
stack build
in the root of the project directory. stack install
will install the Carp command line tool for easy access on your system.- Make sure that the directory where stack installs executables is on your PATH, i.e:
export PATH=~/.local/bin:$PATH
.
The carp
executable must know where to find its core libraries and other files.
Set the environment variable CARP_DIR so that it points to the root of the Carp repo.
For example, add this to your .bashrc
or similar:
export CARP_DIR=~/Carp/
You should now be able to start Carp from anywhere:
$ carp
The carp
executable will emit a single file with C code, main.c
and try to compile it using an external C compiler.
On macOS and Linux it defaults to clang
, on Windows it's cl.exe
.
You can configure the exact compiler command like so:
(Project.config "compiler" "gcc --important-flag")
The examples involving graphics/sound/interaction will require the following libraries installed on your system:
- SDL 2 (cross platform game/interactivity library)
- SDL_image 2 (image helpers)
- SDL_ttf 2 (font rendering
- SDL_mixer 2 (audio playback)
- glfw (Create a rendering context for OpenGL or Vulcan)
Please let us know if you have trouble getting these examples to work.