代码构建 premake4 例子

2 篇文章 0 订阅

Building the Source Code
//构建代码
Premake can be built in either "release" (the default) or "debug" modes. If you are using Makefiles (as opposed to an IDE), you can choose which configuration to build with the config argument:
//构建模式 1.release版本 2.debug版本

make               # build in release mode, both versions
make config=debug  # build in debug mode, when generated with Premake 4.x
make CONFIG=Debug  # build in debug mode, when generated with Premake 3.x
//如果make 直接release版本
//make config=**选择要构建的版本 例如:make config=debug

If you do not supply a config argument, release mode will be used
//如果不设置一个配置方式 默认是release版本

Makefile

all: debug

debug:
    premake4 --os=linux --platform=x64 gmake
    @if [ -d allmake ]; then config=debug $(MAKE) -j$(COUNT) -C allmake; fi

premake4.lua

solution "MyApplication1"
location "allmake"   --生成的makefile .make 存储路径 不会覆盖
language "C++"  --语言
objdir "Intermediate" --中间的 各个版本生成中间目录.o .d ...
configurations { "Debug", "Release" } --版本

configuration "Debug"
defines { "DEBUG" }
flags { "Symbols" }

configuration "Release"
defines { "NDEBUG" }
flags { "Optimize" }

--A project defines one build target
project "MyProject1" 
kind "ConsoleApp"
files
{
    "./Project/Project1/**.h", 
    "./Project/Project1/**.cpp"
}
targetdir("./Project/Project1/") --生成的可执行文件目录
includedirs       --包含的目录
{
    "./Project/include/"
}
links { "pthread" }
linkoptions { "-rdynamic" }
buildoptions { "-x c++" }

project "MyProject2"
kind "ConsoleApp"
files
{
    "./Project/Project2/**.h",
    "./Project/Project2/**.cpp"
}
targetdir("./Project/Project2/")

--[[includedirs
{

}
--
libdirs
{

}
--]]

--buildoptions {"-std=c++11 -Wall"}

整个代码地址,直接make即可

https://github.com/jingsia/test_premake4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值