From 640a50532bddf4553ece701f24291b64f601a26d Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Thu, 7 May 2020 20:44:21 +0800 Subject: [PATCH 1/2] MSVC tweaks --- CMakeLists.txt | 4 ++++ src/nuklear_love.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebb849a..9d8c1f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/nuklear_love.c b/src/nuklear_love.c index 77af1c6..4f2f8ff 100644 --- a/src/nuklear_love.c +++ b/src/nuklear_love.c @@ -8,6 +8,8 @@ #include #include +#define LUA_LIB + #include #include From 0347818ecaa5dbddb89b8a9623a6c0df4a3a40be Mon Sep 17 00:00:00 2001 From: Miku AuahDark Date: Fri, 8 May 2020 16:57:15 +0800 Subject: [PATCH 2/2] Add MSVC build instructions. --- .gitignore | 1 + README.md | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/README.md b/README.md index 6ded569..77244e5 100644 --- a/README.md +++ b/README.md @@ -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="` +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).