Skip to content

Commit

Permalink
Work fixing Windows CI builds. (#27)
Browse files Browse the repository at this point in the history
Windows build updates, CI scripts now build everywhere.
  • Loading branch information
JonathanHenson authored Dec 31, 2018
1 parent 365d2a2 commit a66021b
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 22 deletions.
19 changes: 19 additions & 0 deletions codebuild/common-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ set -e
set -x

CMAKE_ARGS="$@"

# ensure each required package is installed, if not, make a bottle for brew in ./packages
# so it will be cached for future runs. If the cache is ever blown away, this will update
# the packages as well
# If the bottles are already in ./packages, then just install them
function install_from_brew {
pushd ./packages
# usually the existing package is too old for one of the others, so uninstall
# and reinstall from the cache
brew uninstall --ignore-dependencies $1
if [ ! -e $1*bottle*.tar.gz ]; then
brew install --build-bottle $1
brew bottle --json $1
brew uninstall --ignore-dependencies $1
fi
brew install $1*bottle*tar.gz
popd
}

install_from_brew openssl
install_from_brew gdbm
install_from_brew sqlite
Expand Down
6 changes: 3 additions & 3 deletions codebuild/common-windows.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

set CMAKE_ARGS=%*

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install %PYTHON_PACKAGE% -y
echo "Installing python version: %* via choco"
choco install %* -y
call RefreshEnv.cmd

git submodule update --init --recursive
mkdir build\deps\install
set AWS_C_INSTALL=%cd%\build\deps\install

py setup.py build
python setup.py build

exit /b %errorlevel%
3 changes: 1 addition & 2 deletions codebuild/windows-msvc-2015-x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ version: 0.2
phases:
build:
commands:
- setx PYTHON_PACKAGE python3-x86_32 /m
- .\codebuild\common-windows.bat -G "Visual Studio 14 2015"
- .\codebuild\common-windows.bat python3 -ForceX86

3 changes: 1 addition & 2 deletions codebuild/windows-msvc-2015.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ version: 0.2
phases:
build:
commands:
- setx PYTHON_PACKAGE python3 /m
- .\codebuild\common-windows.bat -G "Visual Studio 14 2015 Win64"
- .\codebuild\common-windows.bat python3

3 changes: 1 addition & 2 deletions codebuild/windows-msvc-2017.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ version: 0.2
phases:
build:
commands:
- setx PYTHON_PACKAGE python3 /m
- .\codebuild\common-windows.bat -G "Visual Studio 15 2017 Win64"
- .\codebuild\common-windows.bat python3

44 changes: 31 additions & 13 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import setuptools
import os
import subprocess
from subprocess import CalledProcessError
import platform
from os import path
import sys
Expand All @@ -26,20 +27,35 @@ def determine_cross_compile_string():

def determine_generator_string():
if sys.platform == 'win32':
vswhere_args = ['%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe', '-legacy', '-latest', '-property', 'installationVersion']
vswhere_output = subprocess.check_output(vswhere_args, shell=True)

vs_version = None

if vswhere_output != None:
for out in vswhere_output.split():
vs_version = out.decode('utf-8')

prog_x86_path = os.getenv('PROGRAMFILES(x86)')
if vs_version == None:
print('No version of MSVC compiler could be found!')
exit(1)

print('found MSVC compiler version: {}'.format(vs_version))
if os.path.exists(prog_x86_path + '\\Microsoft Visual Studio\\2019'):
vs_version = '16.0'
print('found installed version of Visual Studio 2019')
elif os.path.exists(prog_x86_path + '\\Microsoft Visual Studio\\2017'):
vs_version = '15.0'
print('found installed version of Visual Studio 2017')
elif os.path.exists(prog_x86_path + '\\Microsoft Visual Studio 14.0'):
vs_version = '14.0'
print('found installed version of Visual Studio 2015')
else:
print('Making an attempt at calling vswhere')
vswhere_args = ['%ProgramFiles(x86)%\\Microsoft Visual Studio\\Installer\\vswhere.exe', '-legacy', '-latest', '-property', 'installationVersion']
vswhere_output = None

try:
vswhere_output = subprocess.check_output(vswhere_args, shell=True)
except CalledProcessError as ex:
print('No version of MSVC compiler could be found!')
exit(1)

if vswhere_output != None:
for out in vswhere_output.split():
vs_version = out.decode('utf-8')
else:
print('No MSVC compiler could be found!')
exit(1)

vs_major_version = vs_version.split('.')[0]

Expand All @@ -50,8 +66,10 @@ def determine_generator_string():
for out in cmake_help_output.splitlines():
trimmed_out = out.decode('utf-8').strip()
if 'Visual Studio' in trimmed_out and vs_major_version in trimmed_out:
print('selecting generator {}'.format(trimmed_out))
vs_version_gen_str = trimmed_out.split('[')[0].strip()

break

if vs_version_gen_str == None:
print('CMake does not recognize an installed version of visual studio on your system.')
exit(1)
Expand Down

0 comments on commit a66021b

Please sign in to comment.