]>
Commit | Line | Data |
---|---|---|
11fdf7f2 TL |
1 | #!/usr/bin/env python |
2 | # Build the project on AppVeyor. | |
3 | ||
4 | import os | |
5 | from subprocess import check_call | |
6 | ||
7 | build = os.environ['BUILD'] | |
8 | config = os.environ['CONFIGURATION'] | |
9 | platform = os.environ['PLATFORM'] | |
10 | path = os.environ['PATH'] | |
11 | image = os.environ['APPVEYOR_BUILD_WORKER_IMAGE'] | |
12 | jobid = os.environ['APPVEYOR_JOB_ID'] | |
13 | cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config, '..'] | |
14 | if build == 'mingw': | |
15 | cmake_command.append('-GMinGW Makefiles') | |
16 | build_command = ['mingw32-make', '-j4'] | |
17 | test_command = ['mingw32-make', 'test'] | |
18 | # Remove the path to Git bin directory from $PATH because it breaks | |
19 | # MinGW config. | |
20 | path = path.replace(r'C:\Program Files (x86)\Git\bin', '') | |
21 | os.environ['PATH'] = r'C:\MinGW\bin;' + path | |
22 | else: | |
23 | # Add MSBuild 14.0 to PATH as described in | |
24 | # http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc. | |
25 | os.environ['PATH'] = r'C:\Program Files (x86)\MSBuild\15.0\Bin;' + path | |
f67539c2 TL |
26 | if image == 'Visual Studio 2019': |
27 | generator = 'Visual Studio 16 2019' | |
28 | if platform == 'x64': | |
29 | cmake_command.extend(['-A', 'x64']) | |
30 | else: | |
31 | if image == 'Visual Studio 2015': | |
32 | generator = 'Visual Studio 14 2015' | |
33 | elif image == 'Visual Studio 2017': | |
34 | generator = 'Visual Studio 15 2017' | |
35 | if platform == 'x64': | |
36 | generator += ' Win64' | |
11fdf7f2 TL |
37 | cmake_command.append('-G' + generator) |
38 | build_command = ['cmake', '--build', '.', '--config', config, '--', '/m:4'] | |
39 | test_command = ['ctest', '-C', config] | |
40 | ||
41 | check_call(cmake_command) | |
42 | check_call(build_command) | |
43 | check_call(test_command) |