summaryrefslogtreecommitdiffstats
path: root/coin/module_config.yaml
blob: 421aad601f08f9c75bca93dddb822d36109c481c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
version: 1
accept_configuration:
  condition: property
  property: host.os
  equals_property: target.os

windows_specific_instructions:
  - &export_target_architecture_and_sdk
    # Export TARGET_ARCHITECTURE and WINDOWS_SDK_VERSION for MSVC cross compilation
    type: Group
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
    instructions:
      - type: EnvironmentVariable
        variableName: TARGET_ARCHITECTURE
        variableValue: amd64 # TODO add something like "{{toLower .Config host.arch}}"
        disable_if:
          condition: property
          property: host.arch
          not_equals_property: target.arch
      - type: EnvironmentVariable
        variableName: TARGET_ARCHITECTURE
        variableValue: amd64_x86
        enable_if:
          condition: and
          conditions:
            - condition: property
              property: target.arch
              equals_property: X86
            - condition: property
              property: host.arch
              equals_property: X86_64
      - type: EnvironmentVariable
        # HACK. Overwrite TARGET_ARCHITECTURE as we do not use standard MSVC cross
        # compilation targets here. The target architecture will be detected by Qt.
        variableName: TARGET_ARCHITECTURE
        variableValue: x86
        enable_if:
          condition: property
          property: target.os
          in_values: ["WINRT", "WINPHONE", "WINCE"]
      - type: EnvironmentVariable
        variableName: WINDOWS_SDK_VERSION
        variableValue: "10.0.14393.0"
        enable_if:
          condition: property
          property: target.os
          equals_value: WINRT
      - type: EnvironmentVariable
        variableName: WINDOWS_SDK_VERSION
        variableValue: ""
        disable_if:
          condition: property
          property: host.os
          equals_value: WINRT  # TODO set windows sdk version for desktop windows as well

  - &find_path_to_compiler
    # MSVC is installed in somehow arbitrary places. To reduce amount of combinations we need to make a variable.
    # This seems inverted, but on 64 bit hosts VS is installed into the x86 path, otherwise the regular one
    # TODO cleanup, that step could be removed if we have same installation paths or we read the path from registry.
    type: Group
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
    instructions:
      # Try to pick one of many coexistent MSVC installation to use
      # TODO cleanup, that could be much simpler if all tools are installed to similar paths, so it would
      # be enough to substitute compiler name.
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%VS90COMNTOOLS%\\vsvars32.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2008
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%VS100COMNTOOLS%\\vsvars32.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2010
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%ProgramFiles(x86)%\\Microsoft Visual Studio 11.0\\VC\\vcvarsall.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2012
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%ProgramFiles(x86)%\\Microsoft Visual Studio 12.0\\VC\\vcvarsall.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2013
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%ProgramFiles(x86)%\\Microsoft Visual Studio 14.0\\VC\\vcvarsall.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2015
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2017
      - type: EnvironmentVariable
        variableName: VC_SCRIPT
        variableValue: "%ProgramFiles(x86)%\\Microsoft Visual Studio\\2019\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat"
        enable_if:
          condition: property
          property: host.compiler
          equals_value: MSVC2019

icc_specific_instructions: &icc_export_variables
  type: Group
  instructions:
    - type: EnvironmentVariable
      variableName: LD_LIBRARY_PATH
      variableValue: "{{.Env.ICC64_18_LDLP}}"
    - type: PrependToEnvironmentVariable
      variableName: PATH
      variableValue: "{{.Env.ICC64_18_PATH}}"
  enable_if:
    condition: property
    property: host.compiler
    equals_value: ICC_18

set_cmake_compiler: &set_cmake_c_cxx_compiler
  type: Group
  instructions:
    - type: PrependToEnvironmentVariable
      variableName: CONFIGURE_ARGS
      variableValue: "-DCMAKE_C_COMPILER=icc -DCMAKE_CXX_COMPILER=icpc "
      enable_if:
        condition: property
        property: host.compiler
        contains_value: ICC
    - type: PrependToEnvironmentVariable
      variableName: CONFIGURE_ARGS
      variableValue: "-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ "
      enable_if:
        condition: property
        property: host.compiler
        contains_value: GCC
    - type: PrependToEnvironmentVariable
      variableName: CONFIGURE_ARGS
      variableValue: "-DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe "
      enable_if:
        condition: property
        property: host.compiler
        contains_value: MSVC
    - type: PrependToEnvironmentVariable
      variableName: CONFIGURE_ARGS
      variableValue: "-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ "
      enable_if:
        condition: property
        property: host.compiler
        contains_value: Clang

call_cmake_instructions: &call_cmake
  type: Group
  instructions:
    - type: ExecuteCommand
      command: "{{.Env.ENV_PREFIX}} {{.InstallDir}}\\bin\\qt-cmake {{.SourceDir}}/tests"
      maxTimeInSeconds: 6000
      maxTimeBetweenOutput: 120
      userMessageOnFailure: >
        Failed to call cmake. Contact Liang then.
      enable_if:
        condition: property
        property: host.os
        equals_value: Windows
    - type: ExecuteCommand
      command: "{{.InstallDir}}/bin/qt-cmake {{.SourceDir}}/tests"
      maxTimeInSeconds: 6000
      maxTimeBetweenOutput: 120
      userMessageOnFailure: >
        Failed to call cmake. Contact Liang then.
      disable_if:
        condition: property
        property: host.os
        equals_value: Windows

