Skip to content

Commit 900e642

Browse files
committed
Merge branch 'develop'
2 parents 609c2fe + 6d56c7a commit 900e642

87 files changed

Lines changed: 1362 additions & 554 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!--
2+
Copyright 2020 Ole Kliemann, Malte Kliemann
3+
4+
This file is part of DrMock.
5+
6+
DrMock is free software: you can redistribute it and/or modify it
7+
under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
DrMock is distributed in the hope that it will be useful, but
12+
WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with DrMock. If not, see <https://www.gnu.org/licenses/>.
18+
-->
19+
20+
# DrMock 0.2.0
21+
22+
Released 2020/05/15
23+
24+
### Added/Changed:
25+
26+
* Autodetect number of threads for compiling in Makefile
27+
28+
* Add convenience Makefile for building all sample projects
29+
30+
* Add tutorial for manually building **DrMock**
31+
32+
* Add pkg-config file
33+
34+
* Add DRMOCK, DRMOCK_DUMMY macros
35+
36+
- Change order of includes in mock objects
37+
(so that `DRMOCK` is defined when including the interface header in
38+
mock object header)
39+
40+
* Allow applying `DRTEST_VERIFY_MOCK` to mock object (not just method objects)
41+
42+
- Add `makeFormattedErrorString` virtual method to `IMethod` interface
43+
44+
- Add `makeFormattedErrorString` method to `MethodCollection`
45+
(concatenates formatted error strings of collected method objects)
46+
47+
- Add `makeFormattedErrorString` method to mock objects (returns
48+
formatted error string of method collection)
49+
50+
* Use `RESOURCES` parameter in `DrMockTest` to add resource files to
51+
test executables
52+
53+
* Add remark about QII pattern to docs
54+
55+
### Removed
56+
57+
* Disable verbose print from DrMockGenerator
58+
59+
### Fixed
60+
61+
* Add missing remark that `DRMOCK_QT_PATH` must be set when using
62+
`DrMockModule` with Qt5 modules to documentation.
63+
64+
* Apply do-while-false pattern to `DRTEST_VERIFY_MOCK`
65+
66+
* Fix formatting errors and typos in source/docs
67+
68+
* Fix transition table in rocket example
69+
70+
* Replace `python3.7` and `pip3.7` with `python` and `pip` and shifting
71+
the responsibility of managing the python versions to the user.
72+
73+
* Replace odd error message thrown when using `DrMockModule` with
74+
`QTMODULE` parameter but unset `DRMOCK_QT_PATH` environment variable.
75+
76+
* Throw error message if `DrMockTest` can't find files specified in `TESTS`.
77+
78+
# DrMock 0.1.0
79+
80+
Released 2020/01/10
81+
82+
Official open-source release

CMakeLists.txt

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cmake_minimum_required (VERSION 3.13)
2323

2424
project(
2525
DrMock
26-
VERSION 0.1.0
26+
VERSION 0.2.0
2727
DESCRIPTION "C++17 testing and mocking framework"
2828
LANGUAGES CXX
2929
)
@@ -38,7 +38,7 @@ find_library(
3838
LIBCLANG_PATH
3939
NAMES clang clang-6.0 clang-7.0 clang-8.0
4040
PATH_SUFFIXES lib
41-
HINTS
41+
HINTS
4242
/Library/Developer/CommandLineTools/usr
4343
/usr/lib/llvm-7/lib
4444
)
@@ -48,24 +48,24 @@ endif()
4848

4949
# Write the libclang path to the mocker.cfg.
5050
configure_file(
51-
${CMAKE_SOURCE_DIR}/python/mocker/mocker.cfg.in
51+
${CMAKE_SOURCE_DIR}/python/mocker/mocker.cfg.in
5252
${CMAKE_SOURCE_DIR}/python/mocker/mocker.cfg
5353
)
5454

