• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# -*- coding: utf-8 -*-
2
3import os
4import sys
5
6from common import *
7from config import *
8
9def initBuildDir (config, generator):
10	srcPath = DEQP_DIR
11	cfgArgs = []
12
13	# Build base configuration args
14	cfgArgs += config.getArgs()
15
16	# Generator args
17	cfgArgs += generator.getGenerateArgs(config.getBuildType())
18
19	if not os.path.exists(config.buildDir):
20		os.makedirs(config.buildDir)
21
22	pushWorkingDir(config.getBuildDir())
23	execute(["cmake", srcPath] + cfgArgs)
24	popWorkingDir()
25
26def build (config, generator, targets = None):
27	# Initialize or update build dir.
28	initBuildDir(config, generator)
29
30	baseCmd		= ['cmake', '--build', '.']
31	buildArgs	= generator.getBuildArgs(config.getBuildType())
32
33	pushWorkingDir(config.getBuildDir())
34
35	if targets == None:
36		execute(baseCmd + buildArgs)
37	else:
38		for target in targets:
39			execute(baseCmd + ['--target', target] + buildArgs)
40
41	popWorkingDir()
42