Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: cpp
os:
- osx
- linux
sudo: required
dist: trusty
Expand All @@ -12,15 +11,16 @@ env:
- GMOCK_VER=1.7.0
- GMOCK_PATH=/usr/src/gmock #1.6.0 from ubuntu trusty repo
matrix:
exclude:
- os: osx
env: GMOCK_PATH=/usr/src/gmock
- os: osx
compiler: gcc #does anyone on osx use it?
include:
- os: linux
compiler: gcc
env: GMOCK_VER=1.8.0 VALGRIND_TESTS=ON
- os: osx
compiler: clang
env: GMOCK_VER=1.8.0 QTDIR=/usr/local/Cellar/qt5/5.8.0_1
- os: osx
compiler: clang
env: GMOCK_VER=1.7.0 QTDIR=/usr/local/Cellar/qt5/5.8.0_1

addons:
apt:
Expand All @@ -35,9 +35,10 @@ addons:
- google-mock
- ninja-build
- valgrind
- qtbase5-dev

before_install:
- if [[ "${TRAVIS_OS_NAME}" = "osx" ]]; then brew update && brew install ninja; fi
- if [[ "${TRAVIS_OS_NAME}" = "osx" ]]; then brew update && brew install ninja qt5; fi

script: ./travis.sh

Expand Down
44 changes: 32 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ cmake_minimum_required(VERSION 3.1)

project(Cucumber-Cpp)

set(CUKE_USE_STATIC_BOOST ${WIN32} CACHE BOOL "Statically link Boost (except boost::test)")
set(CUKE_USE_STATIC_GTEST ON CACHE BOOL "Statically link Google Test")

set(CUKE_DISABLE_BOOST_TEST OFF CACHE BOOL "Disable boost:test")
set(CUKE_DISABLE_GTEST OFF CACHE BOOL "Disable Google Test framework")
set(CUKE_DISABLE_UNIT_TESTS OFF CACHE BOOL "Disable unit tests")
set(CUKE_DISABLE_E2E_TESTS OFF CACHE BOOL "Disable end-to-end tests")
set(CUKE_ENABLE_EXAMPLES OFF CACHE BOOL "Enable the examples")
option(CUKE_USE_STATIC_BOOST "Statically link Boost (except boost::test)" ${WIN32})
option(CUKE_USE_STATIC_GTEST "Statically link Google Test" ON)
option(CUKE_DISABLE_BOOST_TEST "Disable boost:test" OFF)
option(CUKE_DISABLE_GTEST "Disable Google Test framework" OFF)
option(CUKE_DISABLE_UNIT_TESTS "Disable unit tests" OFF)
option(CUKE_DISABLE_E2E_TESTS "Disable end-to-end tests" OFF)
option(CUKE_ENABLE_EXAMPLES "Enable the examples" OFF)
option(VALGRIND_TESTS "Run tests within Valgrind" OFF)
option(CUKE_DISABLE_QT "Disable using Qt framework" OFF)
set(GMOCK_SRC_DIR "" CACHE STRING "Google Mock framework sources path (otherwise downloaded)")
set(GMOCK_VER "1.7.0" CACHE STRING "Google Mock framework version to be used")
option(VALGRIND_TESTS "Run tests within Valgrind" OFF)

set(ignoreMe "${QT_QMAKE_EXECUTABLE}") #supress warning
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this line now

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)

#
Expand Down Expand Up @@ -112,6 +113,27 @@ if(NOT CUKE_DISABLE_GTEST)
endif()
endif()

#
# Qt
#

if(NOT CUKE_DISABLE_QT)
find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Test)

if(${Qt5Core_FOUND} AND ${Qt5Widgets_FOUND} AND ${Qt5Test_FOUND})
message(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}")
set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Test)
else()
find_package(Qt4 COMPONENTS QtCore QtGui QtTest)
if(QT4_FOUND)
set(QT_LIBRARIES Qt4::QtCore Qt4::QtGui Qt4::QtTest)
include(${QT_USE_FILE})
endif()
endif()
endif()

#
# Valgrind
#
Expand Down Expand Up @@ -163,11 +185,8 @@ endif()
#