5555
# If enabled, find Qt.
5656
if (DEFINED ENV{DRMOCK_QT_PATH})
5757
find_package(
58-
Qt5
59-
COMPONENTS
60-
Core
58+
Qt5
59+
COMPONENTS
60+
Core
6161
)
6262
if (${Qt5_FOUND})
6363
# Set CMP0071 to NEW so that generated files are automoc'ed.
6464
cmake_policy(SET CMP0071 NEW)
6565
set(CMAKE_AUTOMOC ON)
6666
else()
6767
message(
68-
FATAL_ERROR
68+
FATAL_ERROR
6969
"DRMOCK_QT_PATH environment variable is set, but Qt5 was not found."
7070
)
7171
endif()
@@ -90,8 +90,8 @@ set(DrMockMacros
9090
foreach (pathToFile ${${PROJECT_NAME}Macros})
9191
get_filename_component(name ${pathToFile} NAME)
9292
configure_file(
93-
${pathToFile}
94-
${CMAKE_CURRENT_BINARY_DIR}/${name}
93+
${pathToFile}
94+
${CMAKE_CURRENT_BINARY_DIR}/${name}
9595
COPYONLY
9696
)
9797
endforeach()
@@ -100,11 +100,6 @@ endforeach()
100100
# Configure install.
101101
#######################################
102102

103-
# If install directory is default, install to `prefix` instead.
104-
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
105-
set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/prefix CACHE PATH "..." FORCE)
106-
endif()
107-
108103
set(CMAKE_INSTALL_INCLUDEDIR "include/${PROJECT_NAME}")
109104
set(CMAKE_INSTALL_LIBDIR "lib")
110105
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
@@ -119,24 +114,39 @@ install(
119114
# Uncomment to alias the libraries on export.
120115
set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME Core)
121116

117+
install(
118+
DIRECTORY pkgconfig/
119+
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
120+
FILES_MATCHING
121+
PATTERN "*.pc"
122+
)
122123
install(
123124
DIRECTORY include/
124125
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
125126
)
126127
install(
127-
DIRECTORY src/
128+
DIRECTORY src/
128129
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
129-
FILES_MATCHING
130-
PATTERN "*.h"
130+
FILES_MATCHING
131+
PATTERN "*.h"
131132
PATTERN "*.tpp"
132133
)
133134

135+
#######################################
136+
# pkgconfig
137+
#######################################
138+
139+
configure_file(
140+
${CMAKE_SOURCE_DIR}/pkgconfig/DrMock.pc.in
141+
${CMAKE_SOURCE_DIR}/pkgconfig/DrMock.pc
142+
)
143+
134144
#######################################
135145
# Configure export.
136146
#######################################
137147

138148
install(
139-
EXPORT
149+
EXPORT
140150
${PROJECT_NAME}Targets
141151
FILE
142152
${PROJECT_NAME}Targets.cmake
@@ -150,16 +160,16 @@ include(CMakePackageConfigHelpers)
150160

151161
write_basic_package_version_file(
152162
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
153-
VERSION
163+
VERSION
154164
${PROJECT_VERSION}
155-
COMPATIBILITY
165+
COMPATIBILITY
156166
SameMajorVersion
157167
)
158168

159169
configure_package_config_file(
160170
${CMAKE_CURRENT_LIST_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
161171
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
162-
INSTALL_DESTINATION
172+
INSTALL_DESTINATION
163173
${INSTALL_CONFIGDIR}
164174
)
165175

@@ -168,7 +178,7 @@ install(
168178
FILES
169179
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
170180
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
171-
DESTINATION
181+
DESTINATION
172182
${INSTALL_CONFIGDIR}
173183
)
174184

@@ -178,17 +188,17 @@ foreach (pathToFile ${${PROJECT_NAME}Macros})
178188
install(
179189
FILES
180190
${CMAKE_CURRENT_BINARY_DIR}/${name}
181-
DESTINATION
191+
DESTINATION
182192
${INSTALL_CONFIGDIR}
183193
)
184194
endforeach()
185195

186196
export(
187-
EXPORT
188-
${PROJECT_NAME}Targets
189-
FILE
190-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake
191-
NAMESPACE
197+
EXPORT
198+
${PROJECT_NAME}Targets
199+
FILE
200+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake
201+
NAMESPACE
192202
${PROJECT_NAME}::
193203
)
194204

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
# Discover operating system.
2+
uname := $(shell uname -s)
3+
4+
# Get number of threads
5+
ifeq ($(uname), Darwin)
6+
num_threads := $(shell sysctl -n hw.activecpu)
7+
else # Assuming Linux.
8+
num_threads := $(shell nproc)
9+
endif
10+
11+
.PHONY: default
112
default:
2-
mkdir -p build && cd build && cmake .. -DCMAKE_PREFIX_PATH=${DRMOCK_QT_PATH}
3-
cd python && make && python3.7 setup.py bdist_wheel && cd ..
4-
mkdir -p build && cd build && make -j10 && ctest --output-on-failure
13+
mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX="../prefix" .. -DCMAKE_PREFIX_PATH=${DRMOCK_QT_PATH}
14+
cd python && make && cd ..
15+
cd build && make -j$(num_threads) && ctest --output-on-failure
516

17+
.PHONY: clean
618
clean:
719
rm -fr build && rm -fr prefix
820

21+
.PHONY: install
922
install:
1023
cd build && make install && cd ..

0 commit comments

Comments
 (0)