From 7169a9d58ce9962e75d23f9cd45e15ef51cdae24 Mon Sep 17 00:00:00 2001 From: Jacob Alexander Date: Wed, 31 Aug 2016 01:09:44 -0700 Subject: [PATCH] Adding Cygwin build using Appveyor - Uses 32 version of Cygwin (on a 64 bit machine) - Adding PYTHON_EXECUTABLE override variable for Cygwin builds * We have to use the system CMake instead of the Cygwin CMake which detects the wrong version of Python - Update Bootloader build infrastructure to attempt tests on Windows --- Bootloader/Builds/cmake.bash | 28 ++++++++++++----- Keyboards/cmake.bash | 9 +++--- Lib/CMake/kll.cmake | 12 ++++++-- README.markdown | 3 +- appveyor.yml | 59 ++++++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 14 deletions(-) create mode 100644 appveyor.yml diff --git a/Bootloader/Builds/cmake.bash b/Bootloader/Builds/cmake.bash index c6f9869..6989823 100644 --- a/Bootloader/Builds/cmake.bash +++ b/Bootloader/Builds/cmake.bash @@ -84,21 +84,35 @@ done # Run CMake commands -## TODO Check for windows and do windows specific things ## mkdir -p "${BuildPath}" cd "${BuildPath}" -cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" "${CMakeListsPath}" -return_code=$? + +# Cygwin +if [[ $(uname -s) == MINGW32_NT* ]] || [[ $(uname -s) == CYGWIN* ]]; then + if [[ -z "$wincmake_path" ]]; then + echo "Error wincmake_path environment variable has not been set, see -> https://github.com/kiibohd/controller/wiki/Windows-Setup" + exit 1 + fi + echo "Cygwin Build" + PATH="$wincmake_path":"${PATH}" cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" "${CMakeListsPath}" -G 'Unix Makefiles' + +# Linux / Mac (and everything else) +else + cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" "${CMakeListsPath}" + return_code=$? + +fi + if [ $return_code != 0 ] ; then - echo "Error in cmake. Exiting..." - exit $return_code + echo "Error in cmake. Exiting..." + exit $return_code fi make return_code=$? if [ $return_code != 0 ] ; then - echo "Error in make. Exiting..." - exit $return_code + echo "Error in make. Exiting..." + exit $return_code fi echo "Firmware has been compiled into: '${BuildPath}'" diff --git a/Keyboards/cmake.bash b/Keyboards/cmake.bash index b4ea5f1..16ae5c5 100644 --- a/Keyboards/cmake.bash +++ b/Keyboards/cmake.bash @@ -93,6 +93,7 @@ if [[ $(uname -s) == MINGW32_NT* ]] || [[ $(uname -s) == CYGWIN* ]]; then echo "Error wincmake_path environment variable has not been set, see -> https://github.com/kiibohd/controller/wiki/Windows-Setup" exit 1 fi + echo "Cygwin Build" PATH="$wincmake_path":"${PATH}" cmake -DCHIP="${Chip}" -DCOMPILER="${Compiler}" -DScanModule="${ScanModule}" -DMacroModule="${MacroModule}" -DOutputModule="${OutputModule}" -DDebugModule="${DebugModule}" -DBaseMap="${BaseMap}" -DDefaultMap="${DefaultMap}" -DPartialMaps="${PartialMapsExpanded}" "${CMakeListsPath}" -G 'Unix Makefiles' return_code=$? @@ -104,15 +105,15 @@ else fi if [ $return_code != 0 ] ; then - echo "Error in cmake. Exiting..." - exit $return_code + echo "Error in cmake. Exiting..." + exit $return_code fi make return_code=$? if [ $return_code != 0 ] ; then - echo "Error in make. Exiting..." - exit $return_code + echo "Error in make. Exiting..." + exit $return_code fi echo "Firmware has been compiled into: '${BuildPath}'" diff --git a/Lib/CMake/kll.cmake b/Lib/CMake/kll.cmake index bd481d0..534761b 100644 --- a/Lib/CMake/kll.cmake +++ b/Lib/CMake/kll.cmake @@ -16,9 +16,17 @@ if ( "${MacroModule}" STREQUAL "PartialMap" ) ### # Python 3 is required for kll +# Check disabled for Win32 as it can't detect version correctly (we don't use Python directly through CMake anyways) # -set ( PYTHON_EXECUTABLE python3 ) # Required on systems where python is 2, not 3 -find_package ( PythonInterp 3 REQUIRED ) + +if ( NOT WIN32 ) + # Required on systems where python is 2, not 3 + set ( PYTHON_EXECUTABLE + python3 + CACHE STRING "Python 3 Executable Path" + ) + find_package ( PythonInterp 3 REQUIRED ) +endif () ### diff --git a/README.markdown b/README.markdown index 8e6c5d6..aa39b05 100644 --- a/README.markdown +++ b/README.markdown @@ -7,7 +7,8 @@ The [KLL](https://github.com/kiibohd/kll) git repo is automatically cloned durin Please refer to the [KLL](https://github.com/kiibohd/kll) repo or [kiibohd.com](http://kiibohd.com) for details on the KLL (Keyboard Layout Language) Spec. -[![](https://travis-ci.org/kiibohd/controller.svg?branch=master)](https://travis-ci.org/kiibohd/controller) +[![Travis Status](https://travis-ci.org/kiibohd/controller.svg?branch=master)](https://travis-ci.org/kiibohd/controller) [![Appveyor Status](https://ci.appveyor.com/api/projects/status/erfnnhlm3w5sinr3/branch/master?svg=true)](https://ci.appveyor.com/project/haata/controller/branch/master) + [![Visit our IRC channel](https://kiwiirc.com/buttons/irc.freenode.net/input.club.png)](https://kiwiirc.com/client/irc.freenode.net/#input.club) diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..ce7efc0 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,59 @@ +# appveyor file for kiibohd/controller +# Used to test out the Cygwin builds + +platform: + - x64 + +environment: + global: + CYG_MIRROR: http://cygwin.uib.no + CYG_CACHE: C:/cygwin/var/cache/setup + CYG_ARCH: x86 + CYG_ROOT: C:/cygwin + WIN_CMAKE: "/cygdrive/c/Program Files (x86)/CMake/bin" + matrix: + # Input Club Keyboard Tests + - SCRIPT_DIR: Keyboards + SCRIPT: infinity.bash + - SCRIPT_DIR: Keyboards + SCRIPT: infinity_led.bash + - SCRIPT_DIR: Keyboards + SCRIPT: ergodox.bash + - SCRIPT_DIR: Keyboards + SCRIPT: whitefox.bash + + # Debug Build Tests + - SCRIPT_DIR: Keyboards/Testing + SCRIPT: uartout.bash + - SCRIPT_DIR: Keyboards/Testing + SCRIPT: usbmuxuart.bash + + # Bootloader Build Tests + - SCRIPT_DIR: Bootloader/Builds + SCRIPT: mk20dx128vlf5.bash + - SCRIPT_DIR: Bootloader/Builds + SCRIPT: mk20dx256vlh7.bash + +init: + - git config --global core.autocrlf input + +install: + - 'appveyor DownloadFile http://cygwin.com/setup-%CYG_ARCH%.exe -FileName setup.exe' + - 'setup.exe -qnNdO -R "%CYG_ROOT%" -s "%CYG_MIRROR%" -l "%CYG_CACHE%" -P git -P make -P python3 -P ctags -P tree -P p7zip' + - '%CYG_ROOT%/bin/bash -lc "cygcheck -dc cygwin"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"/%SCRIPT_DIR% && export wincmake_path=\"%WIN_CMAKE%\" && which cmake"' + - 'appveyor DownloadFile https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q2-update/+download/gcc-arm-none-eabi-5_4-2016q2-20160622-win32.zip -FileName gcc-arm-none-eabi.zip' + - dir + - cmake --version + +build_script: + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && 7z x -o/ gcc-arm-none-eabi.zip"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && pwd"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && tree"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && cmake --version"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"/%SCRIPT_DIR% && export wincmake_path=\"%WIN_CMAKE%\" && export PATH=\"${wincmake_path}\":$PATH && cmake --version"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && git --version"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && python3 --version"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\" && arm-none-eabi-gcc --version"' + - '%CYG_ROOT%/bin/bash -lc "cd \"$OLDPWD\"/%SCRIPT_DIR% && export wincmake_path=\"%WIN_CMAKE%\" && COMPILER=gcc ./%SCRIPT%"' +