-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from DrCpp/rc-0.6
- Loading branch information
Showing
246 changed files
with
5,435 additions
and
6,375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Linux (install, test) | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: jurplel/install-qt-action@v2 | ||
- uses: lukka/get-cmake@latest | ||
- name: Install libclang | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install libclang-7-dev | ||
- name: Install drmock-generator | ||
run: pip install drmock-generator | ||
- name: Compile drmock | ||
run: | | ||
cmake . -DCMAKE_INSTALL_PREFIX=install -DCMAKE_PREFIX_PATH=$Qt5_Dir | ||
make | ||
ctest --output-on-failure | ||
env: | ||
DRMOCK_QT_PATH: $Qt5_Dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: macOS (install, test) | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: jurplel/install-qt-action@v2 | ||
with: | ||
version: '5.15.2' | ||
- uses: lukka/get-cmake@latest | ||
- name: Install drmock-generator | ||
run: pip install drmock-generator | ||
- name: Compile drmock | ||
run: | | ||
cmake . -DCMAKE_INSTALL_PREFIX=install -DCMAKE_PREFIX_PATH=$Qt5_Dir | ||
make | ||
ctest --output-on-failure | ||
env: | ||
DRMOCK_QT_PATH: /Users/runner/work/DrMock/Qt/5.15.2/clang_64 # For some reason, we have to kick macOS a little... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Windows (install, test) | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
- uses: jurplel/install-qt-action@v2 | ||
- uses: lukka/get-cmake@latest | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
- uses: crazy-max/ghaction-chocolatey@v1 | ||
with: | ||
args: -h | ||
- name: Install libclang | ||
run: | | ||
choco install llvm | ||
- name: Install drmock-generator | ||
run: pip install drmock-generator | ||
- name: Compile drmock | ||
run: | | ||
mkdir build | ||
cd build | ||
cmake .. -G "NMake Makefiles" # -DCMAKE_PREFIX_PATH=%DRMOCK_QT_PATH% | ||
nmake | ||
# No idea why nmake doesn't put these in the right dir | ||
# automatically... | ||
copy src/DrMock.dll tests/DrMock.dll | ||
copy src/DrMock.dll tests/integration/DrMock.dll | ||
ctest --output-on-failure | ||
env: | ||
# DRMOCK_QT_PATH: D:/a/DrMock/Qt/5.15.2/msvc2019_64/ | ||
CLANG_LIBRARY_FILE: C:\Program Files\LLVM\bin\libclang.dll | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
# build directory | ||
build/ | ||
|
||
# vim swap files | ||
*.swp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
<!-- | ||
Copyright 2019 Ole Kliemann, Malte Kliemann | ||
This file is part of DrMock. | ||
DrMock is free software: you can redistribute it and/or modify it | ||
under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
DrMock is distributed in the hope that it will be useful, but | ||
WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with DrMock. If not, see <https://www.gnu.org/licenses/>. | ||
--> | ||
|
||
# Building DrMock | ||
|
||
|
||
## Dependencies | ||
|
||
### Supported platforms | ||
|
||
**DrMock** is current supported on the following platforms: | ||
|
||
* Windows | ||
* Linux | ||
* macOS | ||
|
||
|
||
### Installing dependencies | ||
|
||
Go through the following steps to ensure that all dependencies are satisfied: | ||
|
||
1. Install `cmake` (minimum 3.17): | ||
|
||
``` | ||
choco install cmake (Windows) | ||
sudo apt-get install cmake (Linux) | ||
brew install cmake (macOS) | ||
``` | ||
|
||
2. Install `libclang` (minimum 6.0.0): | ||
|
||
``` | ||
choco install llvm (Windows) | ||
sudo apt-get install libclang-6.0-dev (Linux) | ||
``` | ||
|
||
On macOS, `libclang` is installed by default. | ||
Note that, it is not sufficient to install the `libclang1-6.0` package | ||
on Linux. Installing later versions of `libclang` should be fine. | ||
|
||
3. Install `drmock-generator`: | ||
|
||
``` | ||
pip install drmock-generator | ||
``` | ||
|
||
|
||
## Building | ||
|
||
### Manually | ||
|
||
To build and install **DrMock**, run | ||
|
||
``` | ||
cmake . | ||
make | ||
make install | ||
``` | ||
|
||
Add whatever `-DCMAKE` directives you wish. Don't forget to set | ||
`CMAKE_PREFIX_PATH` if necessary. | ||
|
||
On Windows, CMake may fail to detect the correct `libclang.dll`. If that | ||
is the case, you should set the `CLANG_LIBRARY_FILE` environment | ||
variable to the path of the `libclang.dll`. When using `choco`, then | ||
`C:\Program Files\LLVM\bin\libclang.dll` is usually correct. | ||
|
||
|
||
### Using the Makefile | ||
|
||
To build **DrMock** using the presupplied `Makefile`, proceed as | ||
follows: In the source directory, do `make`, then `make install`. This | ||
will install the **DrMock** cmake package into `build/install`. Move the | ||
contents of that folder wherever you please. For example, | ||
``` | ||
rsync -a build/install/ /usr/local | ||
``` | ||
|
||
|
||
## Building with Qt | ||
|
||
If you wish to mock `Q_OBJECT`s, set the environment variable | ||
`$DRMOCK_QT_PATH` equal to the location of the Qt library before | ||
following the steps above. Example: | ||
``` | ||
export DRMOCK_QT_PATH="$HOME/Qt/5.13.1/clang_64" | ||
``` | ||
If you're using the `Makefile` for building, `${DRMOCK_QT_PATH}` will be | ||
used to set the `CMAKE_PREFIX_PATH`. If you're building manually and | ||
haven't already, you will also have to add `${DRMOCK_QT_PATH}` to your | ||
prefix path by using a CMake directive: | ||
``` | ||
cmake. -D CMAKE_PREFIX_PATH=$DRMOCK_QT_PATH | ||
``` | ||
|
||
**Note.** `$DRMOCK_QT_PATH` must be set in order to use **DrMock** with | ||
Qt. | ||
|
||
|
||
## Troubleshooting | ||
|
||
### Installing CMake on Linux | ||
|
||
On some Linux systems, CMake 3.17 might not be available via `apt-get` | ||
(this seems to be the case with Ubuntu 18.04). It's not difficult to | ||
build CMake from source, following | ||
[https://cmake.org/install/ ](https://cmake.org/install/). | ||
|
||
We've noticed that on a mint Ubuntu 18.04 installation, the following error | ||
occurs during `./bootstrap` (see [CMake not able to find OpenSSL | ||
library](https://stackoverflow.com/questions/16248775/cmake-not-able-to-find-openssl-library)), | ||
which we were able to solve by installing `openssl-dev`: | ||
``` | ||
sudo apt-get install libssl-dev | ||
``` | ||
(or similar for other package managers). | ||
|
||
|
||
### `libgl` missing | ||
|
||
You might encounter the following on Linux when linking against | ||
`Qt5::Widgets`: | ||
``` | ||
${DRMOCK_QT_PATH}/lib/cmake/Qt5Gui/Qt5GuiConfigExtras.cmake:9 (message): | ||
Failed to find "GL/gl.h" in "/usr/include/libdrm". | ||
``` | ||
The solution is to install `libgl-dev`: | ||
``` | ||
sudo apt-get install libgl-dev | ||
``` | ||
|
||
|
||
### Old versions of Python | ||
|
||
On many systems, `python` will still point to Python 2.7.x, which has | ||
reached the end of its life on 01/01/2020 (as of January 2020, macOS | ||
Catalina and Ubuntu 18.04 are examples of this). | ||
Using this configuration **DrMock** requires `python` to point to Python (minimum 3.7.0). | ||
We recommend using [pyenv](https://github.com/pyenv/pyenv) for this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.