diff --git a/CMakeLists.txt b/CMakeLists.txt index f78a823..6661a18 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,9 @@ if(DEFINED WXVER AND NOT WXVER MATCHES "PLATFORM") elseif(WXVER MATCHES "3.0") find_package(wxWidgets 3.0.2 COMPONENTS base core net xml html adv qa richtext) + elseif(WXVER MATCHES "3.1") + find_package(wxWidgets 3.1.0 + COMPONENTS base core net xml html adv qa richtext) else() message(FATAL_ERROR "Unknown WXVER forced") endif() diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..f969335 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,49 @@ +environment: + WXSUM: EA219E64377E78AA5CDB7C438A5D3E19B91FD22EB9DE33FA21447EF0EEA794D9 + WXFILE: wxlauncher_widgets-1.0.2.7z + WXURL: "https://dl.bintray.com/issmneur/generic/wxlauncher_widgets-1.0.2.7z" + WXWIDGETS2.8: C:/wx/wxMSW-2.8.12 + WXWIDGETS2.8-stl: C:/wx/wxMSW-2.8.12-stl + WXWIDGETS3.1: C:/wx/wxWidgets-3.1.0 + WXWIDGETS3.1-stl: C:/wx/wxWidgets-3.1.0-stl + OPENAL: C:\openal-soft-1.17.2 + OPENAL_LIBRARY: C:\openal-soft-1.17.2\build\OpenAL.lib + OPENAL_INCLUDE_DIR: C:\openal-soft-1.17.2\include\AL + matrix: + - WXVER: "2.8" + PYTHON: "C:\\Python35" + - WXVER: "2.8-stl" + PYTHON: "C:\\Python35" + - WXVER: "3.1" + PYTHON: "C:\\Python35" + - WXVER: "3.1-stl" + PYTHON: "C:\\Python35" +matrix: + fast_finish: true + allow_failures: + - platform: x64 +platform: + - x86 + - x64 +configuration: + - Release + - Debug +install: + - ps: | + git describe --tags | Set-Variable -Name tag + appveyor UpdateBuild -Version "$tag-${ENV:APPVEYOR_BUILD_NUMBER}" + - powershell "%APPVEYOR_BUILD_FOLDER%/ci/appveyor/load_wxwidgets.ps1" + - powershell "%APPVEYOR_BUILD_FOLDER%/ci/appveyor/load_openal.ps1" + - "%PYTHON%\\Scripts\\pip.exe install markdown" +build_script: + - cmd: "%APPVEYOR_BUILD_FOLDER%/ci/appveyor/build.cmd" +cache: + - C:\wx\wxMSW-2.8.12\include -> appveyor.yml + - C:\wx\wxMSW-2.8.12\lib\vc_lib -> appveyor.yml + - C:\wx\wxMSW-2.8.12-stl\include -> appveyor.yml + - C:\wx\wxMSW-2.8.12-stl\lib\vc_lib -> appveyor.yml + - C:\wx\wxWidgets-3.1.0\include -> appveyor.yml + - C:\wx\wxWidgets-3.1.0\lib\vc_lib -> appveyor.yml + - C:\wx\wxWidgets-3.1.0-stl\include -> appveyor.yml + - C:\wx\wxWidgets-3.1.0-stl\lib\vc_lib -> appveyor.yml + - C:\openal-soft-1.17.2\build -> appveyor.yml diff --git a/ci/appveyor/build.cmd b/ci/appveyor/build.cmd new file mode 100644 index 0000000..7d1ab57 --- /dev/null +++ b/ci/appveyor/build.cmd @@ -0,0 +1,23 @@ +setlocal ENABLEEXTENSIONS + +echo on + +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %Platform% + +cd %APPVEYOR_BUILD_FOLDER% +if not exist build (mkdir build) +cd build + +echo. +echo Configuring build +cmake .. -G "NMake Makefiles" -DWXVER=%WXVER% ^ + -DCMAKE_BUILD_TYPE=%Configuration% ^ + -DOPENAL_LIBRARY=%OPENAL_LIBRARY% ^ + -DOPENAL_INCLUDE_DIR=%OPENAL_INCLUDE_DIR% ^ + -DPYTHON_EXECUTABLE=%PYTHON%\python.exe +if ERRORLEVEL 1 exit /b %ERRORLEVEL% + +echo. +echo Building +nmake +if ERRORLEVEL 1 exit /b %ERRORLEVEL% diff --git a/ci/appveyor/build_openal.cmd b/ci/appveyor/build_openal.cmd new file mode 100644 index 0000000..48aaba8 --- /dev/null +++ b/ci/appveyor/build_openal.cmd @@ -0,0 +1,18 @@ +:contargs +@if "%2"=="" goto doneargs +set %1=%2 +@shift +@shift +@goto contargs + +:doneargs + +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %Platform% + +echo "Configuring..." +cmake .. -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release +if ERRORLEVEL 1 exit /b %ERRORLEVEL% + +echo "Building" +cmake .. --build . +if ERRORLEVEL 1 exit /b %ERRORLEVEL% diff --git a/ci/appveyor/build_wxwidgets.cmd b/ci/appveyor/build_wxwidgets.cmd new file mode 100644 index 0000000..ce524d6 --- /dev/null +++ b/ci/appveyor/build_wxwidgets.cmd @@ -0,0 +1,13 @@ +:contargs +@if "%2"=="" goto doneargs +set %1=%2 +@shift +@shift +@goto contargs + +:doneargs + +call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %Platform% + +nmake -f makefile.vc BUILD=%BUILD% UNICODE=1 +if ERRORLEVEL 1 exit /b %ERRORLEVEL% diff --git a/ci/appveyor/load_openal.ps1 b/ci/appveyor/load_openal.ps1 new file mode 100644 index 0000000..6f5e6a1 --- /dev/null +++ b/ci/appveyor/load_openal.ps1 @@ -0,0 +1,50 @@ +$start_dir = $pwd + +$openaldir = $ENV:OPENAL +$sha2sum = "A341F8542F1F0B8C65241A17DA13D073F18EC06658E1A1606A8ECC8BBC2B3314" +$openalurl = "http://kcat.strangesoft.net/openal-releases/openal-soft-1.17.2.tar.bz2" +$openalfile = "openal-soft-1.17.2.tar.bz2" +$openaltar = "openal-soft-1.17.2.tar" +$7zipoutdir = "C:\" + +if (Test-Path $openaldir) { + echo "$($openaldir) already exists" + exit 0 +} +echo "$($openaldir) is missing. Getting openal" + +if (Test-Path $openalfile) { + echo "Zip exists" + $sum = Get-FileHash -LiteralPath $openalfile -Algorithm "SHA256" + if ($sum.Hash -ne $sha2sum) { + echo "Current file hash doesn't match" + Remove-Item $openalfile + } +} +if (-Not (Test-Path $openalfile)) { + echo "Fetching zip" + (new-object net.webclient).DownloadFile($openalurl, $openalfile) +} + +$sum = Get-FileHash -LiteralPath $openalfile -Algorithm "SHA256" +if ($sum.Hash -ne $sha2sum) { + echo "ERROR: $($wxfile) is corrupt" + echo "Orig: $($sha2sum)" + echo "Calc: $($sum.Hash)" + exit 3 +} + +$unzip_args = "x", $openalfile, "-y" +& "C:\Program Files\7-zip\7z.exe" $unzip_args +if ($exitcode -gt 0) {exit $exitcode} + +$unzip_args = "x", $openaltar, "-y", "-o$($7zipoutdir)" +& "C:\Program Files\7-zip\7z.exe" $unzip_args +if ($exitcode -gt 0) {exit $exitcode} + +cd $openaldir + +cd build + +& "$($start_dir.Path)\ci\appveyor\build_openal.cmd" +if ($exitcode -gt 0) {exit $exitcode} diff --git a/ci/appveyor/load_wxwidgets.ps1 b/ci/appveyor/load_wxwidgets.ps1 new file mode 100644 index 0000000..eb65592 --- /dev/null +++ b/ci/appveyor/load_wxwidgets.ps1 @@ -0,0 +1,85 @@ +Get-Childitem -Path Env:* | Sort-Object Name + +$start_dir = $pwd +switch ($ENV:WXVER) { + "2.8" { + $wxdir = ${ENV:WXWIDGETS2.8} + $stl = 'No' + } + "2.8-stl" { + $wxdir = ${ENV:WXWIDGETS2.8-stl} + $stl = 'Yes' + } + "3.1" { + $wxdir = ${ENV:WXWIDGETS3.1} + $stl = 'No' + } + "3.1-stl" { + $wxdir = ${ENV:WXWIDGETS3.1-stl} + $stl = 'Yes' + } + default { + echo "$($ENV:WXVER) is unhandled" + exit 4 + } +} +$wxfile = $ENV:WXFILE +$wxurl = $ENV:WXURL +$wxsum = $ENV:WXSUM + +if (Test-Path $wxdir) { + echo "$($wxdir) already exists" + exit 0 +} +echo "$($wxdir) is missing. Getting wx" + +if (Test-Path $wxfile) { + echo "Zip exists $wxfile" + $sum = Get-FileHash -LiteralPath $wxfile -Algorithm "SHA256" + if ($sum.Hash -ne $wxsum) { + echo "Current file hash doesn't match" + Remove-Item $wxfile + } +} +if (-Not (Test-Path $wxfile)) { + echo "Fetching $wxfile from $wxurl" + (new-object net.webclient).DownloadFile($wxurl, $wxfile) +} + +$sum = Get-FileHash -LiteralPath $wxfile -Algorithm "SHA256" +if ($sum.Hash -ne $wxsum) { + echo "ERROR: $($wxfile) is corrupt" + echo "Orig: $($wxsum)" + echo "Calc: $($sum.Hash)" + exit 3 +} + +$unzip_args = "x", $wxfile, "-y", "-oC:/" + +& "C:\Program Files\7-zip\7z.exe" $unzip_args +if ($exitcode -gt 0) {exit $exitcode} + +cd $wxdir + + +# Include is not needed and can be removed http://stackoverflow.com/a/17144445 +(Get-Content src/msw/window.cpp) -replace '#include ', '' | Set-Content src/msw/window.cpp +$setuph = "include/wx/msw/setup.h" +if ($stl -eq 'Yes') { + echo "Mangling $setuph" + (Get-Content $setuph) -replace '#define wxUSE_STL 0', '#define wxUSE_STL 1' | Set-Content $setuph +} else { + echo "Not magngling $setuph" +} + +cd build\msw + +if ($ENV:Configuration -eq "Debug") { + $buildtype = "BUILD=debug" +} else { + $buildtype = "BUILD=release" +} +echo "Building UNICODE=1 $($buildtype)" +$build_args = "UNICODE=1", $buildtype +& "$($start_dir.Path)\ci\appveyor\build_wxwidgets.cmd" $build_args +if ($exitcode -gt 0) {exit $exitcode} diff --git a/scripts/ohm/utilfunctions.py b/scripts/ohm/utilfunctions.py index 0b415c4..94dce86 100644 --- a/scripts/ohm/utilfunctions.py +++ b/scripts/ohm/utilfunctions.py @@ -2,9 +2,6 @@ print_function, unicode_literals) import traceback - -from builtins import * - import logging import os import os.path @@ -131,4 +128,4 @@ def rmtree_error_handler(function, path, excinfo): logging.error(" %s: %s", type.__name__, value) for filename, line, function, text in traceback.extract_tb(tb): logging.error("%s:%d %s", os.path.basename(filename), line, function) - logging.error(" %s", text) \ No newline at end of file + logging.error(" %s", text)