qmake subdirs可选目标/子项目

时间:2016-06-10 10:12:10

标签: qt qt-creator qmake

我想知道在 qmake (Qt构建工具)中是否存在可选目标或子项目这样的事情。

项目

在我的测试示例中,我有一个子项目,其中包含另外两个项目,一个共享库和一个基本应用程序。应用程序取决于工作得很好的库。另外,我有一个额外的编译器(调用 lrelease )和一个额外的目标(调用 lupdate ),它也像魅力一样工作(共享库将它们作为pri文件提供给多个项目)。

在发布模式下完成构建后,将调用Windows部署工具(即 windeployqt.exe ),并将具有所有必需的共享库和插件的目标部署到我的部署目录。

我希望添加的最后一个组件是使用 Qt安装程序框架创建安装程序,实际上应该可以轻松完成可执行文件所在的安装程序。因此,我想创建另一个包含所有安装程序内容的子项目,并提供 qmake 步骤来创建一个。但是项目不应该一直建立,而只是在我想要的时候,最好是在 Qt Creator 的创建菜单上。

问题

有没有办法让 qmake 子目录子项目完全可选,所以它不会使用默认的构建全部构建?

2 个答案:

答案 0 :(得分:2)

您可以在其周围添加支票:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
UIBezierPath *borderPath;
CGFloat borderWidth;

KKCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"testCell" forIndexPath:indexPath];
borderPath = [UIBezierPath bezierPath];

[borderPath moveToPoint:CGPointMake(cell.frame.origin.x + cell.frame.size.width -1 , cell.frame.origin.y + 2)];
[borderPath addLineToPoint:CGPointMake(cell.frame.origin.x + cell.frame.size.width + 50,  cell.frame.origin.y +2)];
borderWidth = 1.0;
[self dottedLineWithPath:borderPath withborderWidth:borderWidth];
return cell; 
}

/** creating dotted line **/

- (void)dottedLineWithPath:(UIBezierPath *)path withborderWidth:(CGFloat)lineWidth
{
CAShapeLayer *shapelayer = [CAShapeLayer layer];
shapelayer.strokeStart = 0.0;
shapelayer.strokeColor = [UIColor blackColor].CGColor;
shapelayer.lineWidth = borderWidth;
shapelayer.lineJoin = kCALineJoinRound;
shapelayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:2 ], nil];
shapelayer.path = path.CGPath;

[self.milestoneCollection.backgroundView.layer addSublayer:shapelayer];
  }

并使用

致电enableOptional { message(optional enabled) SUBDIRS += YourSubDir }
qmake

答案 1 :(得分:0)

qmake 文档声明应该使用测试函数requires(condition)来跳过构建整个项目。使用这个可以添加一个新的构建配置,即bundle作为示例,它定义了一个配置变量@Jeffrey在他的答案中指出。

我设法使用以下 qmake 项目定义:

requires(BUNDLE_INSTALLER)

TEMPLATE = aux

QMAKE_POST_LINK = ...

一旦您定义了变量,通过新的构建配置以正确使用Qt Creator(示例),就会执行 QMAKE_POST_LINK 下列出的步骤。因此,如果我愿意,我可以捆绑安装程序。