git repos / blockattack-game

blame: source/misc/embedded_libs/fmt-8.1.1/support/appveyor-build.py

normal view · raw

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