qt嵌入式linux开发计算器,使用Qtcreator开发嵌入式linux程序

方法1: 使用 qmake编辑  工程文件 xxxx.pro添加

equals (QT_ARCH, "arm")

{

target.

path

=

/tmp

/$$

{TARGET

}

/bin

INSTALLS

+= target

}

CONFIG(debug, debug|release) {

message(this is debug version)

} else {

DEFINES += QT_NO_DEBUG_OUTPUT

message(disable debug , this is release version)

}

方法2: 使用CMakeList.txt

Deploying CMake Projects to Embedded Linux Devices

Qt Creator cannot extract files to be installed from a CMake project, and therefore, only executable targets are automatically added to deployment files. You must specify all other files in the QtCreatorDeployment.txt file that you create and place in the root directory of the CMake project.

Use the following syntax in the file:

:...

:

Where:

is the (absolute) path prefix to where files are copied on the remote machine.

is the file path relative to the CMake project root. No directories or wildcards are allowed in this value.

is the destination directory path relative to deployment/prefix.

To automate the creation of QtCreatorDeployment.txt file:

Define the following macros in the top level CMakeLists.txt file:file(WRITE "${CMAKE_SOURCE_DIR}/QtCreatorDeployment.txt""\n")

macro(add_deployment_file SRC DEST)

file(RELATIVE_PATH path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

file(APPEND "${CMAKE_SOURCE_DIR}/QtCreatorDeployment.txt""${path}/${SRC}:${DEST}\n")

endmacro()

macro(add_deployment_directory SRC DEST)

file(GLOB_RECURSE files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}""${SRC}/*")

foreach(filename ${files})

get_filename_component(path ${filename} PATH)

add_deployment_file("${filename}""${DEST}/${path}")

endforeach(filename)

endmacro()

Use add_deployment_file() to add files and add_deployment_directory() to add directories (including subdirectories) to the QtCreatorDeployment.txt file.

Re-run cmake after you add or remove files using the macros.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值