Skip to content

Commit 956c11e

Browse files
authored
Merge pull request #341 from yurtpage/cmake
CMake: make test build conditional
2 parents 59f8083 + dceb643 commit 956c11e

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ include(configuration)
1515

1616
add_subdirectory(source)
1717
add_subdirectory(thirdparty)
18-
add_subdirectory(tests)
18+
if(BUILD_TESTING)
19+
add_subdirectory(tests)
20+
endif(BUILD_TESTING)
1921

2022
include(installation)
2123
add_subdirectory(examples)

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
## Overview
1111

1212
This model-view-viewmodel framework is intended for large Qt based scientific
13-
applications written in C++. Project was created as a playground toward GUI
13+
applications written in C++. The Project was created as a playground toward GUI
1414
refactoring of [BornAgain project](https://www.bornagainproject.org).
1515

1616
Main features of the framework are:
1717

1818
+ Application model to store arbitrary data of GUI session.
1919
+ Serialization of application models to json.
20-
+ Undo/redo based on command pattern.
21-
+ View model to show parts of application model in Qt widgets. Depends on Qt.
20+
+ Undo/redo based on a command pattern.
21+
+ View model to show parts of an application model in Qt widgets. Depends on Qt.
2222
+ Scientific plotting based on [qcustomplot](https://www.qcustomplot.com/).
2323
+ Automatic generation of widgets from model content.
2424
+ Property editors.
@@ -34,13 +34,13 @@ Main features of the framework are:
3434

3535
## Installation instructions
3636

37-
```
37+
```sh
3838
git clone --recurse-submodules https://github.com/gpospelov/qt-mvvm.git
39-
mkdir <build-dir>; cd <build-dir>
40-
cmake <source>; make -j8; ctest
39+
mkdir ./build; cd ./build
40+
cmake ..; make -j8; ctest
4141

42-
# run one of examples
43-
<build-dir>/bin/collidingmice
42+
# run one of examples from ./build
43+
./bin/collidingmice
4444
```
4545

4646
## Example
@@ -66,7 +66,7 @@ See short animation [here](doc/assets/colliding-mice.gif).
6666
The demo shows that `qt-mvvm` library allows to equip the GUI with the
6767
serialization and undo/redo and to provide proper model/view relations via
6868
relatively small modifications to the original code. Implementing similar
69-
features from the scratch in bare metal Qt would take much more time and the
69+
features from scratch in bare metal Qt would take much more time and the
7070
resulting code wouldn't be easily transferable to another project.
7171

7272
This and other examples can be found in [examples](examples/README.md)
@@ -149,11 +149,11 @@ editing.
149149
The library is intended for large GUI applications. The definition of `large` is
150150
quite arbitrary and means something in the range 20k - 200k lines of code. The
151151
main logic here is that using the additional library for smaller Qt applications
152-
is redundant, Qt has everything that may be required. If small GUI becomes messy
152+
is redundant, Qt has everything that may be required. If a small GUI becomes messy
153153
with time, it can always be refactored or even rewritten from scratch.
154154

155155
However, when the number of views to show the same data is getting large, and
156-
the GUI enters the range 20k - 200k, this is were a given library might help in
156+
the GUI enters the range 20k200k, this is where a given library might help in
157157
proper separation of data, logic, and UI. When the GUI grows even further, well,
158158
developers of such large GUI know already what they need and probably have
159159
already implemented similar machinery.

examples/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ if (MVVM_BUILD_EXAMPLES)
1616
add_subdirectory(plotgraphs)
1717
add_subdirectory(saveloadproject)
1818
add_subdirectory(treeviews)
19-
endif()
20-
21-
install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples DESTINATION share/mvvm)
2219

20+
install(DIRECTORY ${CMAKE_SOURCE_DIR}/examples DESTINATION share/mvvm)
21+
endif()
2322

2423

source/libmvvm_model/mvvm/utils/stringutils.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <algorithm>
1212
#include <iomanip>
1313
#include <iterator>
14+
#include <limits>
1415
#include <sstream>
1516
#include <string_view>
1617

thirdparty/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
add_subdirectory(gtest)
1+
if(BUILD_TESTING)
2+
add_subdirectory(gtest)
3+
endif(BUILD_TESTING)
24
add_subdirectory(qcustomplot)

0 commit comments

Comments
 (0)