Add proper build instructions to README.md

This commit is contained in:
Kevin Harrison 2018-06-29 15:32:06 -04:00 committed by GitHub
parent c09651b655
commit 4d001728a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,14 +75,53 @@ end
## Building
Windows and Linux binaries are available for each [release](https://github.com/keharriso/love-nuklear/releases).
Windows binaries are available for each [release](https://github.com/keharriso/love-nuklear/releases).
To build the library yourself, grab the code with:
```sh
$ git clone --recursive git@github.com:keharriso/love-nuklear.git
```
Compile with CMake (I recommend using the MinGW generator on Windows). You'll need to tell CMake where to find the LuaJIT headers and binaries. The end result is a native Lua module.
Next, you need to compile the code to a native Lua module.
### Compiling with CMake on Linux
1. First, ensure you have the `cmake` and `luajit` packages installed.
2. Create a new folder next to `love-nuklear` called `love-nuklear-build`.
3. Open a terminal inside `love-nuklear-build`.
4. Compile with
```sh
$ cmake ../love-nuklear
$ make
```
5. Locate `nuklear.so` in the build folder.
### Compiling with CMake and MinGW on Windows
1. Install [CMake](https://cmake.org/download/) and [MinGW](http://mingw.org/) or [MinGW-w64](https://mingw-w64.org/doku.php).
2. Download the source code for [LuaJIT](http://luajit.org/download.html).
3. Open a command window inside the LuaJIT folder (the one that contains "README").
4. Compile LuaJIT with
```sh
$ mingw32-make
```
5. Remember the path to `lua51.dll` inside the LuaJIT `src` folder.
6. Run the CMake GUI.
7. Click "Browse Source" at the top right, then select the `love-nuklear` folder.
8. Enter a path for the build folder. It should be separate from the source folder.
9. Press "Configure" at the bottom.
10. Select "MinGW Makefiles" from the generator drop list, then click "Finish".
11. You should receive an error. This is normal.
12. Open the LUA tree by clicking the triangle on the left.
13. Replace "LUA_INCLUDE_DIR-NOTFOUND" with the path to the LuaJIT `src` folder.
14. Replace "LUA_LIBRARY-NOTFOUND" with the path to `lua51.dll` inside the LuaJIT `src` folder.
15. Click "Generate" at the bottom.
16. Open a command window inside the build folder.
17. Compile with
```sh
$ mingw32-make
```
18. Locate `nuklear.dll` inside the build folder.
## Documentation