Lua53 premake

来源:互联网 发布:java电商系统源码下载 编辑:程序博客网 时间:2024/05/21 10:50
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

   filter {}

   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   


0 0
原创粉丝点击