premake 简单的脚本
solution "test" configurations {"Debug", "Release"} project "test" kind "ConsoleApp" language "C++" files {"**.h", "**.cpp"} configuration "Debug" defines {"DEBUG"} flags {"Symbols"} configuration "Release" defines {"NDEBUG"} flags {"Optimize"}
执行premake脚本命令
[root@instance-4420gg0f premake_demo]# premake4 --file=premake4.lua --os=windows --platform=x32 vs2012 Building configurations... Running action 'vs2012'... Generating test.sln... Generating test.vcxproj... Generating test.vcxproj.user... Generating test.vcxproj.filters... Done. [root@instance-4420gg0f premake_demo]# ll 总用量 28 -rw------- 1 root root 272 9月 18 09:11 premake4.lua -rw-r--r-- 1 root root 66 9月 18 09:32 solution.lua -rw-r--r-- 1 root root 874 9月 18 09:37 test.sln -rw-r--r-- 1 root root 5101 9月 18 09:37 test.vcxproj -rw-r--r-- 1 root root 142 9月 18 09:37 test.vcxproj.filters -rw-r--r-- 1 root root 476 9月 18 09:37 test.vcxproj.user
如指令:生成windows下,32位的vs2012工程文件。
Note:--file=premake4.lua "="前后不能有空格
查看premake4的版本号
[root@instance-4420gg0f premake_demo]# premake4 --version premake4 (Premake Build Script Generator) 4.4-beta5
查看可以生成vs工程文件的vs版本
Usage: premake4 [options] action [arguments] OPTIONS --cc=VALUE Choose a C/C++ compiler set; one of: gcc GNU GCC (gcc/g++) ow OpenWatcom --dotnet=VALUE Choose a .NET compiler set; one of: msnet Microsoft .NET (csc) mono Novell Mono (mcs) pnet Portable.NET (cscc) --file=FILE Read FILE as a Premake script; default is 'premake4.lua' --help Display this information --os=VALUE Generate files for a different operating system; one of: bsd OpenBSD, NetBSD, or FreeBSD haiku Haiku linux Linux macosx Apple Mac OS X solaris Solaris windows Microsoft Windows --platform=VALUE Add target architecture (if supported by action); one of: x32 32-bit x64 64-bit universal Mac OS X Universal, 32- and 64-bit universal32 Mac OS X Universal, 32-bit only universal64 Mac OS X Universal, 64-bit only ps3 Playstation 3 (experimental) xbox360 Xbox 360 (experimental) --scripts=path Search for additional scripts on the given path --version Display version information ACTIONS clean Remove all binaries and generated files codeblocks Generate Code::Blocks project files codelite Generate CodeLite project files gmake Generate GNU makefiles for POSIX, MinGW, and Cygwin vs2002 Generate Microsoft Visual Studio 2002 project files vs2003 Generate Microsoft Visual Studio 2003 project files vs2005 Generate Microsoft Visual Studio 2005 project files vs2008 Generate Microsoft Visual Studio 2008 project files vs2010 Generate Microsoft Visual Studio 2010 project files vs2012 Generate Microsoft Visual Studio 2012 project files vs2013 Generate Microsoft Visual Studio 2013 project files xcode3 Generate Apple Xcode 3 project files (experimental) xcode4 Generate Apple Xcode 4 project files (experimental)
通过ACTIONS,可以看到最高支持vs2013.
[root@instance-4420gg0f premake_demo]# premake4 --file=premake4.lua --os=windows --platform=x32 vs2013 Building configurations... Running action 'vs2013'... [string "newaction..."]:14: attempt to index global 'vstudio' (a nil value)
实际用premake4生成2013工程文件

浙公网安备 33010602011771号