IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Lua53 premake

    金庆发表于 2017-02-18 14:18:00
    love 0
    Lua53 premake

    (金庆的专栏 2017.2)

    参考:用premake5创建lua532工程
          http://blog.csdn.net/jq0123/article/details/51242780

    -- premake5.lua
    --[[
    Usage examples:
       for windows: premake5.exe --os=windows vs2015
       fot linux:   premake5.exe --os=linux gmake
    ]]

    workspace "lua53"
       configurations { "Debug", "Release" }
       targetdir "bin/%{cfg.buildcfg}"

       language "C++"
       -- Force VS to compile as C++.
       -- https://github.com/premake/premake-core/issues/142
       filter "action:vs*"
          buildoptions "/TP"

       filter "system:windows"
          defines { "LUA_BUILD_AS_DLL" }

       filter "configurations:Debug"
          defines { "DEBUG" }
          flags { "Symbols" }

       filter "configurations:Release"
          defines { "NDEBUG" }
          optimize "On"

    project "lua53"
       kind "ConsoleApp"
       files { "src/lua.c" }
       links { "lua53_shared_lib" }   

    project "luac53"
       kind "ConsoleApp"
       files { "src/luac.c" }
       links { "lua53_static_lib" }  -- Link error on Windows if link lua53 shared lib.   

    project "lua53_shared_lib"
       kind "SharedLib"
       targetname "lua53"
       files { "src/*.h", "src/*.c" }
       removefiles { "src/lua.c", "src/luac.c" }

    project "lua53_static_lib"
       kind "StaticLib"
       targetname "lua53"
       filter "system:windows"
          targetprefix "lib"  -- liblua53.lib
       files { "src/*.h", "src/*.c" }
       removefiles { "src/lua.c", "src/luac.c" }
          
    更改之处:
    * VS强制按C++编译
    * 创建动态库和静态库
    * lua53.exe 链接动态库,luac53.exe 链接静态库
      因为 luac53.exe 链接动态库缺3个函数未导出。
    * 添加宏 LUA_BUILD_AS_DLL,不然 lua53.dll 不会生成 lua53.lib   
     


    金庆 2017-02-18 22:18 发表评论


沪ICP备19023445号-2号
友情链接