build_and_upload_test_artifacts_instruction: &build_and_upload_test_artifacts
  type: Group
  instructions:
    - type: ChangeDirectory
      directory: "{{.SourceDir}}/tests"
    - *call_cmake
    - type: ExecuteCommand
      command: "{{.Env.ENV_PREFIX}} cmake --build ."
      maxTimeInSeconds: 6000
      maxTimeBetweenOutput: 120
      userMessageOnFailure: >
        Failed to build sources. In the current state bug can be everywhere. Contact Liang first.
    - type: UploadTestArtifact
      transferType: UploadModuleTestsArtifact
      archiveDirectory: "{{.SourceDir}}/tests"
      maxTimeInSeconds: 1200
      maxTimeBetweenOutput: 1200
  disable_if:
      condition: property
      property: configureArgs
      contains_value: "-DBUILD_SHARED_LIBS=OFF"

regular_specific_test_instructions: &regular_test_instructions
  type: Group
  instructions:
    - type: InstallTestBinaryArchive
      relativeStoragePath: "{{.Env.MODULE_ARTIFACTS_RELATIVE_STORAGE_PATH}}"
      directory: "{{.SourceDir}}/tests"
      maxTimeInSeconds: 1200
      maxTimeBetweenOutput: 1200
      userMessageOnFailure: >
        Failed to install tests archive.
    - type: ChangeDirectory
      directory: "{{.SourceDir}}/tests"
    - type: ExecuteCommand
      command: "ctest -V --rerun-failed"
      ignoreExitCode: true
      maxTimeInSeconds: 7200
      maxTimeBetweenOutput: 900
      userMessageOnFailure: >
        Failed to run tests.
  disable_if:
      condition: property
      property: configureArgs
      in_values: "-DBUILD_SHARED_LIBS=OFF"


build_instructions:
  - type: MakeDirectory
    directory: .git
  - type: SetBuildDirectory
    directory: "{{.SourceDir}}"
  - type: ChangeDirectory
    directory: "{{.BuildDir}}"
  - type: EnvironmentVariable
    variableName: CMAKE_GENERATOR
    variableValue: Ninja
  - *icc_export_variables
  - *set_cmake_c_cxx_compiler
  - *export_target_architecture_and_sdk
  - *find_path_to_compiler
  # With MSVC we need setup the environment before every subprocess call.
  - type: WriteFile
    fileContents: "call \"{{.Env.VC_SCRIPT}}\" {{.Env.TARGET_ARCHITECTURE}} {{.Env.WINDOWS_SDK_VERSION}}\r\ncmd /c %*"
    filename: c:\\users\\qt\\prefix.bat
    fileMode: 420
    maxTimeInSeconds: 20
    maxTimeBetweenOutput: 20
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
  - type: EnvironmentVariable
    variableName: ENV_PREFIX
    variableValue: "c:\\users\\qt\\prefix.bat"
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
  - type: EnvironmentVariable
    variableName: ENV_PREFIX
    variableValue: ""
    disable_if:
      condition: property
      property: host.os
      equals_value: Windows
  - type: ExecuteCommand
    command: "{{.Env.ENV_PREFIX}} cmake {{.Env.CONFIGURE_ARGS}} -DCMAKE_INSTALL_PREFIX:PATH={{.InstallDir}} -DBUILD_TESTING=OFF {{.SourceDir}}"
    executeCommandArgumentSplitingBehavior: SplitAfterVariableSubstitution
    maxTimeInSeconds: 6000
    maxTimeBetweenOutput: 120
    userMessageOnFailure: >
      Failed to call cmake. Contact Liang then.
  - type: ExecuteCommand  # TODO: remove me, just debuging
    command: cmd.exe /c type {{.BuildDir}}\\CMakeCache.txt
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
    maxTimeInSeconds: 60
    userMessageOnFailure: Could not print the file cmake config file. This should not be possible.
  - type: ExecuteCommand
    command: "{{.Env.ENV_PREFIX}} cmake --build ."
    maxTimeInSeconds: 6000
    maxTimeBetweenOutput: 120
    userMessageOnFailure: >
      Failed to build sources. In the current state bug can be everywhere. Contact Liang first.
  - type: ExecuteCommand
    command: "{{.Env.ENV_PREFIX}} cmake --install ."
    maxTimeInSeconds: 6000
    maxTimeBetweenOutput: 120
    userMessageOnFailure: >
      Failed to install package.
  - type: EnvironmentVariable
    variableName: DESTDIR
    variableValue: "{{.InstallRoot}}"
  - type: ExecuteCommand
    command: "{{.Env.ENV_PREFIX}} cmake --install ."
    maxTimeInSeconds: 6000
    maxTimeBetweenOutput: 120
    userMessageOnFailure: >
      Failed to install package for archiving.
  - type: SignPackage
    enable_if:
      condition: property
      property: host.os
      equals_value: Windows
    directory: "{{.InstallRoot}}/{{.AgentWorkingDir}}"
    maxTimeInSeconds: 1200
    maxTimeBetweenOutput: 1200
  - type: UploadArtifact
    archiveDirectory: "{{.InstallRoot}}/{{.AgentWorkingDir}}"
    transferType: UploadModuleBuildArtifact
    maxTimeInSeconds: 1200
    maxTimeBetweenOutput: 1200
  - *build_and_upload_test_artifacts

test_instructions:
  - *regular_test_instructions