lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Wed, Jan 13, 2021 at 6:25 AM Pierre Chapuis <catwell@archlinux.us> wrote:
On Tue, Jan 12, 2021, at 16:26, Russell Haley wrote:

That's precisely why I created WinLua, it contains Lua, LuaRocks and the LLVM-Mingw compiler. The LLD linker has a gotcha (doesn't link to DLLs, only static or *.lib files), and I am currently working on the debugger machine interface. However, Lua, LuaRocks and the compiler all work well together. I have included GNU make as well as xmake (lua based build system) and  regularly use it. Give it a spin and let me know what you think!

I installed it and installed odbc with LuaRocks, it worked.
*I KNOW RIGHT?* It was like an epiphany the first time it worked right out of the box.

I tried to install LuaSocket but it failed. Apparently it is due to to an incompatibility between LuaSocket and MinGW-GCC. See https://gist.github.com/catwell/44bc95ca61c2c5529dedb162f22e47b6
Sadly my joy was also short lived. It's easy to patch if you clone the luasocket git repository. Comment out line 37 in rockspec/luasocket-3.0rc2-1.rockspec 
 Here a the diff:
PS C:\Users\russh\git\luasocket> git diff
diff --git a/rockspec/luasocket-3.0rc2-1.rockspec b/rockspec/luasocket-3.0rc2-1.rockspec
index dfe5275..257eef4 100644
--- a/rockspec/luasocket-3.0rc2-1.rockspec
+++ b/rockspec/luasocket-3.0rc2-1.rockspec
@@ -34,7 +34,7 @@ local function make_plat(plat)
     },
     mingw32 = {
       "LUASOCKET_DEBUG",
-      "LUASOCKET_INET_PTON",
+--      "LUASOCKET_INET_PTON",
       "WINVER=0x0501"
     }
   }

The problem is caused by different levels of Windows API support. The GNU installation supports Windows XP, the mingw library I am using does not.  I haven't had time to drill in and find a proper solution.

Do you have an example project using xmake with it?

First: I apologize, I am unprepared. I just recently tore down my development environment and mangled another one while testing installers and whatnot.

Please run the following command from powershell or CMD: 
xmake global --mingw= 'C:\Program Files (x86)\WinLua\WLC\'

That will set up xmake to work globally with WinLua's mingw installation (I am trying to automate that step through the installer, hence my broken environments). If you have existing C/C++ code, you can navigate into your source directory and type `xmake f -p mingw -a x86_64`. Xmake will try to find your source code and create a project (-a i686 or -a i386 will also work for 32 bit; they are synonyms for each other). A couple of weeks back I auto generated zlib and it worked really well. The xmake.lua file that is generated has comment notes at the bottom that will give you pointers on how to write xmake and where to find documentation. https://xmake.io/#/

As for example projects, I have a bunch of junk scattered around, let me see what I can find. I have a two part article about Sol 3 C++ Lua bindings and I introduce xmake: 
https://luaforum.com/threads/lua-sol-3-and-c-oh-my-part-1-nice-doggy.196/
https://luaforum.com/threads/lua-sol-3-and-c-oh-my-part-deux-we-like-our-toes.209/

Here is the contents of the xmake file from the article:

set_languages("c++17")
-- define target
target("main")

    -- set kind
    set_kind("binary")

    -- add files
    add_files("main.cpp", "appConfig.cpp")

    add_includedirs("include", "C:\\Program Files (x86)\\WinLua\\Lua\\5.3\\include")

    add_linkdirs("C:\\Program Files (x86)\\WinLua\\Lua\\5.3\\bin")
    add_links("lua53")

    after_build(function(target)
        os.cp("proj1.lua", path.join(target:targetdir(),"proj1.lua"))
    end);

That should get you started?

Xmake is quite easy if you've used SCONS or CMake. I think it's one of the most brilliant pieces of development software I've used. I'm excited about my own project, but xmake is so much cooler and bigger than WinLua. 


-- 
Pierre Chapuis