File tree Expand file tree Collapse file tree 15 files changed +33
-42
lines changed Expand file tree Collapse file tree 15 files changed +33
-42
lines changed Original file line number Diff line number Diff line change @@ -14,14 +14,12 @@ jobs:
14
14
15
15
steps :
16
16
- uses : actions/checkout@v2
17
- with :
18
- submodules : true
19
17
20
18
- name : setup dependencies
21
19
run : |
22
20
sudo apt-get update
23
21
sudo apt-get install -y build-essential cmake ccache \
24
- cmake qt5-default qttools5-dev libqt5svg5-dev qtdeclarative5-dev libx11-xcb1
22
+ cmake qt5-default qttools5-dev libqt5svg5-dev qtdeclarative5-dev libx11-xcb1 libgtest-dev
25
23
26
24
- name : ccache timestamp
27
25
id : ccache_cache_timestamp
Original file line number Diff line number Diff line change 14
14
15
15
steps :
16
16
- uses : actions/checkout@v2
17
- with :
18
- submodules : true
19
17
20
18
- name : dependencies
21
19
run : |
Original file line number Diff line number Diff line change 18
18
19
19
steps :
20
20
- uses : actions/checkout@v2
21
- with :
22
- submodules : true
23
21
24
22
- name : Install Qt
25
23
uses : jurplel/install-qt-action@v2
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -29,13 +29,14 @@ Main features of the framework are:
29
29
## Requirements
30
30
31
31
+ C++-17
32
- + CMake 3.14
33
- + Qt 5.12
32
+ + CMake >= 3.14
33
+ + Qt >= 5.12
34
+ + gtest >= 1.10
34
35
35
36
## Installation instructions
36
37
37
38
``` sh
38
- git clone --recurse-submodules https://github.com/gpospelov/qt-mvvm.git
39
+ git clone https://github.com/gpospelov/qt-mvvm.git
39
40
mkdir ./build; cd ./build
40
41
cmake ..; make -j8; ctest
41
42
Original file line number Diff line number Diff line change @@ -46,6 +46,17 @@ function(project_testcoverage_setup)
46
46
)
47
47
endfunction ()
48
48
49
+ # Fetches google test version 1.12.1
50
+ function (fetch_googletest )
51
+ include (FetchContent )
52
+ FetchContent_Declare (
53
+ googletest
54
+ GIT_REPOSITORY https://github.com/google/googletest.git
55
+ GIT_TAG 58d77fa8070e8cec2dc1ed015d66b454c8d78850 )
56
+ FetchContent_MakeAvailable (googletest )
57
+ message (VERBOSE "GTest binaries are present at ${googletest_BINARY_DIR} " )
58
+ endfunction ()
59
+
49
60
# Setups targets for code processing.
50
61
51
62
function (project_codetools_setup )
Original file line number Diff line number Diff line change
1
+ enable_testing ()
2
+
3
+ find_package (GTest 1.10 QUIET CONFIG )
4
+ if (NOT GTest_FOUND )
5
+ message (WARNING "GTest with version >= \" 1.10\" was not found, fetching from internet" )
6
+ fetch_googletest ()
7
+ endif ()
8
+ find_package_message (
9
+ GTest_DETAILS
10
+ "Found GTest: ${GTest_DIR} (version \" ${GTest_VERSION} \" )"
11
+ "[${GTest_FOUND} ][${GTest_DIR} ][v${GTest_VERSION} ]" )
12
+
1
13
include (GoogleTest )
2
14
3
15
if (WIN32 )
Original file line number Diff line number Diff line change @@ -3,12 +3,8 @@ set(library_name testmachinery)
3
3
file (GLOB source_files "*.cpp" )
4
4
file (GLOB include_files "*.h" )
5
5
6
- if (WIN32 )
7
- add_definitions (-DGTEST_LINKED_AS_SHARED_LIBRARY )
8
- endif ()
9
-
10
6
add_library (${library_name} STATIC ${source_files} ${include_files} )
11
- target_link_libraries (${library_name} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model )
7
+ target_link_libraries (${library_name} PUBLIC GTest:: gtest GTest:: gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model )
12
8
target_include_directories (${library_name} PUBLIC
13
9
$< BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} > $< BUILD_INTERFACE:${MVVM_AUTOGEN_DIR} > )
14
10
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
8
8
9
9
set (CMAKE_AUTOMOC ON )
10
10
add_executable (${test} ${source_files} ${include_files} )
11
- target_link_libraries (${test} gtest gmock Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot )
11
+ target_link_libraries (${test} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot )
12
12
13
13
if (MVVM_DISCOVER_TESTS )
14
14
gtest_discover_tests (${test} TEST_PREFIX "Integration." )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
8
8
9
9
set (CMAKE_AUTOMOC ON )
10
10
add_executable (${test} ${source_files} ${include_files} )
11
- target_link_libraries (${test} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model testmachinery )
11
+ target_link_libraries (${test} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_model testmachinery )
12
12
13
13
if (MVVM_DISCOVER_TESTS )
14
14
gtest_discover_tests (${test} TEST_PREFIX "Model." )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
8
8
9
9
set (CMAKE_AUTOMOC ON )
10
10
add_executable (${test} ${source_files} ${include_files} )
11
- target_link_libraries (${test} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot )
11
+ target_link_libraries (${test} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_view testmachinery qcustomplot )
12
12
13
13
if (MVVM_DISCOVER_TESTS )
14
14
gtest_discover_tests (${test} TEST_PREFIX "View." )
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
8
8
9
9
set (CMAKE_AUTOMOC ON )
10
10
add_executable (${test} ${source_files} ${include_files} )
11
- target_link_libraries (${test} gtest gmock Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_viewmodel testmachinery qcustomplot )
11
+ target_link_libraries (${test} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Test mvvm_viewmodel testmachinery qcustomplot )
12
12
13
13
if (MVVM_DISCOVER_TESTS )
14
14
gtest_discover_tests (${test} TEST_PREFIX "View." )
Original file line number Diff line number Diff line change 1
- if (BUILD_TESTING )
2
- add_subdirectory (gtest )
3
- endif (BUILD_TESTING )
4
1
add_subdirectory (qcustomplot )
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments