diff --git a/CMakeLists.txt b/CMakeLists.txt index 2720dcb2..5165030a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,8 @@ IF(UNIX) ENDIF() ENDIF() +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_USER_MOD_PATH} $ENV{CMAKE_USER_MOD_PATH}) +MESSAGE("${CMAKE_MODULE_PATH}") #add CMake build info ADD_DEFINITIONS(-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}") diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..116101f6 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,32 @@ +configuration: + - Debug + - Release + +environment: + CTEST_OUTPUT_ON_FAILURE: 1 + matrix: + - BUILD: msvc + - BUILD: msvc + PLATFORM: x64 + - BUILD: mingw + - BUILD: qmake + QTDIR: C:\Qt\5.9.1\mingw53_32 + # PATH : '%PATH%;%QTDIR%\bin;C:\MinGW\bin' + PATH : '%PATH%;%QTDIR%\bin;C:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\bin' + +build_script: + - python support/appveyor-build.py + +before_build: + # Workaround for CMake not wanting sh.exe on PATH for MinGW. + - set PATH=%PATH:C:\Program Files\Git\usr\bin;=% + - git submodule update --init --recursive + +on_failure: + - appveyor PushArtifact Testing/Temporary/LastTest.log + - appveyor AddTest test + +# Uncomment this to debug AppVeyor failures. +#on_finish: +# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) +# update diff --git a/nitrokey-app-qt5.pro b/nitrokey-app-qt5.pro index 4733de70..b468a686 100644 --- a/nitrokey-app-qt5.pro +++ b/nitrokey-app-qt5.pro @@ -3,6 +3,11 @@ CONFIG += qt c++14 debug QT += core gui widgets +win32-g++ { + QMAKE_CXXFLAGS_CXX14 = -std=c++14 + QMAKE_CXXFLAGS_GNUCXX14 = -std=c++14 +} + target.path = /usr/local/bin desktop.path = /usr/share/applications desktop.files += nitrokey-app.desktop diff --git a/support/appveyor-build.py b/support/appveyor-build.py new file mode 100644 index 00000000..a4d93b5e --- /dev/null +++ b/support/appveyor-build.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# Build the project on AppVeyor. + +import os +from subprocess import check_call + +build = os.environ['BUILD'] +config = os.environ['CONFIGURATION'] +platform = os.environ.get('PLATFORM') +path = os.environ['PATH'] +cmake_command = ['cmake', '-DFMT_PEDANTIC=ON', '-DCMAKE_BUILD_TYPE=' + config] + +if build == 'mingw': + cmake_command.append('-GMinGW Makefiles') + cmake_command.append(r'-DCMAKE_USER_MOD_PATH=C:/Qt/5.9.1/mingw53_32/lib/cmake') + build_command = ['mingw32-make', '-j2'] + test_command = ['mingw32-make', 'test'] + # Remove the path to Git bin directory from $PATH because it breaks + # MinGW config. + path = path.replace(r'C:/Program Files (x86)/Git/bin', '') + #os.environ['PATH'] = r'C:/MinGW/bin;' + path +elif build == 'qmake': + cmake_command = ['qmake', '.'] + build_command = ['mingw32-make', '-j2'] + test_command = ['true'] +else: + # Add MSBuild 14.0 to PATH as described in + # http://help.appveyor.com/discussions/problems/2229-v140-not-found-on-vs2105rc. + os.environ['PATH'] = r'C:/Program Files (x86)/MSBuild/14.0/Bin;' + path + generator = 'Visual Studio 14 2015' + if platform == 'x64': + generator += ' Win64' + cmake_command.append('-G' + generator) + cmake_command.append(r'-DCMAKE_USER_MOD_PATH=C:/Qt/5.9.1/msvc2015/lib/cmake') + build_command = ['cmake', '--build', '.', '--config', config, '--', '/m:2'] + test_command = ['ctest', '-C', config] + +check_call(cmake_command) +check_call(build_command) +check_call(test_command)