金庆的专栏

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  423 随笔 :: 0 文章 :: 454 评论 :: 0 Trackbacks
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   
 
posted on 2017-02-18 22:18 金庆 阅读(500) 评论(0)  编辑 收藏 引用 所属分类: 1. C/C++5. 软工与管理

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理