用premake5創建lua532工程
(金慶的專欄)
lua-5.3.2只有Makefile,根據readme.html中
“Building Lua on other systems” 這一段的說明,
可以自己創建 VS 工程來編譯 lua,luac, liblua.
這里使用 premake5 創建 Vs 工程。
在 lua-5.3.2/ 目錄下創建 premake5.lua 文件:
-- premake5.lua
workspace "lua-5.3.2"
configurations { "Debug", "Release" }
language "C++"
targetdir "bin/%{cfg.buildcfg}"
filter "configurations:Debug"
defines { "DEBUG" }
flags { "Symbols" }
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
project "lua532"
kind "ConsoleApp"
files { "src/lua.c" }
links { "liblua532" }
project "luac532"
kind "ConsoleApp"
files { "src/luac.c" }
links { "liblua532" }
project "liblua532"
kind "StaticLib"
files { "src/*.h", "src/*.c" }
removefiles { "src/lua.c", "src/luac.c" }
然后運行:
premake5.exe vs2015
可生成 VS2015 的 sln.
premake5.exe 可搜索 premake 下載。
因為 lua-intf 需要將 lua 庫編譯為 C++ 庫,
這里特意將語言設為 C++:
language "C++"
結果是項目屬性顯示
C/C++ -> 高級 -> 編譯為:默認值
應該是:C++代碼(/TP)
需要手工設置為 C++.
如果是 language "C",則會設置為:C代碼(/TC).
因為后綴名為 .c, 所以默認值是按C代碼編譯。
(金慶的專欄)
lua-5.3.2只有Makefile,根據readme.html中
“Building Lua on other systems” 這一段的說明,
可以自己創建 VS 工程來編譯 lua,luac, liblua.
這里使用 premake5 創建 Vs 工程。
在 lua-5.3.2/ 目錄下創建 premake5.lua 文件:
-- premake5.lua
workspace "lua-5.3.2"
configurations { "Debug", "Release" }
language "C++"
targetdir "bin/%{cfg.buildcfg}"
filter "configurations:Debug"
defines { "DEBUG" }
flags { "Symbols" }
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
project "lua532"
kind "ConsoleApp"
files { "src/lua.c" }
links { "liblua532" }
project "luac532"
kind "ConsoleApp"
files { "src/luac.c" }
links { "liblua532" }
project "liblua532"
kind "StaticLib"
files { "src/*.h", "src/*.c" }
removefiles { "src/lua.c", "src/luac.c" }
然后運行:
premake5.exe vs2015
可生成 VS2015 的 sln.
premake5.exe 可搜索 premake 下載。
因為 lua-intf 需要將 lua 庫編譯為 C++ 庫,
這里特意將語言設為 C++:
language "C++"
結果是項目屬性顯示
C/C++ -> 高級 -> 編譯為:默認值
應該是:C++代碼(/TP)
需要手工設置為 C++.
如果是 language "C",則會設置為:C代碼(/TC).
因為后綴名為 .c, 所以默認值是按C代碼編譯。