20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/cmake.rb', line 20
def cmake_build(compiler, src_dir, build_dir, regression_dir, regression_baseline, cmake_build_args)
FileUtils.mkdir_p build_dir
cmake_flags = "#{compiler[:cmake_extra_flags]} -DDEVICE_ID:STRING=\"#{cmake_build_args.this_device_id}\""
= compiler[:compiler_extra_flags]
= '' if .nil?
if cmake_build_args.is_release
= compiler[:release_build_cmake_extra_flags]
cmake_flags = "#{cmake_flags} #{}" unless .nil?
end
if compiler[:cc_bin].nil?
env = {
'CXXFLAGS' => "/FC #{}",
'CFLAGS' => "/FC #{}",
'CCACHE_BASEDIR' => build_dir,
'CCACHE_UNIFY' => 'true',
'CCACHE_SLOPPINESS' => 'include_file_mtime'
}
else
cmake_flags = "-DCMAKE_C_COMPILER:PATH=\"#{compiler[:cc_bin]}\" -DCMAKE_CXX_COMPILER:PATH=\"#{compiler[:cxx_bin]}\" #{cmake_flags}"
env = {
'CXXFLAGS' => .to_s,
'CFLAGS' => .to_s,
'CCACHE_BASEDIR' => build_dir,
'CCACHE_UNIFY' => 'true',
'CCACHE_SLOPPINESS' => 'include_file_mtime',
'CC' => compiler[:cc_bin],
'CXX' => compiler[:cxx_bin]
}
end
env['PATH'] = cmake_remove_git_from_path(ENV['PATH'])
if regression_baseline.nil?
env['REGRESSION_BASELINE'] = ' '
env['REGRESSION_DIR'] = ' '
env['REGRESSION_BASELINE_SHA'] = ' '
env['COMMIT_SHA'] = ' '
else
env['REGRESSION_BASELINE'] = File.expand_path(regression_baseline.this_build_dir)
env['REGRESSION_DIR'] = File.expand_path(regression_dir)
env['REGRESSION_BASELINE_SHA'] = regression_baseline.commit_sha
env['COMMIT_SHA'] = @commit_sha && @commit_sha != '' ? @commit_sha : @tag_name
end
env['GITHUB_TOKEN'] = ENV['GITHUB_TOKEN']
if compiler[:name] == 'Visual Studio'
_, err, result = run_scripts(
@config,
["cd #{build_dir} && #{@config.cmake_bin} ../ #{cmake_flags} -DCMAKE_BUILD_TYPE:STRING=#{cmake_build_args.build_type} -G \"#{compiler[:build_generator]}\" -A #{compiler[:target_arch]}"], env
)
else
_, err, result = run_scripts(
@config,
["cd #{build_dir} && #{@config.cmake_bin} ../ #{cmake_flags} -DCMAKE_BUILD_TYPE:STRING=#{cmake_build_args.build_type} -G \"#{compiler[:build_generator]}\""], env
)
end
cmake_result = process_cmake_results(src_dir, build_dir, err, result, false)
return false unless cmake_result
$logger.info('Configure step completed, beginning build step')
build_switches = if @config.os == 'Windows'
''
else
"-j#{compiler[:num_parallel_builds]}"
end
out, err, result = run_scripts(
@config,
["cd #{build_dir} && #{@config.cmake_bin} --build . --config #{cmake_build_args.build_type} --use-stderr -- #{build_switches}"], env
)
msvc_success = process_msvc_results(src_dir, build_dir, out, result)
gcc_success = process_gcc_results(src_dir, build_dir, err, result)
process_cmake_results(src_dir, build_dir, err, result, false)
process_python_results(src_dir, build_dir, out, err, result)
msvc_success && gcc_success
end
|