Skip to content

Commit

Permalink
Merge pull request #53 from MikuAuahDark/msvc
Browse files Browse the repository at this point in the history
MSVC tweaks
  • Loading branch information
keharriso authored May 8, 2020
2 parents 018aaf6 + 0347818 commit e9be4aa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ TARGET_LINK_LIBRARIES(
${LUA_LIBRARIES}
)

IF(MSVC)
TARGET_COMPILE_DEFINITIONS(${LIB_NAME} PRIVATE LUA_BUILD_AS_DLL)
endif(MSVC)

SET_TARGET_PROPERTIES("${LIB_NAME}" PROPERTIES PREFIX "")

IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ $ mingw32-make
```
18. Locate `nuklear.dll` inside the build folder.

### Compiling with CMake and MSVC on Windows

1. Install [CMake](https://cmake.org/download/) and [Visual Studio](https://visualstudio.microsoft.com/).
Community or Express edition is sufficient.
2. Download the source code for [LuaJIT](http://luajit.org/download.html).
3. Open a Visual Studio Command Prompt (x86 or x64 depending on what architecture you need)
and set the current directory to the LuaJIT folder (the one that contains "README"). Also
remember this path.
4. At the VS Command Prompt, set your current directory to `src` then
execute `msvcbuild.bat`. This will create lua51.dll, lua51.lib, and luajit.exe
5. Now open new command prompt window inside the `love-nuklear` folder.
6. Type `set "LUA_DIR=<path to directory at step 3>"`
7. Then type `cmake -Bbuild -H. -A Win32 -DLUA_INCLUDE_DIR=%LUA_DIR%\src -DLUA_LIBRARY=%LUA_DIR%\src\lua51.lib -DCMAKE_INSTALL_PREFIX=%CD%\install`.
If you previously compile LuaJIT using x64 VS command prompt, replace `Win32` with `x64` at above command.
8. Then type `cmake --build build --config Release --target install` and you'll found `nuklear.dll` inside "install" folder.

## Documentation

A complete description of all functions and style properties, alongside additional examples, is available at the [LÖVE-Nuklear wiki](https://github.com/keharriso/love-nuklear/wiki).
Expand Down
2 changes: 2 additions & 0 deletions src/nuklear_love.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <stdio.h>
#include <string.h>

#define LUA_LIB

#include <lua.h>
#include <lauxlib.h>

Expand Down

0 comments on commit e9be4aa

Please sign in to comment.