set(CUKE_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)

include_directories(${CUKE_INCLUDE_DIR})

set(CUKE_LIBRARIES cucumber-cpp ${CUKE_EXTRA_LIBRARIES})

add_subdirectory(src)

#
Expand Down Expand Up @@ -232,3 +251,4 @@ endif()
if(CUKE_ENABLE_EXAMPLES)
add_subdirectory(examples)
endif()

45 changes: 19 additions & 26 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,52 @@ version: "{branch}-ci-{build}"
os: Visual Studio 2015

environment:
RUBY_VERSION: 200
matrix:
- build: mingw
platform: x86
- CMAKE_GENERATOR: 'MSYS Makefiles'
MINGW_ARCH: i686
MSYSTEM: MINGW32
MINGW_ROOT: C:\msys64\mingw32
BOOST_ROOT: C:\msys64\mingw32
BOOST_LIBRARYDIR: C:\msys64\mingw32\lib
BOOST_INCLUDEDIR: C:\msys64\mingw32\include\boost
CMAKE_GENERATOR: 'MSYS Makefiles'
- build: mingw
platform: x64
QT_DIR: C:\Qt\5.8\mingw53_32
- CMAKE_GENERATOR: 'MSYS Makefiles'
MINGW_ARCH: x86_64
MSYSTEM: MINGW64
MINGW_ROOT: C:\msys64\mingw64
BOOST_ROOT: C:\msys64\mingw64
BOOST_LIBRARYDIR: C:\msys64\mingw64\lib
BOOST_INCLUDEDIR: C:\msys64\mingw64\include\boost
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be a QT_DIR variable here (for 64-bit MinGW)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appveyor has only 32-bit mingw-compiled qt libs preinstalled. https://www.appveyor.com/docs/build-environment/#qt
AFAIK it is not possible to link VC-compiled Qt with Mingw-compiled cucumber, or use 32-bit mingw-compiled lib.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your explanation

CMAKE_GENERATOR: 'MSYS Makefiles'
- build: msvc
- CMAKE_GENERATOR: 'NMake Makefiles'
platform: x86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming this to MSVC_ARCH (similarly to MINGW_ARCH)? Then you can change the if %CMAKE_GENERATOR% == NMake check below to check for if defined MSVC_ARCH just like the MinGW stuff.

BOOST_ROOT: C:\Libraries\boost_1_59_0
BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib32-msvc-14.0
BOOST_INCLUDEDIR: C:\Libraries\boost_1_59_0\boost
CMAKE_GENERATOR: 'NMake Makefiles'
- build: msvc
QT_DIR: C:\Qt\5.8\msvc2015
- CMAKE_GENERATOR: 'NMake Makefiles'
platform: x64
BOOST_ROOT: C:\Libraries\boost_1_59_0
BOOST_INCLUDEDIR: C:\Libraries\boost_1_59_0\boost
BOOST_LIBRARYDIR: C:\Libraries\boost_1_59_0\lib64-msvc-14.0
CMAKE_GENERATOR: 'NMake Makefiles'
QT_DIR: C:\Qt\5.8\msvc2015_64

install:
- set PATH=C:\Ruby200\bin;%BOOST_LIBRARYDIR%;%PATH%
- if defined MINGW_ROOT set PATH=%MINGW_ROOT%\bin;C:\msys64\usr\bin\;%PATH%
- if "%CMAKE_GENERATOR%"=="NMake Makefiles" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%
- if defined MINGW_ARCH bash -lc "pacman --needed --noconfirm -S mingw-w64-%MINGW_ARCH%-boost"
- git submodule init
- git submodule update
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%BOOST_LIBRARYDIR%;%PATH%
- gem install bundle
- bundle install
- bundle env
- if "%build%"=="mingw" set PATH=%MINGW_ROOT%\bin;C:\msys64\usr\bin\;%PATH%
- if "%build%"=="mingw" bash -lc "pacman --needed --noconfirm -S mingw-w64-%MINGW_ARCH%-boost
- call gem install bundle
- call bundle install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't shuffle the lines around (in comparison to master), that makes the diff unnecessarily large.


