1#!/usr/bin/env python 2# Build the project on AppVeyor. 3 4import os 5from subprocess import check_call 6 7build = os.environ['BUILD'] 8config = os.environ['CONFIGURATION'] 9platform = os.environ['PLATFORM'] 10path = os.environ['PATH'] 11image = os.environ['APPVEYOR_BUILD_WORKER_IMAGE'] 12jobid = os.environ['APPVEYOR_JOB_ID'] 13cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config, '..'] 14if 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 22else: 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 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' 37 cmake_command.append('-G' + generator) 38 build_command = ['cmake', '--build', '.', '--config', config, '--', '/m:4'] 39 test_command = ['ctest', '-C', config] 40 41check_call(cmake_command) 42check_call(build_command) 43check_call(test_command) 44