pocketlang/docs/pages/Getting-Started/build-from-source.md

49 lines
1.3 KiB
Markdown
Raw Normal View History

# %% Build From Source %%
## %% Without a build script %%
2021-06-23 13:21:18 +08:00
It can be build from source easily without any dependencies, or additional
requirements except for a c99 compatible compiler. It can be compiled with the
following command.
2021-06-23 13:21:18 +08:00
GCC / MinGw / Clang (alias with gcc)
2021-05-28 03:27:29 +08:00
```
2021-06-23 13:21:18 +08:00
gcc -o pocket cli/*.c src/*.c -Isrc/include -lm
2021-05-28 03:27:29 +08:00
```
2021-06-23 13:21:18 +08:00
MSVC
2021-05-28 03:27:29 +08:00
```
cl /Fepocket cli/*.c src/*.c /Isrc/include && rm *.obj
```
2021-06-23 13:21:18 +08:00
Makefile
2021-05-28 03:27:29 +08:00
```
2021-06-23 13:21:18 +08:00
make
2021-05-28 03:27:29 +08:00
```
2021-06-23 13:21:18 +08:00
To run make file on windows with `mingw`, you require `make` and `find` unix tools in your path.
Which you can get from [msys2](https://www.msys2.org/) or [cygwin](https://www.cygwin.com/). Run
`set PATH=<path-to-env/usr/bin/>;%PATH% && make`, this will override the system `find` command with
unix `find` for the current session, and run the `make` script.
2021-05-28 03:27:29 +08:00
2021-06-23 13:21:18 +08:00
Windows batch script
2021-05-28 03:27:29 +08:00
```
2021-06-23 13:21:18 +08:00
build
2021-05-28 03:27:29 +08:00
```
2021-06-23 13:21:18 +08:00
You don't have to run the script from a Visual Studio .NET developer command
prompt, It'll search for the MSVS installation path and setup the build
environment.
2021-06-01 19:50:41 +08:00
2021-06-23 13:21:18 +08:00
### For other compiler/IDE
2021-05-28 03:27:29 +08:00
2021-06-23 13:21:18 +08:00
1. Create an empty project file / makefile.
2. Add all C files in the src directory.
3. Add all C files in the cli directory (**NOT** recursively).
4. Add `src/include` to include path.
5. Compile.
2021-05-28 03:27:29 +08:00
If you weren't able to compile it, please report us by
2021-06-23 13:21:18 +08:00
[opening an issue](https://github.com/ThakeeNathees/pocketlang/issues/new).
2021-05-28 03:27:29 +08:00