build_script:
- cmd: if "%build%"=="msvc" call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %PLATFORM%
- cmd: cmake -E make_directory build
- cmd: cmake -E chdir build cmake -G "%CMAKE_GENERATOR%" -DCUKE_ENABLE_EXAMPLES=ON -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" ..
- cmd: cmake --build build
- cmake -E make_directory build
- cmake -E chdir build cmake -G "%CMAKE_GENERATOR%" -DCUKE_ENABLE_EXAMPLES=on -DBOOST_ROOT="%BOOST_ROOT%" -DBOOST_INCLUDEDIR="%BOOST_INCLUDEDIR%" -DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%" -DCMAKE_PREFIX_PATH="%QT_DIR%" ..
- cmake --build build

test_script:
- cmd: set CTEST_OUTPUT_ON_FAILURE=ON
- cmd: cmake --build build --target test
- cmd: cmake --build build --target features
- set CTEST_OUTPUT_ON_FAILURE=ON
- cmake --build build --target test
- cmake --build build --target features

notifications:
- provider: Email
Expand Down
32 changes: 5 additions & 27 deletions examples/CalcQt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
project(CalcQt)

set(CALCQT_HEADERS src/CalculatorWidget.h)
set(CALCQT_SOURCES src/CalcQt.cpp src/CalculatorWidget.cpp)
include_directories(${CUKE_INCLUDE_DIRS} src)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you remove this global include_directories but you should probably combine it with target_include_directories(libcalcqt PUBLIC src) to fix the build errors you get.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for pointing that - I haven't yet used target_include_directories


find_package(Qt5Core QUIET)
find_package(Qt5Widgets QUIET)
find_package(Qt5Test QUIET)

if(${Qt5Core_FOUND} AND ${Qt5Widgets_FOUND} AND ${Qt5Test_FOUND})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(QT_LIBRARIES Qt5::Core Qt5::Widgets Qt5::Test)

add_library(libcalcqt src/CalculatorWidget.cpp ${CALCQT_HEADERS})
if(QT_LIBRARIES)
add_library(libcalcqt src/CalculatorWidget.cpp src/CalculatorWidget.h)
set_target_properties(libcalcqt PROPERTIES AUTOMOC ON)
target_include_directories(libcalcqt PUBLIC src)
target_link_libraries(libcalcqt ${QT_LIBRARIES})

add_executable(calcqt ${CALCQT_SOURCES})
add_executable(calcqt src/CalcQt.cpp)
target_link_libraries(calcqt libcalcqt ${QT_LIBRARIES})
else()
find_package(Qt4 COMPONENTS QtCore QtGui QtTest)
if(QT4_FOUND)
include(${QT_USE_FILE})
qt4_wrap_cpp(CALCQT_HEADERS_MOC ${CALCQT_HEADERS})
add_library(libcalcqt src/CalculatorWidget ${CALCQT_HEADERS_MOC})

add_executable(calcqt ${CALCQT_SOURCES} ${CALCQT_HEADERS_MOC})
target_link_libraries(calcqt ${QT_LIBRARIES})
endif()
endif()

if(QT_LIBRARIES)
if(Boost_UNIT_TEST_FRAMEWORK_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(BoostCalculatorQtSteps features/step_definitions/BoostCalculatorQtSteps)
Expand Down
2 changes: 2 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
set -e #break script on non-zero exitcode from any command
set -x #display command being executed

gem install bundler
bundle install

Expand All @@ -11,6 +12,7 @@ cmake -E make_directory build
cmake -E chdir build cmake \
-G Ninja \
-DCUKE_ENABLE_EXAMPLES=on \
${QTDIR:+"-DCMAKE_PREFIX_PATH=${QTDIR}"} \
${VALGRIND_TESTS:+"-DVALGRIND_TESTS=${VALGRIND_TESTS}"} \
${GMOCK_PATH:-"-DGMOCK_VER=${GMOCK_VER}"} \
${GMOCK_PATH:+"-DGMOCK_SRC_DIR=${GMOCK_PATH}"} \
Expand Down