diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yaml
new file mode 100644
index 000000000..955b21fd2
--- /dev/null
+++ b/.github/workflows/Build.yaml
@@ -0,0 +1,217 @@
+name: Build
+
+on:
+ push:
+ branches: [ "**" ]
+ pull_request:
+ branches: [ "**" ]
+
+jobs:
+ macOS-premake:
+ strategy:
+ matrix:
+ conf:
+ - Debug
+ - Release
+
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Download & install SDL
+ run: |
+ curl -L -o SDL2.dmg https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.dmg
+ hdiutil attach SDL2.dmg
+ cp -r /Volumes/SDL2/SDL2.framework RecastDemo/Bin
+ hdiutil detach /Volumes/SDL2
+ rm SDL2.dmg
+
+ - name: Download & install premake
+ working-directory: RecastDemo
+ run: |
+ curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-macosx.tar.gz
+ tar -xzf premake.tar.gz
+ rm premake.tar.gz
+
+ - name: Run premake
+ working-directory: RecastDemo
+ run: ./premake5 xcode4
+
+ - name: Build With Xcode
+ working-directory: RecastDemo/Build/xcode4/
+ run: xcodebuild -scheme RecastDemo -configuration ${{matrix.conf}} -project RecastDemo.xcodeproj build
+
+ - name: Build Unit Tests With Xcode
+ working-directory: RecastDemo/Build/xcode4/
+ run: xcodebuild -scheme Tests -configuration ${{matrix.conf}} -project Tests.xcodeproj build
+
+ macos-cmake:
+ strategy:
+ matrix:
+ conf:
+ - Debug
+ - Release
+
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Download & install SDL
+ run: |
+ curl -L -o SDL2.dmg https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.dmg
+ hdiutil attach SDL2.dmg
+ cp -r /Volumes/SDL2/SDL2.framework ${{github.workspace}}/RecastDemo/Bin/
+ hdiutil detach /Volumes/SDL2
+ rm SDL2.dmg
+
+ - name: Configure CMake
+ # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
+ # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
+ run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.conf}} -DSDL2_LIBRARY=${{github.workspace}}/RecastDemo/Bin/SDL2.framework
+
+ - name: Build
+ run: cmake --build ${{github.workspace}}/build --config ${{matrix.conf}}
+
+ linux-premake:
+ strategy:
+ matrix:
+ conf:
+ - debug
+ - release
+ compiler:
+ - clang
+ - gcc
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install opengl and SDL
+ run: sudo apt-get install -y libgl1-mesa-dev libsdl2-dev
+
+ - name: Download & Install premake
+ working-directory: RecastDemo
+ run: |
+ curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
+ tar -xzf premake.tar.gz
+ rm premake.tar.gz
+
+ - name: Run premake
+ working-directory: RecastDemo
+ run: ./premake5 --cc=${{matrix.compiler}} gmake2
+
+ - name: Build
+ working-directory: RecastDemo/Build/gmake2
+ run: make config=${{matrix.conf}} verbose=true
+
+ linux-cmake:
+ strategy:
+ matrix:
+ conf:
+ - Debug
+ - Release
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install opengl and SDL
+ run: sudo apt-get install -y libgl1-mesa-dev libsdl2-dev
+
+ - name: Configure CMake
+ run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.conf}}
+
+ - name: Build
+ run: cmake --build ${{github.workspace}}/build --config ${{matrix.conf}}
+
+ windows-premake:
+ strategy:
+ matrix:
+ conf:
+ - Debug
+ - Release
+ vs-version:
+ - vs2019
+ - vs2022
+ include:
+ - vs-version: vs2019
+ version-range: '16.0'
+ runner: windows-2019
+ - vs-version: vs2022
+ version-range: '17.0'
+ runner: windows-2022
+
+ runs-on: ${{matrix.runner}}
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Add msbuild to PATH
+ uses: microsoft/setup-msbuild@v1.1
+ with:
+ vs-version: ${{matrix.version-range}}
+
+ - name: Download and Install SDL
+ working-directory: RecastDemo/Contrib
+ shell: pwsh
+ run: |
+ (new-object System.Net.WebClient).DownloadFile("https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-devel-2.24.2-VC.zip","${{github.workspace}}/RecastDemo/Contrib/SDL.zip")
+ tar -xf SDL.zip
+ ren SDL2-2.24.2 SDL
+ del SDL.zip
+
+ - name: Download and Install Premake
+ working-directory: RecastDemo
+ shell: pwsh
+ run: |
+ (new-object System.Net.WebClient).DownloadFile("https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip","${{github.workspace}}/RecastDemo/premake.zip")
+ tar -xf premake.zip
+ del premake.zip
+
+ - name: Run Premake
+ working-directory: RecastDemo
+ run: ./premake5.exe ${{matrix.vs-version}}
+
+ - name: Build
+ working-directory: RecastDemo/Build/${{matrix.vs-version}}
+ run: msbuild RecastDemo.vcxproj -property:Configuration=${{matrix.conf}}
+
+ windows-cmake:
+ strategy:
+ matrix:
+ conf:
+ - Debug
+ - Release
+ vs-version:
+ - vs2019
+ - vs2022
+ include:
+ - vs-version: vs2019
+ cmake-generator: Visual Studio 16 2019
+ runner: windows-2019
+ - vs-version: vs2022
+ cmake-generator: Visual Studio 17 2022
+ runner: windows-2022
+
+ runs-on: ${{matrix.runner}}
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Download and Install SDL
+ working-directory: RecastDemo/Contrib
+ shell: pwsh
+ run: |
+ (new-object System.Net.WebClient).DownloadFile("https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-devel-2.24.2-VC.zip","${{github.workspace}}/RecastDemo/Contrib/SDL.zip")
+ tar -xf SDL.zip
+ ren SDL2-2.24.2 SDL
+ del SDL.zip
+
+ - name: Configure CMake
+ run: cmake -G "${{matrix.cmake-generator}}" -B ${{github.workspace}}/build -D CMAKE_BUILD_TYPE=${{matrix.conf}} -D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build
+
+ - name: Build with CMake
+ run: cmake --build ${{github.workspace}}/build --config ${{matrix.conf}}
diff --git a/.github/workflows/Tests.yaml b/.github/workflows/Tests.yaml
new file mode 100644
index 000000000..149fa01a9
--- /dev/null
+++ b/.github/workflows/Tests.yaml
@@ -0,0 +1,107 @@
+name: Tests
+
+on:
+ push:
+ branches: [ "**" ]
+ pull_request:
+ branches: [ "**" ]
+
+jobs:
+ macos-tests:
+ runs-on: macos-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Download & install SDL
+ run: |
+ curl -L -o SDL2.dmg https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-2.24.2.dmg
+ hdiutil attach SDL2.dmg
+ cp -r /Volumes/SDL2/SDL2.framework RecastDemo/Bin
+ hdiutil detach /Volumes/SDL2
+ rm SDL2.dmg
+
+ - name: Download & install premake
+ working-directory: RecastDemo
+ run: |
+ curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-macosx.tar.gz
+ tar -xzf premake.tar.gz
+ rm premake.tar.gz
+
+ - name: Run premake
+ working-directory: RecastDemo
+ run: ./premake5 xcode4
+
+ - name: Build Unit Tests With Xcode
+ working-directory: RecastDemo/Build/xcode4/
+ run: xcodebuild -scheme Tests -configuration Debug -project Tests.xcodeproj build
+
+ - name: Run unit tests
+ working-directory: RecastDemo/Bin
+ run: ./Tests
+
+ linux-tests:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Install opengl and SDL
+ run: sudo apt-get install -y libgl1-mesa-dev libsdl2-dev
+
+ - name: Download & Install premake
+ working-directory: RecastDemo
+ run: |
+ curl -L -o premake.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-linux.tar.gz
+ tar -xzf premake.tar.gz
+ rm premake.tar.gz
+
+ - name: Run premake
+ working-directory: RecastDemo
+ run: ./premake5 --cc=clang gmake2
+
+ - name: Build
+ working-directory: RecastDemo/Build/gmake2
+ run: make config=debug verbose=true
+
+ - name: Run Tests
+ working-directory: RecastDemo/Bin
+ run: ./Tests
+
+ windows-tests:
+ runs-on: windows-2022
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Add msbuild to PATH
+ uses: microsoft/setup-msbuild@v1.1
+
+ - name: Download and Install SDL
+ working-directory: RecastDemo/Contrib
+ shell: pwsh
+ run: |
+ (new-object System.Net.WebClient).DownloadFile("https://github.com/libsdl-org/SDL/releases/download/release-2.24.2/SDL2-devel-2.24.2-VC.zip","${{github.workspace}}/RecastDemo/Contrib/SDL.zip")
+ tar -xf SDL.zip
+ ren SDL2-2.24.2 SDL
+ del SDL.zip
+
+ - name: Download and Install Premake
+ working-directory: RecastDemo
+ shell: pwsh
+ run: |
+ (new-object System.Net.WebClient).DownloadFile("https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip","${{github.workspace}}/RecastDemo/premake.zip")
+ tar -xf premake.zip
+ del premake.zip
+
+ - name: Run Premake
+ working-directory: RecastDemo
+ run: ./premake5.exe vs2022
+
+ - name: Build
+ working-directory: RecastDemo/Build/vs2022
+ run: msbuild Tests.vcxproj -property:Configuration=Debug
+
+ - name: Run Tests
+ working-directory: RecastDemo/Bin/
+ run: ./Tests.exe
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 98f17e4b7..ccd8a58e6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,6 +16,9 @@ RecastDemo/Bin/Tests
# Build directory
RecastDemo/Build
+# XCode debug symbols archive
+RecastDemo/Bin/*.dSYM
+
# Ignore meshes
RecastDemo/Bin/Meshes/*
@@ -44,6 +47,9 @@ RecastDemo/Contrib/SDL/*
## Generated doc files
Docs/html
+## CMake build cache
+build
+
## IDE files
.idea/
cmake-build-*/
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 0e63abad1..000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,72 +0,0 @@
-language: cpp
-branches:
- only:
- - master
- - coverity_scan
- - /recast-.*$/
-
-sudo: false
-
-addons:
- apt:
- sources:
- - ubuntu-toolchain-r-test
- - llvm-toolchain-xenial-7
- packages: [ cmake, clang-7, clang-tools-7, gcc-8, g++-8, libsdl2-dev ]
-
-matrix:
- include:
- - name: Recastnavigation (all) on MacOS xcode9.4
- os: osx
- osx_image: xcode9.4
- before_install:
- - brew update
- - brew install sdl2
- if: branch != coverity_scan
- - name: Recastnavigation on Ubuntu Xenial GCC-5
- os: linux
- dist: xenial
- sudo: required
- if: branch != coverity_scan
- - name: Recastnavigation on Ubuntu Xenial GCC-8
- os: linux
- dist: xenial
- sudo: required
- env:
- - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
- if: branch != coverity_scan
- - name: Recastnavigation on Ubuntu Xenial GCC-5 using Premake5
- os: linux
- dist: xenial
- sudo: required
- if: branch != coverity_scan
- before_install:
- - wget https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz -O premake.tar.gz
- - tar -xf premake.tar.gz
- env:
- - PREMAKE=1
- - name: Recastnavigation on Ubuntu Xenial Clang-7 with Static Analysis
- os: linux
- dist: xenial
- sudo: required
- env:
- - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
- - ANALYZE="scan-build-7 --force-analyze-debug-code --use-cc clang-7 --use-c++ clang++-7"
- if: branch != coverity_scan
- compiler: clang
- - name: Recastnavigation Coverity Scan
- os: linux
- dist: xenial
- sudo: required
- if: branch = coverity_scan
-
-before_script:
- - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then eval "${MATRIX_EVAL}"; fi
- - if [ "${PREMAKE}" = "1" ]; then cd RecastDemo && ../premake5 gmake && cd ..; fi
- - if [ "${PREMAKE}" != "1" ]; then mkdir -p build && cd build && ${ANALYZE} cmake ../ && cd ..; fi
-
-script: # 2 CPUs on Travis-CI + 1 extra for IO bound process
- - if [ "${PREMAKE}" = "1" ]; then make -C RecastDemo/Build/gmake -j3; fi
- - if [ "${PREMAKE}" != "1" ]; then make -C build -j3; fi
- - if [ "${PREMAKE}" = "1" ]; then RecastDemo/Bin/Tests; fi
- - if [ "${PREMAKE}" != "1" ]; then cd build && ctest; fi
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d23859dfc..d6fc2169c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,12 +4,41 @@ project(RecastNavigation)
# lib versions
SET(SOVERSION 1)
-SET(VERSION 1.0.0)
+set(LIB_VERSION 1.5.1)
+string(REPLACE "." "," LIB_VERSION_NUM "${LIB_VERSION}.0")
+
+set_property(GLOBAL PROPERTY CXX_STANDARD 98)
option(RECASTNAVIGATION_DEMO "Build demo" ON)
option(RECASTNAVIGATION_TESTS "Build tests" ON)
option(RECASTNAVIGATION_EXAMPLES "Build examples" ON)
-option(RECASTNAVIGATION_STATIC "Build static libraries" ON)
+
+if(MSVC AND BUILD_SHARED_LIBS)
+ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
+endif()
+
+include(CMakePackageConfigHelpers)
+include(GNUInstallDirs)
+
+configure_file(
+ "${RecastNavigation_SOURCE_DIR}/version.h.in"
+ "${RecastNavigation_BINARY_DIR}/version.h")
+install(FILES "${RecastNavigation_BINARY_DIR}/version.h" DESTINATION
+ ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)
+
+# Needed for recastnavigation.pc.in
+set(prefix ${CMAKE_INSTALL_PREFIX})
+set(exec_prefix "\${prefix}")
+set(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
+set(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}")
+set(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
+set(PACKAGE_VERSION "${LIB_VERSION}")
+configure_file(
+ "${RecastNavigation_SOURCE_DIR}/recastnavigation.pc.in"
+ "${RecastNavigation_BINARY_DIR}/recastnavigation.pc"
+ @ONLY)
+install(FILES "${RecastNavigation_BINARY_DIR}/recastnavigation.pc"
+ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
add_subdirectory(DebugUtils)
add_subdirectory(Detour)
@@ -17,6 +46,38 @@ add_subdirectory(DetourCrowd)
add_subdirectory(DetourTileCache)
add_subdirectory(Recast)
+configure_package_config_file(
+ ${PROJECT_SOURCE_DIR}/recastnavigation-config.cmake.in
+ recastnavigation-config.cmake
+ INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/recastnavigation
+)
+
+write_basic_package_version_file(
+ recastnavigation-config-version.cmake
+ VERSION ${LIB_VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+
+export(
+ EXPORT recastnavigation-targets
+ NAMESPACE RecastNavigation::
+ FILE recastnavigation-targets.cmake
+)
+
+install(
+ EXPORT recastnavigation-targets
+ NAMESPACE RecastNavigation::
+ FILE recastnavigation-targets.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/recastnavigation
+)
+
+install(
+ FILES
+ ${PROJECT_BINARY_DIR}/recastnavigation-config.cmake
+ ${PROJECT_BINARY_DIR}/recastnavigation-config-version.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/recastnavigation
+)
+
if (RECASTNAVIGATION_DEMO)
add_subdirectory(RecastDemo)
endif ()
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3cfdc2160..d46d138e0 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -3,30 +3,23 @@
We'd love for you to contribute to our source code and to make Recast and Detour even better than they are
today! Here are the guidelines we'd like you to follow:
- - [Code of Conduct](#coc)
- - [Question or Problem?](#question)
- - [Issues and Bugs](#issue)
- - [Feature Requests](#feature)
- - [Submission Guidelines](#submission-guidelines)
- - [Git Commit Guidelines](#git-commit-guidelines)
-
-## Code of Conduct
+## Code of Conduct
This project adheres to the [Open Code of Conduct][code-of-conduct].
By participating, you are expected to honor this code.
-## Got a Question or Problem?
+## Got a Question or Problem?
If you have questions about how to use Recast or Detour, please direct these to the [Google Group][groups]
discussion list. We are also available on [Gitter][gitter].
-## Found an Issue?
+## Found an Issue?
If you find a bug in the source code or a mistake in the documentation, you can help us by
submitting an issue to our [GitHub Repository][github]. Even better you can submit a Pull Request
with a fix.
**Please see the Submission Guidelines below**.
-## Want a Feature?
+## Want a Feature?
You can request a new feature by submitting an issue to our [GitHub Repository][github]. If you
would like to implement a new feature then consider what kind of change it is:
@@ -78,8 +71,7 @@ Before you submit your pull request consider the following guidelines:
```
* Implement your changes, **including appropriate tests if appropriate/possible**.
-* Commit your changes using a descriptive commit message that follows our
- [commit message conventions](#commit-message-format).
+* Commit your changes using a descriptive commit message that follows our commit message conventions (see below).
```shell
git commit -a
@@ -108,10 +100,10 @@ Before you submit your pull request consider the following guidelines:
If you have rebased to squash commits together, you will need to force push to update the PR:
- ```shell
- git rebase master -i
- git push origin my-fix-branch -f
- ```
+```shell
+git rebase master -i
+git push origin my-fix-branch -f
+```
That's it! Thank you for your contribution!
diff --git a/DebugUtils/CMakeLists.txt b/DebugUtils/CMakeLists.txt
index 8b6a3fcf6..b04e67d5d 100644
--- a/DebugUtils/CMakeLists.txt
+++ b/DebugUtils/CMakeLists.txt
@@ -1,12 +1,8 @@
file(GLOB SOURCES Source/*.cpp)
-
-if (RECASTNAVIGATION_STATIC)
- add_library(DebugUtils STATIC ${SOURCES})
-else()
- add_library(DebugUtils SHARED ${SOURCES})
-endif()
+add_library(DebugUtils ${SOURCES})
add_library(RecastNavigation::DebugUtils ALIAS DebugUtils)
+set_target_properties(DebugUtils PROPERTIES DEBUG_POSTFIX -d)
set(DebugUtils_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
@@ -22,14 +18,22 @@ target_link_libraries(DebugUtils
set_target_properties(DebugUtils PROPERTIES
SOVERSION ${SOVERSION}
- VERSION ${VERSION}
+ VERSION ${LIB_VERSION}
+ COMPILE_PDB_OUTPUT_DIRECTORY .
+ COMPILE_PDB_NAME "DebugUtils-d"
)
install(TARGETS DebugUtils
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- COMPONENT library
+ EXPORT recastnavigation-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation
)
file(GLOB INCLUDES Include/*.h)
-install(FILES ${INCLUDES} DESTINATION include)
+install(FILES ${INCLUDES} DESTINATION
+ ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)
+if(MSVC)
+ install(FILES "$/DebugUtils-d.pdb" CONFIGURATIONS "Debug" DESTINATION "lib")
+endif()
diff --git a/DebugUtils/Include/DebugDraw.h b/DebugUtils/Include/DebugDraw.h
index 00b544d1c..8ebe9eb24 100644
--- a/DebugUtils/Include/DebugDraw.h
+++ b/DebugUtils/Include/DebugDraw.h
@@ -27,7 +27,7 @@ enum duDebugDrawPrimitives
DU_DRAW_POINTS,
DU_DRAW_LINES,
DU_DRAW_TRIS,
- DU_DRAW_QUADS,
+ DU_DRAW_QUADS
};
/// Abstract debug draw interface.
@@ -57,11 +57,13 @@ struct duDebugDraw
/// Submit a vertex
/// @param pos [in] position of the verts.
/// @param color [in] color of the verts.
+ /// @param uv [in] the uv coordinates of the verts.
virtual void vertex(const float* pos, unsigned int color, const float* uv) = 0;
/// Submit a vertex
/// @param x,y,z [in] position of the verts.
/// @param color [in] color of the verts.
+ /// @param u,v [in] the uv coordinates of the verts.
virtual void vertex(const float x, const float y, const float z, unsigned int color, const float u, const float v) = 0;
/// End drawing primitives.
@@ -197,15 +199,15 @@ class duDisplayList : public duDebugDraw
int m_size;
int m_cap;
- bool m_depthMask;
duDebugDrawPrimitives m_prim;
float m_primSize;
+ bool m_depthMask;
void resize(int cap);
public:
duDisplayList(int cap = 512);
- ~duDisplayList();
+ virtual ~duDisplayList();
virtual void depthMask(bool state);
virtual void begin(duDebugDrawPrimitives prim, float size = 1.0f);
virtual void vertex(const float x, const float y, const float z, unsigned int color);
diff --git a/DebugUtils/Include/DetourDebugDraw.h b/DebugUtils/Include/DetourDebugDraw.h
index ff2ca2f9d..d1a808f1d 100755
--- a/DebugUtils/Include/DetourDebugDraw.h
+++ b/DebugUtils/Include/DetourDebugDraw.h
@@ -27,7 +27,7 @@ enum DrawNavMeshFlags
{
DU_DRAWNAVMESH_OFFMESHCONS = 0x01,
DU_DRAWNAVMESH_CLOSEDLIST = 0x02,
- DU_DRAWNAVMESH_COLOR_TILES = 0x04,
+ DU_DRAWNAVMESH_COLOR_TILES = 0x04
};
void duDebugDrawNavMesh(struct duDebugDraw* dd, const dtNavMesh& mesh, unsigned char flags);
diff --git a/DebugUtils/Include/RecastDump.h b/DebugUtils/Include/RecastDump.h
index 6a722fdae..18cc891a5 100644
--- a/DebugUtils/Include/RecastDump.h
+++ b/DebugUtils/Include/RecastDump.h
@@ -21,7 +21,7 @@
struct duFileIO
{
- virtual ~duFileIO() = 0;
+ virtual ~duFileIO();
virtual bool isWriting() const = 0;
virtual bool isReading() const = 0;
virtual bool write(const void* ptr, const size_t size) = 0;
@@ -39,5 +39,4 @@ bool duReadCompactHeightfield(struct rcCompactHeightfield& chf, duFileIO* io);
void duLogBuildTimes(rcContext& ctx, const int totalTileUsec);
-
#endif // RECAST_DUMP_H
diff --git a/DebugUtils/Source/DebugDraw.cpp b/DebugUtils/Source/DebugDraw.cpp
index d0179bca2..925699284 100644
--- a/DebugUtils/Source/DebugDraw.cpp
+++ b/DebugUtils/Source/DebugDraw.cpp
@@ -530,9 +530,9 @@ duDisplayList::duDisplayList(int cap) :
m_color(0),
m_size(0),
m_cap(0),
- m_depthMask(true),
m_prim(DU_DRAW_LINES),
- m_primSize(1.0f)
+ m_primSize(1.0f),
+ m_depthMask(true)
{
if (cap < 8)
cap = 8;
diff --git a/DebugUtils/Source/RecastDump.cpp b/DebugUtils/Source/RecastDump.cpp
index 209382515..581089983 100644
--- a/DebugUtils/Source/RecastDump.cpp
+++ b/DebugUtils/Source/RecastDump.cpp
@@ -25,10 +25,9 @@
#include "RecastAlloc.h"
#include "RecastDump.h"
-
duFileIO::~duFileIO()
{
- // Empty
+ // Defined out of line to fix the weak v-tables warning
}
static void ioprintf(duFileIO* io, const char* format, ...)
diff --git a/Detour/CMakeLists.txt b/Detour/CMakeLists.txt
index de88111d5..0c1268311 100644
--- a/Detour/CMakeLists.txt
+++ b/Detour/CMakeLists.txt
@@ -1,12 +1,8 @@
file(GLOB SOURCES Source/*.cpp)
-
-if(RECASTNAVIGATION_STATIC)
- add_library(Detour STATIC ${SOURCES})
-else()
- add_library(Detour SHARED ${SOURCES})
-endif()
+add_library(Detour ${SOURCES})
add_library(RecastNavigation::Detour ALIAS Detour)
+set_target_properties(Detour PROPERTIES DEBUG_POSTFIX -d)
set(Detour_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
@@ -16,14 +12,22 @@ target_include_directories(Detour PUBLIC
set_target_properties(Detour PROPERTIES
SOVERSION ${SOVERSION}
- VERSION ${VERSION}
+ VERSION ${LIB_VERSION}
+ COMPILE_PDB_OUTPUT_DIRECTORY .
+ COMPILE_PDB_NAME "Detour-d"
)
install(TARGETS Detour
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- COMPONENT library
+ EXPORT recastnavigation-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation
)
file(GLOB INCLUDES Include/*.h)
-install(FILES ${INCLUDES} DESTINATION include)
+install(FILES ${INCLUDES} DESTINATION
+ ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)
+if(MSVC)
+ install(FILES "$/Detour-d.pdb" CONFIGURATIONS "Debug" DESTINATION "lib")
+endif()
diff --git a/Detour/Include/DetourCommon.h b/Detour/Include/DetourCommon.h
index 113e8c336..d54bc7edc 100644
--- a/Detour/Include/DetourCommon.h
+++ b/Detour/Include/DetourCommon.h
@@ -37,7 +37,6 @@ feature to find minor members.
/// Used to ignore a function parameter. VS complains about unused parameters
/// and this silences the warning.
-/// @param [in] _ Unused parameter
template void dtIgnoreUnused(const T&) { }
/// Swaps the values of the two parameters.
@@ -319,7 +318,7 @@ inline float dtVdot2D(const float* u, const float* v)
/// Derives the xz-plane 2D perp product of the two vectors. (uz*vx - ux*vz)
/// @param[in] u The LHV vector [(x, y, z)]
/// @param[in] v The RHV vector [(x, y, z)]
-/// @return The dot product on the xz-plane.
+/// @return The perp dot product on the xz-plane.
///
/// The vectors are projected onto the xz-plane, so the y-values are ignored.
inline float dtVperp2D(const float* u, const float* v)
diff --git a/Detour/Include/DetourNavMesh.h b/Detour/Include/DetourNavMesh.h
index 98293c49d..4c1277d78 100644
--- a/Detour/Include/DetourNavMesh.h
+++ b/Detour/Include/DetourNavMesh.h
@@ -99,7 +99,7 @@ static const int DT_MAX_AREAS = 64;
enum dtTileFlags
{
/// The navigation mesh owns the tile memory and is responsible for freeing it.
- DT_TILE_FREE_DATA = 0x01,
+ DT_TILE_FREE_DATA = 0x01
};
/// Vertex flags returned by dtNavMeshQuery::findStraightPath.
@@ -107,32 +107,32 @@ enum dtStraightPathFlags
{
DT_STRAIGHTPATH_START = 0x01, ///< The vertex is the start position in the path.
DT_STRAIGHTPATH_END = 0x02, ///< The vertex is the end position in the path.
- DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04, ///< The vertex is the start of an off-mesh connection.
+ DT_STRAIGHTPATH_OFFMESH_CONNECTION = 0x04 ///< The vertex is the start of an off-mesh connection.
};
/// Options for dtNavMeshQuery::findStraightPath.
enum dtStraightPathOptions
{
DT_STRAIGHTPATH_AREA_CROSSINGS = 0x01, ///< Add a vertex at every polygon edge crossing where area changes.
- DT_STRAIGHTPATH_ALL_CROSSINGS = 0x02, ///< Add a vertex at every polygon edge crossing.
+ DT_STRAIGHTPATH_ALL_CROSSINGS = 0x02 ///< Add a vertex at every polygon edge crossing.
};
/// Options for dtNavMeshQuery::initSlicedFindPath and updateSlicedFindPath
enum dtFindPathOptions
{
- DT_FINDPATH_ANY_ANGLE = 0x02, ///< use raycasts during pathfind to "shortcut" (raycast still consider costs)
+ DT_FINDPATH_ANY_ANGLE = 0x02 ///< use raycasts during pathfind to "shortcut" (raycast still consider costs)
};
/// Options for dtNavMeshQuery::raycast
enum dtRaycastOptions
{
- DT_RAYCAST_USE_COSTS = 0x01, ///< Raycast should calculate movement cost along the ray and fill RaycastHit::cost
+ DT_RAYCAST_USE_COSTS = 0x01 ///< Raycast should calculate movement cost along the ray and fill RaycastHit::cost
};
enum dtDetailTriEdgeFlags
{
- DT_DETAIL_EDGE_BOUNDARY = 0x01, ///< Detail triangle edge is part of the poly boundary
+ DT_DETAIL_EDGE_BOUNDARY = 0x01 ///< Detail triangle edge is part of the poly boundary
};
@@ -146,7 +146,7 @@ enum dtPolyTypes
/// The polygon is a standard convex polygon that is part of the surface of the mesh.
DT_POLYTYPE_GROUND = 0,
/// The polygon is an off-mesh connection consisting of two vertices.
- DT_POLYTYPE_OFFMESH_CONNECTION = 1,
+ DT_POLYTYPE_OFFMESH_CONNECTION = 1
};
@@ -285,7 +285,7 @@ struct dtMeshTile
unsigned int linksFreeList; ///< Index to the next free link.
dtMeshHeader* header; ///< The tile header.
dtPoly* polys; ///< The tile polygons. [Size: dtMeshHeader::polyCount]
- float* verts; ///< The tile vertices. [Size: dtMeshHeader::vertCount]
+ float* verts; ///< The tile vertices. [(x, y, z) * dtMeshHeader::vertCount]
dtLink* links; ///< The tile links. [Size: dtMeshHeader::maxLinkCount]
dtPolyDetail* detailMeshes; ///< The tile's detail sub-meshes. [Size: dtMeshHeader::detailMeshCount]
@@ -312,8 +312,8 @@ struct dtMeshTile
};
/// Get flags for edge in detail triangle.
-/// @param triFlags[in] The flags for the triangle (last component of detail vertices above).
-/// @param edgeIndex[in] The index of the first vertex of the edge. For instance, if 0,
+/// @param[in] triFlags The flags for the triangle (last component of detail vertices above).
+/// @param[in] edgeIndex The index of the first vertex of the edge. For instance, if 0,
/// returns flags for edge AB.
inline int dtGetDetailTriEdgeFlags(unsigned char triFlags, int edgeIndex)
{
@@ -329,8 +329,8 @@ struct dtNavMeshParams
float orig[3]; ///< The world space origin of the navigation mesh's tile space. [(x, y, z)]
float tileWidth; ///< The width of each tile. (Along the x-axis.)
float tileHeight; ///< The height of each tile. (Along the z-axis.)
- int maxTiles; ///< The maximum number of tiles the navigation mesh can contain.
- int maxPolys; ///< The maximum number of polygons each tile can contain.
+ int maxTiles; ///< The maximum number of tiles the navigation mesh can contain. This and maxPolys are used to calculate how many bits are needed to identify tiles and polygons uniquely.
+ int maxPolys; ///< The maximum number of polygons each tile can contain. This and maxTiles are used to calculate how many bits are needed to identify tiles and polygons uniquely.
};
/// A navigation mesh based on tiles of convex polygons.
diff --git a/Detour/Include/DetourNavMeshQuery.h b/Detour/Include/DetourNavMeshQuery.h
index 0b40371be..101b3c852 100644
--- a/Detour/Include/DetourNavMeshQuery.h
+++ b/Detour/Include/DetourNavMeshQuery.h
@@ -152,7 +152,7 @@ struct dtRaycastHit
class dtPolyQuery
{
public:
- virtual ~dtPolyQuery() { }
+ virtual ~dtPolyQuery();
/// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons.
/// This can be called multiple times for a single query.
@@ -175,7 +175,7 @@ class dtNavMeshQuery
dtStatus init(const dtNavMesh* nav, const int maxNodes);
/// @name Standard Pathfinding Functions
- // /@{
+ /// @{
/// Finds a path from the start polygon to the end polygon.
/// @param[in] startRef The refrence id of the start polygon.
@@ -313,15 +313,31 @@ class dtNavMeshQuery
///@{
/// Finds the polygon nearest to the specified center point.
+ /// [opt] means the specified parameter can be a null pointer, in that case the output parameter will not be set.
+ ///
/// @param[in] center The center of the search box. [(x, y, z)]
- /// @param[in] halfExtents The search distance along each axis. [(x, y, z)]
+ /// @param[in] halfExtents The search distance along each axis. [(x, y, z)]
/// @param[in] filter The polygon filter to apply to the query.
- /// @param[out] nearestRef The reference id of the nearest polygon.
- /// @param[out] nearestPt The nearest point on the polygon. [opt] [(x, y, z)]
+ /// @param[out] nearestRef The reference id of the nearest polygon. Will be set to 0 if no polygon is found.
+ /// @param[out] nearestPt The nearest point on the polygon. Unchanged if no polygon is found. [opt] [(x, y, z)]
/// @returns The status flags for the query.
dtStatus findNearestPoly(const float* center, const float* halfExtents,
const dtQueryFilter* filter,
dtPolyRef* nearestRef, float* nearestPt) const;
+
+ /// Finds the polygon nearest to the specified center point.
+ /// [opt] means the specified parameter can be a null pointer, in that case the output parameter will not be set.
+ ///
+ /// @param[in] center The center of the search box. [(x, y, z)]
+ /// @param[in] halfExtents The search distance along each axis. [(x, y, z)]
+ /// @param[in] filter The polygon filter to apply to the query.
+ /// @param[out] nearestRef The reference id of the nearest polygon. Will be set to 0 if no polygon is found.
+ /// @param[out] nearestPt The nearest point on the polygon. Unchanged if no polygon is found. [opt] [(x, y, z)]
+ /// @param[out] isOverPoly Set to true if the point's X/Z coordinate lies inside the polygon, false otherwise. Unchanged if no polygon is found. [opt]
+ /// @returns The status flags for the query.
+ dtStatus findNearestPoly(const float* center, const float* halfExtents,
+ const dtQueryFilter* filter,
+ dtPolyRef* nearestRef, float* nearestPt, bool* isOverPoly) const;
/// Finds polygons that overlap the search box.
/// @param[in] center The center of the search box. [(x, y, z)]
@@ -380,9 +396,9 @@ class dtNavMeshQuery
/// @param[in] startPos A position within the start polygon representing
/// the start of the ray. [(x, y, z)]
/// @param[in] endPos The position to cast the ray toward. [(x, y, z)]
+ /// @param[in] filter The polygon filter to apply to the query.
/// @param[out] t The hit parameter. (FLT_MAX if no wall hit.)
/// @param[out] hitNormal The normal of the nearest wall hit. [(x, y, z)]
- /// @param[in] filter The polygon filter to apply to the query.
/// @param[out] path The reference ids of the visited polygons. [opt]
/// @param[out] pathCount The number of visited polygons. [opt]
/// @param[in] maxPath The maximum number of polygons the @p path array can hold.
@@ -398,7 +414,7 @@ class dtNavMeshQuery
/// the start of the ray. [(x, y, z)]
/// @param[in] endPos The position to cast the ray toward. [(x, y, z)]
/// @param[in] filter The polygon filter to apply to the query.
- /// @param[in] flags govern how the raycast behaves. See dtRaycastOptions
+ /// @param[in] options govern how the raycast behaves. See dtRaycastOptions
/// @param[out] hit Pointer to a raycast hit structure which will be filled by the results.
/// @param[in] prevRef parent of start ref. Used during for cost calculation [opt]
/// @returns The status flags for the query.
@@ -449,6 +465,7 @@ class dtNavMeshQuery
/// The location is not exactly constrained by the circle, but it limits the visited polygons.
/// @param[in] startRef The reference id of the polygon where the search starts.
/// @param[in] centerPos The center of the search circle. [(x, y, z)]
+ /// @param[in] maxRadius The radius of the search circle. [Units: wu]
/// @param[in] filter The polygon filter to apply to the query.
/// @param[in] frand Function returning a random number [0..1).
/// @param[out] randomRef The reference id of the random location.
diff --git a/Detour/Include/DetourNode.h b/Detour/Include/DetourNode.h
index db0974708..8918d4686 100644
--- a/Detour/Include/DetourNode.h
+++ b/Detour/Include/DetourNode.h
@@ -25,7 +25,7 @@ enum dtNodeFlags
{
DT_NODE_OPEN = 0x01,
DT_NODE_CLOSED = 0x02,
- DT_NODE_PARENT_DETACHED = 0x04, // parent of the node is not adjacent. Found using raycast.
+ DT_NODE_PARENT_DETACHED = 0x04 // parent of the node is not adjacent. Found using raycast.
};
typedef unsigned short dtNodeIndex;
diff --git a/Detour/Source/DetourNavMesh.cpp b/Detour/Source/DetourNavMesh.cpp
index a655d1d89..2240526eb 100644
--- a/Detour/Source/DetourNavMesh.cpp
+++ b/Detour/Source/DetourNavMesh.cpp
@@ -433,8 +433,8 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side)
float tmax = (neia[k*2+1]-va[2]) / (vb[2]-va[2]);
if (tmin > tmax)
dtSwap(tmin,tmax);
- link->bmin = (unsigned char)(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
- link->bmax = (unsigned char)(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
+ link->bmin = (unsigned char)roundf(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
+ link->bmax = (unsigned char)roundf(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
}
else if (dir == 2 || dir == 6)
{
@@ -442,8 +442,8 @@ void dtNavMesh::connectExtLinks(dtMeshTile* tile, dtMeshTile* target, int side)
float tmax = (neia[k*2+1]-va[0]) / (vb[0]-va[0]);
if (tmin > tmax)
dtSwap(tmin,tmax);
- link->bmin = (unsigned char)(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
- link->bmax = (unsigned char)(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
+ link->bmin = (unsigned char)roundf(dtClamp(tmin, 0.0f, 1.0f)*255.0f);
+ link->bmax = (unsigned char)roundf(dtClamp(tmax, 0.0f, 1.0f)*255.0f);
}
}
}
@@ -914,6 +914,13 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags,
return DT_FAILURE | DT_WRONG_MAGIC;
if (header->version != DT_NAVMESH_VERSION)
return DT_FAILURE | DT_WRONG_VERSION;
+
+#ifndef DT_POLYREF64
+ // Do not allow adding more polygons than specified in the NavMesh's maxPolys constraint.
+ // Otherwise, the poly ID cannot be represented with the given number of bits.
+ if (m_polyBits < dtIlog2(dtNextPow2((unsigned int)header->polyCount)))
+ return DT_FAILURE | DT_INVALID_PARAM;
+#endif
// Make sure the location is free.
if (getTileAt(header->x, header->y, header->layer))
diff --git a/Detour/Source/DetourNavMeshQuery.cpp b/Detour/Source/DetourNavMeshQuery.cpp
index 839ee1e81..cebe26b5d 100644
--- a/Detour/Source/DetourNavMeshQuery.cpp
+++ b/Detour/Source/DetourNavMeshQuery.cpp
@@ -117,6 +117,11 @@ void dtFreeNavMeshQuery(dtNavMeshQuery* navmesh)
dtFree(navmesh);
}
+dtPolyQuery::~dtPolyQuery()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
//////////////////////////////////////////////////////////////////////////////////////////
/// @class dtNavMeshQuery
@@ -301,11 +306,7 @@ dtStatus dtNavMeshQuery::findRandomPoint(const dtQueryFilter* filter, float (*fr
float pt[3];
dtRandomPointInConvexPoly(verts, poly->vertCount, areas, s, t, pt);
- float h = 0.0f;
- dtStatus status = getPolyHeight(polyRef, pt, &h);
- if (dtStatusFailed(status))
- return status;
- pt[1] = h;
+ closestPointOnPoly(polyRef, pt, pt, NULL);
dtVcopy(randomPt, pt);
*randomRef = polyRef;
@@ -488,16 +489,12 @@ dtStatus dtNavMeshQuery::findRandomPointAroundCircle(dtPolyRef startRef, const f
float pt[3];
dtRandomPointInConvexPoly(verts, randomPoly->vertCount, areas, s, t, pt);
- float h = 0.0f;
- dtStatus stat = getPolyHeight(randomPolyRef, pt, &h);
- if (dtStatusFailed(status))
- return stat;
- pt[1] = h;
+ closestPointOnPoly(randomPolyRef, pt, pt, NULL);
dtVcopy(randomPt, pt);
*randomRef = randomPolyRef;
- return DT_SUCCESS;
+ return status;
}
@@ -630,15 +627,19 @@ class dtFindNearestPolyQuery : public dtPolyQuery
float m_nearestDistanceSqr;
dtPolyRef m_nearestRef;
float m_nearestPoint[3];
+ bool m_overPoly;
public:
dtFindNearestPolyQuery(const dtNavMeshQuery* query, const float* center)
- : m_query(query), m_center(center), m_nearestDistanceSqr(FLT_MAX), m_nearestRef(0), m_nearestPoint()
+ : m_query(query), m_center(center), m_nearestDistanceSqr(FLT_MAX), m_nearestRef(0), m_nearestPoint(), m_overPoly(false)
{
}
+ virtual ~dtFindNearestPolyQuery();
+
dtPolyRef nearestRef() const { return m_nearestRef; }
const float* nearestPoint() const { return m_nearestPoint; }
+ bool isOverPoly() const { return m_overPoly; }
void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count)
{
@@ -672,11 +673,17 @@ class dtFindNearestPolyQuery : public dtPolyQuery
m_nearestDistanceSqr = d;
m_nearestRef = ref;
+ m_overPoly = posOverPoly;
}
}
}
};
+dtFindNearestPolyQuery::~dtFindNearestPolyQuery()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
/// @par
///
/// @note If the search box does not intersect any polygons the search will
@@ -686,6 +693,15 @@ class dtFindNearestPolyQuery : public dtPolyQuery
dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* halfExtents,
const dtQueryFilter* filter,
dtPolyRef* nearestRef, float* nearestPt) const
+{
+ return findNearestPoly(center, halfExtents, filter, nearestRef, nearestPt, NULL);
+}
+
+// If center and nearestPt point to an equal position, isOverPoly will be true;
+// however there's also a special case of climb height inside the polygon (see dtFindNearestPolyQuery)
+dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* halfExtents,
+ const dtQueryFilter* filter,
+ dtPolyRef* nearestRef, float* nearestPt, bool* isOverPoly) const
{
dtAssert(m_nav);
@@ -704,7 +720,11 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* halfE
// Only override nearestPt if we actually found a poly so the nearest point
// is valid.
if (nearestPt && *nearestRef)
+ {
dtVcopy(nearestPt, query.nearestPoint());
+ if (isOverPoly)
+ *isOverPoly = query.isOverPoly();
+ }
return DT_SUCCESS;
}
@@ -839,6 +859,8 @@ class dtCollectPolysQuery : public dtPolyQuery
{
}
+ virtual ~dtCollectPolysQuery();
+
int numCollected() const { return m_numCollected; }
bool overflowed() const { return m_overflow; }
@@ -860,6 +882,11 @@ class dtCollectPolysQuery : public dtPolyQuery
}
};
+dtCollectPolysQuery::~dtCollectPolysQuery()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
/// @par
///
/// If no polygons are found, the function will return #DT_SUCCESS with a
diff --git a/DetourCrowd/CMakeLists.txt b/DetourCrowd/CMakeLists.txt
index 73cdf7ce8..6ecd0ddeb 100644
--- a/DetourCrowd/CMakeLists.txt
+++ b/DetourCrowd/CMakeLists.txt
@@ -1,12 +1,8 @@
file(GLOB SOURCES Source/*.cpp)
-
-if (RECASTNAVIGATION_STATIC)
- add_library(DetourCrowd STATIC ${SOURCES})
-else ()
- add_library(DetourCrowd SHARED ${SOURCES})
-endif ()
+add_library(DetourCrowd ${SOURCES})
add_library(RecastNavigation::DetourCrowd ALIAS DetourCrowd)
+set_target_properties(DetourCrowd PROPERTIES DEBUG_POSTFIX -d)
set(DetourCrowd_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
@@ -20,14 +16,22 @@ target_link_libraries(DetourCrowd
set_target_properties(DetourCrowd PROPERTIES
SOVERSION ${SOVERSION}
- VERSION ${VERSION}
+ VERSION ${LIB_VERSION}
+ COMPILE_PDB_OUTPUT_DIRECTORY .
+ COMPILE_PDB_NAME "DetourCrowd-d"
)
install(TARGETS DetourCrowd
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- COMPONENT library
+ EXPORT recastnavigation-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation
)
file(GLOB INCLUDES Include/*.h)
-install(FILES ${INCLUDES} DESTINATION include)
+install(FILES ${INCLUDES} DESTINATION
+ ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)
+if(MSVC)
+ install(FILES "$/DetourCrowd-d.pdb" CONFIGURATIONS "Debug" DESTINATION "lib")
+endif()
diff --git a/DetourCrowd/Include/DetourCrowd.h b/DetourCrowd/Include/DetourCrowd.h
index 952050878..854546fc1 100644
--- a/DetourCrowd/Include/DetourCrowd.h
+++ b/DetourCrowd/Include/DetourCrowd.h
@@ -66,7 +66,7 @@ enum CrowdAgentState
{
DT_CROWDAGENT_STATE_INVALID, ///< The agent is not in a valid state.
DT_CROWDAGENT_STATE_WALKING, ///< The agent is traversing a normal navigation mesh polygon.
- DT_CROWDAGENT_STATE_OFFMESH, ///< The agent is traversing an off-mesh connection.
+ DT_CROWDAGENT_STATE_OFFMESH ///< The agent is traversing an off-mesh connection.
};
/// Configuration parameters for a crowd agent.
@@ -108,7 +108,7 @@ enum MoveRequestState
DT_CROWDAGENT_TARGET_REQUESTING,
DT_CROWDAGENT_TARGET_WAITING_FOR_QUEUE,
DT_CROWDAGENT_TARGET_WAITING_FOR_PATH,
- DT_CROWDAGENT_TARGET_VELOCITY,
+ DT_CROWDAGENT_TARGET_VELOCITY
};
/// Represents an agent managed by a #dtCrowd object.
@@ -188,7 +188,7 @@ enum UpdateFlags
DT_CROWD_OBSTACLE_AVOIDANCE = 2,
DT_CROWD_SEPARATION = 4,
DT_CROWD_OPTIMIZE_VIS = 8, ///< Use #dtPathCorridor::optimizePathVisibility() to optimize the agent path.
- DT_CROWD_OPTIMIZE_TOPO = 16, ///< Use dtPathCorridor::optimizePathTopology() to optimize the agent path.
+ DT_CROWD_OPTIMIZE_TOPO = 16 ///< Use dtPathCorridor::optimizePathTopology() to optimize the agent path.
};
struct dtCrowdAgentDebugInfo
diff --git a/DetourCrowd/Source/DetourCrowd.cpp b/DetourCrowd/Source/DetourCrowd.cpp
index 1e76e40ce..3f0311f7f 100644
--- a/DetourCrowd/Source/DetourCrowd.cpp
+++ b/DetourCrowd/Source/DetourCrowd.cpp
@@ -1409,12 +1409,14 @@ void dtCrowd::update(const float dt, dtCrowdAgentDebugInfo* debug)
}
// Update agents using off-mesh connection.
- for (int i = 0; i < m_maxAgents; ++i)
+ for (int i = 0; i < nagents; ++i)
{
- dtCrowdAgentAnimation* anim = &m_agentAnims[i];
+ dtCrowdAgent* ag = agents[i];
+ const int idx = (int)(ag - m_agents);
+ dtCrowdAgentAnimation* anim = &m_agentAnims[idx];
if (!anim->active)
continue;
- dtCrowdAgent* ag = agents[i];
+
anim->t += dt;
if (anim->t > anim->tmax)
diff --git a/DetourTileCache/CMakeLists.txt b/DetourTileCache/CMakeLists.txt
index 121b8edcc..fcd23d5b1 100644
--- a/DetourTileCache/CMakeLists.txt
+++ b/DetourTileCache/CMakeLists.txt
@@ -1,12 +1,8 @@
file(GLOB SOURCES Source/*.cpp)
-
-if (RECASTNAVIGATION_STATIC)
- add_library(DetourTileCache STATIC ${SOURCES})
-else ()
- add_library(DetourTileCache SHARED ${SOURCES})
-endif ()
+add_library(DetourTileCache ${SOURCES})
add_library(RecastNavigation::DetourTileCache ALIAS DetourTileCache)
+set_target_properties(DetourTileCache PROPERTIES DEBUG_POSTFIX -d)
set(DetourTileCache_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
@@ -20,15 +16,23 @@ target_link_libraries(DetourTileCache
set_target_properties(DetourTileCache PROPERTIES
SOVERSION ${SOVERSION}
- VERSION ${VERSION}
+ VERSION ${LIB_VERSION}
+ COMPILE_PDB_OUTPUT_DIRECTORY .
+ COMPILE_PDB_NAME "DetourTileCache-d"
)
install(TARGETS DetourTileCache
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- COMPONENT library
+ EXPORT recastnavigation-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation
)
file(GLOB INCLUDES Include/*.h)
-install(FILES ${INCLUDES} DESTINATION include)
+install(FILES ${INCLUDES} DESTINATION
+ ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)
+if(MSVC)
+ install(FILES "$/DetourTileCache-d.pdb" CONFIGURATIONS "Debug" DESTINATION "lib")
+endif()
diff --git a/DetourTileCache/Include/DetourTileCache.h b/DetourTileCache/Include/DetourTileCache.h
index 75713366d..0d346f17c 100644
--- a/DetourTileCache/Include/DetourTileCache.h
+++ b/DetourTileCache/Include/DetourTileCache.h
@@ -3,16 +3,13 @@
#include "DetourStatus.h"
-
-
typedef unsigned int dtObstacleRef;
-
typedef unsigned int dtCompressedTileRef;
/// Flags for addTile
enum dtCompressedTileFlags
{
- DT_COMPRESSEDTILE_FREE_DATA = 0x01, ///< Navmesh owns the tile memory and should free it.
+ DT_COMPRESSEDTILE_FREE_DATA = 0x01 ///< Navmesh owns the tile memory and should free it.
};
struct dtCompressedTile
@@ -32,14 +29,14 @@ enum ObstacleState
DT_OBSTACLE_EMPTY,
DT_OBSTACLE_PROCESSING,
DT_OBSTACLE_PROCESSED,
- DT_OBSTACLE_REMOVING,
+ DT_OBSTACLE_REMOVING
};
enum ObstacleType
{
DT_OBSTACLE_CYLINDER,
DT_OBSTACLE_BOX, // AABB
- DT_OBSTACLE_ORIENTED_BOX, // OBB
+ DT_OBSTACLE_ORIENTED_BOX // OBB
};
struct dtObstacleCylinder
@@ -97,13 +94,10 @@ struct dtTileCacheParams
struct dtTileCacheMeshProcess
{
- virtual ~dtTileCacheMeshProcess() { }
-
- virtual void process(struct dtNavMeshCreateParams* params,
- unsigned char* polyAreas, unsigned short* polyFlags) = 0;
+ virtual ~dtTileCacheMeshProcess();
+ virtual void process(struct dtNavMeshCreateParams* params, unsigned char* polyAreas, unsigned short* polyFlags) = 0;
};
-
class dtTileCache
{
public:
@@ -219,7 +213,7 @@ class dtTileCache
enum ObstacleRequestAction
{
REQUEST_ADD,
- REQUEST_REMOVE,
+ REQUEST_REMOVE
};
struct ObstacleRequest
diff --git a/DetourTileCache/Include/DetourTileCacheBuilder.h b/DetourTileCache/Include/DetourTileCacheBuilder.h
index ff6109193..9a6844c65 100644
--- a/DetourTileCache/Include/DetourTileCacheBuilder.h
+++ b/DetourTileCache/Include/DetourTileCacheBuilder.h
@@ -78,7 +78,7 @@ struct dtTileCachePolyMesh
struct dtTileCacheAlloc
{
- virtual ~dtTileCacheAlloc() {}
+ virtual ~dtTileCacheAlloc();
virtual void reset() {}
@@ -95,7 +95,7 @@ struct dtTileCacheAlloc
struct dtTileCacheCompressor
{
- virtual ~dtTileCacheCompressor() { }
+ virtual ~dtTileCacheCompressor();
virtual int maxCompressedSize(const int bufferSize) = 0;
virtual dtStatus compress(const unsigned char* buffer, const int bufferSize,
diff --git a/DetourTileCache/Source/DetourTileCache.cpp b/DetourTileCache/Source/DetourTileCache.cpp
index a82cd1350..6f97ab5b7 100644
--- a/DetourTileCache/Source/DetourTileCache.cpp
+++ b/DetourTileCache/Source/DetourTileCache.cpp
@@ -239,6 +239,11 @@ const dtTileCacheObstacle* dtTileCache::getObstacleByRef(dtObstacleRef ref)
return ob;
}
+dtTileCacheMeshProcess::~dtTileCacheMeshProcess()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
dtStatus dtTileCache::addTile(unsigned char* data, const int dataSize, unsigned char flags, dtCompressedTileRef* result)
{
// Make sure the data is in right format.
diff --git a/DetourTileCache/Source/DetourTileCacheBuilder.cpp b/DetourTileCache/Source/DetourTileCacheBuilder.cpp
index 21a59f1a6..796e165d3 100644
--- a/DetourTileCache/Source/DetourTileCacheBuilder.cpp
+++ b/DetourTileCache/Source/DetourTileCacheBuilder.cpp
@@ -23,6 +23,15 @@
#include "DetourTileCacheBuilder.h"
#include
+dtTileCacheAlloc::~dtTileCacheAlloc()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
+dtTileCacheCompressor::~dtTileCacheCompressor()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
template class dtFixedArray
{
@@ -1399,7 +1408,6 @@ static void pushBack(unsigned short v, unsigned short* arr, int& an)
static bool canRemoveVertex(dtTileCachePolyMesh& mesh, const unsigned short rem)
{
// Count number of polygons to remove.
- int numRemovedVerts = 0;
int numTouchedVerts = 0;
int numRemainingEdges = 0;
for (int i = 0; i < mesh.npolys; ++i)
@@ -1419,7 +1427,6 @@ static bool canRemoveVertex(dtTileCachePolyMesh& mesh, const unsigned short rem)
}
if (numRemoved)
{
- numRemovedVerts += numRemoved;
numRemainingEdges += numVerts-(numRemoved+1);
}
}
diff --git a/Docs/Conceptual/license_c.txt b/Docs/Conceptual/license_c.txt
deleted file mode 100644
index c2a3c1e85..000000000
--- a/Docs/Conceptual/license_c.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-
-/**
-@page License License
-
-
-Copyright (c) 2009-2011 Mikko Mononen memon@inside.org
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source distribution.
-
-
-*/
\ No newline at end of file
diff --git a/Docs/Conceptual/mainpage_c.txt b/Docs/Conceptual/mainpage_c.txt
deleted file mode 100644
index 14dd1cf8f..000000000
--- a/Docs/Conceptual/mainpage_c.txt
+++ /dev/null
@@ -1,109 +0,0 @@
-/// @mainpage Recast Navigation
-///
-/// @image html recast_intro.png
-///
-///
Recast
-///
-/// _Recast_ is a state of the art navigation mesh construction toolset for
-/// games.
-///
-/// - It is automatic, which means that you can throw any level
-/// geometry at it and you will get a robust mesh out.
-/// - It is fast, which means swift turnaround times for level designers.
-/// - It is open source, so it comes with full source and you can
-/// customize it to your hearts content.
-///
-/// The latest version can be found on
-/// GitHub.
-///
-/// The _Recast_ process starts with constructing a voxel mold from level
-/// geometry and then casting a navigation mesh over it. The process
-/// consists of three steps: building the voxel mold, partitioning the
-/// mold into simple regions, and triangulating the regions as simple polygons.
-///
-/// -# The voxel mold is built from the input triangle mesh by
-/// rasterizing the triangles into a multi-layer heightfield. Some
-/// simple filters are then applied to the mold to prune out locations
-/// where the character would not be able to move.
-/// -# The walkable areas described by the mold are divided into simple
-/// overlayed 2D regions. The resulting regions have only one
-/// non-overlapping contour, which simplifies the final step of the
-/// process tremendously.
-/// -# The navigation polygons are generated from the regions by first
-/// tracing the boundaries and then simplifying them. The resulting
-/// polygons are finally converted to convex polygons which makes them
-/// perfect for pathfinding and spatial reasoning about the level.
-///
-///
Detour
-///
-/// _Recast_ is accompanied by _Detour_, a path-finding and spatial reasoning
-/// toolkit. You can use any navigation mesh with _Detour_, but of course
-/// the data generated by _Recast_ fits perfectly.
-///
-/// _Detour_ offers a simple static navigation mesh that is suitable for
-/// many simple cases, as well as a tiled navigation mesh that allows you
-/// to add and remove pieces of the mesh. The tiled mesh allows you to
-/// create systems where you stream new navigation data in and out as
-/// the player progresses the level, or regenerate tiles as the
-/// world changes.
-///
-///
Recast Demo
-///
-/// You can find a comprehensive demo project in the `RecastDemo` folder. It
-/// is a kitchen sink demo containing all the major functionality of the library.
-/// If you are new to _Recast_ & _Detour_, check out
-///
-/// Sample_SoloMesh.cpp to get started with building navmeshes and
-///
-/// NavMeshTesterTool.cpp to see how _Detour_ can be used to find paths.
-///
-///
Building RecastDemo
-///
-/// RecastDemo uses [premake5](http://premake.github.io/) to build platform specific projects.
-/// Download it and make sure it's available on your path, or specify the path to it.
-///
-///
Linux
-///
-/// - Install SDl2 and its dependencies according to your distro's guidelines.
-/// - run `premake5 gmake` from the `RecastDemo` folder.
-/// - `cd Build/gmake` then `make`
-/// - Run `RecastDemo\Bin\RecastDemo`
-///
-///
OSX
-///
-/// - Grab the latest SDL2 development library dmg from [here](https://www.libsdl.org/download-2.0.php) and place `SDL2.framework` in `/Library/Frameworks/`
-/// - Navigate to the `RecastDemo` folder and run `premake5 xcode4`
-/// - Open `Build/xcode4/recastnavigation.xcworkspace`
-/// - Select the "RecastDemo" project in the left pane, go to the "BuildPhases" tab and expand "Link Binary With Libraries"
-/// - Remove the existing entry for SDL2 (it should have a white box icon) and re-add it by hitting the plus, selecting "Add Other", and selecting `/Library/Frameworks/SDL2.framework`. It should now have a suitcase icon.
-/// - Set the RecastDemo project as the target and build.
-///
-///
Windows
-///
-/// - Grab the latest SDL2 development library release from [here](https://www.libsdl.org/download-2.0.php) and unzip it `RecastDemo\Contrib`. Rename the SDL folder such that the path `RecastDemo\Contrib\SDL\lib\x86` is valid.
-/// - Run `"premake5" vs2015` from the `RecastDemo` folder
-/// - Open the solution, build, and run.
-///
-///
Integrating With Your Own Project
-///
-/// It is recommended to add the source directories `DebugUtils`, `Detour`,
-/// `DetourCrowd`, `DetourTileCache`, and `Recast` into your own project
-/// depending on which parts of the project you need. For example your
-/// level building tool could include `DebugUtils`, `Recast`, and `Detour`,
-/// and your game runtime could just include `Detour`.
-///
-///
Contributing
-/// All development is centralized in github. Check out the Contributing Guidelines for more information.
-///
-///
-///
-/// _Recast Navigation_ is licensed under the ZLib license.
-///
diff --git a/Docs/DoxygenLayout.xml b/Docs/DoxygenLayout.xml
index b20079c91..db963bbaf 100644
--- a/Docs/DoxygenLayout.xml
+++ b/Docs/DoxygenLayout.xml
@@ -107,7 +107,7 @@
-
+
diff --git a/Docs/Extern/Recast_api.txt b/Docs/Extern/Recast_api.txt
index f6ff06444..6cd4c63f1 100644
--- a/Docs/Extern/Recast_api.txt
+++ b/Docs/Extern/Recast_api.txt
@@ -28,9 +28,6 @@ The general life-cycle of the main classes is as follows:
-# Use the object as part of the pipeline.
-# Free the object using the Recast allocator. (E.g. #rcFreeHeightField)
-@note This is a summary list of members. Use the index or search
-feature to find minor members.
-
@struct rcConfig
@par
@@ -51,6 +48,10 @@ the platform's floating point accuraccy as well as interdependencies between
the values of multiple parameters. See the individual parameter
documentation for details.
+@note First you should decide the size of your agent's logical cylinder.
+If your game world uses meters as units, a reasonable starting point for
+a human-sized agent might be a radius of `0.4` and a height of `2.0`.
+
@var rcConfig::borderSize
@par
@@ -66,7 +67,24 @@ This field is only used when building multi-tile meshes.
@var rcConfig::cs
@par
-@p cs and #ch define voxel/grid/cell size. So their values have significant
+The voxelization cell size #cs defines the voxel size along both axes of
+the ground plane: x and z in Recast. This value is usually derived from the
+character radius `r`. A recommended starting value for #cs is either `r/2`
+or `r/3`. Smaller values of #cs will increase rasterization resolution and
+navmesh detail, but total generation time will increase exponentially. In
+outdoor environments, `r/2` is often good enough. For indoor scenes with
+tight spaces you might want the extra precision, so a value of `r/3` or
+smaller may give better results.
+
+The initial instinct is to reduce this value to something very close to zero
+to maximize the detail of the generated navmesh. This quickly becomes a case
+of diminishing returns, however. Beyond a certain point there's usually not
+much perceptable difference in the generated navmesh, but huge increases in
+generation time. This hinders your ability to quickly iterate on level
+designs and provides little benefit. The general recommendation here is to
+use as large a value for #cs as you can get away with.
+
+#cs and #ch define voxel/grid/cell size. So their values have significant
side effects on all parameters defined in voxel units.
The minimum value for this parameter depends on the platform's floating point
@@ -75,7 +93,15 @@ accuracy, with the practical minimum usually around 0.05.
@var rcConfig::ch
@par
-#cs and @p ch define voxel/grid/cell size. So their values have significant
+The voxelization cell height #ch is defined separately in order to allow for
+greater precision in height tests. A good starting point for #ch is half the
+#cs value. Smaller #ch values ensure that the navmesh properly connects areas
+that are only separated by a small curb or ditch. If small holes are generated
+in your navmesh around where there are discontinuities in height (for example,
+stairs or curbs), you may want to decrease the cell height value to increase
+the vertical rasterization precision of Recast.
+
+#cs and #ch define voxel/grid/cell size. So their values have significant
side effects on all parameters defined in voxel units.
The minimum value for this parameter depends on the platform's floating point
@@ -84,44 +110,106 @@ accuracy, with the practical minimum usually around 0.05.
@var rcConfig::walkableSlopeAngle
@par
+The parameter #walkableSlopeAngle is to filter out areas of the world where
+the ground slope would be too steep for an agent to traverse. This value is
+defined as a maximum angle in degrees that the surface normal of a polgyon
+can differ from the world's up vector. This value must be within the range
+`[0, 90]`.
+
The practical upper limit for this parameter is usually around 85 degrees.
@var rcConfig::walkableHeight
@par
+This value defines the worldspace height `h` of the agent in voxels. Th value
+of #walkableHeight should be calculated as `ceil(h / ch)`. Note this is based
+on #ch not #cs since it's a height value.
+
Permits detection of overhangs in the source geometry that make the geometry
below un-walkable. The value is usually set to the maximum agent height.
@var rcConfig::walkableClimb
@par
+The #walkableClimb value defines the maximum height of ledges and steps that
+the agent can walk up. Given a designer-defined `maxClimb` distance in world
+units, the value of #walkableClimb should be calculated as `ceil(maxClimb / ch)`.
+Note that this is using #ch not #cs because it's a height-based value.
+
Allows the mesh to flow over low lying obstructions such as curbs and
up/down stairways. The value is usually set to how far up/down an agent can step.
@var rcConfig::walkableRadius
@par
+The parameter #walkableRadius defines the worldspace agent radius `r` in voxels.
+Most often, this value of #walkableRadius should be calculated as `ceil(r / cs)`.
+Note this is based on #cs since the agent radius is always parallel to the ground
+plane.
+
+If the #walkableRadius value is greater than zero, the edges of the navmesh will
+be pushed away from all obstacles by this amount.
+
+A non-zero #walkableRadius allows for much simpler runtime navmesh collision checks.
+The game only needs to check that the center point of the agent is contained within
+a navmesh polygon. Without this erosion, runtime navigation checks need to collide
+the geometric projection of the agent's logical cylinder onto the navmesh with the
+boundary edges of the navmesh polygons.
+
In general, this is the closest any part of the final mesh should get to an
obstruction in the source geometry. It is usually set to the maximum
agent radius.
-While a value of zero is legal, it is not recommended and can result in
-odd edge case issues.
+If you want to have tight-fitting navmesh, or want to reuse the same navmesh for
+multiple agents with differing radii, you can use a `walkableRadius` value of zero.
+Be advised though that you will need to perform your own collisions with the navmesh
+edges, and odd edge cases issues in the mesh generation can potentially occur. For
+these reasons, specifying a radius of zero is allowed but is not recommended.
@var rcConfig::maxEdgeLen
@par
+In certain cases, long outer edges may decrease the quality of the resulting
+triangulation, creating very long thin triangles. This can sometimes be
+remedied by limiting the maximum edge length, causing the problematic long
+edges to be broken up into smaller segments.
+
+The parameter #maxEdgeLen defines the maximum edge length and is defined in
+terms of voxels. A good value for #maxEdgeLen is something like
+`walkableRadius * 8`. A good way to adjust this value is to first set it really
+high and see if your data creates long edges. If it does, decrease #maxEdgeLen
+until you find the largest value which improves the resulting tesselation.
+
Extra vertices will be inserted as needed to keep contour edges below this
length. A value of zero effectively disables this feature.
@var rcConfig::maxSimplificationError
@par
+When the rasterized areas are converted back to a vectorized representation,
+the #maxSimplificationError describes how loosely the simplification is done.
+The simplification process uses the
+Ramer–Douglas-Peucker algorithm,
+and this value describes the max deviation in voxels.
+
+Good values for #maxSimplificationError are in the range `[1.1, 1.5]`.
+A value of `1.3` is a good starting point and usually yields good results.
+If the value is less than `1.1`, some sawtoothing starts to appear at the
+generated edges. If the value is more than `1.5`, the mesh simplification
+starts to cut some corners it shouldn't.
+
The effect of this parameter only applies to the xz-plane.
@var rcConfig::minRegionArea
@par
+Watershed partitioning is really prone to noise in the input distance field.
+In order to get nicer areas, the areas are merged and small disconnected areas
+are removed after the water shed partitioning. The parameter #minRegionArea
+describes the minimum isolated region size that is still kept. A region is
+removed if the number of voxels in the region is less than the square of
+#minRegionArea.
+
Any regions that are smaller than this area will be marked as unwalkable.
This is useful in removing useless regions that can sometimes form on
geometry such as table tops, box tops, etc.
@@ -132,6 +220,13 @@ geometry such as table tops, box tops, etc.
If the mesh data is to be used to construct a Detour navigation mesh, then the upper limit
is limited to <= #DT_VERTS_PER_POLYGON.
+@var rcConfig::mergeRegionArea
+@par
+
+The triangulation process works best with small, localized voxel regions.
+The parameter #mergeRegionArea controls the maximum voxel area of a region
+that is allowed to be merged with another region. If you see small patches
+missing here and there, you could lower the #minRegionArea value.
@struct rcHeightfield
@par
diff --git a/Docs/Images/recast_intro.png b/Docs/Images/recast_intro.png
deleted file mode 100644
index ad18ac610..000000000
Binary files a/Docs/Images/recast_intro.png and /dev/null differ
diff --git a/RecastDemo/screenshot.png b/Docs/Images/screenshot.png
similarity index 100%
rename from RecastDemo/screenshot.png
rename to Docs/Images/screenshot.png
diff --git a/Docs/Readme.txt b/Docs/Readme.txt
index be153b94b..3bf89fa8d 100644
--- a/Docs/Readme.txt
+++ b/Docs/Readme.txt
@@ -7,11 +7,6 @@ Directory Layout
High level content and format files. (E.g. css, header, footer.)
-./Conceptual
-
- Conceptual (non-api) documentation such as overviews, how-to's, etc.
- The main index page content is also in this directory.
-
./Extern
API documentation that is located outside the source files.
diff --git a/Docs/doxygen-awesome-css/LICENSE b/Docs/doxygen-awesome-css/LICENSE
new file mode 100644
index 000000000..1d8b99a95
--- /dev/null
+++ b/Docs/doxygen-awesome-css/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 jothepro
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/Docs/doxygen-awesome-css/README.md b/Docs/doxygen-awesome-css/README.md
new file mode 100644
index 000000000..5b07c9239
--- /dev/null
+++ b/Docs/doxygen-awesome-css/README.md
@@ -0,0 +1,124 @@
+# Doxygen Awesome
+
+[](https://github.com/jothepro/doxygen-awesome-css/releases/latest)
+[](https://github.com/jothepro/doxygen-awesome-css/blob/main/LICENSE)
+
+
+
+
+
+
+
+
+**Doxygen Awesome** is a custom **CSS theme for Doxygen HTML-documentation** with lots of customization parameters.
+
+## Motivation
+
+I really like how the Doxygen HTML-documentation is structured! But IMHO it looks a bit outdated.
+
+This theme is an attempt to update the visuals of Doxygen without changing its overall layout too much.
+
+## Features
+
+- 🌈 Clean, modern design
+- 🚀 Heavily customizable by adjusting CSS-variables
+- 🧩 No changes to the HTML structure of Doxygen required
+- 📱 Improved mobile usability
+- 🌘 Dark mode support!
+- 🥇 Works best with **doxygen 1.9.1** - **1.9.4**
+
+## Examples
+
+Some websites using this theme:
+
+- [Documentation of this repository](https://jothepro.github.io/doxygen-awesome-css/)
+- [wxWidgets](https://docs.wxwidgets.org/3.2/)
+- [OpenCV 5.x](https://docs.opencv.org/5.x/)
+- [Zephyr](https://docs.zephyrproject.org/latest/doxygen/html/index.html)
+- [FELTOR](https://mwiesenberger.github.io/feltor/dg/html/modules.html)
+- [Spatial Audio Framework (SAF)](https://leomccormack.github.io/Spatial_Audio_Framework/index.html)
+- [libCloudSync](https://jothepro.github.io/libCloudSync/)
+- [libsl3](https://a4z.github.io/libsl3/)
+
+## Installation
+
+To use the theme in your documentation, copy the required CSS and JS files from this repository into your project or add the repository as submodule and check out the latest release:
+
+```bash
+git submodule add https://github.com/jothepro/doxygen-awesome-css.git
+cd doxygen-awesome-css
+git checkout v2.1.0
+```
+
+All theme files are located in the root of this repository and start with the prefix `doxygen-awesome-`. You may not need all of them. Follow the install instructions to figure out what files are required for your setup.
+
+### Choosing a layout
+
+There is two layout options. Choose one of them and configure Doxygen accordingly:
+
+
Project Home
- | Licence: ZLib
- | Copyright (c) 2009-2014 Mikko Mononen
+ | Licence (ZLib)
+ | Copyright 2009 Mikko Mononen
diff --git a/Doxyfile b/Doxyfile
index e175a45cc..920937bfd 100644
--- a/Doxyfile
+++ b/Doxyfile
@@ -1,4 +1,4 @@
-# Doxyfile 1.8.10
+# Doxyfile 1.9.5
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -12,16 +12,26 @@
# For lists, items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").
+#
+# Note:
+#
+# Use doxygen to compare the used configuration file with the template
+# configuration file:
+# doxygen -x [configFile]
+# Use doxygen to compare the used configuration file with the template
+# configuration file without replacing the environment variables or CMake type
+# replacement variables:
+# doxygen -x_noenv [configFile]
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all text
-# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
-# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
-# for the list of possible encodings.
+# This tag specifies the encoding used for all characters in the configuration
+# file that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
# The default value is: UTF-8.
DOXYFILE_ENCODING = UTF-8
@@ -38,7 +48,7 @@ PROJECT_NAME = "Recast Navigation"
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER =
+PROJECT_NUMBER =
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
@@ -51,7 +61,7 @@ PROJECT_BRIEF = "Navigation-mesh Toolset for Games"
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
-PROJECT_LOGO =
+PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
@@ -60,16 +70,28 @@ PROJECT_LOGO =
OUTPUT_DIRECTORY = Docs
-# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
-# directories (in 2 levels) under the output directory of each output format and
-# will distribute the generated files over these directories. Enabling this
+# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
+# sub-directories (in 2 levels) under the output directory of each output format
+# and will distribute the generated files over these directories. Enabling this
# option can be useful when feeding doxygen a huge amount of source files, where
# putting all generated files in the same directory would otherwise causes
-# performance problems for the file system.
+# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to
+# control the number of sub-directories.
# The default value is: NO.
CREATE_SUBDIRS = NO
+# Controls the number of sub-directories that will be created when
+# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every
+# level increment doubles the number of directories, resulting in 4096
+# directories at level 8 which is the default and also the maximum value. The
+# sub-directories are organized in 2 levels, the first level always has a fixed
+# numer of 16 directories.
+# Minimum value: 0, maximum value: 8, default value: 8.
+# This tag requires that the tag CREATE_SUBDIRS is set to YES.
+
+CREATE_SUBDIRS_LEVEL = 8
+
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
# characters to appear in the names of generated files. If set to NO, non-ASCII
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
@@ -81,14 +103,14 @@ ALLOW_UNICODE_NAMES = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
-# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
-# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
-# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
-# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
-# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
-# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
-# Ukrainian and Vietnamese.
+# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian,
+# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English
+# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek,
+# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with
+# English messages), Korean, Korean-en (Korean with English messages), Latvian,
+# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese,
+# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish,
+# Swedish, Turkish, Ukrainian and Vietnamese.
# The default value is: English.
OUTPUT_LANGUAGE = English
@@ -162,7 +184,7 @@ FULL_PATH_NAMES = NO
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
-STRIP_FROM_PATH =
+STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
@@ -171,7 +193,7 @@ STRIP_FROM_PATH =
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
-STRIP_FROM_INC_PATH =
+STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
@@ -189,6 +211,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
+# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
+# such as
+# /***************
+# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
+# Javadoc-style will behave just like regular comments and it will not be
+# interpreted by doxygen.
+# The default value is: NO.
+
+JAVADOC_BANNER = NO
+
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@@ -209,6 +241,14 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
+# By default Python docstrings are displayed as preformatted text and doxygen's
+# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
+# doxygen's special commands can be used and the contents of the docstring
+# documentation blocks is shown as doxygen documentation.
+# The default value is: YES.
+
+PYTHON_DOCSTRING = YES
+
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
# The default value is: YES.
@@ -232,19 +272,18 @@ TAB_SIZE = 4
# the documentation. An alias has the form:
# name=value
# For example adding
-# "sideeffect=@par Side Effects:\n"
+# "sideeffect=@par Side Effects:^^"
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
-# "Side Effects:". You can put \n's in the value part of an alias to insert
-# newlines.
+# "Side Effects:". Note that you cannot put \n's in the value part of an alias
+# to insert newlines (in the resulting output). You can put ^^ in the value part
+# of an alias to insert a newline as if a physical newline was in the original
+# file. When you need a literal { or } or , in the value part of an alias you
+# have to escape them by means of a backslash (\), this can lead to conflicts
+# with the commands \{ and \} for these it is advised to use the version @{ and
+# @} or use a double escape (\\{ and \\})
-ALIASES =
-
-# This tag can be used to specify a number of word-keyword mappings (TCL only).
-# A mapping has the form "name=value". For example adding "class=itcl::class"
-# will allow you to use the command class in the itcl::class meaning.
-
-TCL_SUBST =
+ALIASES =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
@@ -274,28 +313,40 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
+# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
+# sources only. Doxygen will then generate output that is more tailored for that
+# language. For instance, namespaces will be presented as modules, types will be
+# separated into more groups, etc.
+# The default value is: NO.
+
+OPTIMIZE_OUTPUT_SLICE = NO
+
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
-# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
-# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
-# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
-# Fortran. In the later case the parser tries to guess whether the code is fixed
-# or free formatted code, this is the default for Fortran type files), VHDL. For
-# instance to make doxygen treat .inc files as Fortran files (default is PHP),
-# and .f files as C (default is Fortran), use: inc=Fortran f=C.
+# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
+# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice,
+# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
+# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
+# tries to guess whether the code is fixed or free formatted code, this is the
+# default for Fortran type files). For instance to make doxygen treat .inc files
+# as Fortran files (default is PHP), and .f files as C (default is Fortran),
+# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
-# the files are not read by doxygen.
+# the files are not read by doxygen. When specifying no_extension you should add
+# * to the FILE_PATTERNS.
+#
+# Note see also the list of default file extension mappings.
-EXTENSION_MAPPING =
+EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
-# documentation. See http://daringfireball.net/projects/markdown/ for details.
+# documentation. See https://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you can
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
# case of backward compatibilities issues.
@@ -303,6 +354,15 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
+# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
+# to that level are automatically included in the table of contents, even if
+# they do not have an id attribute.
+# Note: This feature currently applies only to Markdown headings.
+# Minimum value: 0, maximum value: 99, default value: 5.
+# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
+
+TOC_INCLUDE_HEADINGS = 5
+
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
@@ -328,7 +388,7 @@ BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
-# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
+# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
# will parse them like normal C++ but will assume all classes use public instead
# of private inheritance when no explicit protection keyword is present.
# The default value is: NO.
@@ -414,6 +474,19 @@ TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
+# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use
+# during processing. When set to 0 doxygen will based this on the number of
+# cores available in the system. You can set it explicitly to a value larger
+# than 0 to get more control over the balance between CPU load and processing
+# speed. At this moment only the input processing can be done using multiple
+# threads. Since this is still an experimental feature the default is set to 1,
+# which effectively disables parallel processing. Please report any issues you
+# encounter. Generating dot graphs in parallel is controlled by the
+# DOT_NUM_THREADS setting.
+# Minimum value: 0, maximum value: 32, default value: 1.
+
+NUM_PROC_THREADS = 1
+
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -434,6 +507,12 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = NO
+# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
+# methods of a class will be included in the documentation.
+# The default value is: NO.
+
+EXTRACT_PRIV_VIRTUAL = NO
+
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@@ -471,6 +550,13 @@ EXTRACT_LOCAL_METHODS = NO
EXTRACT_ANON_NSPACES = NO
+# If this flag is set to YES, the name of an unnamed parameter in a declaration
+# will be determined by the corresponding definition. By default unnamed
+# parameters remain unnamed in the output.
+# The default value is: YES.
+
+RESOLVE_UNNAMED_PARAMS = YES
+
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
# members will be included in the various overviews, but no documentation
@@ -488,8 +574,8 @@ HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
-# (class|struct|union) declarations. If set to NO, these declarations will be
-# included in the documentation.
+# declarations. If set to NO, these declarations will be included in the
+# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@@ -508,12 +594,20 @@ HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
-# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
-# names in lower-case letters. If set to YES, upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-# The default value is: system dependent.
+# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
+# able to match the capabilities of the underlying filesystem. In case the
+# filesystem is case sensitive (i.e. it supports files in the same directory
+# whose names only differ in casing), the option must be set to YES to properly
+# deal with such files in case they appear in the input. For filesystems that
+# are not case sensitive the option should be set to NO to properly deal with
+# output files written for symbols that only differ in casing, such as for two
+# classes, one named CLASS and the other named Class, and to also support
+# references to files without having to specify the exact matching casing. On
+# Windows (including Cygwin) and MacOS, users should typically set this option
+# to NO, whereas on Linux or other Unix flavors it should typically be set to
+# YES.
+# Possible values are: SYSTEM, NO and YES.
+# The default value is: SYSTEM.
CASE_SENSE_NAMES = YES
@@ -531,6 +625,12 @@ HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
+# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class
+# will show which file needs to be included to use the class.
+# The default value is: YES.
+
+SHOW_HEADERFILE = YES
+
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
@@ -639,7 +739,7 @@ GENERATE_DEPRECATEDLIST= YES
# sections, marked by \if ... \endif and \cond
# ... \endcond blocks.
-ENABLED_SECTIONS =
+ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
@@ -681,14 +781,15 @@ SHOW_NAMESPACES = YES
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
-FILE_VERSION_FILTER =
+FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option. You can
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
-# will be used as the name of the layout file.
+# will be used as the name of the layout file. See also section "Changing the
+# layout of pages" for information.
#
# Note that if you run doxygen from a directory containing a file called
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
@@ -699,12 +800,12 @@ LAYOUT_FILE = Docs/DoxygenLayout.xml
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
-# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
+# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
-CITE_BIB_FILES =
+CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
@@ -734,36 +835,68 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some parameters
-# in a documented function, or documenting parameters that don't exist or using
-# markup commands wrongly.
+# potential errors in the documentation, such as documenting some parameters in
+# a documented function twice, or documenting parameters that don't exist or
+# using markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = YES
+# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete
+# function parameter documentation. If set to NO, doxygen will accept that some
+# parameters have no documentation without warning.
+# The default value is: YES.
+
+WARN_IF_INCOMPLETE_DOC = YES
+
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
-# value. If set to NO, doxygen will only warn about wrong or incomplete
-# parameter documentation, but not about the absence of documentation.
+# value. If set to NO, doxygen will only warn about wrong parameter
+# documentation, but not about the absence of documentation. If EXTRACT_ALL is
+# set to YES then this flag will automatically be disabled. See also
+# WARN_IF_INCOMPLETE_DOC
# The default value is: NO.
WARN_NO_PARAMDOC = NO
+# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
+# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
+# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
+# at the end of the doxygen process doxygen will return with a non-zero status.
+# Possible values are: NO, YES and FAIL_ON_WARNINGS.
+# The default value is: NO.
+
+WARN_AS_ERROR = NO
+
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated
# and the warning text. Optionally the format may contain $version, which will
# be replaced by the version of the file (if it could be obtained via
# FILE_VERSION_FILTER)
+# See also: WARN_LINE_FORMAT
# The default value is: $file:$line: $text.
WARN_FORMAT = "$file:$line: $text"
+# In the $text part of the WARN_FORMAT command it is possible that a reference
+# to a more specific place is given. To make it easier to jump to this place
+# (outside of doxygen) the user can define a custom "cut" / "paste" string.
+# Example:
+# WARN_LINE_FORMAT = "'vi $file +$line'"
+# See also: WARN_FORMAT
+# The default value is: at line $line of file $file.
+
+WARN_LINE_FORMAT = "at line $line of file $file"
+
# The WARN_LOGFILE tag can be used to specify a file to which warning and error
# messages should be written. If left blank the output is written to standard
-# error (stderr).
+# error (stderr). In case the file specified cannot be opened for writing the
+# warning and error messages are written to standard error. When as file - is
+# specified the warning and error messages are written to standard output
+# (stdout).
-WARN_LOGFILE =
+WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@@ -776,21 +909,34 @@ WARN_LOGFILE =
# Note: If this tag is empty the current directory is searched.
INPUT = . \
+ README.md \
+ CONTRIBUTING.md \
+ Roadmap.md \
DetourCrowd \
DetourTileCache \
Recast \
- Docs/Conceptual \
Docs/Extern
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
-# documentation (see: http://www.gnu.org/software/libiconv) for the list of
-# possible encodings.
+# documentation (see:
+# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
+# See also: INPUT_FILE_ENCODING
# The default value is: UTF-8.
INPUT_ENCODING = UTF-8
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify
+# character encoding on a per file pattern basis. Doxygen will compare the file
+# name with each pattern and apply the encoding instead of the default
+# INPUT_ENCODING) if there is a match. The character encodings are a list of the
+# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding
+# "INPUT_ENCODING" for further information on supported encodings.
+
+INPUT_FILE_ENCODING =
+
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories.
@@ -799,11 +945,15 @@ INPUT_ENCODING = UTF-8
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
+# Note the list of default checked file patterns might differ from the list of
+# default file extension mappings.
+#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
-# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
-# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd,
-# *.vhdl, *.ucf, *.qsf, *.as and *.js.
+# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml,
+# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C
+# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd,
+# *.vhdl, *.ucf, *.qsf and *.ice.
FILE_PATTERNS = *.cpp \
*.h \
@@ -829,7 +979,8 @@ EXCLUDE = Doxyfile \
TODO.txt \
RecastDemo/Contrib \
RecastDemo/Build \
- RecastDemo/Bin
+ RecastDemo/Bin \
+ Tests
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -851,25 +1002,25 @@ EXCLUDE_PATTERNS = CMakeLists.txt
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
+# ANamespace::AClass, ANamespace::*Test
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
-EXCLUDE_SYMBOLS =
+EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH =
+EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all
# files are included.
-EXAMPLE_PATTERNS =
+EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands
@@ -898,8 +1049,17 @@ IMAGE_PATH = Docs/Images
# Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
+#
+# Note that doxygen will use the data processed and written to standard output
+# for further processing, therefore nothing else, like debug statements or used
+# commands (so in case of a Windows batch file always use @echo OFF), should be
+# written to standard output.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
-INPUT_FILTER =
+INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
@@ -907,8 +1067,12 @@ INPUT_FILTER =
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied.
+#
+# Note that for custom extensions or not directly supported extensions you also
+# need to set EXTENSION_MAPPING for the extension otherwise the files are not
+# properly processed by doxygen.
-FILTER_PATTERNS =
+FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -923,14 +1087,23 @@ FILTER_SOURCE_FILES = NO
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
-FILTER_SOURCE_PATTERNS =
+FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE =
+USE_MDFILE_AS_MAINPAGE = ./README.md
+
+# The Fortran standard specifies that for fixed formatted Fortran code all
+# characters from position 72 are to be considered as comment. A common
+# extension is to allow longer lines before the automatic comment starts. The
+# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can
+# be processed before the automatic comment starts.
+# Minimum value: 7, maximum value: 10000, default value: 72.
+
+FORTRAN_COMMENT_AFTER = 72
#---------------------------------------------------------------------------
# Configuration options related to source browsing
@@ -959,7 +1132,7 @@ INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
-# function all documented functions referencing it will be listed.
+# entity all documented functions referencing it will be listed.
# The default value is: NO.
REFERENCED_BY_RELATION = NO
@@ -991,12 +1164,12 @@ SOURCE_TOOLTIPS = YES
# If the USE_HTAGS tag is set to YES then the references to source code will
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
# source browser. The htags tool is part of GNU's global source tagging system
-# (see http://www.gnu.org/software/global/global.html). You will need version
+# (see https://www.gnu.org/software/global/global.html). You will need version
# 4.8.6 or higher.
#
# To use it do the following:
# - Install the latest version of global
-# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
+# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
# - Make sure the INPUT points to the root of the source tree
# - Run doxygen as normal
#
@@ -1018,25 +1191,6 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
-# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
-# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
-# cost of reduced performance. This can be particularly helpful with template
-# rich C++ code for which doxygen's built-in parser lacks the necessary type
-# information.
-# Note: The availability of this option depends on whether or not doxygen was
-# compiled with the --with-libclang option.
-# The default value is: NO.
-
-CLANG_ASSISTED_PARSING = NO
-
-# If clang assisted parsing is enabled you can provide the compiler with command
-# line options that you would normally use when invoking the compiler. Note that
-# the include paths will already be set by doxygen for the files and directories
-# specified with INPUT and INCLUDE_PATH.
-# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
-
-CLANG_OPTIONS =
-
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@@ -1048,20 +1202,13 @@ CLANG_OPTIONS =
ALPHABETICAL_INDEX = YES
-# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
-# which the alphabetical index list will be split.
-# Minimum value: 1, maximum value: 20, default value: 5.
-# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-
-COLS_IN_ALPHA_INDEX = 5
-
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
# can be used to specify a prefix (or a list of prefixes) that should be ignored
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
-IGNORE_PREFIX =
+IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
@@ -1105,7 +1252,7 @@ HTML_FILE_EXTENSION = .html
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_HEADER =
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
@@ -1127,7 +1274,7 @@ HTML_FOOTER = Docs/footer.html
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_STYLESHEET =
+HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
@@ -1140,7 +1287,8 @@ HTML_STYLESHEET =
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_STYLESHEET =
+HTML_EXTRA_STYLESHEET = Docs/doxygen-awesome-css/doxygen-awesome.css \
+ Docs/doxygen-awesome-css/doxygen-awesome-sidebar-only.css
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
@@ -1150,12 +1298,29 @@ HTML_EXTRA_STYLESHEET =
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
-HTML_EXTRA_FILES =
+HTML_EXTRA_FILES = License.txt
+
+# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output
+# should be rendered with a dark or light theme. Default setting AUTO_LIGHT
+# enables light output unless the user preference is dark output. Other options
+# are DARK to always use dark mode, LIGHT to always use light mode, AUTO_DARK to
+# default to dark mode unless the user prefers light mode, and TOGGLE to let the
+# user toggle between dark and light mode via a button.
+# Possible values are: LIGHT Always generate light output., DARK Always generate
+# dark output., AUTO_LIGHT Automatically set the mode according to the user
+# preference, use light mode if no preference is set (the default)., AUTO_DARK
+# Automatically set the mode according to the user preference, use dark mode if
+# no preference is set. and TOGGLE Allow to user to switch between light and
+# dark mode via a button..
+# The default value is: AUTO_LIGHT.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_COLORSTYLE = AUTO_LIGHT
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
-# this color. Hue is specified as an angle on a colorwheel, see
-# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
+# this color. Hue is specified as an angle on a color-wheel, see
+# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
@@ -1164,7 +1329,7 @@ HTML_EXTRA_FILES =
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
-# in the HTML output. For a value of 0 the output will use grayscales only. A
+# in the HTML output. For a value of 0 the output will use gray-scales only. A
# value of 255 will produce the most vivid colors.
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1191,6 +1356,17 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
+# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
+# documentation will contain a main index with vertical navigation menus that
+# are dynamically created via JavaScript. If disabled, the navigation index will
+# consists of multiple levels of tabs that are statically embedded in every HTML
+# page. Disable this option to support browsers that do not have JavaScript,
+# like the Qt help browser.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_DYNAMIC_MENUS = YES
+
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
@@ -1214,13 +1390,14 @@ HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
-# environment (see: http://developer.apple.com/tools/xcode/), introduced with
-# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
-# Makefile in the HTML output directory. Running make will produce the docset in
-# that directory and running make install will install the docset in
+# environment (see:
+# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
+# create a documentation set, doxygen will generate a Makefile in the HTML
+# output directory. Running make will produce the docset in that directory and
+# running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
-# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
-# for more information.
+# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
+# genXcode/_index.html for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1234,6 +1411,13 @@ GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
+# This tag determines the URL of the docset feed. A documentation feed provides
+# an umbrella under which multiple documentation sets from a single provider
+# (such as a company or product suite) can be grouped.
+# This tag requires that the tag GENERATE_DOCSET is set to YES.
+
+DOCSET_FEEDURL =
+
# This tag specifies a string that should uniquely identify the documentation
# set bundle. This should be a reverse domain-name style string, e.g.
# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
@@ -1259,8 +1443,12 @@ DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
-# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
-# Windows.
+# on Windows. In the beginning of 2021 Microsoft took the original page, with
+# a.o. the download links, offline the HTML help workshop was already many years
+# in maintenance mode). You can download the HTML help workshop from the web
+# archives at Installation executable (see:
+# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo
+# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe).
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
@@ -1279,7 +1467,7 @@ GENERATE_HTMLHELP = NO
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_FILE =
+CHM_FILE =
# The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
@@ -1287,10 +1475,10 @@ CHM_FILE =
# The file has to be specified with full path.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-HHC_LOCATION =
+HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated
-# (YES) or that it should be included in the master .chm file (NO).
+# (YES) or that it should be included in the main .chm file (NO).
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
@@ -1300,7 +1488,7 @@ GENERATE_CHI = NO
# and project file content.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
-CHM_INDEX_ENCODING =
+CHM_INDEX_ENCODING =
# The BINARY_TOC flag controls whether a binary table of contents is generated
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
@@ -1331,11 +1519,12 @@ GENERATE_QHP = NO
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QCH_FILE =
+QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
-# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
+# (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1343,8 +1532,8 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
-# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
-# folders).
+# Folders (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1352,33 +1541,33 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
+# Filters (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_NAME =
+QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
-# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
-# filters).
+# Filters (see:
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_CUST_FILTER_ATTRS =
+QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
-# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
+# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHP_SECT_FILTER_ATTRS =
+QHP_SECT_FILTER_ATTRS =
-# The QHG_LOCATION tag can be used to specify the location of Qt's
-# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
-# generated .qhp file.
+# The QHG_LOCATION tag can be used to specify the location (absolute path
+# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
+# run qhelpgenerator on the generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
-QHG_LOCATION =
+QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
@@ -1418,16 +1607,28 @@ DISABLE_INDEX = NO
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
-# further fine-tune the look of the index. As an example, the default style
-# sheet generated by doxygen has an example that shows how to put an image at
-# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
-# the same information as the tab index, you could consider setting
-# DISABLE_INDEX to YES when enabling this option.
+# further fine tune the look of the index (see "Fine-tuning the output"). As an
+# example, the default style sheet generated by doxygen has an example that
+# shows how to put an image at the root of the tree instead of the PROJECT_NAME.
+# Since the tree basically has the same information as the tab index, you could
+# consider setting DISABLE_INDEX to YES when enabling this option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = YES
+# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the
+# FULL_SIDEBAR option determines if the side bar is limited to only the treeview
+# area (value NO) or if it should extend to the full height of the window (value
+# YES). Setting this to YES gives a layout similar to
+# https://docs.readthedocs.io with more room for contents, but less room for the
+# project logo, title, and description. If either GENERATE_TREEVIEW or
+# DISABLE_INDEX is set to NO, this option has no effect.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+FULL_SIDEBAR = NO
+
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
#
@@ -1452,6 +1653,24 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
+# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email
+# addresses.
+# The default value is: YES.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+OBFUSCATE_EMAILS = YES
+
+# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
+# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
+# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
+# the HTML output. These images will generally look nicer at scaled resolutions.
+# Possible values are: png (the default) and svg (looks nicer but requires the
+# pdf2svg or inkscape tool).
+# The default value is: png.
+# This tag requires that the tag GENERATE_HTML is set to YES.
+
+HTML_FORMULA_FORMAT = png
+
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@@ -1461,19 +1680,14 @@ EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
-# Use the FORMULA_TRANPARENT tag to determine whether or not the images
-# generated for formulas are transparent PNGs. Transparent PNGs are not
-# supported properly for IE 6.0, but are supported on all modern browsers.
-#
-# Note that when changing this option you need to delete any form_*.png files in
-# the HTML output directory before the changes have effect.
-# The default value is: YES.
-# This tag requires that the tag GENERATE_HTML is set to YES.
+# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
+# to create new LaTeX commands to be used in formulas as building blocks. See
+# the section "Including formulas" for details.
-FORMULA_TRANSPARENT = YES
+FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
-# http://www.mathjax.org) which uses client side Javascript for the rendering
+# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@@ -1483,11 +1697,29 @@ FORMULA_TRANSPARENT = YES
USE_MATHJAX = NO
+# With MATHJAX_VERSION it is possible to specify the MathJax version to be used.
+# Note that the different versions of MathJax have different requirements with
+# regards to the different settings, so it is possible that also other MathJax
+# settings have to be changed when switching between the different MathJax
+# versions.
+# Possible values are: MathJax_2 and MathJax_3.
+# The default value is: MathJax_2.
+# This tag requires that the tag USE_MATHJAX is set to YES.
+
+MATHJAX_VERSION = MathJax_2
+
# When MathJax is enabled you can set the default output format to be used for
-# the MathJax output. See the MathJax site (see:
-# http://docs.mathjax.org/en/latest/output.html) for more details.
+# the MathJax output. For more details about the output format see MathJax
+# version 2 (see:
+# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3
+# (see:
+# http://docs.mathjax.org/en/latest/web/components/output.html).
# Possible values are: HTML-CSS (which is slower, but has the best
-# compatibility), NativeMML (i.e. MathML) and SVG.
+# compatibility. This is the name for Mathjax version 2, for MathJax version 3
+# this will be translated into chtml), NativeMML (i.e. MathML. Only supported
+# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This
+# is the name for Mathjax version 3, for MathJax version 2 this will be
+# translated into HTML-CSS) and SVG.
# The default value is: HTML-CSS.
# This tag requires that the tag USE_MATHJAX is set to YES.
@@ -1500,26 +1732,33 @@ MATHJAX_FORMAT = HTML-CSS
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
-# MathJax from http://www.mathjax.org before deployment.
-# The default value is: http://cdn.mathjax.org/mathjax/latest.
+# MathJax from https://www.mathjax.org before deployment. The default value is:
+# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2
+# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
+# for MathJax version 2 (see
+# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions):
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
+# For example for MathJax version 3 (see
+# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html):
+# MATHJAX_EXTENSIONS = ams
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_EXTENSIONS =
+MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
-# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
+# (see:
+# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
-MATHJAX_CODEFILE =
+MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
@@ -1543,7 +1782,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
-# implemented using a web server instead of a web client using Javascript. There
+# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@@ -1562,7 +1801,8 @@ SERVER_BASED_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/).
+# Xapian (see:
+# https://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
@@ -1575,11 +1815,12 @@ EXTERNAL_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
-# Xapian (see: http://xapian.org/). See the section "External Indexing and
-# Searching" for details.
+# Xapian (see:
+# https://xapian.org/). See the section "External Indexing and Searching" for
+# details.
# This tag requires that the tag SEARCHENGINE is set to YES.
-SEARCHENGINE_URL =
+SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
@@ -1595,7 +1836,7 @@ SEARCHDATA_FILE = searchdata.xml
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTERNAL_SEARCH_ID =
+EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
@@ -1605,7 +1846,7 @@ EXTERNAL_SEARCH_ID =
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
-EXTRA_SEARCH_MAPPINGS =
+EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
@@ -1627,21 +1868,35 @@ LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked.
#
-# Note that when enabling USE_PDFLATEX this option is only used for generating
-# bitmaps for formulas in the HTML output, but not in the Makefile that is
-# written to the output directory.
-# The default file is: latex.
+# Note that when not enabling USE_PDFLATEX the default is latex when enabling
+# USE_PDFLATEX the default is pdflatex and when in the later case latex is
+# chosen this is overwritten by pdflatex. For specific output languages the
+# default can have been set differently, this depends on the implementation of
+# the output language.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
# index for LaTeX.
+# Note: This tag is used in the Makefile / make.bat.
+# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
+# (.tex).
# The default file is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
MAKEINDEX_CMD_NAME = makeindex
+# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
+# generate index for LaTeX. In case there is no backslash (\) as first character
+# it will be automatically added in the LaTeX code.
+# Note: This tag is used in the generated output file (.tex).
+# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
+# The default value is: makeindex.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_MAKEINDEX_CMD = makeindex
+
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some
# trees in general.
@@ -1657,7 +1912,7 @@ COMPACT_LATEX = NO
# The default value is: a4.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-PAPER_TYPE = a4wide
+PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. The package can be specified just
@@ -1669,34 +1924,36 @@ PAPER_TYPE = a4wide
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-EXTRA_PACKAGES =
+EXTRA_PACKAGES =
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
-# generated LaTeX document. The header should contain everything until the first
-# chapter. If it is left blank doxygen will generate a standard header. See
-# section "Doxygen usage" for information on how to let doxygen write the
-# default header to a separate file.
+# The LATEX_HEADER tag can be used to specify a user-defined LaTeX header for
+# the generated LaTeX document. The header should contain everything until the
+# first chapter. If it is left blank doxygen will generate a standard header. It
+# is highly recommended to start with a default header using
+# doxygen -w latex new_header.tex new_footer.tex new_stylesheet.sty
+# and then modify the file new_header.tex. See also section "Doxygen usage" for
+# information on how to generate the default header that doxygen normally uses.
#
-# Note: Only use a user-defined header if you know what you are doing! The
-# following commands have a special meaning inside the header: $title,
-# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
-# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
-# string, for the replacement values of the other commands the user is referred
-# to HTML_HEADER.
+# Note: Only use a user-defined header if you know what you are doing!
+# Note: The header is subject to change so you typically have to regenerate the
+# default header when upgrading to a newer version of doxygen. The following
+# commands have a special meaning inside the header (and footer): For a
+# description of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_HEADER =
+LATEX_HEADER =
-# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
-# generated LaTeX document. The footer should contain everything after the last
-# chapter. If it is left blank doxygen will generate a standard footer. See
+# The LATEX_FOOTER tag can be used to specify a user-defined LaTeX footer for
+# the generated LaTeX document. The footer should contain everything after the
+# last chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
-# special commands can be used inside the footer.
-#
-# Note: Only use a user-defined footer if you know what you are doing!
+# special commands can be used inside the footer. See also section "Doxygen
+# usage" for information on how to generate the default footer that doxygen
+# normally uses. Note: Only use a user-defined footer if you know what you are
+# doing!
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_FOOTER =
+LATEX_FOOTER =
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# LaTeX style sheets that are included after the standard style sheets created
@@ -1707,7 +1964,7 @@ LATEX_FOOTER =
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_STYLESHEET =
+LATEX_EXTRA_STYLESHEET =
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the LATEX_OUTPUT output
@@ -1715,7 +1972,7 @@ LATEX_EXTRA_STYLESHEET =
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
-LATEX_EXTRA_FILES =
+LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
@@ -1726,9 +1983,11 @@ LATEX_EXTRA_FILES =
PDF_HYPERLINKS = NO
-# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
-# the PDF file directly from the LaTeX files. Set this option to YES, to get a
-# higher quality PDF documentation.
+# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
+# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
+# files. Set this option to YES, to get a higher quality PDF documentation.
+#
+# See also section LATEX_CMD_NAME for selecting the engine.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1736,8 +1995,7 @@ USE_PDFLATEX = NO
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
# command to the generated LaTeX files. This will instruct LaTeX to keep running
-# if errors occur, instead of asking the user for help. This option is also used
-# when generating formulas in HTML.
+# if errors occur, instead of asking the user for help.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1750,24 +2008,30 @@ LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
-# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
-# code with syntax highlighting in the LaTeX output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_LATEX is set to YES.
-
-LATEX_SOURCE_CODE = NO
-
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
-# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
+# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_BIB_STYLE = plain
+# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
+# page will contain the date and time when the page was generated. Setting this
+# to NO can help when comparing the output of multiple runs.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_TIMESTAMP = NO
+
+# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
+# path from which the emoji images will be read. If a relative path is entered,
+# it will be relative to the LATEX_OUTPUT directory. If left blank the
+# LATEX_OUTPUT directory will be used.
+# This tag requires that the tag GENERATE_LATEX is set to YES.
+
+LATEX_EMOJI_DIRECTORY =
+
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1807,32 +2071,22 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
-# Load stylesheet definitions from file. Syntax is similar to doxygen's config
-# file, i.e. a series of assignments. You only have to provide replacements,
-# missing definitions are set to their default value.
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# configuration file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
#
# See also section "Doxygen usage" for information on how to generate the
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_STYLESHEET_FILE =
+RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
-# similar to doxygen's config file. A template extensions file can be generated
-# using doxygen -e rtf extensionFile.
+# similar to doxygen's configuration file. A template extensions file can be
+# generated using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
-RTF_EXTENSIONS_FILE =
-
-# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
-# with syntax highlighting in the RTF output.
-#
-# Note that which sources are shown also depends on other settings such as
-# SOURCE_BROWSER.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_RTF is set to YES.
-
-RTF_SOURCE_CODE = NO
+RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# Configuration options related to the man page output
@@ -1867,7 +2121,7 @@ MAN_EXTENSION = .3dbus
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
-MAN_SUBDIR =
+MAN_SUBDIR =
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
# will generate one additional man file for each entity documented in the real
@@ -1905,6 +2159,13 @@ XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
+# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
+# namespace members in file scope as well, matching the HTML output.
+# The default value is: NO.
+# This tag requires that the tag GENERATE_XML is set to YES.
+
+XML_NS_MEMB_FILE_SCOPE = NO
+
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
@@ -1923,23 +2184,14 @@ GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
-# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
-# program listings (including syntax highlighting and cross-referencing
-# information) to the DOCBOOK output. Note that enabling this will significantly
-# increase the size of the DOCBOOK output.
-# The default value is: NO.
-# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
-
-DOCBOOK_PROGRAMLISTING = NO
-
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
-# AutoGen Definitions (see http://autogen.sf.net) file that captures the
-# structure of the code including all documentation. Note that this feature is
-# still experimental and incomplete at the moment.
+# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
+# the structure of the code including all documentation. Note that this feature
+# is still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_AUTOGEN_DEF = NO
@@ -1980,7 +2232,7 @@ PERLMOD_PRETTY = YES
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
-PERLMOD_MAKEVAR_PREFIX =
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
@@ -2018,10 +2270,11 @@ SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by the
-# preprocessor.
+# preprocessor. Note that the INCLUDE_PATH is not recursive, so the setting of
+# RECURSIVE has no effect here.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
-INCLUDE_PATH =
+INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2029,7 +2282,7 @@ INCLUDE_PATH =
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-INCLUDE_FILE_PATTERNS =
+INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
@@ -2039,7 +2292,7 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-PREDEFINED =
+PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2048,7 +2301,7 @@ PREDEFINED =
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
-EXPAND_AS_DEFINED =
+EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
@@ -2077,13 +2330,13 @@ SKIP_FUNCTION_MACROS = YES
# the path). If a tag file is not located in the directory in which doxygen is
# run, you must also specify the path to the tagfile here.
-TAGFILES =
+TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
-GENERATE_TAGFILE =
+GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
@@ -2106,40 +2359,16 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of 'which perl').
-# The default file (with absolute path) is: /usr/bin/perl.
-
-PERL_PATH = /usr/bin/perl
-
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
-# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
-# NO turns the diagrams off. Note that this option also works with HAVE_DOT
-# disabled, but it is recommended to install and use dot, since it yields more
-# powerful graphs.
-# The default value is: YES.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see:
-# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
-DIA_PATH =
+DIA_PATH =
# If set to YES the inheritance and collaboration graphs will hide inheritance
# and usage relations if the target is undocumented or is not a class.
@@ -2166,36 +2395,51 @@ HAVE_DOT = NO
DOT_NUM_THREADS = 0
-# When you want a differently looking font in the dot files that doxygen
-# generates you can specify the font name using DOT_FONTNAME. You need to make
-# sure dot is able to find the font, which can be done by putting it in a
-# standard location or by setting the DOTFONTPATH environment variable or by
-# setting DOT_FONTPATH to the directory containing the font.
-# The default value is: Helvetica.
+# DOT_COMMON_ATTR is common attributes for nodes, edges and labels of
+# subgraphs. When you want a differently looking font in the dot files that
+# doxygen generates you can specify fontname, fontcolor and fontsize attributes.
+# For details please see Node,
+# Edge and Graph Attributes specification You need to make sure dot is able
+# to find the font, which can be done by putting it in a standard location or by
+# setting the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
+# directory containing the font. Default graphviz fontsize is 14.
+# The default value is: fontname=Helvetica,fontsize=10.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTNAME = Helvetica
+DOT_COMMON_ATTR = "fontname=Helvetica,fontsize=10"
-# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
-# dot graphs.
-# Minimum value: 4, maximum value: 24, default value: 10.
+# DOT_EDGE_ATTR is concatenated with DOT_COMMON_ATTR. For elegant style you can
+# add 'arrowhead=open, arrowtail=open, arrowsize=0.5'. Complete documentation about
+# arrows shapes.
+# The default value is: labelfontname=Helvetica,labelfontsize=10.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTSIZE = 10
+DOT_EDGE_ATTR = "labelfontname=Helvetica,labelfontsize=10"
-# By default doxygen will tell dot to use the default font as specified with
-# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
-# the path where dot can find it using this tag.
+# DOT_NODE_ATTR is concatenated with DOT_COMMON_ATTR. For view without boxes
+# around nodes set 'shape=plain' or 'shape=plaintext' Shapes specification
+# The default value is: shape=box,height=0.2,width=0.4.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_FONTPATH =
+DOT_NODE_ATTR = "shape=box,height=0.2,width=0.4"
-# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
-# each documented class showing the direct and indirect inheritance relations.
-# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
-# The default value is: YES.
+# You can set the path where dot can find font specified with fontname in
+# DOT_COMMON_ATTR and others dot attributes.
# This tag requires that the tag HAVE_DOT is set to YES.
+DOT_FONTPATH =
+
+# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a
+# graph for each documented class showing the direct and indirect inheritance
+# relations. In case HAVE_DOT is set as well dot will be used to draw the graph,
+# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set
+# to TEXT the direct and indirect inheritance relations will be shown as texts /
+# links.
+# Possible values are: NO, YES, TEXT and GRAPH.
+# The default value is: YES.
+
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
@@ -2208,7 +2452,8 @@ CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
-# groups, showing the direct groups dependencies.
+# groups, showing the direct groups dependencies. See also the chapter Grouping
+# in the manual.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
@@ -2231,10 +2476,32 @@ UML_LOOK = NO
# but if the number exceeds 15, the total amount of fields shown is limited to
# 10.
# Minimum value: 0, maximum value: 100, default value: 10.
-# This tag requires that the tag HAVE_DOT is set to YES.
+# This tag requires that the tag UML_LOOK is set to YES.
UML_LIMIT_NUM_FIELDS = 10
+# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
+# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
+# tag is set to YES, doxygen will add type and arguments for attributes and
+# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
+# will not generate fields with class member information in the UML graphs. The
+# class diagrams will look similar to the default class diagrams but using UML
+# notation for the relationships.
+# Possible values are: NO, YES and NONE.
+# The default value is: NO.
+# This tag requires that the tag UML_LOOK is set to YES.
+
+DOT_UML_DETAILS = NO
+
+# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
+# to display on a single line. If the actual line length exceeds this threshold
+# significantly it will wrapped across multiple lines. Some heuristics are apply
+# to avoid ugly line breaks.
+# Minimum value: 0, maximum value: 1000, default value: 17.
+# This tag requires that the tag HAVE_DOT is set to YES.
+
+DOT_WRAP_THRESHOLD = 17
+
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
# collaboration graphs will show the relations between templates and their
# instances.
@@ -2301,6 +2568,13 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
+# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels
+# of child directories generated in directory dependency graphs by dot.
+# Minimum value: 1, maximum value: 25, default value: 1.
+# This tag requires that the tag DIRECTORY_GRAPH is set to YES.
+
+DIR_GRAPH_MAX_DEPTH = 1
+
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
@@ -2332,39 +2606,44 @@ INTERACTIVE_SVG = NO
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_PATH =
+DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
-DOTFILE_DIRS =
+DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
-MSCFILE_DIRS =
+MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
-DIAFILE_DIRS =
+DIAFILE_DIRS =
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
-# path where java can find the plantuml.jar file. If left blank, it is assumed
-# PlantUML is not used or called during a preprocessing step. Doxygen will
-# generate a warning when it encounters a \startuml command in this case and
-# will not generate output for the diagram.
+# path where java can find the plantuml.jar file or to the filename of jar file
+# to be used. If left blank, it is assumed PlantUML is not used or called during
+# a preprocessing step. Doxygen will generate a warning when it encounters a
+# \startuml command in this case and will not generate output for the diagram.
+
+PLANTUML_JAR_PATH =
-PLANTUML_JAR_PATH =
+# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
+# configuration file for plantuml.
+
+PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
-PLANTUML_INCLUDE_PATH =
+PLANTUML_INCLUDE_PATH =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
# that will be shown in the graph. If the number of nodes in a graph becomes
@@ -2390,18 +2669,6 @@ DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not seem
-# to support this out of the box.
-#
-# Warning: Depending on the platform used, enabling this option may lead to
-# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
-# read).
-# The default value is: NO.
-# This tag requires that the tag HAVE_DOT is set to YES.
-
-DOT_TRANSPARENT = NO
-
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
@@ -2414,14 +2681,18 @@ DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
# explaining the meaning of the various boxes and arrows in the dot generated
# graphs.
+# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal
+# graphical representation for inheritance and collaboration diagrams is used.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GENERATE_LEGEND = YES
-# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
+# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
# files that are used to generate the various graphs.
+#
+# Note: This setting is not only used for dot files but also for msc temporary
+# files.
# The default value is: YES.
-# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
diff --git a/README.md b/README.md
index afa036896..1de41e8e9 100644
--- a/README.md
+++ b/README.md
@@ -2,42 +2,36 @@
Recast & Detour
===============
-[](https://travis-ci.org/recastnavigation/recastnavigation)
-[](https://ci.appveyor.com/project/recastnavigation/recastnavigation/branch/master)
+[](https://github.com/recastnavigation/recastnavigation/actions/workflows/Build.yaml)
+[](https://github.com/recastnavigation/recastnavigation/actions/workflows/Tests.yaml)
-[](http://www.issuestats.com/github/recastnavigation/recastnavigation)
-[](http://www.issuestats.com/github/recastnavigation/recastnavigation)
-
-
+
## Recast
Recast is state of the art navigation mesh construction toolset for games.
-* It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out
-* It is fast which means swift turnaround times for level designers
-* It is open source so it comes with full source and you can customize it to your heart's content.
-
-The Recast process starts with constructing a voxel mold from a level geometry
-and then casting a navigation mesh over it. The process consists of three steps,
-building the voxel mold, partitioning the mold into simple regions, peeling off
-the regions as simple polygons.
+Recast is...
+* 🤖 **Automatic** - throw any level geometry at it and you will get a robust navmesh out
+* 🏎️ **Fast** - swift turnaround times for level designers
+* 🧘 **Flexible** - easily customize the navmesh generation and runtime navigation systems to suit your specific game's needs.
-1. The voxel mold is built from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move.
-2. The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously.
-3. The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level.
+Recast constructs a navmesh through a multi-step rasterization process:
+1. First Recast voxelizes the input triangle mesh by rasterizing the triangles into a multi-layer heightfield.
+2. Voxels in areas where the character would not be able to move are removed by applying simple voxel data filters.
+3. The walkable areas described by the voxel grid are then divided into sets of 2D polygonal regions.
+4. The navigation polygons are generated by triangulating and stiching together the generated 2d plygonal regions.
## Detour
-Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly.
-
-Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes.
+Recast is accompanied by Detour, a path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly.
+Detour offers a simple static navmesh data representation which is suitable for many simple cases. It also provides a tiled navigation mesh representation, which allows you to stream of navigation data in and out as the player progresses through the world and regenerate sections of the navmesh data as the world changes.
-## Recast Demo
+## RecastDemo
-You can find a comprehensive demo project in RecastDemo folder. It is a kitchen sink demo containing all the functionality of the library. If you are new to Recast & Detour, check out [Sample_SoloMesh.cpp](/RecastDemo/Source/Sample_SoloMesh.cpp) to get started with building navmeshes and [NavMeshTesterTool.cpp](/RecastDemo/Source/NavMeshTesterTool.cpp) to see how Detour can be used to find paths.
+You can find a comprehensive demo project in the `RecastDemo` folder. It's a kitchen sink demo showcasing all the functionality of the library. If you are new to Recast & Detour, check out [Sample_SoloMesh.cpp](/RecastDemo/Source/Sample_SoloMesh.cpp) to get started with building navmeshes and [NavMeshTesterTool.cpp](/RecastDemo/Source/NavMeshTesterTool.cpp) to see how Detour can be used to find paths.
### Building RecastDemo
@@ -46,24 +40,23 @@ RecastDemo uses [premake5](http://premake.github.io/) to build platform specific
#### Linux
- Install SDL2 and its dependencies according to your distro's guidelines.
-- run `premake5 gmake` from the `RecastDemo` folder.
-- `cd Build/gmake` then `make`
-- Run `RecastDemo\Bin\RecastDemo`
+- Navigate to the `RecastDemo` folder and run `premake5 gmake2`
+- Navigate to `RecastDemo/Build/gmake2` and run `make`
+- Navigate to `RecastDemo/Bin` and run `./RecastDemo`
-#### OSX
+#### macOS
-- Grab the latest SDL2 development library dmg from [here](https://www.libsdl.org/download-2.0.php) and place `SDL2.framework` in `/Library/Frameworks/`
+- Grab the latest SDL2 development library dmg from [here](https://github.com/libsdl-org/SDL) and place `SDL2.framework` in `RecastDemo/Bin`
- Navigate to the `RecastDemo` folder and run `premake5 xcode4`
- Open `Build/xcode4/recastnavigation.xcworkspace`
-- Select the "RecastDemo" project in the left pane, go to the "BuildPhases" tab and expand "Link Binary With Libraries"
-- Remove the existing entry for SDL2 (it should have a white box icon) and re-add it by hitting the plus, selecting "Add Other", and selecting `/Library/Frameworks/SDL2.framework`. It should now have a suitcase icon.
- Set the RecastDemo project as the target and build.
#### Windows
-- Grab the latest SDL2 development library release from [here](https://www.libsdl.org/download-2.0.php) and unzip it `RecastDemo\Contrib`. Rename the SDL folder such that the path `RecastDemo\Contrib\SDL\lib\x86` is valid.
-- Run `"premake5" vs2015` from the `RecastDemo` folder
-- Open the solution, build, and run.
+- Grab the latest SDL2 development library release from [here](https://github.com/libsdl-org/SDL) and unzip it `RecastDemo\Contrib`. Rename the SDL folder such that the path `RecastDemo\Contrib\SDL\lib\x86` is valid.
+- Navigate to the `RecastDemo` folder and run `premake5 vs2022`
+- Open `Build/vs2022/recastnavigation.sln`.
+- Set `RecastDemo` as the startup project, build, and run.
### Running Unit tests
@@ -71,13 +64,21 @@ RecastDemo uses [premake5](http://premake.github.io/) to build platform specific
- Build the "Tests" project. This will generate an executable named "Tests" in `RecastDemo/Bin/`
- Run the "Tests" executable. It will execute all the unit tests, indicate those that failed, and display a count of those that succeeded.
-## Integrating with your own project
+## Integrating with your game or engine
It is recommended to add the source directories `DebugUtils`, `Detour`, `DetourCrowd`, `DetourTileCache`, and `Recast` into your own project depending on which parts of the project you need. For example your level building tool could include `DebugUtils`, `Recast`, and `Detour`, and your game runtime could just include `Detour`.
-## Contributing
+### Install through vcpkg
+
+If you are using the [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager you can download and install Recast with:
+
+```
+vcpkg install recast
+```
+
+## Contribute
-See the [Contributing document](CONTRIBUTING.md) for guidelines for making contributions.
+Check out the [Project Roadmap](Roadmap.md) to see what features and functionality you might be able to help with, and the [Contributing doc](CONTRIBUTING.md) for guidance on making contributions.
## Discuss
diff --git a/Recast/CMakeLists.txt b/Recast/CMakeLists.txt
index 5e843762e..001430b59 100644
--- a/Recast/CMakeLists.txt
+++ b/Recast/CMakeLists.txt
@@ -1,12 +1,8 @@
file(GLOB SOURCES Source/*.cpp)
-
-if (RECASTNAVIGATION_STATIC)
- add_library(Recast STATIC ${SOURCES})
-else ()
- add_library(Recast SHARED ${SOURCES})
-endif ()
+add_library(Recast ${SOURCES})
add_library(RecastNavigation::Recast ALIAS Recast)
+set_target_properties(Recast PROPERTIES DEBUG_POSTFIX -d)
set(Recast_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Include")
@@ -16,14 +12,22 @@ target_include_directories(Recast PUBLIC
set_target_properties(Recast PROPERTIES
SOVERSION ${SOVERSION}
- VERSION ${VERSION}
+ VERSION ${LIB_VERSION}
+ COMPILE_PDB_OUTPUT_DIRECTORY .
+ COMPILE_PDB_NAME "Recast-d"
)
install(TARGETS Recast
- ARCHIVE DESTINATION lib
- LIBRARY DESTINATION lib
- COMPONENT library
+ EXPORT recastnavigation-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation
)
file(GLOB INCLUDES Include/*.h)
-install(FILES ${INCLUDES} DESTINATION include)
+install(FILES ${INCLUDES} DESTINATION
+ ${CMAKE_INSTALL_INCLUDEDIR}/recastnavigation)
+if(MSVC)
+ install(FILES "$/Recast-d.pdb" CONFIGURATIONS "Debug" DESTINATION "lib")
+endif()
diff --git a/Recast/Include/Recast.h b/Recast/Include/Recast.h
index 4d557389b..246376bbe 100644
--- a/Recast/Include/Recast.h
+++ b/Recast/Include/Recast.h
@@ -22,13 +22,16 @@
/// The value of PI used by Recast.
static const float RC_PI = 3.14159265f;
+/// Used to ignore unused function parameters and silence any compiler warnings.
+template void rcIgnoreUnused(const T&) { }
+
/// Recast log categories.
/// @see rcContext
enum rcLogCategory
{
RC_LOG_PROGRESS = 1, ///< A progress log entry.
RC_LOG_WARNING, ///< A warning log entry.
- RC_LOG_ERROR, ///< An error log entry.
+ RC_LOG_ERROR ///< An error log entry.
};
/// Recast performance timer categories.
@@ -101,7 +104,6 @@ enum rcTimerLabel
class rcContext
{
public:
-
/// Contructor.
/// @param[in] state TRUE if the logging and performance timers should be enabled. [Default: true]
inline rcContext(bool state = true) : m_logEnabled(state), m_timerEnabled(state) {}
@@ -140,31 +142,30 @@ class rcContext
inline int getAccumulatedTime(const rcTimerLabel label) const { return m_timerEnabled ? doGetAccumulatedTime(label) : -1; }
protected:
-
/// Clears all log entries.
- virtual void doResetLog() {}
+ virtual void doResetLog();
/// Logs a message.
/// @param[in] category The category of the message.
/// @param[in] msg The formatted message.
/// @param[in] len The length of the formatted message.
- virtual void doLog(const rcLogCategory /*category*/, const char* /*msg*/, const int /*len*/) {}
+ virtual void doLog(const rcLogCategory category, const char* msg, const int len) { rcIgnoreUnused(category); rcIgnoreUnused(msg); rcIgnoreUnused(len); }
/// Clears all timers. (Resets all to unused.)
virtual void doResetTimers() {}
/// Starts the specified performance timer.
/// @param[in] label The category of timer.
- virtual void doStartTimer(const rcTimerLabel /*label*/) {}
+ virtual void doStartTimer(const rcTimerLabel label) { rcIgnoreUnused(label); }
/// Stops the specified performance timer.
/// @param[in] label The category of the timer.
- virtual void doStopTimer(const rcTimerLabel /*label*/) {}
+ virtual void doStopTimer(const rcTimerLabel label) { rcIgnoreUnused(label); }
/// Returns the total accumulated time of the specified performance timer.
/// @param[in] label The category of the timer.
/// @return The accumulated time of the timer, or -1 if timers are disabled or the timer has never been started.
- virtual int doGetAccumulatedTime(const rcTimerLabel /*label*/) const { return -1; }
+ virtual int doGetAccumulatedTime(const rcTimerLabel label) const { rcIgnoreUnused(label); return -1; }
/// True if logging is enabled.
bool m_logEnabled;
@@ -564,7 +565,7 @@ static const int RC_AREA_BORDER = 0x20000;
enum rcBuildContoursFlags
{
RC_CONTOUR_TESS_WALL_EDGES = 0x01, ///< Tessellate solid (impassable) edges during contour simplification.
- RC_CONTOUR_TESS_AREA_EDGES = 0x02, ///< Tessellate edges between areas during contour simplification.
+ RC_CONTOUR_TESS_AREA_EDGES = 0x02 ///< Tessellate edges between areas during contour simplification.
};
/// Applied to the region id field of contour vertices in order to extract the region id.
@@ -595,11 +596,6 @@ static const int RC_NOT_CONNECTED = 0x3f;
/// @name General helper functions
/// @{
-/// Used to ignore a function parameter. VS complains about unused parameters
-/// and this silences the warning.
-/// @param [in] _ Unused parameter
-template void rcIgnoreUnused(const T&) { }
-
/// Swaps the values of the two parameters.
/// @param[in,out] a Value A
/// @param[in,out] b Value B
@@ -996,6 +992,7 @@ void rcMarkConvexPolyArea(rcContext* ctx, const float* verts, const int nverts,
/// @ingroup recast
/// @param[in] verts The vertices of the polygon [Form: (x, y, z) * @p nverts]
/// @param[in] nverts The number of vertices in the polygon.
+/// @param[in] offset How much to offset the polygon by. [Units: wu]
/// @param[out] outVerts The offset vertices (should hold up to 2 * @p nverts) [Form: (x, y, z) * return value]
/// @param[in] maxOutVerts The max number of vertices that can be stored to @p outVerts.
/// @returns Number of vertices in the offset polygon or 0 if too few vertices in @p outVerts.
diff --git a/Recast/Include/RecastAlloc.h b/Recast/Include/RecastAlloc.h
index e436af9a0..8b166d736 100644
--- a/Recast/Include/RecastAlloc.h
+++ b/Recast/Include/RecastAlloc.h
@@ -22,7 +22,7 @@
#include
#include
-#include
+#include "RecastAssert.h"
/// Provides hint values to the memory allocator on how long the
/// memory is expected to be used.
@@ -106,11 +106,13 @@ class rcVectorBase {
// Creates an array of the given size, copies all of this vector's data into it, and returns it.
T* allocate_and_copy(rcSizeType size);
void resize_impl(rcSizeType size, const T* value);
+ // Requires: min_capacity > m_cap.
+ rcSizeType get_new_capacity(rcSizeType min_capacity);
public:
typedef rcSizeType size_type;
typedef T value_type;
- rcVectorBase() : m_size(0), m_cap(0), m_data(0) {};
+ rcVectorBase() : m_size(0), m_cap(0), m_data(0) {}
rcVectorBase(const rcVectorBase& other) : m_size(0), m_cap(0), m_data(0) { assign(other.begin(), other.end()); }
explicit rcVectorBase(rcSizeType count) : m_size(0), m_cap(0), m_data(0) { resize(count); }
rcVectorBase(rcSizeType count, const T& value) : m_size(0), m_cap(0), m_data(0) { resize(count, value); }
@@ -140,8 +142,8 @@ class rcVectorBase {
const T& front() const { rcAssert(m_size); return m_data[0]; }
T& front() { rcAssert(m_size); return m_data[0]; }
- const T& back() const { rcAssert(m_size); return m_data[m_size - 1]; };
- T& back() { rcAssert(m_size); return m_data[m_size - 1]; };
+ const T& back() const { rcAssert(m_size); return m_data[m_size - 1]; }
+ T& back() { rcAssert(m_size); return m_data[m_size - 1]; }
const T* data() const { return m_data; }
T* data() { return m_data; }
@@ -196,8 +198,7 @@ void rcVectorBase::push_back(const T& value) {
return;
}
- rcAssert(RC_SIZE_MAX / 2 >= m_size);
- rcSizeType new_cap = m_size ? 2*m_size : 1;
+ const rcSizeType new_cap = get_new_capacity(m_cap + 1);
T* data = allocate_and_copy(new_cap);
// construct between allocate and destroy+free in case value is
// in this vector.
@@ -208,25 +209,44 @@ void rcVectorBase::push_back(const T& value) {
rcFree(m_data);
m_data = data;
}
+
+template
+rcSizeType rcVectorBase::get_new_capacity(rcSizeType min_capacity) {
+ rcAssert(min_capacity <= RC_SIZE_MAX);
+ if (rcUnlikely(m_cap >= RC_SIZE_MAX / 2))
+ return RC_SIZE_MAX;
+ return 2 * m_cap > min_capacity ? 2 * m_cap : min_capacity;
+}
+
template
void rcVectorBase::resize_impl(rcSizeType size, const T* value) {
if (size < m_size) {
destroy_range(size, m_size);
m_size = size;
} else if (size > m_size) {
- T* new_data = allocate_and_copy(size);
- // We defer deconstructing/freeing old data until after constructing
- // new elements in case "value" is there.
- if (value) {
- construct_range(new_data + m_size, new_data + size, *value);
+ if (size <= m_cap) {
+ if (value) {
+ construct_range(m_data + m_size, m_data + size, *value);
+ } else {
+ construct_range(m_data + m_size, m_data + size);
+ }
+ m_size = size;
} else {
- construct_range(new_data + m_size, new_data + size);
+ const rcSizeType new_cap = get_new_capacity(size);
+ T* new_data = allocate_and_copy(new_cap);
+ // We defer deconstructing/freeing old data until after constructing
+ // new elements in case "value" is there.
+ if (value) {
+ construct_range(new_data + m_size, new_data + size, *value);
+ } else {
+ construct_range(new_data + m_size, new_data + size);
+ }
+ destroy_range(0, m_size);
+ rcFree(m_data);
+ m_data = new_data;
+ m_cap = new_cap;
+ m_size = size;
}
- destroy_range(0, m_size);
- rcFree(m_data);
- m_data = new_data;
- m_cap = size;
- m_size = size;
}
}
template
@@ -303,6 +323,7 @@ class rcIntArray
rcIntArray(int n) : m_impl(n, 0) {}
void push(int item) { m_impl.push_back(item); }
void resize(int size) { m_impl.resize(size); }
+ void clear() { m_impl.clear(); }
int pop()
{
int v = m_impl.back();
diff --git a/Recast/Source/Recast.cpp b/Recast/Source/Recast.cpp
index 1b71710cd..4cf145c98 100644
--- a/Recast/Source/Recast.cpp
+++ b/Recast/Source/Recast.cpp
@@ -94,6 +94,11 @@ void rcContext::log(const rcLogCategory category, const char* format, ...)
doLog(category, msg, len);
}
+void rcContext::doResetLog()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
rcHeightfield* rcAllocHeightfield()
{
return rcNew(RC_ALLOC_PERM);
diff --git a/Recast/Source/RecastContour.cpp b/Recast/Source/RecastContour.cpp
index 277ab0150..1293d4fbd 100644
--- a/Recast/Source/RecastContour.cpp
+++ b/Recast/Source/RecastContour.cpp
@@ -921,8 +921,8 @@ bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
continue;
const unsigned char area = chf.areas[i];
- verts.resize(0);
- simplified.resize(0);
+ verts.clear();
+ simplified.clear();
ctx->startTimer(RC_TIMER_BUILD_CONTOURS_TRACE);
walkContour(x, y, i, chf, flags, verts);
@@ -1009,7 +1009,7 @@ bool rcBuildContours(rcContext* ctx, rcCompactHeightfield& chf,
if (cset.nconts > 0)
{
// Calculate winding of all polygons.
- rcScopedDelete winding((char*)rcAlloc(sizeof(char)*cset.nconts, RC_ALLOC_TEMP));
+ rcScopedDelete winding((signed char*)rcAlloc(sizeof(signed char)*cset.nconts, RC_ALLOC_TEMP));
if (!winding)
{
ctx->log(RC_LOG_ERROR, "rcBuildContours: Out of memory 'hole' (%d).", cset.nconts);
diff --git a/Recast/Source/RecastMesh.cpp b/Recast/Source/RecastMesh.cpp
index e99eaebb7..ea09ee1de 100644
--- a/Recast/Source/RecastMesh.cpp
+++ b/Recast/Source/RecastMesh.cpp
@@ -566,7 +566,6 @@ static bool canRemoveVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned sho
const int nvp = mesh.nvp;
// Count number of polygons to remove.
- int numRemovedVerts = 0;
int numTouchedVerts = 0;
int numRemainingEdges = 0;
for (int i = 0; i < mesh.npolys; ++i)
@@ -586,7 +585,6 @@ static bool canRemoveVertex(rcContext* ctx, rcPolyMesh& mesh, const unsigned sho
}
if (numRemoved)
{
- numRemovedVerts += numRemoved;
numRemainingEdges += numVerts-(numRemoved+1);
}
}
diff --git a/Recast/Source/RecastMeshDetail.cpp b/Recast/Source/RecastMeshDetail.cpp
index 9a423cab8..40bfc9b4b 100644
--- a/Recast/Source/RecastMeshDetail.cpp
+++ b/Recast/Source/RecastMeshDetail.cpp
@@ -284,7 +284,7 @@ static unsigned short getHeight(const float fx, const float fy, const float fz,
enum EdgeValues
{
EV_UNDEF = -1,
- EV_HULL = -2,
+ EV_HULL = -2
};
static int findEdge(const int* edges, int nedges, int s, int t)
@@ -653,8 +653,8 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
for (int i = 0; i < nin; ++i)
rcVcopy(&verts[i*3], &in[i*3]);
- edges.resize(0);
- tris.resize(0);
+ edges.clear();
+ tris.clear();
const float cs = chf.cs;
const float ics = 1.0f/cs;
@@ -803,7 +803,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
int x1 = (int)ceilf(bmax[0]/sampleDist);
int z0 = (int)floorf(bmin[2]/sampleDist);
int z1 = (int)ceilf(bmax[2]/sampleDist);
- samples.resize(0);
+ samples.clear();
for (int z = z0; z < z1; ++z)
{
for (int x = x0; x < x1; ++x)
@@ -864,8 +864,8 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin,
// Create new triangulation.
// TODO: Incremental add instead of full rebuild.
- edges.resize(0);
- tris.resize(0);
+ edges.clear();
+ tris.clear();
delaunayHull(ctx, nverts, verts, nhull, hull, tris, edges);
}
}
@@ -935,7 +935,7 @@ static void seedArrayWithPolyCenter(rcContext* ctx, const rcCompactHeightfield&
pcy /= npoly;
// Use seeds array as a stack for DFS
- array.resize(0);
+ array.clear();
array.push(startCellX);
array.push(startCellY);
array.push(startSpanIndex);
@@ -1001,7 +1001,7 @@ static void seedArrayWithPolyCenter(rcContext* ctx, const rcCompactHeightfield&
rcSwap(dirs[directDir], dirs[3]);
}
- array.resize(0);
+ array.clear();
// getHeightData seeds are given in coordinates with borders
array.push(cx+bs);
array.push(cy+bs);
@@ -1030,7 +1030,7 @@ static void getHeightData(rcContext* ctx, const rcCompactHeightfield& chf,
// Note: Reads to the compact heightfield are offset by border size (bs)
// since border size offset is already removed from the polymesh vertices.
- queue.resize(0);
+ queue.clear();
// Set all heights to RC_UNSET_HEIGHT.
memset(hp.data, 0xff, sizeof(unsigned short)*hp.width*hp.height);
diff --git a/Recast/Source/RecastRasterization.cpp b/Recast/Source/RecastRasterization.cpp
index a4cef7490..673550e79 100644
--- a/Recast/Source/RecastRasterization.cpp
+++ b/Recast/Source/RecastRasterization.cpp
@@ -264,7 +264,8 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2,
// Calculate the footprint of the triangle on the grid's y-axis
int y0 = (int)((tmin[2] - bmin[2])*ics);
int y1 = (int)((tmax[2] - bmin[2])*ics);
- y0 = rcClamp(y0, 0, h-1);
+ // use -1 rather than 0 to cut the polygon properly at the start of the tile
+ y0 = rcClamp(y0, -1, h-1);
y1 = rcClamp(y1, 0, h-1);
// Clip the triangle into all grid cells it touches.
@@ -283,7 +284,7 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2,
dividePoly(in, nvIn, inrow, &nvrow, p1, &nvIn, cz+cs, 2);
rcSwap(in, p1);
if (nvrow < 3) continue;
-
+ if (y < 0) continue;
// find the horizontal bounds in the row
float minX = inrow[0], maxX = inrow[0];
for (int i=1; i= w) {
+ continue;
+ }
+ x0 = rcClamp(x0, -1, w-1);
x1 = rcClamp(x1, 0, w-1);
int nv, nv2 = nvrow;
@@ -305,7 +309,7 @@ static bool rasterizeTri(const float* v0, const float* v1, const float* v2,
dividePoly(inrow, nv2, p1, &nv, p2, &nv2, cx+cs, 0);
rcSwap(inrow, p2);
if (nv < 3) continue;
-
+ if (x < 0) continue;
// Calculate min and max of the span.
float smin = p1[1], smax = p1[1];
for (int i = 1; i < nv; ++i)
diff --git a/Recast/Source/RecastRegion.cpp b/Recast/Source/RecastRegion.cpp
index e1fc0ee78..48318688b 100644
--- a/Recast/Source/RecastRegion.cpp
+++ b/Recast/Source/RecastRegion.cpp
@@ -650,7 +650,7 @@ static bool mergeRegions(rcRegion& rega, rcRegion& regb)
return false;
// Merge neighbours.
- rega.connections.resize(0);
+ rega.connections.clear();
for (int i = 0, ni = acon.size(); i < ni-1; ++i)
rega.connections.push(acon[(insa+1+i) % ni]);
@@ -876,8 +876,8 @@ static bool mergeAndFilterRegions(rcContext* ctx, int minRegionArea, int mergeRe
// Also keep track of the regions connects to a tile border.
bool connectsToBorder = false;
int spanCount = 0;
- stack.resize(0);
- trace.resize(0);
+ stack.clear();
+ trace.clear();
reg.visited = true;
stack.push(i);
@@ -1068,7 +1068,7 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
{
const rcCompactCell& c = chf.cells[x+y*w];
- lregs.resize(0);
+ lregs.clear();
for (int i = (int)c.index, ni = (int)(c.index+c.count); i < ni; ++i)
{
@@ -1139,7 +1139,7 @@ static bool mergeAndFilterLayerRegions(rcContext* ctx, int minRegionArea,
// Start search.
root.id = layerId;
- stack.resize(0);
+ stack.clear();
stack.push(i);
while (stack.size() > 0)
diff --git a/RecastDemo/Bin/.gitignore b/RecastDemo/Bin/.gitignore
index c44262faf..f6861ba21 100644
--- a/RecastDemo/Bin/.gitignore
+++ b/RecastDemo/Bin/.gitignore
@@ -1 +1,2 @@
Recast.app
+SDL2.framework
\ No newline at end of file
diff --git a/RecastDemo/CMakeLists.txt b/RecastDemo/CMakeLists.txt
index a6a1a7333..1e8f9398a 100644
--- a/RecastDemo/CMakeLists.txt
+++ b/RecastDemo/CMakeLists.txt
@@ -3,11 +3,22 @@ file(GLOB SOURCES Source/*.cpp Contrib/fastlz/fastlz.c)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if(NOT SDL2_ROOT_DIR)
+ if(WIN32)
set(SDL2_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Contrib/SDL")
+ elseif(APPLE)
+ set(SDL2_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Bin")
+ endif()
endif()
find_package(OpenGL REQUIRED)
-find_package(SDL2 REQUIRED)
+if(APPLE)
+ find_library(SDL2_LIBRARY
+ NAMES SDL2
+ PATHS ${SDL2_ROOT_DIR}
+ REQUIRED)
+else()
+ find_package(SDL2 REQUIRED)
+endif()
include_directories(SYSTEM ${OPENGL_INCLUDE_DIR})
include_directories(SYSTEM Contrib/fastlz)
@@ -18,6 +29,10 @@ include_directories(../DetourCrowd/Include)
include_directories(../DetourTileCache/Include)
include_directories(../Recast/Include)
include_directories(Include)
+include_directories(Contrib/SDL/include)
+if(APPLE)
+ include_directories(${SDL2_LIBRARY}/Headers)
+endif()
if (WIN32)
add_executable(RecastDemo WIN32 ${SOURCES})
@@ -27,16 +42,38 @@ else()
add_executable(RecastDemo ${SOURCES})
endif()
-file(COPY Bin/Meshes DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY Bin/TestCases DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY Bin/DroidSans.ttf DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-
-if (WIN32)
- file(COPY "${SDL2_RUNTIME_LIBRARY}" DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+if( WIN32 )
+ if ( "${CMAKE_MAKE_PROGRAM}" MATCHES "MSBuild" )
+ add_custom_command(TARGET RecastDemo
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${SDL2_RUNTIME_LIBRARY}" ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/Meshes ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/Meshes
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/TestCases ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/TestCases
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Bin/DroidSans.ttf ${CMAKE_BINARY_DIR}/RecastDemo/$(ConfigurationName)/
+ )
+ elseif ( MINGW )
+ add_custom_command(TARGET RecastDemo
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E copy "${SDL2_RUNTIME_LIBRARY}" ${CMAKE_BINARY_DIR}/RecastDemo/
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/Meshes ${CMAKE_BINARY_DIR}/RecastDemo/Meshes
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Bin/TestCases ${CMAKE_BINARY_DIR}/RecastDemo/TestCases
+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Bin/DroidSans.ttf ${CMAKE_BINARY_DIR}/RecastDemo/
+ )
+ endif()
+else()
+ file(COPY Bin/Meshes DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY Bin/TestCases DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY Bin/DroidSans.ttf DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endif()
+
add_dependencies(RecastDemo DebugUtils Detour DetourCrowd DetourTileCache Recast)
-target_link_libraries(RecastDemo ${OPENGL_LIBRARIES} SDL2::SDL2main DebugUtils Detour DetourCrowd DetourTileCache Recast)
+if(APPLE)
+ target_link_libraries(RecastDemo ${OPENGL_LIBRARIES} ${SDL2_LIBRARY} DebugUtils Detour DetourCrowd DetourTileCache Recast)
+else()
+ target_link_libraries(RecastDemo ${OPENGL_LIBRARIES} SDL2::SDL2main DebugUtils Detour DetourCrowd DetourTileCache Recast)
+endif()
+
install(TARGETS RecastDemo
RUNTIME DESTINATION bin
diff --git a/RecastDemo/Include/ChunkyTriMesh.h b/RecastDemo/Include/ChunkyTriMesh.h
index 65849799f..0870d64ef 100644
--- a/RecastDemo/Include/ChunkyTriMesh.h
+++ b/RecastDemo/Include/ChunkyTriMesh.h
@@ -29,7 +29,7 @@ struct rcChunkyTriMeshNode
struct rcChunkyTriMesh
{
- inline rcChunkyTriMesh() : nodes(0), nnodes(0), tris(0), ntris(0), maxTrisPerChunk(0) {};
+ inline rcChunkyTriMesh() : nodes(0), nnodes(0), tris(0), ntris(0), maxTrisPerChunk(0) {}
inline ~rcChunkyTriMesh() { delete [] nodes; delete [] tris; }
rcChunkyTriMeshNode* nodes;
diff --git a/RecastDemo/Include/CrowdTool.h b/RecastDemo/Include/CrowdTool.h
index 8c170ef47..a2980660f 100644
--- a/RecastDemo/Include/CrowdTool.h
+++ b/RecastDemo/Include/CrowdTool.h
@@ -122,7 +122,7 @@ class CrowdTool : public SampleTool
TOOLMODE_CREATE,
TOOLMODE_MOVE_TARGET,
TOOLMODE_SELECT,
- TOOLMODE_TOGGLE_POLYS,
+ TOOLMODE_TOGGLE_POLYS
};
ToolMode m_mode;
diff --git a/RecastDemo/Include/NavMeshTesterTool.h b/RecastDemo/Include/NavMeshTesterTool.h
index 01f46808c..080170ea0 100644
--- a/RecastDemo/Include/NavMeshTesterTool.h
+++ b/RecastDemo/Include/NavMeshTesterTool.h
@@ -43,7 +43,7 @@ class NavMeshTesterTool : public SampleTool
TOOLMODE_DISTANCE_TO_WALL,
TOOLMODE_FIND_POLYS_IN_CIRCLE,
TOOLMODE_FIND_POLYS_IN_SHAPE,
- TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD,
+ TOOLMODE_FIND_LOCAL_NEIGHBOURHOOD
};
ToolMode m_toolMode;
@@ -110,4 +110,5 @@ class NavMeshTesterTool : public SampleTool
void drawAgent(const float* pos, float r, float h, float c, const unsigned int col);
};
-#endif // NAVMESHTESTERTOOL_H
\ No newline at end of file
+#endif // NAVMESHTESTERTOOL_H
+
diff --git a/RecastDemo/Include/PerfTimer.h b/RecastDemo/Include/PerfTimer.h
index ed62c1805..ce0f296f0 100644
--- a/RecastDemo/Include/PerfTimer.h
+++ b/RecastDemo/Include/PerfTimer.h
@@ -29,4 +29,5 @@ typedef __int64 TimeVal;
TimeVal getPerfTime();
int getPerfTimeUsec(const TimeVal duration);
-#endif // PERFTIMER_H
\ No newline at end of file
+#endif // PERFTIMER_H
+
diff --git a/RecastDemo/Include/Sample.h b/RecastDemo/Include/Sample.h
index aa46f860a..608c3dbea 100644
--- a/RecastDemo/Include/Sample.h
+++ b/RecastDemo/Include/Sample.h
@@ -47,7 +47,7 @@ enum SamplePolyAreas
SAMPLE_POLYAREA_ROAD,
SAMPLE_POLYAREA_DOOR,
SAMPLE_POLYAREA_GRASS,
- SAMPLE_POLYAREA_JUMP,
+ SAMPLE_POLYAREA_JUMP
};
enum SamplePolyFlags
{
@@ -69,12 +69,12 @@ enum SamplePartitionType
{
SAMPLE_PARTITION_WATERSHED,
SAMPLE_PARTITION_MONOTONE,
- SAMPLE_PARTITION_LAYERS,
+ SAMPLE_PARTITION_LAYERS
};
struct SampleTool
{
- virtual ~SampleTool() {}
+ virtual ~SampleTool();
virtual int type() = 0;
virtual void init(class Sample* sample) = 0;
virtual void reset() = 0;
@@ -88,7 +88,7 @@ struct SampleTool
};
struct SampleToolState {
- virtual ~SampleToolState() {}
+ virtual ~SampleToolState();
virtual void init(class Sample* sample) = 0;
virtual void reset() = 0;
virtual void handleRender() = 0;
diff --git a/RecastDemo/Include/TestCase.h b/RecastDemo/Include/TestCase.h
index f61cc8565..8991e576f 100644
--- a/RecastDemo/Include/TestCase.h
+++ b/RecastDemo/Include/TestCase.h
@@ -27,13 +27,17 @@ class TestCase
enum TestType
{
TEST_PATHFIND,
- TEST_RAYCAST,
+ TEST_RAYCAST
};
struct Test
{
Test() :
type(),
+ spos(),
+ epos(),
+ nspos(),
+ nepos(),
radius(0),
includeFlags(0),
excludeFlags(0),
@@ -107,4 +111,4 @@ class TestCase
TestCase& operator=(const TestCase&);
};
-#endif // TESTCASE_H
\ No newline at end of file
+#endif // TESTCASE_H
diff --git a/RecastDemo/Include/ValueHistory.h b/RecastDemo/Include/ValueHistory.h
index 2da53902a..1e83a2110 100644
--- a/RecastDemo/Include/ValueHistory.h
+++ b/RecastDemo/Include/ValueHistory.h
@@ -47,4 +47,5 @@ void drawGraph(const GraphParams* p, const ValueHistory* graph,
int idx, const char* label, const unsigned int col);
-#endif // VALUEHISTORY_H
\ No newline at end of file
+#endif // VALUEHISTORY_H
+
diff --git a/RecastDemo/Include/imgui.h b/RecastDemo/Include/imgui.h
index 325829b3d..3d7346ef1 100644
--- a/RecastDemo/Include/imgui.h
+++ b/RecastDemo/Include/imgui.h
@@ -22,14 +22,14 @@
enum imguiMouseButton
{
IMGUI_MBUT_LEFT = 0x01,
- IMGUI_MBUT_RIGHT = 0x02,
+ IMGUI_MBUT_RIGHT = 0x02
};
enum imguiTextAlign
{
IMGUI_ALIGN_LEFT,
IMGUI_ALIGN_CENTER,
- IMGUI_ALIGN_RIGHT,
+ IMGUI_ALIGN_RIGHT
};
inline unsigned int imguiRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
@@ -68,7 +68,7 @@ enum imguiGfxCmdType
IMGUI_GFXCMD_TRIANGLE,
IMGUI_GFXCMD_LINE,
IMGUI_GFXCMD_TEXT,
- IMGUI_GFXCMD_SCISSOR,
+ IMGUI_GFXCMD_SCISSOR
};
struct imguiGfxRect
diff --git a/RecastDemo/Include/imguiRenderGL.h b/RecastDemo/Include/imguiRenderGL.h
index b14834169..33cd017ce 100644
--- a/RecastDemo/Include/imguiRenderGL.h
+++ b/RecastDemo/Include/imguiRenderGL.h
@@ -23,4 +23,5 @@ bool imguiRenderGLInit(const char* fontpath);
void imguiRenderGLDestroy();
void imguiRenderGLDraw();
-#endif // IMGUI_RENDER_GL_H
\ No newline at end of file
+#endif // IMGUI_RENDER_GL_H
+
diff --git a/RecastDemo/Source/ChunkyTriMesh.cpp b/RecastDemo/Source/ChunkyTriMesh.cpp
index 2991d4ff8..242bf285a 100644
--- a/RecastDemo/Source/ChunkyTriMesh.cpp
+++ b/RecastDemo/Source/ChunkyTriMesh.cpp
@@ -83,7 +83,7 @@ static void subdivide(BoundsItem* items, int nitems, int imin, int imax, int tri
int inum = imax - imin;
int icur = curNode;
- if (curNode > maxNodes)
+ if (curNode >= maxNodes)
return;
rcChunkyTriMeshNode& node = nodes[curNode++];
diff --git a/RecastDemo/Source/Filelist.cpp b/RecastDemo/Source/Filelist.cpp
index 7e0513040..bd715c47b 100644
--- a/RecastDemo/Source/Filelist.cpp
+++ b/RecastDemo/Source/Filelist.cpp
@@ -55,10 +55,10 @@ void scanDirectoryAppend(const string& path, const string& ext, vector&
return;
}
- int extLen = strlen(ext.c_str());
+ size_t extLen = strlen(ext.c_str());
while ((current = readdir(dp)) != 0)
{
- int len = strlen(current->d_name);
+ size_t len = strlen(current->d_name);
if (len > extLen && strncmp(current->d_name + len - extLen, ext.c_str(), extLen) == 0)
{
filelist.push_back(current->d_name);
diff --git a/RecastDemo/Source/InputGeom.cpp b/RecastDemo/Source/InputGeom.cpp
index a5f9a0d15..fc6af8204 100644
--- a/RecastDemo/Source/InputGeom.cpp
+++ b/RecastDemo/Source/InputGeom.cpp
@@ -424,9 +424,6 @@ static bool isectSegAABB(const float* sp, const float* sq,
bool InputGeom::raycastMesh(float* src, float* dst, float& tmin)
{
- float dir[3];
- rcVsub(dir, dst, src);
-
// Prune hit ray.
float btmin, btmax;
if (!isectSegAABB(src, dst, m_meshBMin, m_meshBMax, btmin, btmax))
diff --git a/RecastDemo/Source/Sample.cpp b/RecastDemo/Source/Sample.cpp
index d8c4cfdb1..2b5a7a2dc 100644
--- a/RecastDemo/Source/Sample.cpp
+++ b/RecastDemo/Source/Sample.cpp
@@ -35,6 +35,16 @@
# define snprintf _snprintf
#endif
+SampleTool::~SampleTool()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
+SampleToolState::~SampleToolState()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
unsigned int SampleDebugDraw::areaToCol(unsigned int area)
{
switch(area)
diff --git a/RecastDemo/Source/SampleInterfaces.cpp b/RecastDemo/Source/SampleInterfaces.cpp
index 72bb34c28..a9fd3ae54 100644
--- a/RecastDemo/Source/SampleInterfaces.cpp
+++ b/RecastDemo/Source/SampleInterfaces.cpp
@@ -184,7 +184,7 @@ class GLCheckerTexture
}
}
};
-GLCheckerTexture g_tex;
+static GLCheckerTexture g_tex;
void DebugDrawGL::depthMask(bool state)
diff --git a/RecastDemo/Source/Sample_TempObstacles.cpp b/RecastDemo/Source/Sample_TempObstacles.cpp
index 6c1367f20..4dd4e5f00 100644
--- a/RecastDemo/Source/Sample_TempObstacles.cpp
+++ b/RecastDemo/Source/Sample_TempObstacles.cpp
@@ -109,6 +109,8 @@ static int calcLayerBufferSize(const int gridWidth, const int gridHeight)
struct FastLZCompressor : public dtTileCacheCompressor
{
+ virtual ~FastLZCompressor();
+
virtual int maxCompressedSize(const int bufferSize)
{
return (int)(bufferSize* 1.05f);
@@ -129,6 +131,11 @@ struct FastLZCompressor : public dtTileCacheCompressor
}
};
+FastLZCompressor::~FastLZCompressor()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
+
struct LinearAllocator : public dtTileCacheAlloc
{
unsigned char* buffer;
@@ -141,10 +148,7 @@ struct LinearAllocator : public dtTileCacheAlloc
resize(cap);
}
- ~LinearAllocator()
- {
- dtFree(buffer);
- }
+ virtual ~LinearAllocator();
void resize(const size_t cap)
{
@@ -176,6 +180,12 @@ struct LinearAllocator : public dtTileCacheAlloc
}
};
+LinearAllocator::~LinearAllocator()
+{
+ // Defined out of line to fix the weak v-tables warning
+ dtFree(buffer);
+}
+
struct MeshProcess : public dtTileCacheMeshProcess
{
InputGeom* m_geom;
@@ -184,6 +194,8 @@ struct MeshProcess : public dtTileCacheMeshProcess
{
}
+ virtual ~MeshProcess();
+
inline void init(InputGeom* geom)
{
m_geom = geom;
@@ -228,8 +240,10 @@ struct MeshProcess : public dtTileCacheMeshProcess
}
};
-
-
+MeshProcess::~MeshProcess()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
static const int MAX_LAYERS = 32;
@@ -494,7 +508,7 @@ enum DrawDetailType
DRAWDETAIL_AREAS,
DRAWDETAIL_REGIONS,
DRAWDETAIL_CONTOURS,
- DRAWDETAIL_MESH,
+ DRAWDETAIL_MESH
};
void drawDetail(duDebugDraw* dd, dtTileCache* tc, const int tx, const int ty, int type)
@@ -667,9 +681,6 @@ void drawObstacles(duDebugDraw* dd, const dtTileCache* tc)
}
}
-
-
-
class TempObstacleHilightTool : public SampleTool
{
Sample_TempObstacles* m_sample;
@@ -687,9 +698,7 @@ class TempObstacleHilightTool : public SampleTool
m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0;
}
- virtual ~TempObstacleHilightTool()
- {
- }
+ virtual ~TempObstacleHilightTool();
virtual int type() { return TOOL_TILE_HIGHLIGHT; }
@@ -764,6 +773,10 @@ class TempObstacleHilightTool : public SampleTool
}
};
+TempObstacleHilightTool::~TempObstacleHilightTool()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
class TempObstacleCreateTool : public SampleTool
{
@@ -775,9 +788,7 @@ class TempObstacleCreateTool : public SampleTool
{
}
- virtual ~TempObstacleCreateTool()
- {
- }
+ virtual ~TempObstacleCreateTool();
virtual int type() { return TOOL_TEMP_OBSTACLE; }
@@ -819,9 +830,10 @@ class TempObstacleCreateTool : public SampleTool
virtual void handleRenderOverlay(double* /*proj*/, double* /*model*/, int* /*view*/) { }
};
-
-
-
+TempObstacleCreateTool::~TempObstacleCreateTool()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
Sample_TempObstacles::Sample_TempObstacles() :
m_keepInterResults(false),
diff --git a/RecastDemo/Source/Sample_TileMesh.cpp b/RecastDemo/Source/Sample_TileMesh.cpp
index 1de558184..42fe3078b 100644
--- a/RecastDemo/Source/Sample_TileMesh.cpp
+++ b/RecastDemo/Source/Sample_TileMesh.cpp
@@ -87,9 +87,7 @@ class NavMeshTileTool : public SampleTool
m_hitPos[0] = m_hitPos[1] = m_hitPos[2] = 0;
}
- virtual ~NavMeshTileTool()
- {
- }
+ virtual ~NavMeshTileTool();
virtual int type() { return TOOL_TILE_EDIT; }
@@ -172,8 +170,10 @@ class NavMeshTileTool : public SampleTool
}
};
-
-
+NavMeshTileTool::~NavMeshTileTool()
+{
+ // Defined out of line to fix the weak v-tables warning
+}
Sample_TileMesh::Sample_TileMesh() :
m_keepInterResults(false),
diff --git a/RecastDemo/Source/TestCase.cpp b/RecastDemo/Source/TestCase.cpp
index cf1214a73..5ce42623f 100644
--- a/RecastDemo/Source/TestCase.cpp
+++ b/RecastDemo/Source/TestCase.cpp
@@ -154,8 +154,7 @@ bool TestCase::load(const std::string& filePath)
else if (row[0] == 'p' && row[1] == 'f')
{
// Pathfind test.
- Test* test = new Test;
- memset(test, 0, sizeof(Test));
+ Test* test = new Test();
test->type = TEST_PATHFIND;
test->expand = false;
test->next = m_tests;
@@ -168,8 +167,7 @@ bool TestCase::load(const std::string& filePath)
else if (row[0] == 'r' && row[1] == 'c')
{
// Pathfind test.
- Test* test = new Test;
- memset(test, 0, sizeof(Test));
+ Test* test = new Test();
test->type = TEST_RAYCAST;
test->expand = false;
test->next = m_tests;
diff --git a/RecastDemo/Source/main.cpp b/RecastDemo/Source/main.cpp
index e9f584df4..90c6dbb3c 100644
--- a/RecastDemo/Source/main.cpp
+++ b/RecastDemo/Source/main.cpp
@@ -78,6 +78,9 @@ int main(int /*argc*/, char** /*argv*/)
return -1;
}
+ // Use OpenGL render driver.
+ SDL_SetHint(SDL_HINT_RENDER_DRIVER, "opengl");
+
// Enable depth buffer.
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
@@ -124,7 +127,6 @@ int main(int /*argc*/, char** /*argv*/)
}
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
- SDL_GL_CreateContext(window);
if (!imguiRenderGLInit("DroidSans.ttf"))
{
@@ -133,7 +135,6 @@ int main(int /*argc*/, char** /*argv*/)
return -1;
}
- float t = 0.0f;
float timeAcc = 0.0f;
Uint32 prevFrameTime = SDL_GetTicks();
int mousePos[2] = {0, 0};
@@ -352,8 +353,6 @@ int main(int /*argc*/, char** /*argv*/)
Uint32 time = SDL_GetTicks();
float dt = (time - prevFrameTime) / 1000.0f;
prevFrameTime = time;
-
- t += dt;
// Hit test mesh.
if (processHitTest && geom && sample)
diff --git a/RecastDemo/premake5.lua b/RecastDemo/premake5.lua
index 8c218ddb5..52bbaf93b 100644
--- a/RecastDemo/premake5.lua
+++ b/RecastDemo/premake5.lua
@@ -6,7 +6,7 @@
local action = _ACTION or ""
local todir = "Build/" .. action
-solution "recastnavigation"
+workspace "recastnavigation"
configurations {
"Debug",
"Release"
@@ -15,27 +15,28 @@ solution "recastnavigation"
location (todir)
floatingpoint "Fast"
- symbols "On"
exceptionhandling "Off"
rtti "Off"
+ symbols "On"
flags { "FatalCompileWarnings" }
+ cppdialect "C++98"
-- debug configs
- configuration "Debug*"
+ filter "configurations:Debug"
defines { "DEBUG" }
targetdir ( todir .. "/lib/Debug" )
-- release configs
- configuration "Release*"
+ filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
targetdir ( todir .. "/lib/Release" )
- configuration "not windows"
+ filter "system:not windows"
warnings "Extra"
-- windows specific
- configuration "windows"
+ filter "system:windows"
platforms { "Win32", "Win64" }
defines { "WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS", "_HAS_EXCEPTIONS=0" }
-- warnings "Extra" uses /W4 which is too aggressive for us, so use W3 instead.
@@ -58,7 +59,7 @@ project "DebugUtils"
"../DetourTileCache/Include",
"../Recast/Include"
}
- files {
+ files {
"../DebugUtils/Include/*.h",
"../DebugUtils/Source/*.cpp"
}
@@ -74,12 +75,12 @@ project "Detour"
"../Detour/Source/*.cpp"
}
-- linux library cflags and libs
- configuration { "linux", "gmake" }
- buildoptions {
- "-Wno-error=class-memaccess"
+ filter {"system:linux", "toolset:gcc"}
+ buildoptions {
+ "-Wno-error=class-memaccess",
+ "-Wno-error=maybe-uninitialized"
}
-
project "DetourCrowd"
language "C++"
kind "StaticLib"
@@ -130,7 +131,7 @@ project "RecastDemo"
"../DetourTileCache/Include",
"../Recast/Include"
}
- files {
+ files {
"../RecastDemo/Include/*.h",
"../RecastDemo/Source/*.cpp",
"../RecastDemo/Contrib/fastlz/*.h",
@@ -138,7 +139,7 @@ project "RecastDemo"
}
-- project dependencies
- links {
+ links {
"DebugUtils",
"Detour",
"DetourCrowd",
@@ -150,14 +151,12 @@ project "RecastDemo"
targetdir "Bin"
-- linux library cflags and libs
- configuration { "linux", "gmake" }
+ filter "system:linux"
buildoptions {
"`pkg-config --cflags sdl2`",
"`pkg-config --cflags gl`",
"`pkg-config --cflags glu`",
"-Wno-ignored-qualifiers",
- "-Wno-error=class-memaccess"
-
}
linkoptions {
"`pkg-config --libs sdl2`",
@@ -165,8 +164,13 @@ project "RecastDemo"
"`pkg-config --libs glu`"
}
+ filter { "system:linux", "toolset:gcc", "files:*.c" }
+ buildoptions {
+ "-Wno-class-memaccess"
+ }
+
-- windows library cflags and libs
- configuration { "windows" }
+ filter "system:windows"
includedirs { "../RecastDemo/Contrib/SDL/include" }
libdirs { "../RecastDemo/Contrib/SDL/lib/%{cfg.architecture:gsub('x86_64', 'x64')}" }
debugdir "../RecastDemo/Bin/"
@@ -182,9 +186,9 @@ project "RecastDemo"
}
-- mac includes and libs
- configuration { "macosx" }
+ filter "system:macosx"
kind "ConsoleApp" -- xcode4 failes to run the project if using WindowedApp
- includedirs { "/Library/Frameworks/SDL2.framework/Headers" }
+ includedirs { "Bin/SDL2.framework/Headers" }
links {
"OpenGL.framework",
"SDL2.framework",
@@ -194,6 +198,7 @@ project "RecastDemo"
project "Tests"
language "C++"
kind "ConsoleApp"
+ cppdialect "C++14" -- Catch requires newer C++ features
-- Catch requires RTTI and exceptions
exceptionhandling "On"
@@ -208,8 +213,9 @@ project "Tests"
"../Recast/Source",
"../Tests/Recast",
"../Tests",
+ "../Tests/Contrib/Catch"
}
- files {
+ files {
"../Tests/*.h",
"../Tests/*.hpp",
"../Tests/*.cpp",
@@ -217,6 +223,7 @@ project "Tests"
"../Tests/Recast/*.cpp",
"../Tests/Detour/*.h",
"../Tests/Detour/*.cpp",
+ "../Tests/Contrib/Catch/*.cpp"
}
-- project dependencies
@@ -232,8 +239,8 @@ project "Tests"
targetdir "Bin"
-- linux library cflags and libs
- configuration { "linux", "gmake" }
- buildoptions {
+ filter "system:linux"
+ buildoptions {
"`pkg-config --cflags sdl2`",
"`pkg-config --cflags gl`",
"`pkg-config --cflags glu`",
@@ -242,11 +249,12 @@ project "Tests"
linkoptions {
"`pkg-config --libs sdl2`",
"`pkg-config --libs gl`",
- "`pkg-config --libs glu`"
+ "`pkg-config --libs glu`",
+ "-lpthread"
}
-- windows library cflags and libs
- configuration { "windows" }
+ filter "system:windows"
includedirs { "../RecastDemo/Contrib/SDL/include" }
libdirs { "../RecastDemo/Contrib/SDL/lib/%{cfg.architecture:gsub('x86_64', 'x64')}" }
debugdir "../RecastDemo/Bin/"
@@ -258,11 +266,8 @@ project "Tests"
}
-- mac includes and libs
- configuration { "macosx" }
+ filter "system:macosx"
kind "ConsoleApp"
- includedirs { "/Library/Frameworks/SDL2.framework/Headers" }
- links {
- "OpenGL.framework",
- "SDL2.framework",
+ links {
"Cocoa.framework",
}
diff --git a/Roadmap.md b/Roadmap.md
new file mode 100644
index 000000000..e86e3793a
--- /dev/null
+++ b/Roadmap.md
@@ -0,0 +1,74 @@
+# Recast Development Roadmap
+
+This document describes the current development roadmap for Recast and Detour. It is initially focused on maintaining and polishing the current functionality in a way that makes it more appealing and easier to use. There are a number of large areas of new functionality that are appealing as well.
+
+If you're excited about contributing to Recast or want to understand what its future looks like, this roadmap is a great place to start.
+
+## Short Term
+
+### Documentation & Web Presence
+- **Project website** (GitHub pages). A home for docs, info, tutorials, etc. that's easy to find and navigate. There's stuff like the wiki system in GitHub that can serve this purpose, but it's not the greatest.
+- **Hosted API Reference**: We have extensive doxygen docs that we should also host on github pages. Ideally this would be implemented as a job for the CI process.
+- **High-level design/overview**. Basically taking a lot of the "how does Recast work?" docs we have (and stuff on Mikko's blog) and surfacing them in a place that's easier to find. e.g. [this information](http://digestingduck.blogspot.com/2010/02/slides-from-past.html) should be integrated to the documentation.
+- **FAQ** to include answers to common questions like "can I use Recast on a spherical world?" etc. The small group of questions that come up often.
+- **Expand on configuration parameter docstrings**. Expand on the docstrings for the fields in `rcConfig`.
+- **Projects using recast page**. A place to show off integrations of Recast into different games and engines. Having this visible will help give people confidence in the quality of Recast.
+
+### More explicit variable names
+There's quite a few variables that are single-letter or very condensed acronyms. Stuff like `u`, `v`, `cs`, `nnei` etc. These are certainly easier to type than more descriptive names, and can allow for some nice code formatting, but the readability gains of less condensed names outweigh that. These should be updated to be more easily maintainable and less of a hurdle for newcomers.
+
+### Opt-in config value validation system
+There's a number of documentation-defined valid value ranges, as well as some suggested value ranges for config values like those in rcConfig. Recast should have an _opt-in_ system for validating value ranges and value relationships. Some implementations [like Godot's](https://github.com/godotengine/godot/blob/c7ceb94e372216b1b033d7c2ac26d5b7545c4dac/modules/navigation/navigation_mesh_generator.cpp#L545-L568) include similar configuration value checks already. This would help alert users to potential problems arising from misconfiguration. Recast shouldn't restrict people from going outside the recommended bounds, but for the majority of users values that are out of bounds are likely a mistake and Recast should at least raise the concern when prompted.
+
+## Medium Term
+
+### STB-Style Single-Header Release Packaging
+For ease of integration. This should probably be implemented as a build packaging script, similar to the release packaging process for the Catch unit testing library.
+
+### Ensure there's a good threading story
+Currently Recast provides no specific threading support. Many aspects of navmesh generation (especialy with tile generation) can be easily multithreaded, as can parts of detour (threaded pathfinding, etc). This likely requires a good example integration to work with - it probably shouldn't be designed in isolation.
+
+### More Tests
+This is a good place to start when making any changes to the internals or fixing bugs. It's important to have a way to validate that bugfixes or enhancements are not adversely affecting the base Recast functionality. Lots of parts of the code are fairly simple to test, but some would require some extra effort with mocking data or similar.
+
+### More POD structs for clarity in internals
+Small structs like a simple 3-float POD vector would go a long way to help clarify a lot of the internals. Any changes here shouldn't impact performance or functionality. They should just be simple POD structs that get optimized away but make the code a bit clearer to read and work with.
+
+### Revisit structural organization
+There some number of generally low-level geometry functions that are implemented both in Recast and in Detour. We should probably take stock of the general library layout and determine if there's enough of a benefit to slightly restructuring things to better share core functionality. There may not be enough code like this to be worth it, so it might not be a net win. Organization and re-use benefits should vastly outweighing the cost of defining a shared dependency to make this worthwhile. There's likely just minimal gains here since things are already laid out logically, but it's worth looking into.
+
+## Longer-Term
+
+### Higher-Level APIs
+The current API level is excellent for providing maximum control over the entire navmesh building process. For many people, integrating Recast involves copying over all the code from the tiled mesh demo with minimal tweaks. Recast can better serve these people, and hopefully boost adoption by providing some higher-level API calls.
+
+### C API
+This would help tremendously with adoption. There are a number of integrations of Recast to other languages right now, and a number of them are using their own C API wrappers around the existing Recast API. Providing a first-party C API would help normalize the different integrations of Recast out there, as well as improve the integration process for people with engines written in C or other languages with C interop.
+
+There's enough cases where we pass around object pointers in API calls that may cause this to be a bit more work than it seems.
+
+# Roadmap for New Recast/Detour Functionality
+
+### Nav Volumes & 3D Navigation
+Obviously a big feature that would enable flying agents. Probably not terribly difficult to integrate due to the voxelization process, but it's probably a lot of detailed geometric processes and challenges. We'd at least need to retain unwalkable polygons longer in the process (they get thrown away pretty early) so we should ensure it doesn't have any adversarial affects to the perf or capabilities of the normal navmesh process. 3d navigation should be a separate set of APIs, as the considerations and use cases are quite different than normal navmesh navigation.
+
+### Climbing Markup & Navigation
+This is a common problem with many modern games. There's a number of ways to solve this, so we should make sure to consult with people who are actively using Recast and building games with climbing to understand their needs.
+
+### Tooling
+Recast Demo already has a number of sample tools to explore and test the generated navmesh data. There's a number of middleware providers that tout workflow features and tooling for generating and manipulating navmesh data. RecastDemo could be expanded (and maybe re-named) to be a more fully fleshed out standalone tool, rather than be mostly focused as an integration demo and feature showcase. There's almost certainly a ton of custom data and markup most people will want to add to the generated navmeshes, so there should be a reasonable way for people to integrate their customizations and markup with any tooling Recast provide.
+
+### More spatial querying abilities
+There's already a number of spatial query functions, and fleshing out that set some more is likely quite easy and useful.
+
+### Auto-markup system
+This is something recast already gives you access to add yourself, thanks to its low-level API and how each step in the process is explicit. It is worthwhile to consider what kind of help other middleware systems provide in this process. For example, are other navigation middleware solutions providing a structured way to define spatial queries that result in nav markup? Some easy examples of useful features here might be automatic jump point or cover annotations. It would be good to talk to people in the AAA FPS space to see what markup types are most useful to them.
+
+### Formations, Group behaviors
+Extending DetourCrowd to support formations, group navigation, group behaviors and similar beyond what's it's already capable of.
+
+### Vehicle Navigation & Movement
+A feature set centered on pathfinding and movement planning for characters with kinematic movement constraints.
+
+### Crowd Simulation and Flowfield movement systems
+Movement systems for large crowds that leverage flowfields or other highly-scalable navigation and movement approaches.
\ No newline at end of file
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 7c1746964..45d7d1f7d 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1,12 +1,14 @@
-file(GLOB TESTS_SOURCES *.cpp Detour/*.cpp Recast/*.cpp)
+file(GLOB TESTS_SOURCES *.cpp Detour/*.cpp Recast/*.cpp Contrib/Catch/*.cpp)
include_directories(../Detour/Include)
include_directories(../Recast/Include)
+include_directories(./Contrib/Catch)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(Tests ${TESTS_SOURCES})
+
+set_property(TARGET Tests PROPERTY CXX_STANDARD 17)
+
add_dependencies(Tests Recast Detour)
target_link_libraries(Tests Recast Detour)
add_test(Tests Tests)
-
-install(TARGETS Tests RUNTIME DESTINATION bin)
diff --git a/Tests/Contrib/Catch/catch_amalgamated.cpp b/Tests/Contrib/Catch/catch_amalgamated.cpp
new file mode 100644
index 000000000..1f5527a43
--- /dev/null
+++ b/Tests/Contrib/Catch/catch_amalgamated.cpp
@@ -0,0 +1,10395 @@
+// Copyright Catch2 Authors
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// https://www.boost.org/LICENSE_1_0.txt)
+
+// SPDX-License-Identifier: BSL-1.0
+
+// Catch v3.1.1
+// Generated: 2022-10-17 18:47:22.400176
+// ----------------------------------------------------------
+// This file is an amalgamation of multiple different files.
+// You probably shouldn't edit it directly.
+// ----------------------------------------------------------
+
+#include "catch_amalgamated.hpp"
+
+
+#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
+#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
+
+
+#if defined(CATCH_PLATFORM_WINDOWS)
+
+// We might end up with the define made globally through the compiler,
+// and we don't want to trigger warnings for this
+#if !defined(NOMINMAX)
+# define NOMINMAX
+#endif
+#if !defined(WIN32_LEAN_AND_MEAN)
+# define WIN32_LEAN_AND_MEAN
+#endif
+
+#include
+
+#endif // defined(CATCH_PLATFORM_WINDOWS)
+
+#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED
+
+
+
+
+namespace Catch {
+ namespace Benchmark {
+ namespace Detail {
+ ChronometerConcept::~ChronometerConcept() = default;
+ } // namespace Detail
+ } // namespace Benchmark
+} // namespace Catch
+
+
+
+
+namespace Catch {
+ namespace Benchmark {
+ namespace Detail {
+ BenchmarkFunction::callable::~callable() = default;
+ } // namespace Detail
+ } // namespace Benchmark
+} // namespace Catch
+
+
+
+#include
+
+namespace Catch {
+ namespace Benchmark {
+ namespace Detail {
+ struct optimized_away_error : std::exception {
+ const char* what() const noexcept override;
+ };
+
+ const char* optimized_away_error::what() const noexcept {
+ return "could not measure benchmark, maybe it was optimized away";
+ }
+
+ void throw_optimized_away_error() {
+ Catch::throw_exception(optimized_away_error{});
+ }
+
+ } // namespace Detail
+ } // namespace Benchmark
+} // namespace Catch
+
+
+// Adapted from donated nonius code.
+
+
+
+#include
+#include
+#include
+#include
+
+
+#if defined(CATCH_CONFIG_USE_ASYNC)
+#include
+#endif
+
+namespace {
+
+using Catch::Benchmark::Detail::sample;
+
+ template
+ sample resample(URng& rng, unsigned int resamples, std::vector::iterator first, std::vector::iterator last, Estimator& estimator) {
+ auto n = static_cast(last - first);
+ std::uniform_int_distribution dist(0, n - 1);
+
+ sample out;
+ out.reserve(resamples);
+ std::generate_n(std::back_inserter(out), resamples, [n, first, &estimator, &dist, &rng] {
+ std::vector resampled;
+ resampled.reserve(n);
+ std::generate_n(std::back_inserter(resampled), n, [first, &dist, &rng] { return first[static_cast(dist(rng))]; });
+ return estimator(resampled.begin(), resampled.end());
+ });
+ std::sort(out.begin(), out.end());
+ return out;
+ }
+
+
+ double erf_inv(double x) {
+ // Code accompanying the article "Approximating the erfinv function" in GPU Computing Gems, Volume 2
+ double w, p;
+
+ w = -log((1.0 - x) * (1.0 + x));
+
+ if (w < 6.250000) {
+ w = w - 3.125000;
+ p = -3.6444120640178196996e-21;
+ p = -1.685059138182016589e-19 + p * w;
+ p = 1.2858480715256400167e-18 + p * w;
+ p = 1.115787767802518096e-17 + p * w;
+ p = -1.333171662854620906e-16 + p * w;
+ p = 2.0972767875968561637e-17 + p * w;
+ p = 6.6376381343583238325e-15 + p * w;
+ p = -4.0545662729752068639e-14 + p * w;
+ p = -8.1519341976054721522e-14 + p * w;
+ p = 2.6335093153082322977e-12 + p * w;
+ p = -1.2975133253453532498e-11 + p * w;
+ p = -5.4154120542946279317e-11 + p * w;
+ p = 1.051212273321532285e-09 + p * w;
+ p = -4.1126339803469836976e-09 + p * w;
+ p = -2.9070369957882005086e-08 + p * w;
+ p = 4.2347877827932403518e-07 + p * w;
+ p = -1.3654692000834678645e-06 + p * w;
+ p = -1.3882523362786468719e-05 + p * w;
+ p = 0.0001867342080340571352 + p * w;
+ p = -0.00074070253416626697512 + p * w;
+ p = -0.0060336708714301490533 + p * w;
+ p = 0.24015818242558961693 + p * w;
+ p = 1.6536545626831027356 + p * w;
+ } else if (w < 16.000000) {
+ w = sqrt(w) - 3.250000;
+ p = 2.2137376921775787049e-09;
+ p = 9.0756561938885390979e-08 + p * w;
+ p = -2.7517406297064545428e-07 + p * w;
+ p = 1.8239629214389227755e-08 + p * w;
+ p = 1.5027403968909827627e-06 + p * w;
+ p = -4.013867526981545969e-06 + p * w;
+ p = 2.9234449089955446044e-06 + p * w;
+ p = 1.2475304481671778723e-05 + p * w;
+ p = -4.7318229009055733981e-05 + p * w;
+ p = 6.8284851459573175448e-05 + p * w;
+ p = 2.4031110387097893999e-05 + p * w;
+ p = -0.0003550375203628474796 + p * w;
+ p = 0.00095328937973738049703 + p * w;
+ p = -0.0016882755560235047313 + p * w;
+ p = 0.0024914420961078508066 + p * w;
+ p = -0.0037512085075692412107 + p * w;
+ p = 0.005370914553590063617 + p * w;
+ p = 1.0052589676941592334 + p * w;
+ p = 3.0838856104922207635 + p * w;
+ } else {
+ w = sqrt(w) - 5.000000;
+ p = -2.7109920616438573243e-11;
+ p = -2.5556418169965252055e-10 + p * w;
+ p = 1.5076572693500548083e-09 + p * w;
+ p = -3.7894654401267369937e-09 + p * w;
+ p = 7.6157012080783393804e-09 + p * w;
+ p = -1.4960026627149240478e-08 + p * w;
+ p = 2.9147953450901080826e-08 + p * w;
+ p = -6.7711997758452339498e-08 + p * w;
+ p = 2.2900482228026654717e-07 + p * w;
+ p = -9.9298272942317002539e-07 + p * w;
+ p = 4.5260625972231537039e-06 + p * w;
+ p = -1.9681778105531670567e-05 + p * w;
+ p = 7.5995277030017761139e-05 + p * w;
+ p = -0.00021503011930044477347 + p * w;
+ p = -0.00013871931833623122026 + p * w;
+ p = 1.0103004648645343977 + p * w;
+ p = 4.8499064014085844221 + p * w;
+ }
+ return p * x;
+ }
+
+ double standard_deviation(std::vector::iterator first, std::vector::iterator last) {
+ auto m = Catch::Benchmark::Detail::mean(first, last);
+ double variance = std::accumulate( first,
+ last,
+ 0.,
+ [m]( double a, double b ) {
+ double diff = b - m;
+ return a + diff * diff;
+ } ) /
+ ( last - first );
+ return std::sqrt( variance );
+ }
+
+}
+
+namespace Catch {
+ namespace Benchmark {
+ namespace Detail {
+
+#if defined( __GNUC__ ) || defined( __clang__ )
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wfloat-equal"
+#endif
+ bool directCompare( double lhs, double rhs ) { return lhs == rhs; }
+#if defined( __GNUC__ ) || defined( __clang__ )
+# pragma GCC diagnostic pop
+#endif
+
+ double weighted_average_quantile(int k, int q, std::vector::iterator first, std::vector::iterator last) {
+ auto count = last - first;
+ double idx = (count - 1) * k / static_cast(q);
+ int j = static_cast(idx);
+ double g = idx - j;
+ std::nth_element(first, first + j, last);
+ auto xj = first[j];
+ if ( directCompare( g, 0 ) ) {
+ return xj;
+ }
+
+ auto xj1 = *std::min_element(first + (j + 1), last);
+ return xj + g * (xj1 - xj);
+ }
+
+
+ double erfc_inv(double x) {
+ return erf_inv(1.0 - x);
+ }
+
+ double normal_quantile(double p) {
+ static const double ROOT_TWO = std::sqrt(2.0);
+
+ double result = 0.0;
+ assert(p >= 0 && p <= 1);
+ if (p < 0 || p > 1) {
+ return result;
+ }
+
+ result = -erfc_inv(2.0 * p);
+ // result *= normal distribution standard deviation (1.0) * sqrt(2)
+ result *= /*sd * */ ROOT_TWO;
+ // result += normal disttribution mean (0)
+ return result;
+ }
+
+
+ double outlier_variance(Estimate mean, Estimate stddev, int n) {
+ double sb = stddev.point;
+ double mn = mean.point / n;
+ double mg_min = mn / 2.;
+ double sg = (std::min)(mg_min / 4., sb / std::sqrt(n));
+ double sg2 = sg * sg;
+ double sb2 = sb * sb;
+
+ auto c_max = [n, mn, sb2, sg2](double x) -> double {
+ double k = mn - x;
+ double d = k * k;
+ double nd = n * d;
+ double k0 = -n * nd;
+ double k1 = sb2 - n * sg2 + nd;
+ double det = k1 * k1 - 4 * sg2 * k0;
+ return static_cast(-2. * k0 / (k1 + std::sqrt(det)));
+ };
+
+ auto var_out = [n, sb2, sg2](double c) {
+ double nc = n - c;
+ return (nc / n) * (sb2 - nc * sg2);
+ };
+
+ return (std::min)(var_out(1), var_out((std::min)(c_max(0.), c_max(mg_min)))) / sb2;
+ }
+
+
+ bootstrap_analysis analyse_samples(double confidence_level, unsigned int n_resamples, std::vector::iterator first, std::vector::iterator last) {
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+ static std::random_device entropy;
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
+
+ auto n = static_cast(last - first); // seriously, one can't use integral types without hell in C++
+
+ auto mean = &Detail::mean::iterator>;
+ auto stddev = &standard_deviation;
+
+#if defined(CATCH_CONFIG_USE_ASYNC)
+ auto Estimate = [=](double(*f)(std::vector::iterator, std::vector::iterator)) {
+ auto seed = entropy();
+ return std::async(std::launch::async, [=] {
+ std::mt19937 rng(seed);
+ auto resampled = resample(rng, n_resamples, first, last, f);
+ return bootstrap(confidence_level, first, last, resampled, f);
+ });
+ };
+
+ auto mean_future = Estimate(mean);
+ auto stddev_future = Estimate(stddev);
+
+ auto mean_estimate = mean_future.get();
+ auto stddev_estimate = stddev_future.get();
+#else
+ auto Estimate = [=](double(*f)(std::vector::iterator, std::vector::iterator)) {
+ auto seed = entropy();
+ std::mt19937 rng(seed);
+ auto resampled = resample(rng, n_resamples, first, last, f);
+ return bootstrap(confidence_level, first, last, resampled, f);
+ };
+
+ auto mean_estimate = Estimate(mean);
+ auto stddev_estimate = Estimate(stddev);
+#endif // CATCH_USE_ASYNC
+
+ double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);
+
+ return { mean_estimate, stddev_estimate, outlier_variance };
+ }
+ } // namespace Detail
+ } // namespace Benchmark
+} // namespace Catch
+
+
+
+#include
+#include
+
+namespace {
+
+// Performs equivalent check of std::fabs(lhs - rhs) <= margin
+// But without the subtraction to allow for INFINITY in comparison
+bool marginComparison(double lhs, double rhs, double margin) {
+ return (lhs + margin >= rhs) && (rhs + margin >= lhs);
+}
+
+}
+
+namespace Catch {
+
+ Approx::Approx ( double value )
+ : m_epsilon( std::numeric_limits::epsilon()*100. ),
+ m_margin( 0.0 ),
+ m_scale( 0.0 ),
+ m_value( value )
+ {}
+
+ Approx Approx::custom() {
+ return Approx( 0 );
+ }
+
+ Approx Approx::operator-() const {
+ auto temp(*this);
+ temp.m_value = -temp.m_value;
+ return temp;
+ }
+
+
+ std::string Approx::toString() const {
+ ReusableStringStream rss;
+ rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )";
+ return rss.str();
+ }
+
+ bool Approx::equalityComparisonImpl(const double other) const {
+ // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value
+ // Thanks to Richard Harris for his help refining the scaled margin value
+ return marginComparison(m_value, other, m_margin)
+ || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));
+ }
+
+ void Approx::setMargin(double newMargin) {
+ CATCH_ENFORCE(newMargin >= 0,
+ "Invalid Approx::margin: " << newMargin << '.'
+ << " Approx::Margin has to be non-negative.");
+ m_margin = newMargin;
+ }
+
+ void Approx::setEpsilon(double newEpsilon) {
+ CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,
+ "Invalid Approx::epsilon: " << newEpsilon << '.'
+ << " Approx::epsilon has to be in [0, 1]");
+ m_epsilon = newEpsilon;
+ }
+
+namespace literals {
+ Approx operator "" _a(long double val) {
+ return Approx(val);
+ }
+ Approx operator "" _a(unsigned long long val) {
+ return Approx(val);
+ }
+} // end namespace literals
+
+std::string StringMaker::convert(Catch::Approx const& value) {
+ return value.toString();
+}
+
+} // end namespace Catch
+
+
+
+namespace Catch {
+
+ AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression):
+ lazyExpression(_lazyExpression),
+ resultType(_resultType) {}
+
+ std::string AssertionResultData::reconstructExpression() const {
+
+ if( reconstructedExpression.empty() ) {
+ if( lazyExpression ) {
+ ReusableStringStream rss;
+ rss << lazyExpression;
+ reconstructedExpression = rss.str();
+ }
+ }
+ return reconstructedExpression;
+ }
+
+ AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data )
+ : m_info( info ),
+ m_resultData( data )
+ {}
+
+ // Result was a success
+ bool AssertionResult::succeeded() const {
+ return Catch::isOk( m_resultData.resultType );
+ }
+
+ // Result was a success, or failure is suppressed
+ bool AssertionResult::isOk() const {
+ return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );
+ }
+
+ ResultWas::OfType AssertionResult::getResultType() const {
+ return m_resultData.resultType;
+ }
+
+ bool AssertionResult::hasExpression() const {
+ return !m_info.capturedExpression.empty();
+ }
+
+ bool AssertionResult::hasMessage() const {
+ return !m_resultData.message.empty();
+ }
+
+ std::string AssertionResult::getExpression() const {
+ // Possibly overallocating by 3 characters should be basically free
+ std::string expr; expr.reserve(m_info.capturedExpression.size() + 3);
+ if (isFalseTest(m_info.resultDisposition)) {
+ expr += "!(";
+ }
+ expr += m_info.capturedExpression;
+ if (isFalseTest(m_info.resultDisposition)) {
+ expr += ')';
+ }
+ return expr;
+ }
+
+ std::string AssertionResult::getExpressionInMacro() const {
+ std::string expr;
+ if( m_info.macroName.empty() )
+ expr = static_cast(m_info.capturedExpression);
+ else {
+ expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );
+ expr += m_info.macroName;
+ expr += "( ";
+ expr += m_info.capturedExpression;
+ expr += " )";
+ }
+ return expr;
+ }
+
+ bool AssertionResult::hasExpandedExpression() const {
+ return hasExpression() && getExpandedExpression() != getExpression();
+ }
+
+ std::string AssertionResult::getExpandedExpression() const {
+ std::string expr = m_resultData.reconstructExpression();
+ return expr.empty()
+ ? getExpression()
+ : expr;
+ }
+
+ StringRef AssertionResult::getMessage() const {
+ return m_resultData.message;
+ }
+ SourceLineInfo AssertionResult::getSourceInfo() const {
+ return m_info.lineInfo;
+ }
+
+ StringRef AssertionResult::getTestMacroName() const {
+ return m_info.macroName;
+ }
+
+} // end namespace Catch
+
+
+
+namespace {
+ bool provideBazelReporterOutput() {
+#if defined(CATCH_CONFIG_BAZEL_SUPPORT)
+ return true;
+#elif defined(CATCH_PLATFORM_WINDOWS_UWP)
+ // UWP does not support environment variables
+ return false;
+#else
+
+# if defined( _MSC_VER )
+ // On Windows getenv throws a warning as there is no input validation,
+ // since the switch is hardcoded, this should not be an issue.
+# pragma warning( push )
+# pragma warning( disable : 4996 )
+# endif
+
+ return std::getenv( "BAZEL_TEST" ) != nullptr;
+
+# if defined( _MSC_VER )
+# pragma warning( pop )
+# endif
+#endif
+ }
+}
+
+namespace Catch {
+
+ bool operator==( ProcessedReporterSpec const& lhs,
+ ProcessedReporterSpec const& rhs ) {
+ return lhs.name == rhs.name &&
+ lhs.outputFilename == rhs.outputFilename &&
+ lhs.colourMode == rhs.colourMode &&
+ lhs.customOptions == rhs.customOptions;
+ }
+
+ Config::Config( ConfigData const& data ):
+ m_data( data ) {
+ // We need to trim filter specs to avoid trouble with superfluous
+ // whitespace (esp. important for bdd macros, as those are manually
+ // aligned with whitespace).
+
+ for (auto& elem : m_data.testsOrTags) {
+ elem = trim(elem);
+ }
+ for (auto& elem : m_data.sectionsToRun) {
+ elem = trim(elem);
+ }
+
+
+ TestSpecParser parser(ITagAliasRegistry::get());
+ if (!m_data.testsOrTags.empty()) {
+ m_hasTestFilters = true;
+ for (auto const& testOrTags : m_data.testsOrTags) {
+ parser.parse(testOrTags);
+ }
+ }
+ m_testSpec = parser.testSpec();
+
+
+ // Insert the default reporter if user hasn't asked for a specfic one
+ if ( m_data.reporterSpecifications.empty() ) {
+ m_data.reporterSpecifications.push_back( {
+#if defined( CATCH_CONFIG_DEFAULT_REPORTER )
+ CATCH_CONFIG_DEFAULT_REPORTER,
+#else
+ "console",
+#endif
+ {}, {}, {}
+ } );
+ }
+
+#if !defined(CATCH_PLATFORM_WINDOWS_UWP)
+ if(provideBazelReporterOutput()){
+ // Register a JUnit reporter for Bazel. Bazel sets an environment
+ // variable with the path to XML output. If this file is written to
+ // during test, Bazel will not generate a default XML output.
+ // This allows the XML output file to contain higher level of detail
+ // than what is possible otherwise.
+# if defined( _MSC_VER )
+ // On Windows getenv throws a warning as there is no input validation,
+ // since the key is hardcoded, this should not be an issue.
+# pragma warning( push )
+# pragma warning( disable : 4996 )
+# endif
+ const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" );
+# if defined( _MSC_VER )
+# pragma warning( pop )
+# endif
+ if ( bazelOutputFilePtr != nullptr ) {
+ m_data.reporterSpecifications.push_back(
+ { "junit", std::string( bazelOutputFilePtr ), {}, {} } );
+ }
+ }
+#endif
+
+ // We now fixup the reporter specs to handle default output spec,
+ // default colour spec, etc
+ bool defaultOutputUsed = false;
+ for ( auto const& reporterSpec : m_data.reporterSpecifications ) {
+ // We do the default-output check separately, while always
+ // using the default output below to make the code simpler
+ // and avoid superfluous copies.
+ if ( reporterSpec.outputFile().none() ) {
+ CATCH_ENFORCE( !defaultOutputUsed,
+ "Internal error: cannot use default output for "
+ "multiple reporters" );
+ defaultOutputUsed = true;
+ }
+
+ m_processedReporterSpecs.push_back( ProcessedReporterSpec{
+ reporterSpec.name(),
+ reporterSpec.outputFile() ? *reporterSpec.outputFile()
+ : data.defaultOutputFilename,
+ reporterSpec.colourMode().valueOr( data.defaultColourMode ),
+ reporterSpec.customOptions() } );
+ }
+ }
+
+ Config::~Config() = default;
+
+
+ bool Config::listTests() const { return m_data.listTests; }
+ bool Config::listTags() const { return m_data.listTags; }
+ bool Config::listReporters() const { return m_data.listReporters; }
+ bool Config::listListeners() const { return m_data.listListeners; }
+
+ std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; }
+ std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }
+
+ std::vector const& Config::getReporterSpecs() const {
+ return m_data.reporterSpecifications;
+ }
+
+ std::vector const&
+ Config::getProcessedReporterSpecs() const {
+ return m_processedReporterSpecs;
+ }
+
+ TestSpec const& Config::testSpec() const { return m_testSpec; }
+ bool Config::hasTestFilters() const { return m_hasTestFilters; }
+
+ bool Config::showHelp() const { return m_data.showHelp; }
+
+ // IConfig interface
+ bool Config::allowThrows() const { return !m_data.noThrow; }
+ StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
+ bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
+ bool Config::warnAboutMissingAssertions() const {
+ return !!( m_data.warnings & WarnAbout::NoAssertions );
+ }
+ bool Config::warnAboutUnmatchedTestSpecs() const {
+ return !!( m_data.warnings & WarnAbout::UnmatchedTestSpec );
+ }
+ bool Config::zeroTestsCountAsSuccess() const { return m_data.allowZeroTests; }
+ ShowDurations Config::showDurations() const { return m_data.showDurations; }
+ double Config::minDuration() const { return m_data.minDuration; }
+ TestRunOrder Config::runOrder() const { return m_data.runOrder; }
+ uint32_t Config::rngSeed() const { return m_data.rngSeed; }
+ unsigned int Config::shardCount() const { return m_data.shardCount; }
+ unsigned int Config::shardIndex() const { return m_data.shardIndex; }
+ ColourMode Config::defaultColourMode() const { return m_data.defaultColourMode; }
+ bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; }
+ int Config::abortAfter() const { return m_data.abortAfter; }
+ bool Config::showInvisibles() const { return m_data.showInvisibles; }
+ Verbosity Config::verbosity() const { return m_data.verbosity; }
+
+ bool Config::skipBenchmarks() const { return m_data.skipBenchmarks; }
+ bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; }
+ unsigned int Config::benchmarkSamples() const { return m_data.benchmarkSamples; }
+ double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; }
+ unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; }
+ std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); }
+
+} // end namespace Catch
+
+
+
+
+
+namespace Catch {
+ std::uint32_t getSeed() {
+ return getCurrentContext().getConfig()->rngSeed();
+ }
+}
+
+
+
+#include
+#include
+
+namespace Catch {
+
+ ////////////////////////////////////////////////////////////////////////////
+
+
+ ScopedMessage::ScopedMessage( MessageBuilder const& builder ):
+ m_info( builder.m_info ) {
+ m_info.message = builder.m_stream.str();
+ getResultCapture().pushScopedMessage( m_info );
+ }
+
+ ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept:
+ m_info( CATCH_MOVE( old.m_info ) ) {
+ old.m_moved = true;
+ }
+
+ ScopedMessage::~ScopedMessage() {
+ if ( !uncaught_exceptions() && !m_moved ){
+ getResultCapture().popScopedMessage(m_info);
+ }
+ }
+
+
+ Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) {
+ auto trimmed = [&] (size_t start, size_t end) {
+ while (names[start] == ',' || isspace(static_cast(names[start]))) {
+ ++start;
+ }
+ while (names[end] == ',' || isspace(static_cast(names[end]))) {
+ --end;
+ }
+ return names.substr(start, end - start + 1);
+ };
+ auto skipq = [&] (size_t start, char quote) {
+ for (auto i = start + 1; i < names.size() ; ++i) {
+ if (names[i] == quote)
+ return i;
+ if (names[i] == '\\')
+ ++i;
+ }
+ CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote");
+ };
+
+ size_t start = 0;
+ std::stack openings;
+ for (size_t pos = 0; pos < names.size(); ++pos) {
+ char c = names[pos];
+ switch (c) {
+ case '[':
+ case '{':
+ case '(':
+ // It is basically impossible to disambiguate between
+ // comparison and start of template args in this context
+// case '<':
+ openings.push(c);
+ break;
+ case ']':
+ case '}':
+ case ')':
+// case '>':
+ openings.pop();
+ break;
+ case '"':
+ case '\'':
+ pos = skipq(pos, c);
+ break;
+ case ',':
+ if (start != pos && openings.empty()) {
+ m_messages.emplace_back(macroName, lineInfo, resultType);
+ m_messages.back().message = static_cast(trimmed(start, pos));
+ m_messages.back().message += " := ";
+ start = pos;
+ }
+ }
+ }
+ assert(openings.empty() && "Mismatched openings");
+ m_messages.emplace_back(macroName, lineInfo, resultType);
+ m_messages.back().message = static_cast(trimmed(start, names.size() - 1));
+ m_messages.back().message += " := ";
+ }
+ Capturer::~Capturer() {
+ if ( !uncaught_exceptions() ){
+ assert( m_captured == m_messages.size() );
+ for( size_t i = 0; i < m_captured; ++i )
+ m_resultCapture.popScopedMessage( m_messages[i] );
+ }
+ }
+
+ void Capturer::captureValue( size_t index, std::string const& value ) {
+ assert( index < m_messages.size() );
+ m_messages[index].message += value;
+ m_resultCapture.pushScopedMessage( m_messages[index] );
+ m_captured++;
+ }
+
+} // end namespace Catch
+
+
+
+
+namespace Catch {
+
+ namespace {
+
+ class RegistryHub : public IRegistryHub,
+ public IMutableRegistryHub,
+ private Detail::NonCopyable {
+
+ public: // IRegistryHub
+ RegistryHub() = default;
+ IReporterRegistry const& getReporterRegistry() const override {
+ return m_reporterRegistry;
+ }
+ ITestCaseRegistry const& getTestCaseRegistry() const override {
+ return m_testCaseRegistry;
+ }
+ IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override {
+ return m_exceptionTranslatorRegistry;
+ }
+ ITagAliasRegistry const& getTagAliasRegistry() const override {
+ return m_tagAliasRegistry;
+ }
+ StartupExceptionRegistry const& getStartupExceptionRegistry() const override {
+ return m_exceptionRegistry;
+ }
+
+ public: // IMutableRegistryHub
+ void registerReporter( std::string const& name, IReporterFactoryPtr factory ) override {
+ m_reporterRegistry.registerReporter( name, CATCH_MOVE(factory) );
+ }
+ void registerListener( Detail::unique_ptr factory ) override {
+ m_reporterRegistry.registerListener( CATCH_MOVE(factory) );
+ }
+ void registerTest( Detail::unique_ptr&& testInfo, Detail::unique_ptr&& invoker ) override {
+ m_testCaseRegistry.registerTest( CATCH_MOVE(testInfo), CATCH_MOVE(invoker) );
+ }
+ void registerTranslator( Detail::unique_ptr&& translator ) override {
+ m_exceptionTranslatorRegistry.registerTranslator( CATCH_MOVE(translator) );
+ }
+ void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {
+ m_tagAliasRegistry.add( alias, tag, lineInfo );
+ }
+ void registerStartupException() noexcept override {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+ m_exceptionRegistry.add(std::current_exception());
+#else
+ CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
+#endif
+ }
+ IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {
+ return m_enumValuesRegistry;
+ }
+
+ private:
+ TestRegistry m_testCaseRegistry;
+ ReporterRegistry m_reporterRegistry;
+ ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;
+ TagAliasRegistry m_tagAliasRegistry;
+ StartupExceptionRegistry m_exceptionRegistry;
+ Detail::EnumValuesRegistry m_enumValuesRegistry;
+ };
+ }
+
+ using RegistryHubSingleton = Singleton;
+
+ IRegistryHub const& getRegistryHub() {
+ return RegistryHubSingleton::get();
+ }
+ IMutableRegistryHub& getMutableRegistryHub() {
+ return RegistryHubSingleton::getMutable();
+ }
+ void cleanUp() {
+ cleanupSingletons();
+ cleanUpContext();
+ }
+ std::string translateActiveException() {
+ return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();
+ }
+
+
+} // end namespace Catch
+
+
+
+#include
+#include
+#include
+#include
+
+namespace Catch {
+
+ namespace {
+ const int MaxExitCode = 255;
+
+ IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig&& config) {
+ auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, CATCH_MOVE(config));
+ CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << '\'');
+
+ return reporter;
+ }
+
+ IEventListenerPtr prepareReporters(Config const* config) {
+ if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()
+ && config->getProcessedReporterSpecs().size() == 1) {
+ auto const& spec = config->getProcessedReporterSpecs()[0];
+ return createReporter(
+ spec.name,
+ ReporterConfig( config,
+ makeStream( spec.outputFilename ),
+ spec.colourMode,
+ spec.customOptions ) );
+ }
+
+ auto multi = Detail::make_unique(config);
+
+ auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();
+ for (auto const& listener : listeners) {
+ multi->addListener(listener->create(config));
+ }
+
+ for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) {
+ multi->addReporter( createReporter(
+ reporterSpec.name,
+ ReporterConfig( config,
+ makeStream( reporterSpec.outputFilename ),
+ reporterSpec.colourMode,
+ reporterSpec.customOptions ) ) );
+ }
+
+ return multi;
+ }
+
+ class TestGroup {
+ public:
+ explicit TestGroup(IEventListenerPtr&& reporter, Config const* config):
+ m_reporter(reporter.get()),
+ m_config{config},
+ m_context{config, CATCH_MOVE(reporter)} {
+
+ assert( m_config->testSpec().getInvalidSpecs().empty() &&
+ "Invalid test specs should be handled before running tests" );
+
+ auto const& allTestCases = getAllTestCasesSorted(*m_config);
+ auto const& testSpec = m_config->testSpec();
+ if ( !testSpec.hasFilters() ) {
+ for ( auto const& test : allTestCases ) {
+ if ( !test.getTestCaseInfo().isHidden() ) {
+ m_tests.emplace( &test );
+ }
+ }
+ } else {
+ m_matches =
+ testSpec.matchesByFilter( allTestCases, *m_config );
+ for ( auto const& match : m_matches ) {
+ m_tests.insert( match.tests.begin(),
+ match.tests.end() );
+ }
+ }
+
+ m_tests = createShard(m_tests, m_config->shardCount(), m_config->shardIndex());
+ }
+
+ Totals execute() {
+ Totals totals;
+ for (auto const& testCase : m_tests) {
+ if (!m_context.aborting())
+ totals += m_context.runTest(*testCase);
+ else
+ m_reporter->skipTest(testCase->getTestCaseInfo());
+ }
+
+ for (auto const& match : m_matches) {
+ if (match.tests.empty()) {
+ m_unmatchedTestSpecs = true;
+ m_reporter->noMatchingTestCases( match.name );
+ }
+ }
+
+ return totals;
+ }
+
+ bool hadUnmatchedTestSpecs() const {
+ return m_unmatchedTestSpecs;
+ }
+
+
+ private:
+ IEventListener* m_reporter;
+ Config const* m_config;
+ RunContext m_context;
+ std::set m_tests;
+ TestSpec::Matches m_matches;
+ bool m_unmatchedTestSpecs = false;
+ };
+
+ void applyFilenamesAsTags() {
+ for (auto const& testInfo : getRegistryHub().getTestCaseRegistry().getAllInfos()) {
+ testInfo->addFilenameTag();
+ }
+ }
+
+ } // anon namespace
+
+ Session::Session() {
+ static bool alreadyInstantiated = false;
+ if( alreadyInstantiated ) {
+ CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); }
+ CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); }
+ }
+
+ // There cannot be exceptions at startup in no-exception mode.
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+ const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();
+ if ( !exceptions.empty() ) {
+ config();
+ getCurrentMutableContext().setConfig(m_config.get());
+
+ m_startupExceptions = true;
+ auto errStream = makeStream( "%stderr" );
+ auto colourImpl = makeColourImpl(
+ ColourMode::PlatformDefault, errStream.get() );
+ auto guard = colourImpl->guardColour( Colour::Red );
+ errStream->stream() << "Errors occurred during startup!" << '\n';
+ // iterate over all exceptions and notify user
+ for ( const auto& ex_ptr : exceptions ) {
+ try {
+ std::rethrow_exception(ex_ptr);
+ } catch ( std::exception const& ex ) {
+ errStream->stream() << TextFlow::Column( ex.what() ).indent(2) << '\n';
+ }
+ }
+ }
+#endif
+
+ alreadyInstantiated = true;
+ m_cli = makeCommandLineParser( m_configData );
+ }
+ Session::~Session() {
+ Catch::cleanUp();
+ }
+
+ void Session::showHelp() const {
+ Catch::cout()
+ << "\nCatch2 v" << libraryVersion() << '\n'
+ << m_cli << '\n'
+ << "For more detailed usage please see the project docs\n\n" << std::flush;
+ }
+ void Session::libIdentify() {
+ Catch::cout()
+ << std::left << std::setw(16) << "description: " << "A Catch2 test executable\n"
+ << std::left << std::setw(16) << "category: " << "testframework\n"
+ << std::left << std::setw(16) << "framework: " << "Catch2\n"
+ << std::left << std::setw(16) << "version: " << libraryVersion() << '\n' << std::flush;
+ }
+
+ int Session::applyCommandLine( int argc, char const * const * argv ) {
+ if( m_startupExceptions )
+ return 1;
+
+ auto result = m_cli.parse( Clara::Args( argc, argv ) );
+
+ if( !result ) {
+ config();
+ getCurrentMutableContext().setConfig(m_config.get());
+ auto errStream = makeStream( "%stderr" );
+ auto colour = makeColourImpl( ColourMode::PlatformDefault, errStream.get() );
+
+ errStream->stream()
+ << colour->guardColour( Colour::Red )
+ << "\nError(s) in input:\n"
+ << TextFlow::Column( result.errorMessage() ).indent( 2 )
+ << "\n\n";
+ errStream->stream() << "Run with -? for usage\n\n" << std::flush;
+ return MaxExitCode;
+ }
+
+ if( m_configData.showHelp )
+ showHelp();
+ if( m_configData.libIdentify )
+ libIdentify();
+
+ m_config.reset();
+ return 0;
+ }
+
+#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)
+ int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {
+
+ char **utf8Argv = new char *[ argc ];
+
+ for ( int i = 0; i < argc; ++i ) {
+ int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr );
+
+ utf8Argv[ i ] = new char[ bufSize ];
+
+ WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, nullptr, nullptr );
+ }
+
+ int returnCode = applyCommandLine( argc, utf8Argv );
+
+ for ( int i = 0; i < argc; ++i )
+ delete [] utf8Argv[ i ];
+
+ delete [] utf8Argv;
+
+ return returnCode;
+ }
+#endif
+
+ void Session::useConfigData( ConfigData const& configData ) {
+ m_configData = configData;
+ m_config.reset();
+ }
+
+ int Session::run() {
+ if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {
+ Catch::cout() << "...waiting for enter/ return before starting\n" << std::flush;
+ static_cast(std::getchar());
+ }
+ int exitCode = runInternal();
+ if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {
+ Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << '\n' << std::flush;
+ static_cast(std::getchar());
+ }
+ return exitCode;
+ }
+
+ Clara::Parser const& Session::cli() const {
+ return m_cli;
+ }
+ void Session::cli( Clara::Parser const& newParser ) {
+ m_cli = newParser;
+ }
+ ConfigData& Session::configData() {
+ return m_configData;
+ }
+ Config& Session::config() {
+ if( !m_config )
+ m_config = Detail::make_unique( m_configData );
+ return *m_config;
+ }
+
+ int Session::runInternal() {
+ if( m_startupExceptions )
+ return 1;
+
+ if (m_configData.showHelp || m_configData.libIdentify) {
+ return 0;
+ }
+
+ if ( m_configData.shardIndex >= m_configData.shardCount ) {
+ Catch::cerr() << "The shard count (" << m_configData.shardCount
+ << ") must be greater than the shard index ("
+ << m_configData.shardIndex << ")\n"
+ << std::flush;
+ return 1;
+ }
+
+ CATCH_TRY {
+ config(); // Force config to be constructed
+
+ seedRng( *m_config );
+
+ if (m_configData.filenamesAsTags) {
+ applyFilenamesAsTags();
+ }
+
+ // Set up global config instance before we start calling into other functions
+ getCurrentMutableContext().setConfig(m_config.get());
+
+ // Create reporter(s) so we can route listings through them
+ auto reporter = prepareReporters(m_config.get());
+
+ auto const& invalidSpecs = m_config->testSpec().getInvalidSpecs();
+ if ( !invalidSpecs.empty() ) {
+ for ( auto const& spec : invalidSpecs ) {
+ reporter->reportInvalidTestSpec( spec );
+ }
+ return 1;
+ }
+
+
+ // Handle list request
+ if (list(*reporter, *m_config)) {
+ return 0;
+ }
+
+ TestGroup tests { CATCH_MOVE(reporter), m_config.get() };
+ auto const totals = tests.execute();
+
+ if ( tests.hadUnmatchedTestSpecs()
+ && m_config->warnAboutUnmatchedTestSpecs() ) {
+ return 3;
+ }
+
+ if ( totals.testCases.total() == 0
+ && !m_config->zeroTestsCountAsSuccess() ) {
+ return 2;
+ }
+
+ // Note that on unices only the lower 8 bits are usually used, clamping
+ // the return value to 255 prevents false negative when some multiple
+ // of 256 tests has failed
+ return (std::min) (MaxExitCode, static_cast(totals.assertions.failed));
+ }
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+ catch( std::exception& ex ) {
+ Catch::cerr() << ex.what() << '\n' << std::flush;
+ return MaxExitCode;
+ }
+#endif
+ }
+
+} // end namespace Catch
+
+
+
+
+namespace Catch {
+
+ RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {
+ CATCH_TRY {
+ getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);
+ } CATCH_CATCH_ALL {
+ // Do not throw when constructing global objects, instead register the exception to be processed later
+ getMutableRegistryHub().registerStartupException();
+ }
+ }
+
+}
+
+
+
+#include
+#include
+#include
+
+namespace Catch {
+
+ namespace {
+ using TCP_underlying_type = uint8_t;
+ static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),
+ "The size of the TestCaseProperties is different from the assumed size");
+
+ TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {
+ return static_cast(
+ static_cast(lhs) | static_cast(rhs)
+ );
+ }
+
+ TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {
+ lhs = static_cast(
+ static_cast(lhs) | static_cast(rhs)
+ );
+ return lhs;
+ }
+
+ TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {
+ return static_cast(
+ static_cast(lhs) & static_cast(rhs)
+ );
+ }
+
+ bool applies(TestCaseProperties tcp) {
+ static_assert(static_cast(TestCaseProperties::None) == 0,
+ "TestCaseProperties::None must be equal to 0");
+ return tcp != TestCaseProperties::None;
+ }
+
+ TestCaseProperties parseSpecialTag( StringRef tag ) {
+ if( !tag.empty() && tag[0] == '.' )
+ return TestCaseProperties::IsHidden;
+ else if( tag == "!throws"_sr )
+ return TestCaseProperties::Throws;
+ else if( tag == "!shouldfail"_sr )
+ return TestCaseProperties::ShouldFail;
+ else if( tag == "!mayfail"_sr )
+ return TestCaseProperties::MayFail;
+ else if( tag == "!nonportable"_sr )
+ return TestCaseProperties::NonPortable;
+ else if( tag == "!benchmark"_sr )
+ return TestCaseProperties::Benchmark | TestCaseProperties::IsHidden;
+ else
+ return TestCaseProperties::None;
+ }
+ bool isReservedTag( StringRef tag ) {
+ return parseSpecialTag( tag ) == TestCaseProperties::None
+ && tag.size() > 0
+ && !std::isalnum( static_cast(tag[0]) );
+ }
+ void enforceNotReservedTag( StringRef tag, SourceLineInfo const& _lineInfo ) {
+ CATCH_ENFORCE( !isReservedTag(tag),
+ "Tag name: [" << tag << "] is not allowed.\n"
+ << "Tag names starting with non alphanumeric characters are reserved\n"
+ << _lineInfo );
+ }
+
+ std::string makeDefaultName() {
+ static size_t counter = 0;
+ return "Anonymous test case " + std::to_string(++counter);
+ }
+
+ StringRef extractFilenamePart(StringRef filename) {
+ size_t lastDot = filename.size();
+ while (lastDot > 0 && filename[lastDot - 1] != '.') {
+ --lastDot;
+ }
+ --lastDot;
+
+ size_t nameStart = lastDot;
+ while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
+ --nameStart;
+ }
+
+ return filename.substr(nameStart, lastDot - nameStart);
+ }
+
+ // Returns the upper bound on size of extra tags ([#file]+[.])
+ size_t sizeOfExtraTags(StringRef filepath) {
+ // [.] is 3, [#] is another 3
+ const size_t extras = 3 + 3;
+ return extractFilenamePart(filepath).size() + extras;
+ }
+ } // end unnamed namespace
+
+ bool operator<( Tag const& lhs, Tag const& rhs ) {
+ Detail::CaseInsensitiveLess cmp;
+ return cmp( lhs.original, rhs.original );
+ }
+ bool operator==( Tag const& lhs, Tag const& rhs ) {
+ Detail::CaseInsensitiveEqualTo cmp;
+ return cmp( lhs.original, rhs.original );
+ }
+
+ Detail::unique_ptr
+ makeTestCaseInfo(StringRef _className,
+ NameAndTags const& nameAndTags,
+ SourceLineInfo const& _lineInfo ) {
+ return Detail::make_unique(_className, nameAndTags, _lineInfo);
+ }
+
+ TestCaseInfo::TestCaseInfo(StringRef _className,
+ NameAndTags const& _nameAndTags,
+ SourceLineInfo const& _lineInfo):
+ name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ),
+ className( _className ),
+ lineInfo( _lineInfo )
+ {
+ StringRef originalTags = _nameAndTags.tags;
+ // We need to reserve enough space to store all of the tags
+ // (including optional hidden tag and filename tag)
+ auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file);
+ backingTags.reserve(requiredSize);
+
+ // We cannot copy the tags directly, as we need to normalize
+ // some tags, so that [.foo] is copied as [.][foo].
+ size_t tagStart = 0;
+ size_t tagEnd = 0;
+ bool inTag = false;
+ for (size_t idx = 0; idx < originalTags.size(); ++idx) {
+ auto c = originalTags[idx];
+ if (c == '[') {
+ assert(!inTag);
+ inTag = true;
+ tagStart = idx;
+ }
+ if (c == ']') {
+ assert(inTag);
+ inTag = false;
+ tagEnd = idx;
+ assert(tagStart < tagEnd);
+
+ // We need to check the tag for special meanings, copy
+ // it over to backing storage and actually reference the
+ // backing storage in the saved tags
+ StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);
+ CATCH_ENFORCE(!tagStr.empty(), "Empty tags are not allowed");
+ enforceNotReservedTag(tagStr, lineInfo);
+ properties |= parseSpecialTag(tagStr);
+ // When copying a tag to the backing storage, we need to
+ // check if it is a merged hide tag, such as [.foo], and
+ // if it is, we need to handle it as if it was [foo].
+ if (tagStr.size() > 1 && tagStr[0] == '.') {
+ tagStr = tagStr.substr(1, tagStr.size() - 1);
+ }
+ // We skip over dealing with the [.] tag, as we will add
+ // it later unconditionally and then sort and unique all
+ // the tags.
+ internalAppendTag(tagStr);
+ }
+ (void)inTag; // Silence "set-but-unused" warning in release mode.
+ }
+ // Add [.] if relevant
+ if (isHidden()) {
+ internalAppendTag("."_sr);
+ }
+
+ // Sort and prepare tags
+ std::sort(begin(tags), end(tags));
+ tags.erase(std::unique(begin(tags), end(tags)),
+ end(tags));
+ }
+
+ bool TestCaseInfo::isHidden() const {
+ return applies( properties & TestCaseProperties::IsHidden );
+ }
+ bool TestCaseInfo::throws() const {
+ return applies( properties & TestCaseProperties::Throws );
+ }
+ bool TestCaseInfo::okToFail() const {
+ return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
+ }
+ bool TestCaseInfo::expectedToFail() const {
+ return applies( properties & (TestCaseProperties::ShouldFail) );
+ }
+
+ void TestCaseInfo::addFilenameTag() {
+ std::string combined("#");
+ combined += extractFilenamePart(lineInfo.file);
+ internalAppendTag(combined);
+ }
+
+ std::string TestCaseInfo::tagsAsString() const {
+ std::string ret;
+ // '[' and ']' per tag
+ std::size_t full_size = 2 * tags.size();
+ for (const auto& tag : tags) {
+ full_size += tag.original.size();
+ }
+ ret.reserve(full_size);
+ for (const auto& tag : tags) {
+ ret.push_back('[');
+ ret += tag.original;
+ ret.push_back(']');
+ }
+
+ return ret;
+ }
+
+ void TestCaseInfo::internalAppendTag(StringRef tagStr) {
+ backingTags += '[';
+ const auto backingStart = backingTags.size();
+ backingTags += tagStr;
+ const auto backingEnd = backingTags.size();
+ backingTags += ']';
+ tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart));
+ }
+
+ bool operator<( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) {
+ // We want to avoid redoing the string comparisons multiple times,
+ // so we store the result of a three-way comparison before using
+ // it in the actual comparison logic.
+ const auto cmpName = lhs.name.compare( rhs.name );
+ if ( cmpName != 0 ) {
+ return cmpName < 0;
+ }
+ const auto cmpClassName = lhs.className.compare( rhs.className );
+ if ( cmpClassName != 0 ) {
+ return cmpClassName < 0;
+ }
+ return lhs.tags < rhs.tags;
+ }
+
+ TestCaseInfo const& TestCaseHandle::getTestCaseInfo() const {
+ return *m_info;
+ }
+
+} // end namespace Catch
+
+
+
+#include
+#include
+#include
+
+namespace Catch {
+
+ TestSpec::Pattern::Pattern( std::string const& name )
+ : m_name( name )
+ {}
+
+ TestSpec::Pattern::~Pattern() = default;
+
+ std::string const& TestSpec::Pattern::name() const {
+ return m_name;
+ }
+
+
+ TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString )
+ : Pattern( filterString )
+ , m_wildcardPattern( toLower( name ), CaseSensitive::No )
+ {}
+
+ bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {
+ return m_wildcardPattern.matches( testCase.name );
+ }
+
+
+ TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString )
+ : Pattern( filterString )
+ , m_tag( tag )
+ {}
+
+ bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {
+ return std::find( begin( testCase.tags ),
+ end( testCase.tags ),
+ Tag( m_tag ) ) != end( testCase.tags );
+ }
+
+ bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {
+ bool should_use = !testCase.isHidden();
+ for (auto const& pattern : m_required) {
+ should_use = true;
+ if (!pattern->matches(testCase)) {
+ return false;
+ }
+ }
+ for (auto const& pattern : m_forbidden) {
+ if (pattern->matches(testCase)) {
+ return false;
+ }
+ }
+ return should_use;
+ }
+
+ std::string TestSpec::Filter::name() const {
+ std::string name;
+ for (auto const& p : m_required) {
+ name += p->name();
+ }
+ for (auto const& p : m_forbidden) {
+ name += p->name();
+ }
+ return name;
+ }
+
+
+ bool TestSpec::hasFilters() const {
+ return !m_filters.empty();
+ }
+
+ bool TestSpec::matches( TestCaseInfo const& testCase ) const {
+ return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );
+ }
+
+ TestSpec::Matches TestSpec::matchesByFilter( std::vector const& testCases, IConfig const& config ) const
+ {
+ Matches matches( m_filters.size() );
+ std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){
+ std::vector currentMatches;
+ for( auto const& test : testCases )
+ if( isThrowSafe( test, config ) && filter.matches( test.getTestCaseInfo() ) )
+ currentMatches.emplace_back( &test );
+ return FilterMatch{ filter.name(), currentMatches };
+ } );
+ return matches;
+ }
+
+ const TestSpec::vectorStrings& TestSpec::getInvalidSpecs() const {
+ return m_invalidSpecs;
+ }
+
+}
+
+
+
+#include
+
+namespace Catch {
+
+ namespace {
+ static auto getCurrentNanosecondsSinceEpoch() -> uint64_t {
+ return std::chrono::duration_cast(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
+ }
+ } // end unnamed namespace
+
+ void Timer::start() {
+ m_nanoseconds = getCurrentNanosecondsSinceEpoch();
+ }
+ auto Timer::getElapsedNanoseconds() const -> uint64_t {
+ return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;
+ }
+ auto Timer::getElapsedMicroseconds() const -> uint64_t {
+ return getElapsedNanoseconds()/1000;
+ }
+ auto Timer::getElapsedMilliseconds() const -> unsigned int {
+ return static_cast(getElapsedMicroseconds()/1000);
+ }
+ auto Timer::getElapsedSeconds() const -> double {
+ return getElapsedMicroseconds()/1000000.0;
+ }
+
+
+} // namespace Catch
+
+
+
+
+#include
+#include
+
+namespace Catch {
+
+namespace Detail {
+
+ namespace {
+ const int hexThreshold = 255;
+
+ struct Endianness {
+ enum Arch { Big, Little };
+
+ static Arch which() {
+ int one = 1;
+ // If the lowest byte we read is non-zero, we can assume
+ // that little endian format is used.
+ auto value = *reinterpret_cast(&one);
+ return value ? Little : Big;
+ }
+ };
+
+ template
+ std::string fpToString(T value, int precision) {
+ if (Catch::isnan(value)) {
+ return "nan";
+ }
+
+ ReusableStringStream rss;
+ rss << std::setprecision(precision)
+ << std::fixed
+ << value;
+ std::string d = rss.str();
+ std::size_t i = d.find_last_not_of('0');
+ if (i != std::string::npos && i != d.size() - 1) {
+ if (d[i] == '.')
+ i++;
+ d = d.substr(0, i + 1);
+ }
+ return d;
+ }
+ } // end unnamed namespace
+
+ std::string convertIntoString(StringRef string, bool escape_invisibles) {
+ std::string ret;
+ // This is enough for the "don't escape invisibles" case, and a good
+ // lower bound on the "escape invisibles" case.
+ ret.reserve(string.size() + 2);
+
+ if (!escape_invisibles) {
+ ret += '"';
+ ret += string;
+ ret += '"';
+ return ret;
+ }
+
+ ret += '"';
+ for (char c : string) {
+ switch (c) {
+ case '\r':
+ ret.append("\\r");
+ break;
+ case '\n':
+ ret.append("\\n");
+ break;
+ case '\t':
+ ret.append("\\t");
+ break;
+ case '\f':
+ ret.append("\\f");
+ break;
+ default:
+ ret.push_back(c);
+ break;
+ }
+ }
+ ret += '"';
+
+ return ret;
+ }
+
+ std::string convertIntoString(StringRef string) {
+ return convertIntoString(string, getCurrentContext().getConfig()->showInvisibles());
+ }
+
+ std::string rawMemoryToString( const void *object, std::size_t size ) {
+ // Reverse order for little endian architectures
+ int i = 0, end = static_cast( size ), inc = 1;
+ if( Endianness::which() == Endianness::Little ) {
+ i = end-1;
+ end = inc = -1;
+ }
+
+ unsigned char const *bytes = static_cast(object);
+ ReusableStringStream rss;
+ rss << "0x" << std::setfill('0') << std::hex;
+ for( ; i != end; i += inc )
+ rss << std::setw(2) << static_cast(bytes[i]);
+ return rss.str();
+ }
+} // end Detail namespace
+
+
+
+//// ======================================================= ////
+//
+// Out-of-line defs for full specialization of StringMaker
+//
+//// ======================================================= ////
+
+std::string StringMaker::convert(const std::string& str) {
+ return Detail::convertIntoString( str );
+}
+
+#ifdef CATCH_CONFIG_CPP17_STRING_VIEW
+std::string StringMaker::convert(std::string_view str) {
+ return Detail::convertIntoString( StringRef( str.data(), str.size() ) );
+}
+#endif
+
+std::string StringMaker::convert(char const* str) {
+ if (str) {
+ return Detail::convertIntoString( str );
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker::convert(char* str) {
+ if (str) {
+ return Detail::convertIntoString( str );
+ } else {
+ return{ "{null string}" };
+ }
+}
+
+#ifdef CATCH_CONFIG_WCHAR
+std::string StringMaker::convert(const std::wstring& wstr) {
+ std::string s;
+ s.reserve(wstr.size());
+ for (auto c : wstr) {
+ s += (c <= 0xff) ? static_cast(c) : '?';
+ }
+ return ::Catch::Detail::stringify(s);
+}
+
+# ifdef CATCH_CONFIG_CPP17_STRING_VIEW
+std::string StringMaker::convert(std::wstring_view str) {
+ return StringMaker::convert(std::wstring(str));
+}
+# endif
+
+std::string StringMaker::convert(wchar_t const * str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::wstring{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+std::string StringMaker::convert(wchar_t * str) {
+ if (str) {
+ return ::Catch::Detail::stringify(std::wstring{ str });
+ } else {
+ return{ "{null string}" };
+ }
+}
+#endif
+
+#if defined(CATCH_CONFIG_CPP17_BYTE)
+#include
+std::string StringMaker::convert(std::byte value) {
+ return ::Catch::Detail::stringify(std::to_integer(value));
+}
+#endif // defined(CATCH_CONFIG_CPP17_BYTE)
+
+std::string StringMaker::convert(int value) {
+ return ::Catch::Detail::stringify(static_cast(value));
+}
+std::string StringMaker::convert(long value) {
+ return ::Catch::Detail::stringify(static_cast(value));
+}
+std::string StringMaker::convert(long long value) {
+ ReusableStringStream rss;
+ rss << value;
+ if (value > Detail::hexThreshold) {
+ rss << " (0x" << std::hex << value << ')';
+ }
+ return rss.str();
+}
+
+std::string StringMaker::convert(unsigned int value) {
+ return ::Catch::Detail::stringify(static_cast(value));
+}
+std::string StringMaker::convert(unsigned long value) {
+ return ::Catch::Detail::stringify(static_cast(value));
+}
+std::string StringMaker::convert(unsigned long long value) {
+ ReusableStringStream rss;
+ rss << value;
+ if (value > Detail::hexThreshold) {
+ rss << " (0x" << std::hex << value << ')';
+ }
+ return rss.str();
+}
+
+std::string StringMaker::convert(signed char value) {
+ if (value == '\r') {
+ return "'\\r'";
+ } else if (value == '\f') {
+ return "'\\f'";
+ } else if (value == '\n') {
+ return "'\\n'";
+ } else if (value == '\t') {
+ return "'\\t'";
+ } else if ('\0' <= value && value < ' ') {
+ return ::Catch::Detail::stringify(static_cast(value));
+ } else {
+ char chstr[] = "' '";
+ chstr[1] = value;
+ return chstr;
+ }
+}
+std::string StringMaker::convert(char c) {
+ return ::Catch::Detail::stringify(static_cast(c));
+}
+std::string StringMaker::convert(unsigned char c) {
+ return ::Catch::Detail::stringify(static_cast(c));
+}
+
+int StringMaker::precision = 5;
+
+std::string StringMaker::convert(float value) {
+ return Detail::fpToString(value, precision) + 'f';
+}
+
+int StringMaker::precision = 10;
+
+std::string StringMaker::convert(double value) {
+ return Detail::fpToString(value, precision);
+}
+
+} // end namespace Catch
+
+
+
+namespace Catch {
+
+ Counts Counts::operator - ( Counts const& other ) const {
+ Counts diff;
+ diff.passed = passed - other.passed;
+ diff.failed = failed - other.failed;
+ diff.failedButOk = failedButOk - other.failedButOk;
+ return diff;
+ }
+
+ Counts& Counts::operator += ( Counts const& other ) {
+ passed += other.passed;
+ failed += other.failed;
+ failedButOk += other.failedButOk;
+ return *this;
+ }
+
+ std::uint64_t Counts::total() const {
+ return passed + failed + failedButOk;
+ }
+ bool Counts::allPassed() const {
+ return failed == 0 && failedButOk == 0;
+ }
+ bool Counts::allOk() const {
+ return failed == 0;
+ }
+
+ Totals Totals::operator - ( Totals const& other ) const {
+ Totals diff;
+ diff.assertions = assertions - other.assertions;
+ diff.testCases = testCases - other.testCases;
+ return diff;
+ }
+
+ Totals& Totals::operator += ( Totals const& other ) {
+ assertions += other.assertions;
+ testCases += other.testCases;
+ return *this;
+ }
+
+ Totals Totals::delta( Totals const& prevTotals ) const {
+ Totals diff = *this - prevTotals;
+ if( diff.assertions.failed > 0 )
+ ++diff.testCases.failed;
+ else if( diff.assertions.failedButOk > 0 )
+ ++diff.testCases.failedButOk;
+ else
+ ++diff.testCases.passed;
+ return diff;
+ }
+
+}
+
+
+#include
+
+namespace Catch {
+
+ Version::Version
+ ( unsigned int _majorVersion,
+ unsigned int _minorVersion,
+ unsigned int _patchNumber,
+ char const * const _branchName,
+ unsigned int _buildNumber )
+ : majorVersion( _majorVersion ),
+ minorVersion( _minorVersion ),
+ patchNumber( _patchNumber ),
+ branchName( _branchName ),
+ buildNumber( _buildNumber )
+ {}
+
+ std::ostream& operator << ( std::ostream& os, Version const& version ) {
+ os << version.majorVersion << '.'
+ << version.minorVersion << '.'
+ << version.patchNumber;
+ // branchName is never null -> 0th char is \0 if it is empty
+ if (version.branchName[0]) {
+ os << '-' << version.branchName
+ << '.' << version.buildNumber;
+ }
+ return os;
+ }
+
+ Version const& libraryVersion() {
+ static Version version( 3, 1, 1, "", 0 );
+ return version;
+ }
+
+}
+
+
+
+
+namespace Catch {
+
+ const char* GeneratorException::what() const noexcept {
+ return m_msg;
+ }
+
+} // end namespace Catch
+
+
+
+
+namespace Catch {
+
+ IGeneratorTracker::~IGeneratorTracker() = default;
+
+namespace Generators {
+
+namespace Detail {
+
+ [[noreturn]]
+ void throw_generator_exception(char const* msg) {
+ Catch::throw_exception(GeneratorException{ msg });
+ }
+} // end namespace Detail
+
+ GeneratorUntypedBase::~GeneratorUntypedBase() = default;
+
+ auto acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& {
+ return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
+ }
+
+} // namespace Generators
+} // namespace Catch
+
+
+
+
+
+std::uint32_t Catch::Generators::Detail::getSeed() { return sharedRng()(); }
+
+
+
+
+namespace Catch {
+ IResultCapture::~IResultCapture() = default;
+}
+
+
+
+
+namespace Catch {
+ IConfig::~IConfig() = default;
+}
+
+
+
+
+namespace Catch {
+ IExceptionTranslator::~IExceptionTranslator() = default;
+ IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;
+}
+
+
+
+#include
+
+namespace Catch {
+ namespace Generators {
+
+ bool GeneratorUntypedBase::countedNext() {
+ auto ret = next();
+ if ( ret ) {
+ m_stringReprCache.clear();
+ ++m_currentElementIndex;
+ }
+ return ret;
+ }
+
+ StringRef GeneratorUntypedBase::currentElementAsString() const {
+ if ( m_stringReprCache.empty() ) {
+ m_stringReprCache = stringifyImpl();
+ }
+ return m_stringReprCache;
+ }
+
+ } // namespace Generators
+} // namespace Catch
+
+
+
+
+namespace Catch {
+ IRegistryHub::~IRegistryHub() = default;
+ IMutableRegistryHub::~IMutableRegistryHub() = default;
+}
+
+
+
+#include
+#include
+#include
+
+namespace Catch {
+
+ ReporterConfig::ReporterConfig(
+ IConfig const* _fullConfig,
+ Detail::unique_ptr _stream,
+ ColourMode colourMode,
+ std::map customOptions ):
+ m_stream( CATCH_MOVE(_stream) ),
+ m_fullConfig( _fullConfig ),
+ m_colourMode( colourMode ),
+ m_customOptions( CATCH_MOVE( customOptions ) ) {}
+
+ Detail::unique_ptr ReporterConfig::takeStream() && {
+ assert( m_stream );
+ return CATCH_MOVE( m_stream );
+ }
+ IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
+ ColourMode ReporterConfig::colourMode() const { return m_colourMode; }
+
+ std::map const&
+ ReporterConfig::customOptions() const {
+ return m_customOptions;
+ }
+
+ ReporterConfig::~ReporterConfig() = default;
+
+ AssertionStats::AssertionStats( AssertionResult const& _assertionResult,
+ std::vector const& _infoMessages,
+ Totals const& _totals )
+ : assertionResult( _assertionResult ),
+ infoMessages( _infoMessages ),
+ totals( _totals )
+ {
+ assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression;
+
+ if( assertionResult.hasMessage() ) {
+ // Copy message into messages list.
+ // !TBD This should have been done earlier, somewhere
+ MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );
+ builder << assertionResult.getMessage();
+ builder.m_info.message = builder.m_stream.str();
+
+ infoMessages.push_back( builder.m_info );
+ }
+ }
+
+ SectionStats::SectionStats( SectionInfo const& _sectionInfo,
+ Counts const& _assertions,
+ double _durationInSeconds,
+ bool _missingAssertions )
+ : sectionInfo( _sectionInfo ),
+ assertions( _assertions ),
+ durationInSeconds( _durationInSeconds ),
+ missingAssertions( _missingAssertions )
+ {}
+
+
+ TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo,
+ Totals const& _totals,
+ std::string const& _stdOut,
+ std::string const& _stdErr,
+ bool _aborting )
+ : testInfo( &_testInfo ),
+ totals( _totals ),
+ stdOut( _stdOut ),
+ stdErr( _stdErr ),
+ aborting( _aborting )
+ {}
+
+
+ TestRunStats::TestRunStats( TestRunInfo const& _runInfo,
+ Totals const& _totals,
+ bool _aborting )
+ : runInfo( _runInfo ),
+ totals( _totals ),
+ aborting( _aborting )
+ {}
+
+ IEventListener::~IEventListener() = default;
+
+} // end namespace Catch
+
+
+
+
+namespace Catch {
+ IReporterFactory::~IReporterFactory() = default;
+ EventListenerFactory::~EventListenerFactory() = default;
+}
+
+
+
+
+namespace Catch {
+ IReporterRegistry::~IReporterRegistry() = default;
+}
+
+
+
+
+namespace Catch {
+ ITestInvoker::~ITestInvoker() = default;
+ ITestCaseRegistry::~ITestCaseRegistry() = default;
+}
+
+
+
+namespace Catch {
+
+ AssertionHandler::AssertionHandler
+ ( StringRef macroName,
+ SourceLineInfo const& lineInfo,
+ StringRef capturedExpression,
+ ResultDisposition::Flags resultDisposition )
+ : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
+ m_resultCapture( getResultCapture() )
+ {}
+
+ void AssertionHandler::handleExpr( ITransientExpression const& expr ) {
+ m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );
+ }
+ void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef message) {
+ m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction );
+ }
+
+ auto AssertionHandler::allowThrows() const -> bool {
+ return getCurrentContext().getConfig()->allowThrows();
+ }
+
+ void AssertionHandler::complete() {
+ setCompleted();
+ if( m_reaction.shouldDebugBreak ) {
+
+ // If you find your debugger stopping you here then go one level up on the
+ // call-stack for the code that caused it (typically a failed assertion)
+
+ // (To go back to the test and change execution, jump over the throw, next)
+ CATCH_BREAK_INTO_DEBUGGER();
+ }
+ if (m_reaction.shouldThrow) {
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+ throw Catch::TestFailureException();
+#else
+ CATCH_ERROR( "Test failure requires aborting test!" );
+#endif
+ }
+ }
+ void AssertionHandler::setCompleted() {
+ m_completed = true;
+ }
+
+ void AssertionHandler::handleUnexpectedInflightException() {
+ m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );
+ }
+
+ void AssertionHandler::handleExceptionThrownAsExpected() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+ void AssertionHandler::handleExceptionNotThrownAsExpected() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+
+ void AssertionHandler::handleUnexpectedExceptionNotThrown() {
+ m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );
+ }
+
+ void AssertionHandler::handleThrowingCallSkipped() {
+ m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);
+ }
+
+ // This is the overload that takes a string and infers the Equals matcher from it
+ // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp
+ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef matcherString ) {
+ handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString );
+ }
+
+} // namespace Catch
+
+
+
+
+#include
+
+namespace Catch {
+ namespace Detail {
+
+ bool CaseInsensitiveLess::operator()( StringRef lhs,
+ StringRef rhs ) const {
+ return std::lexicographical_compare(
+ lhs.begin(), lhs.end(),
+ rhs.begin(), rhs.end(),
+ []( char l, char r ) { return toLower( l ) < toLower( r ); } );
+ }
+
+ bool
+ CaseInsensitiveEqualTo::operator()( StringRef lhs,
+ StringRef rhs ) const {
+ return std::equal(
+ lhs.begin(), lhs.end(),
+ rhs.begin(), rhs.end(),
+ []( char l, char r ) { return toLower( l ) == toLower( r ); } );
+ }
+
+ } // namespace Detail
+} // namespace Catch
+
+
+
+
+#include
+#include
+
+namespace {
+ bool isOptPrefix( char c ) {
+ return c == '-'
+#ifdef CATCH_PLATFORM_WINDOWS
+ || c == '/'
+#endif
+ ;
+ }
+
+ std::string normaliseOpt( std::string const& optName ) {
+#ifdef CATCH_PLATFORM_WINDOWS
+ if ( optName[0] == '/' )
+ return "-" + optName.substr( 1 );
+ else
+#endif
+ return optName;
+ }
+
+} // namespace
+
+namespace Catch {
+ namespace Clara {
+ namespace Detail {
+
+ void TokenStream::loadBuffer() {
+ m_tokenBuffer.clear();
+
+ // Skip any empty strings
+ while ( it != itEnd && it->empty() ) {
+ ++it;
+ }
+
+ if ( it != itEnd ) {
+ auto const& next = *it;
+ if ( isOptPrefix( next[0] ) ) {
+ auto delimiterPos = next.find_first_of( " :=" );
+ if ( delimiterPos != std::string::npos ) {
+ m_tokenBuffer.push_back(
+ { TokenType::Option,
+ next.substr( 0, delimiterPos ) } );
+ m_tokenBuffer.push_back(
+ { TokenType::Argument,
+ next.substr( delimiterPos + 1 ) } );
+ } else {
+ if ( next[1] != '-' && next.size() > 2 ) {
+ std::string opt = "- ";
+ for ( size_t i = 1; i < next.size(); ++i ) {
+ opt[1] = next[i];
+ m_tokenBuffer.push_back(
+ { TokenType::Option, opt } );
+ }
+ } else {
+ m_tokenBuffer.push_back(
+ { TokenType::Option, next } );
+ }
+ }
+ } else {
+ m_tokenBuffer.push_back(
+ { TokenType::Argument, next } );
+ }
+ }
+ }
+
+ TokenStream::TokenStream( Args const& args ):
+ TokenStream( args.m_args.begin(), args.m_args.end() ) {}
+
+ TokenStream::TokenStream( Iterator it_, Iterator itEnd_ ):
+ it( it_ ), itEnd( itEnd_ ) {
+ loadBuffer();
+ }
+
+ TokenStream& TokenStream::operator++() {
+ if ( m_tokenBuffer.size() >= 2 ) {
+ m_tokenBuffer.erase( m_tokenBuffer.begin() );
+ } else {
+ if ( it != itEnd )
+ ++it;
+ loadBuffer();
+ }
+ return *this;
+ }
+
+ ParserResult convertInto( std::string const& source,
+ std::string& target ) {
+ target = source;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ ParserResult convertInto( std::string const& source,
+ bool& target ) {
+ std::string srcLC = toLower( source );
+
+ if ( srcLC == "y" || srcLC == "1" || srcLC == "true" ||
+ srcLC == "yes" || srcLC == "on" ) {
+ target = true;
+ } else if ( srcLC == "n" || srcLC == "0" || srcLC == "false" ||
+ srcLC == "no" || srcLC == "off" ) {
+ target = false;
+ } else {
+ return ParserResult::runtimeError(
+ "Expected a boolean value but did not recognise: '" +
+ source + '\'' );
+ }
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ size_t ParserBase::cardinality() const { return 1; }
+
+ InternalParseResult ParserBase::parse( Args const& args ) const {
+ return parse( args.exeName(), TokenStream( args ) );
+ }
+
+ ParseState::ParseState( ParseResultType type,
+ TokenStream const& remainingTokens ):
+ m_type( type ), m_remainingTokens( remainingTokens ) {}
+
+ ParserResult BoundFlagRef::setFlag( bool flag ) {
+ m_ref = flag;
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ ResultBase::~ResultBase() = default;
+
+ bool BoundRef::isContainer() const { return false; }
+
+ bool BoundRef::isFlag() const { return false; }
+
+ bool BoundFlagRefBase::isFlag() const { return true; }
+
+} // namespace Detail
+
+ Detail::InternalParseResult Arg::parse(std::string const&,
+ Detail::TokenStream const& tokens) const {
+ auto validationResult = validate();
+ if (!validationResult)
+ return Detail::InternalParseResult(validationResult);
+
+ auto remainingTokens = tokens;
+ auto const& token = *remainingTokens;
+ if (token.type != Detail::TokenType::Argument)
+ return Detail::InternalParseResult::ok(Detail::ParseState(
+ ParseResultType::NoMatch, remainingTokens));
+
+ assert(!m_ref->isFlag());
+ auto valueRef =
+ static_cast(m_ref.get());
+
+ auto result = valueRef->setValue(remainingTokens->token);
+ if (!result)
+ return Detail::InternalParseResult(result);
+ else
+ return Detail::InternalParseResult::ok(Detail::ParseState(
+ ParseResultType::Matched, ++remainingTokens));
+ }
+
+ Opt::Opt(bool& ref) :
+ ParserRefImpl(std::make_shared(ref)) {}
+
+ std::vector Opt::getHelpColumns() const {
+ std::ostringstream oss;
+ bool first = true;
+ for (auto const& opt : m_optNames) {
+ if (first)
+ first = false;
+ else
+ oss << ", ";
+ oss << opt;
+ }
+ if (!m_hint.empty())
+ oss << " <" << m_hint << '>';
+ return { { oss.str(), m_description } };
+ }
+
+ bool Opt::isMatch(std::string const& optToken) const {
+ auto normalisedToken = normaliseOpt(optToken);
+ for (auto const& name : m_optNames) {
+ if (normaliseOpt(name) == normalisedToken)
+ return true;
+ }
+ return false;
+ }
+
+ Detail::InternalParseResult Opt::parse(std::string const&,
+ Detail::TokenStream const& tokens) const {
+ auto validationResult = validate();
+ if (!validationResult)
+ return Detail::InternalParseResult(validationResult);
+
+ auto remainingTokens = tokens;
+ if (remainingTokens &&
+ remainingTokens->type == Detail::TokenType::Option) {
+ auto const& token = *remainingTokens;
+ if (isMatch(token.token)) {
+ if (m_ref->isFlag()) {
+ auto flagRef =
+ static_cast(
+ m_ref.get());
+ auto result = flagRef->setFlag(true);
+ if (!result)
+ return Detail::InternalParseResult(result);
+ if (result.value() ==
+ ParseResultType::ShortCircuitAll)
+ return Detail::InternalParseResult::ok(Detail::ParseState(
+ result.value(), remainingTokens));
+ } else {
+ auto valueRef =
+ static_cast(
+ m_ref.get());
+ ++remainingTokens;
+ if (!remainingTokens)
+ return Detail::InternalParseResult::runtimeError(
+ "Expected argument following " +
+ token.token);
+ auto const& argToken = *remainingTokens;
+ if (argToken.type != Detail::TokenType::Argument)
+ return Detail::InternalParseResult::runtimeError(
+ "Expected argument following " +
+ token.token);
+ const auto result = valueRef->setValue(argToken.token);
+ if (!result)
+ return Detail::InternalParseResult(result);
+ if (result.value() ==
+ ParseResultType::ShortCircuitAll)
+ return Detail::InternalParseResult::ok(Detail::ParseState(
+ result.value(), remainingTokens));
+ }
+ return Detail::InternalParseResult::ok(Detail::ParseState(
+ ParseResultType::Matched, ++remainingTokens));
+ }
+ }
+ return Detail::InternalParseResult::ok(
+ Detail::ParseState(ParseResultType::NoMatch, remainingTokens));
+ }
+
+ Detail::Result Opt::validate() const {
+ if (m_optNames.empty())
+ return Detail::Result::logicError("No options supplied to Opt");
+ for (auto const& name : m_optNames) {
+ if (name.empty())
+ return Detail::Result::logicError(
+ "Option name cannot be empty");
+#ifdef CATCH_PLATFORM_WINDOWS
+ if (name[0] != '-' && name[0] != '/')
+ return Detail::Result::logicError(
+ "Option name must begin with '-' or '/'");
+#else
+ if (name[0] != '-')
+ return Detail::Result::logicError(
+ "Option name must begin with '-'");
+#endif
+ }
+ return ParserRefImpl::validate();
+ }
+
+ ExeName::ExeName() :
+ m_name(std::make_shared("")) {}
+
+ ExeName::ExeName(std::string& ref) : ExeName() {
+ m_ref = std::make_shared>(ref);
+ }
+
+ Detail::InternalParseResult
+ ExeName::parse(std::string const&,
+ Detail::TokenStream const& tokens) const {
+ return Detail::InternalParseResult::ok(
+ Detail::ParseState(ParseResultType::NoMatch, tokens));
+ }
+
+ ParserResult ExeName::set(std::string const& newName) {
+ auto lastSlash = newName.find_last_of("\\/");
+ auto filename = (lastSlash == std::string::npos)
+ ? newName
+ : newName.substr(lastSlash + 1);
+
+ *m_name = filename;
+ if (m_ref)
+ return m_ref->setValue(filename);
+ else
+ return ParserResult::ok(ParseResultType::Matched);
+ }
+
+
+
+
+ Parser& Parser::operator|=( Parser const& other ) {
+ m_options.insert( m_options.end(),
+ other.m_options.begin(),
+ other.m_options.end() );
+ m_args.insert(
+ m_args.end(), other.m_args.begin(), other.m_args.end() );
+ return *this;
+ }
+
+ std::vector Parser::getHelpColumns() const {
+ std::vector cols;
+ for ( auto const& o : m_options ) {
+ auto childCols = o.getHelpColumns();
+ cols.insert( cols.end(), childCols.begin(), childCols.end() );
+ }
+ return cols;
+ }
+
+ void Parser::writeToStream( std::ostream& os ) const {
+ if ( !m_exeName.name().empty() ) {
+ os << "usage:\n"
+ << " " << m_exeName.name() << ' ';
+ bool required = true, first = true;
+ for ( auto const& arg : m_args ) {
+ if ( first )
+ first = false;
+ else
+ os << ' ';
+ if ( arg.isOptional() && required ) {
+ os << '[';
+ required = false;
+ }
+ os << '<' << arg.hint() << '>';
+ if ( arg.cardinality() == 0 )
+ os << " ... ";
+ }
+ if ( !required )
+ os << ']';
+ if ( !m_options.empty() )
+ os << " options";
+ os << "\n\nwhere options are:\n";
+ }
+
+ auto rows = getHelpColumns();
+ size_t consoleWidth = CATCH_CONFIG_CONSOLE_WIDTH;
+ size_t optWidth = 0;
+ for ( auto const& cols : rows )
+ optWidth = ( std::max )( optWidth, cols.left.size() + 2 );
+
+ optWidth = ( std::min )( optWidth, consoleWidth / 2 );
+
+ for ( auto const& cols : rows ) {
+ auto row = TextFlow::Column( cols.left )
+ .width( optWidth )
+ .indent( 2 ) +
+ TextFlow::Spacer( 4 ) +
+ TextFlow::Column( cols.right )
+ .width( consoleWidth - 7 - optWidth );
+ os << row << '\n';
+ }
+ }
+
+ Detail::Result Parser::validate() const {
+ for ( auto const& opt : m_options ) {
+ auto result = opt.validate();
+ if ( !result )
+ return result;
+ }
+ for ( auto const& arg : m_args ) {
+ auto result = arg.validate();
+ if ( !result )
+ return result;
+ }
+ return Detail::Result::ok();
+ }
+
+ Detail::InternalParseResult
+ Parser::parse( std::string const& exeName,
+ Detail::TokenStream const& tokens ) const {
+
+ struct ParserInfo {
+ ParserBase const* parser = nullptr;
+ size_t count = 0;
+ };
+ std::vector parseInfos;
+ parseInfos.reserve( m_options.size() + m_args.size() );
+ for ( auto const& opt : m_options ) {
+ parseInfos.push_back( { &opt, 0 } );
+ }
+ for ( auto const& arg : m_args ) {
+ parseInfos.push_back( { &arg, 0 } );
+ }
+
+ m_exeName.set( exeName );
+
+ auto result = Detail::InternalParseResult::ok(
+ Detail::ParseState( ParseResultType::NoMatch, tokens ) );
+ while ( result.value().remainingTokens() ) {
+ bool tokenParsed = false;
+
+ for ( auto& parseInfo : parseInfos ) {
+ if ( parseInfo.parser->cardinality() == 0 ||
+ parseInfo.count < parseInfo.parser->cardinality() ) {
+ result = parseInfo.parser->parse(
+ exeName, result.value().remainingTokens() );
+ if ( !result )
+ return result;
+ if ( result.value().type() !=
+ ParseResultType::NoMatch ) {
+ tokenParsed = true;
+ ++parseInfo.count;
+ break;
+ }
+ }
+ }
+
+ if ( result.value().type() == ParseResultType::ShortCircuitAll )
+ return result;
+ if ( !tokenParsed )
+ return Detail::InternalParseResult::runtimeError(
+ "Unrecognised token: " +
+ result.value().remainingTokens()->token );
+ }
+ // !TBD Check missing required options
+ return result;
+ }
+
+ Args::Args(int argc, char const* const* argv) :
+ m_exeName(argv[0]), m_args(argv + 1, argv + argc) {}
+
+ Args::Args(std::initializer_list args) :
+ m_exeName(*args.begin()),
+ m_args(args.begin() + 1, args.end()) {}
+
+
+ Help::Help( bool& showHelpFlag ):
+ Opt( [&]( bool flag ) {
+ showHelpFlag = flag;
+ return ParserResult::ok( ParseResultType::ShortCircuitAll );
+ } ) {
+ static_cast ( *this )(
+ "display usage information" )["-?"]["-h"]["--help"]
+ .optional();
+ }
+
+ } // namespace Clara
+} // namespace Catch
+
+
+
+
+#include
+#include
+
+namespace Catch {
+
+ Clara::Parser makeCommandLineParser( ConfigData& config ) {
+
+ using namespace Clara;
+
+ auto const setWarning = [&]( std::string const& warning ) {
+ if ( warning == "NoAssertions" ) {
+ config.warnings = static_cast(config.warnings | WarnAbout::NoAssertions);
+ return ParserResult::ok( ParseResultType::Matched );
+ } else if ( warning == "UnmatchedTestSpec" ) {
+ config.warnings = static_cast(config.warnings | WarnAbout::UnmatchedTestSpec);
+ return ParserResult::ok( ParseResultType::Matched );
+ }
+
+ return ParserResult ::runtimeError(
+ "Unrecognised warning option: '" + warning + '\'' );
+ };
+ auto const loadTestNamesFromFile = [&]( std::string const& filename ) {
+ std::ifstream f( filename.c_str() );
+ if( !f.is_open() )
+ return ParserResult::runtimeError( "Unable to load input file: '" + filename + '\'' );
+
+ std::string line;
+ while( std::getline( f, line ) ) {
+ line = trim(line);
+ if( !line.empty() && !startsWith( line, '#' ) ) {
+ if( !startsWith( line, '"' ) )
+ line = '"' + line + '"';
+ config.testsOrTags.push_back( line );
+ config.testsOrTags.emplace_back( "," );
+ }
+ }
+ //Remove comma in the end
+ if(!config.testsOrTags.empty())
+ config.testsOrTags.erase( config.testsOrTags.end()-1 );
+
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setTestOrder = [&]( std::string const& order ) {
+ if( startsWith( "declared", order ) )
+ config.runOrder = TestRunOrder::Declared;
+ else if( startsWith( "lexical", order ) )
+ config.runOrder = TestRunOrder::LexicographicallySorted;
+ else if( startsWith( "random", order ) )
+ config.runOrder = TestRunOrder::Randomized;
+ else
+ return ParserResult::runtimeError( "Unrecognised ordering: '" + order + '\'' );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setRngSeed = [&]( std::string const& seed ) {
+ if( seed == "time" ) {
+ config.rngSeed = generateRandomSeed(GenerateFrom::Time);
+ return ParserResult::ok(ParseResultType::Matched);
+ } else if (seed == "random-device") {
+ config.rngSeed = generateRandomSeed(GenerateFrom::RandomDevice);
+ return ParserResult::ok(ParseResultType::Matched);
+ }
+
+ CATCH_TRY {
+ std::size_t parsedTo = 0;
+ unsigned long parsedSeed = std::stoul(seed, &parsedTo, 0);
+ if (parsedTo != seed.size()) {
+ return ParserResult::runtimeError("Could not parse '" + seed + "' as seed");
+ }
+
+ // TODO: Ideally we could parse unsigned int directly,
+ // but the stdlib doesn't provide helper for that
+ // type. After this is refactored to use fixed size
+ // type, we should check the parsed value is in range
+ // of the underlying type.
+ config.rngSeed = static_cast(parsedSeed);
+ return ParserResult::ok(ParseResultType::Matched);
+ } CATCH_CATCH_ANON(std::exception const&) {
+ return ParserResult::runtimeError("Could not parse '" + seed + "' as seed");
+ }
+ };
+ auto const setDefaultColourMode = [&]( std::string const& colourMode ) {
+ Optional maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode ));
+ if ( !maybeMode ) {
+ return ParserResult::runtimeError(
+ "colour mode must be one of: default, ansi, win32, "
+ "or none. '" +
+ colourMode + "' is not recognised" );
+ }
+ auto mode = *maybeMode;
+ if ( !isColourImplAvailable( mode ) ) {
+ return ParserResult::runtimeError(
+ "colour mode '" + colourMode +
+ "' is not supported in this binary" );
+ }
+ config.defaultColourMode = mode;
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setWaitForKeypress = [&]( std::string const& keypress ) {
+ auto keypressLc = toLower( keypress );
+ if (keypressLc == "never")
+ config.waitForKeypress = WaitForKeypress::Never;
+ else if( keypressLc == "start" )
+ config.waitForKeypress = WaitForKeypress::BeforeStart;
+ else if( keypressLc == "exit" )
+ config.waitForKeypress = WaitForKeypress::BeforeExit;
+ else if( keypressLc == "both" )
+ config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;
+ else
+ return ParserResult::runtimeError( "keypress argument must be one of: never, start, exit or both. '" + keypress + "' not recognised" );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setVerbosity = [&]( std::string const& verbosity ) {
+ auto lcVerbosity = toLower( verbosity );
+ if( lcVerbosity == "quiet" )
+ config.verbosity = Verbosity::Quiet;
+ else if( lcVerbosity == "normal" )
+ config.verbosity = Verbosity::Normal;
+ else if( lcVerbosity == "high" )
+ config.verbosity = Verbosity::High;
+ else
+ return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + '\'' );
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setReporter = [&]( std::string const& userReporterSpec ) {
+ if ( userReporterSpec.empty() ) {
+ return ParserResult::runtimeError( "Received empty reporter spec." );
+ }
+
+ Optional parsed =
+ parseReporterSpec( userReporterSpec );
+ if ( !parsed ) {
+ return ParserResult::runtimeError(
+ "Could not parse reporter spec '" + userReporterSpec +
+ "'" );
+ }
+
+ auto const& reporterSpec = *parsed;
+
+ IReporterRegistry::FactoryMap const& factories =
+ getRegistryHub().getReporterRegistry().getFactories();
+ auto result = factories.find( reporterSpec.name() );
+
+ if ( result == factories.end() ) {
+ return ParserResult::runtimeError(
+ "Unrecognized reporter, '" + reporterSpec.name() +
+ "'. Check available with --list-reporters" );
+ }
+
+
+ const bool hadOutputFile = reporterSpec.outputFile().some();
+ config.reporterSpecifications.push_back( CATCH_MOVE( *parsed ) );
+ // It would be enough to check this only once at the very end, but
+ // there is not a place where we could call this check, so do it
+ // every time it could fail. For valid inputs, this is still called
+ // at most once.
+ if (!hadOutputFile) {
+ int n_reporters_without_file = 0;
+ for (auto const& spec : config.reporterSpecifications) {
+ if (spec.outputFile().none()) {
+ n_reporters_without_file++;
+ }
+ }
+ if (n_reporters_without_file > 1) {
+ return ParserResult::runtimeError( "Only one reporter may have unspecified output file." );
+ }
+ }
+
+ return ParserResult::ok( ParseResultType::Matched );
+ };
+ auto const setShardCount = [&]( std::string const& shardCount ) {
+ CATCH_TRY{
+ std::size_t parsedTo = 0;
+ int64_t parsedCount = std::stoll(shardCount, &parsedTo, 0);
+ if (parsedTo != shardCount.size()) {
+ return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count");
+ }
+ if (parsedCount <= 0) {
+ return ParserResult::runtimeError("Shard count must be a positive number");
+ }
+
+ config.shardCount = static_cast(parsedCount);
+ return ParserResult::ok(ParseResultType::Matched);
+ } CATCH_CATCH_ANON(std::exception const&) {
+ return ParserResult::runtimeError("Could not parse '" + shardCount + "' as shard count");
+ }
+ };
+
+ auto const setShardIndex = [&](std::string const& shardIndex) {
+ CATCH_TRY{
+ std::size_t parsedTo = 0;
+ int64_t parsedIndex = std::stoll(shardIndex, &parsedTo, 0);
+ if (parsedTo != shardIndex.size()) {
+ return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index");
+ }
+ if (parsedIndex < 0) {
+ return ParserResult::runtimeError("Shard index must be a non-negative number");
+ }
+
+ config.shardIndex = static_cast(parsedIndex);
+ return ParserResult::ok(ParseResultType::Matched);
+ } CATCH_CATCH_ANON(std::exception const&) {
+ return ParserResult::runtimeError("Could not parse '" + shardIndex + "' as shard index");
+ }
+ };
+
+
+ auto cli
+ = ExeName( config.processName )
+ | Help( config.showHelp )
+ | Opt( config.showSuccessfulTests )
+ ["-s"]["--success"]
+ ( "include successful tests in output" )
+ | Opt( config.shouldDebugBreak )
+ ["-b"]["--break"]
+ ( "break into debugger on failure" )
+ | Opt( config.noThrow )
+ ["-e"]["--nothrow"]
+ ( "skip exception tests" )
+ | Opt( config.showInvisibles )
+ ["-i"]["--invisibles"]
+ ( "show invisibles (tabs, newlines)" )
+ | Opt( config.defaultOutputFilename, "filename" )
+ ["-o"]["--out"]
+ ( "default output filename" )
+ | Opt( accept_many, setReporter, "name[::key=value]*" )
+ ["-r"]["--reporter"]
+ ( "reporter to use (defaults to console)" )
+ | Opt( config.name, "name" )
+ ["-n"]["--name"]
+ ( "suite name" )
+ | Opt( [&]( bool ){ config.abortAfter = 1; } )
+ ["-a"]["--abort"]
+ ( "abort at first failure" )
+ | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" )
+ ["-x"]["--abortx"]
+ ( "abort after x failures" )
+ | Opt( accept_many, setWarning, "warning name" )
+ ["-w"]["--warn"]
+ ( "enable warnings" )
+ | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
+ ["-d"]["--durations"]
+ ( "show test durations" )
+ | Opt( config.minDuration, "seconds" )
+ ["-D"]["--min-duration"]
+ ( "show test durations for tests taking at least the given number of seconds" )
+ | Opt( loadTestNamesFromFile, "filename" )
+ ["-f"]["--input-file"]
+ ( "load test names to run from a file" )
+ | Opt( config.filenamesAsTags )
+ ["-#"]["--filenames-as-tags"]
+ ( "adds a tag for the filename" )
+ | Opt( config.sectionsToRun, "section name" )
+ ["-c"]["--section"]
+ ( "specify section to run" )
+ | Opt( setVerbosity, "quiet|normal|high" )
+ ["-v"]["--verbosity"]
+ ( "set output verbosity" )
+ | Opt( config.listTests )
+ ["--list-tests"]
+ ( "list all/matching test cases" )
+ | Opt( config.listTags )
+ ["--list-tags"]
+ ( "list all/matching tags" )
+ | Opt( config.listReporters )
+ ["--list-reporters"]
+ ( "list all available reporters" )
+ | Opt( config.listListeners )
+ ["--list-listeners"]
+ ( "list all listeners" )
+ | Opt( setTestOrder, "decl|lex|rand" )
+ ["--order"]
+ ( "test case order (defaults to decl)" )
+ | Opt( setRngSeed, "'time'|'random-device'|number" )
+ ["--rng-seed"]
+ ( "set a specific seed for random numbers" )
+ | Opt( setDefaultColourMode, "ansi|win32|none|default" )
+ ["--colour-mode"]
+ ( "what color mode should be used as default" )
+ | Opt( config.libIdentify )
+ ["--libidentify"]
+ ( "report name and version according to libidentify standard" )
+ | Opt( setWaitForKeypress, "never|start|exit|both" )
+ ["--wait-for-keypress"]
+ ( "waits for a keypress before exiting" )
+ | Opt( config.skipBenchmarks)
+ ["--skip-benchmarks"]
+ ( "disable running benchmarks")
+ | Opt( config.benchmarkSamples, "samples" )
+ ["--benchmark-samples"]
+ ( "number of samples to collect (default: 100)" )
+ | Opt( config.benchmarkResamples, "resamples" )
+ ["--benchmark-resamples"]
+ ( "number of resamples for the bootstrap (default: 100000)" )
+ | Opt( config.benchmarkConfidenceInterval, "confidence interval" )
+ ["--benchmark-confidence-interval"]
+ ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" )
+ | Opt( config.benchmarkNoAnalysis )
+ ["--benchmark-no-analysis"]
+ ( "perform only measurements; do not perform any analysis" )
+ | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" )
+ ["--benchmark-warmup-time"]
+ ( "amount of time in milliseconds spent on warming up each test (default: 100)" )
+ | Opt( setShardCount, "shard count" )
+ ["--shard-count"]
+ ( "split the tests to execute into this many groups" )
+ | Opt( setShardIndex, "shard index" )
+ ["--shard-index"]
+ ( "index of the group of tests to execute (see --shard-count)" ) |
+ Opt( config.allowZeroTests )
+ ["--allow-running-no-tests"]
+ ( "Treat 'No tests run' as a success" )
+ | Arg( config.testsOrTags, "test name|pattern|tags" )
+ ( "which test or tests to use" );
+
+ return cli;
+ }
+
+} // end namespace Catch
+
+
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wexit-time-destructors"
+#endif
+
+
+
+#include
+#include
+#include
+
+namespace Catch {
+
+ ColourImpl::~ColourImpl() = default;
+
+ ColourImpl::ColourGuard ColourImpl::guardColour( Colour::Code colourCode ) {
+ return ColourGuard(colourCode, this );
+ }
+
+ void ColourImpl::ColourGuard::engageImpl( std::ostream& stream ) {
+ assert( &stream == &m_colourImpl->m_stream->stream() &&
+ "Engaging colour guard for different stream than used by the "
+ "parent colour implementation" );
+ static_cast( stream );
+
+ m_engaged = true;
+ m_colourImpl->use( m_code );
+ }
+
+ ColourImpl::ColourGuard::ColourGuard( Colour::Code code,
+ ColourImpl const* colour ):
+ m_colourImpl( colour ), m_code( code ) {
+ }
+ ColourImpl::ColourGuard::ColourGuard( ColourGuard&& rhs ) noexcept:
+ m_colourImpl( rhs.m_colourImpl ),
+ m_code( rhs.m_code ),
+ m_engaged( rhs.m_engaged ) {
+ rhs.m_engaged = false;
+ }
+ ColourImpl::ColourGuard&
+ ColourImpl::ColourGuard::operator=( ColourGuard&& rhs ) noexcept {
+ using std::swap;
+ swap( m_colourImpl, rhs.m_colourImpl );
+ swap( m_code, rhs.m_code );
+ swap( m_engaged, rhs.m_engaged );
+
+ return *this;
+ }
+ ColourImpl::ColourGuard::~ColourGuard() {
+ if ( m_engaged ) {
+ m_colourImpl->use( Colour::None );
+ }
+ }
+
+ ColourImpl::ColourGuard&
+ ColourImpl::ColourGuard::engage( std::ostream& stream ) & {
+ engageImpl( stream );
+ return *this;
+ }
+
+ ColourImpl::ColourGuard&&
+ ColourImpl::ColourGuard::engage( std::ostream& stream ) && {
+ engageImpl( stream );
+ return CATCH_MOVE(*this);
+ }
+
+ namespace {
+ //! A do-nothing implementation of colour, used as fallback for unknown
+ //! platforms, and when the user asks to deactivate all colours.
+ class NoColourImpl : public ColourImpl {
+ public:
+ NoColourImpl( IStream* stream ): ColourImpl( stream ) {}
+
+ private:
+ void use( Colour::Code ) const override {}
+ };
+ } // namespace
+
+
+} // namespace Catch
+
+
+#if defined ( CATCH_CONFIG_COLOUR_WIN32 ) /////////////////////////////////////////
+
+namespace Catch {
+namespace {
+
+ class Win32ColourImpl : public ColourImpl {
+ public:
+ Win32ColourImpl(IStream* stream):
+ ColourImpl(stream) {
+ CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
+ GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ),
+ &csbiInfo );
+ originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );
+ originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );
+ }
+
+ static bool useImplementationForStream(IStream const& stream) {
+ // Win32 text colour APIs can only be used on console streams
+ // We cannot check that the output hasn't been redirected,
+ // so we just check that the original stream is console stream.
+ return stream.isConsole();
+ }
+
+ private:
+ void use( Colour::Code _colourCode ) const override {
+ switch( _colourCode ) {
+ case Colour::None: return setTextAttribute( originalForegroundAttributes );
+ case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
+ case Colour::Red: return setTextAttribute( FOREGROUND_RED );
+ case Colour::Green: return setTextAttribute( FOREGROUND_GREEN );
+ case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE );
+ case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );
+ case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );
+ case Colour::Grey: return setTextAttribute( 0 );
+
+ case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY );
+ case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );
+ case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );
+ case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );
+ case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );
+
+ case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
+
+ default:
+ CATCH_ERROR( "Unknown colour requested" );
+ }
+ }
+
+ void setTextAttribute( WORD _textAttribute ) const {
+ SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ),
+ _textAttribute |
+ originalBackgroundAttributes );
+ }
+ WORD originalForegroundAttributes;
+ WORD originalBackgroundAttributes;
+ };
+
+} // end anon namespace
+} // end namespace Catch
+
+#endif // Windows/ ANSI/ None
+
+
+#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC )
+# define CATCH_INTERNAL_HAS_ISATTY
+# include
+#endif
+
+namespace Catch {
+namespace {
+
+ class ANSIColourImpl : public ColourImpl {
+ public:
+ ANSIColourImpl( IStream* stream ): ColourImpl( stream ) {}
+
+ static bool useImplementationForStream(IStream const& stream) {
+ // This is kinda messy due to trying to support a bunch of
+ // different platforms at once.
+ // The basic idea is that if we are asked to do autodetection (as
+ // opposed to being told to use posixy colours outright), then we
+ // only want to use the colours if we are writing to console.
+ // However, console might be redirected, so we make an attempt at
+ // checking for that on platforms where we know how to do that.
+ bool useColour = stream.isConsole();
+#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \
+ !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) )
+ ErrnoGuard _; // for isatty
+ useColour = useColour && isatty( STDOUT_FILENO );
+# endif
+# if defined( CATCH_PLATFORM_MAC ) || defined( CATCH_PLATFORM_IPHONE )
+ useColour = useColour && !isDebuggerActive();
+# endif
+
+ return useColour;
+ }
+
+ private:
+ void use( Colour::Code _colourCode ) const override {
+ auto setColour = [&out =
+ m_stream->stream()]( char const* escapeCode ) {
+ // The escape sequence must be flushed to console, otherwise
+ // if stdin and stderr are intermixed, we'd get accidentally
+ // coloured output.
+ out << '\033' << escapeCode << std::flush;
+ };
+ switch( _colourCode ) {
+ case Colour::None:
+ case Colour::White: return setColour( "[0m" );
+ case Colour::Red: return setColour( "[0;31m" );
+ case Colour::Green: return setColour( "[0;32m" );
+ case Colour::Blue: return setColour( "[0;34m" );
+ case Colour::Cyan: return setColour( "[0;36m" );
+ case Colour::Yellow: return setColour( "[0;33m" );
+ case Colour::Grey: return setColour( "[1;30m" );
+
+ case Colour::LightGrey: return setColour( "[0;37m" );
+ case Colour::BrightRed: return setColour( "[1;31m" );
+ case Colour::BrightGreen: return setColour( "[1;32m" );
+ case Colour::BrightWhite: return setColour( "[1;37m" );
+ case Colour::BrightYellow: return setColour( "[1;33m" );
+
+ case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" );
+ default: CATCH_INTERNAL_ERROR( "Unknown colour requested" );
+ }
+ }
+ };
+
+} // end anon namespace
+} // end namespace Catch
+
+namespace Catch {
+
+ Detail::unique_ptr makeColourImpl( ColourMode implSelection,
+ IStream* stream ) {
+#if defined( CATCH_CONFIG_COLOUR_WIN32 )
+ if ( implSelection == ColourMode::Win32 ) {
+ return Detail::make_unique( stream );
+ }
+#endif
+ if ( implSelection == ColourMode::ANSI ) {
+ return Detail::make_unique( stream );
+ }
+ if ( implSelection == ColourMode::None ) {
+ return Detail::make_unique( stream );
+ }
+
+ if ( implSelection == ColourMode::PlatformDefault) {
+#if defined( CATCH_CONFIG_COLOUR_WIN32 )
+ if ( Win32ColourImpl::useImplementationForStream( *stream ) ) {
+ return Detail::make_unique( stream );
+ }
+#endif
+ if ( ANSIColourImpl::useImplementationForStream( *stream ) ) {
+ return Detail::make_unique( stream );
+ }
+ return Detail::make_unique( stream );
+ }
+
+ CATCH_ERROR( "Could not create colour impl for selection " << static_cast(implSelection) );
+ }
+
+ bool isColourImplAvailable( ColourMode colourSelection ) {
+ switch ( colourSelection ) {
+#if defined( CATCH_CONFIG_COLOUR_WIN32 )
+ case ColourMode::Win32:
+#endif
+ case ColourMode::ANSI:
+ case ColourMode::None:
+ case ColourMode::PlatformDefault:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+
+} // end namespace Catch
+
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+
+
+
+
+namespace Catch {
+
+ class Context : public IMutableContext, private Detail::NonCopyable {
+
+ public: // IContext
+ IResultCapture* getResultCapture() override {
+ return m_resultCapture;
+ }
+
+ IConfig const* getConfig() const override {
+ return m_config;
+ }
+
+ ~Context() override;
+
+ public: // IMutableContext
+ void setResultCapture( IResultCapture* resultCapture ) override {
+ m_resultCapture = resultCapture;
+ }
+ void setConfig( IConfig const* config ) override {
+ m_config = config;
+ }
+
+ friend IMutableContext& getCurrentMutableContext();
+
+ private:
+ IConfig const* m_config = nullptr;
+ IResultCapture* m_resultCapture = nullptr;
+ };
+
+ IMutableContext *IMutableContext::currentContext = nullptr;
+
+ void IMutableContext::createContext()
+ {
+ currentContext = new Context();
+ }
+
+ void cleanUpContext() {
+ delete IMutableContext::currentContext;
+ IMutableContext::currentContext = nullptr;
+ }
+ IContext::~IContext() = default;
+ IMutableContext::~IMutableContext() = default;
+ Context::~Context() = default;
+
+
+ SimplePcg32& sharedRng() {
+ static SimplePcg32 s_rng;
+ return s_rng;
+ }
+
+}
+
+
+
+
+
+#include
+
+#if defined(CATCH_CONFIG_ANDROID_LOGWRITE)
+#include
+
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ __android_log_write( ANDROID_LOG_DEBUG, "Catch", text.c_str() );
+ }
+ }
+
+#elif defined(CATCH_PLATFORM_WINDOWS)
+
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ ::OutputDebugStringA( text.c_str() );
+ }
+ }
+
+#else
+
+ namespace Catch {
+ void writeToDebugConsole( std::string const& text ) {
+ // !TBD: Need a version for Mac/ XCode and other IDEs
+ Catch::cout() << text;
+ }
+ }
+
+#endif // Platform
+
+
+
+#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)
+
+# include
+# include
+# include
+# include
+# include
+
+#ifdef __apple_build_version__
+ // These headers will only compile with AppleClang (XCode)
+ // For other compilers (Clang, GCC, ... ) we need to exclude them
+# include
+#endif
+
+ namespace Catch {
+ #ifdef __apple_build_version__
+ // The following function is taken directly from the following technical note:
+ // https://developer.apple.com/library/archive/qa/qa1361/_index.html
+
+ // Returns true if the current process is being debugged (either
+ // running under the debugger or has a debugger attached post facto).
+ bool isDebuggerActive(){
+ int mib[4];
+ struct kinfo_proc info;
+ std::size_t size;
+
+ // Initialize the flags so that, if sysctl fails for some bizarre
+ // reason, we get a predictable result.
+
+ info.kp_proc.p_flag = 0;
+
+ // Initialize mib, which tells sysctl the info we want, in this case
+ // we're looking for information about a specific process ID.
+
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_PROC;
+ mib[2] = KERN_PROC_PID;
+ mib[3] = getpid();
+
+ // Call sysctl.
+
+ size = sizeof(info);
+ if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {
+ Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n\n" << std::flush;
+ return false;
+ }
+
+ // We're being debugged if the P_TRACED flag is set.
+
+ return ( (info.kp_proc.p_flag & P_TRACED) != 0 );
+ }
+ #else
+ bool isDebuggerActive() {
+ // We need to find another way to determine this for non-appleclang compilers on macOS
+ return false;
+ }
+ #endif
+ } // namespace Catch
+
+#elif defined(CATCH_PLATFORM_LINUX)
+ #include
+ #include
+
+ namespace Catch{
+ // The standard POSIX way of detecting a debugger is to attempt to
+ // ptrace() the process, but this needs to be done from a child and not
+ // this process itself to still allow attaching to this process later
+ // if wanted, so is rather heavy. Under Linux we have the PID of the
+ // "debugger" (which doesn't need to be gdb, of course, it could also
+ // be strace, for example) in /proc/$PID/status, so just get it from
+ // there instead.
+ bool isDebuggerActive(){
+ // Libstdc++ has a bug, where std::ifstream sets errno to 0
+ // This way our users can properly assert over errno values
+ ErrnoGuard guard;
+ std::ifstream in("/proc/self/status");
+ for( std::string line; std::getline(in, line); ) {
+ static const int PREFIX_LEN = 11;
+ if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) {
+ // We're traced if the PID is not 0 and no other PID starts
+ // with 0 digit, so it's enough to check for just a single
+ // character.
+ return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';
+ }
+ }
+
+ return false;
+ }
+ } // namespace Catch
+#elif defined(_MSC_VER)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ namespace Catch {
+ bool isDebuggerActive() {
+ return IsDebuggerPresent() != 0;
+ }
+ }
+#elif defined(__MINGW32__)
+ extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
+ namespace Catch {
+ bool isDebuggerActive() {
+ return IsDebuggerPresent() != 0;
+ }
+ }
+#else
+ namespace Catch {
+ bool isDebuggerActive() { return false; }
+ }
+#endif // Platform
+
+
+
+
+namespace Catch {
+
+ ITransientExpression::~ITransientExpression() = default;
+
+ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
+ if( lhs.size() + rhs.size() < 40 &&
+ lhs.find('\n') == std::string::npos &&
+ rhs.find('\n') == std::string::npos )
+ os << lhs << ' ' << op << ' ' << rhs;
+ else
+ os << lhs << '\n' << op << '\n' << rhs;
+ }
+}
+
+
+
+#include
+
+
+namespace Catch {
+#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)
+ [[noreturn]]
+ void throw_exception(std::exception const& e) {
+ Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n"
+ << "The message was: " << e.what() << '\n';
+ std::terminate();
+ }
+#endif
+
+ [[noreturn]]
+ void throw_logic_error(std::string const& msg) {
+ throw_exception(std::logic_error(msg));
+ }
+
+ [[noreturn]]
+ void throw_domain_error(std::string const& msg) {
+ throw_exception(std::domain_error(msg));
+ }
+
+ [[noreturn]]
+ void throw_runtime_error(std::string const& msg) {
+ throw_exception(std::runtime_error(msg));
+ }
+
+
+
+} // namespace Catch;
+
+
+
+#include
+
+namespace Catch {
+
+ IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() = default;
+
+ namespace Detail {
+
+ namespace {
+ // Extracts the actual name part of an enum instance
+ // In other words, it returns the Blue part of Bikeshed::Colour::Blue
+ StringRef extractInstanceName(StringRef enumInstance) {
+ // Find last occurrence of ":"
+ size_t name_start = enumInstance.size();
+ while (name_start > 0 && enumInstance[name_start - 1] != ':') {
+ --name_start;
+ }
+ return enumInstance.substr(name_start, enumInstance.size() - name_start);
+ }
+ }
+
+ std::vector parseEnums( StringRef enums ) {
+ auto enumValues = splitStringRef( enums, ',' );
+ std::vector parsed;
+ parsed.reserve( enumValues.size() );
+ for( auto const& enumValue : enumValues ) {
+ parsed.push_back(trim(extractInstanceName(enumValue)));
+ }
+ return parsed;
+ }
+
+ EnumInfo::~EnumInfo() {}
+
+ StringRef EnumInfo::lookup( int value ) const {
+ for( auto const& valueToName : m_values ) {
+ if( valueToName.first == value )
+ return valueToName.second;
+ }
+ return "{** unexpected enum value **}"_sr;
+ }
+
+ Catch::Detail::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ) {
+ auto enumInfo = Catch::Detail::make_unique();
+ enumInfo->m_name = enumName;
+ enumInfo->m_values.reserve( values.size() );
+
+ const auto valueNames = Catch::Detail::parseEnums( allValueNames );
+ assert( valueNames.size() == values.size() );
+ std::size_t i = 0;
+ for( auto value : values )
+ enumInfo->m_values.emplace_back(value, valueNames[i++]);
+
+ return enumInfo;
+ }
+
+ EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector const& values ) {
+ m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values));
+ return *m_enumInfos.back();
+ }
+
+ } // Detail
+} // Catch
+
+
+
+
+
+#include
+
+namespace Catch {
+ ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}
+ ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }
+}
+
+
+
+namespace Catch {
+
+ ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() {
+ }
+
+ void ExceptionTranslatorRegistry::registerTranslator( Detail::unique_ptr&& translator ) {
+ m_translators.push_back( CATCH_MOVE( translator ) );
+ }
+
+#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)
+ std::string ExceptionTranslatorRegistry::translateActiveException() const {
+ // Compiling a mixed mode project with MSVC means that CLR
+ // exceptions will be caught in (...) as well. However, these do
+ // do not fill-in std::current_exception and thus lead to crash
+ // when attempting rethrow.
+ // /EHa switch also causes structured exceptions to be caught
+ // here, but they fill-in current_exception properly, so
+ // at worst the output should be a little weird, instead of
+ // causing a crash.
+ if ( std::current_exception() == nullptr ) {
+ return "Non C++ exception. Possibly a CLR exception.";
+ }
+
+ // First we try user-registered translators. If none of them can
+ // handle the exception, it will be rethrown handled by our defaults.
+ try {
+ return tryTranslators();
+ }
+ // To avoid having to handle TFE explicitly everywhere, we just
+ // rethrow it so that it goes back up the caller.
+ catch( TestFailureException& ) {
+ std::rethrow_exception(std::current_exception());
+ }
+ catch( std::exception const& ex ) {
+ return ex.what();
+ }
+ catch( std::string const& msg ) {
+ return msg;
+ }
+ catch( const char* msg ) {
+ return msg;
+ }
+ catch(...) {
+ return "Unknown exception";
+ }
+ }
+
+ std::string ExceptionTranslatorRegistry::tryTranslators() const {
+ if (m_translators.empty()) {
+ std::rethrow_exception(std::current_exception());
+ } else {
+ return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end());
+ }
+ }
+
+#else // ^^ Exceptions are enabled // Exceptions are disabled vv
+ std::string ExceptionTranslatorRegistry::translateActiveException() const {
+ CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
+ }
+
+ std::string ExceptionTranslatorRegistry::tryTranslators() const {
+ CATCH_INTERNAL_ERROR("Attempted to use exception translators under CATCH_CONFIG_DISABLE_EXCEPTIONS!");
+ }
+#endif
+
+
+}
+
+
+
+/** \file
+ * This file provides platform specific implementations of FatalConditionHandler
+ *
+ * This means that there is a lot of conditional compilation, and platform
+ * specific code. Currently, Catch2 supports a dummy handler (if no
+ * handler is desired), and 2 platform specific handlers:
+ * * Windows' SEH
+ * * POSIX signals
+ *
+ * Consequently, various pieces of code below are compiled if either of
+ * the platform specific handlers is enabled, or if none of them are
+ * enabled. It is assumed that both cannot be enabled at the same time,
+ * and doing so should cause a compilation error.
+ *
+ * If another platform specific handler is added, the compile guards
+ * below will need to be updated taking these assumptions into account.
+ */
+
+
+
+#include
+
+#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )
+
+namespace Catch {
+
+ // If neither SEH nor signal handling is required, the handler impls
+ // do not have to do anything, and can be empty.
+ void FatalConditionHandler::engage_platform() {}
+ void FatalConditionHandler::disengage_platform() noexcept {}
+ FatalConditionHandler::FatalConditionHandler() = default;
+ FatalConditionHandler::~FatalConditionHandler() = default;
+
+} // end namespace Catch
+
+#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS
+
+#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS )
+#error "Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time"
+#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS
+
+#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )
+
+namespace {
+ //! Signals fatal error message to the run context
+ void reportFatal( char const * const message ) {
+ Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );
+ }
+
+ //! Minimal size Catch2 needs for its own fatal error handling.
+ //! Picked empirically, so it might not be sufficient on all
+ //! platforms, and for all configurations.
+ constexpr std::size_t minStackSizeForErrors = 32 * 1024;
+} // end unnamed namespace
+
+#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS
+
+#if defined( CATCH_CONFIG_WINDOWS_SEH )
+
+namespace Catch {
+
+ struct SignalDefs { DWORD id; const char* name; };
+
+ // There is no 1-1 mapping between signals and windows exceptions.
+ // Windows can easily distinguish between SO and SigSegV,
+ // but SigInt, SigTerm, etc are handled differently.
+ static SignalDefs signalDefs[] = {
+ { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" },
+ { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" },
+ { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" },
+ { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" },
+ };
+
+ static LONG CALLBACK topLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) {
+ for (auto const& def : signalDefs) {
+ if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {
+ reportFatal(def.name);
+ }
+ }
+ // If its not an exception we care about, pass it along.
+ // This stops us from eating debugger breaks etc.
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ // Since we do not support multiple instantiations, we put these
+ // into global variables and rely on cleaning them up in outlined
+ // constructors/destructors
+ static LPTOP_LEVEL_EXCEPTION_FILTER previousTopLevelExceptionFilter = nullptr;
+
+
+ // For MSVC, we reserve part of the stack memory for handling
+ // memory overflow structured exception.
+ FatalConditionHandler::FatalConditionHandler() {
+ ULONG guaranteeSize = static_cast(minStackSizeForErrors);
+ if (!SetThreadStackGuarantee(&guaranteeSize)) {
+ // We do not want to fully error out, because needing
+ // the stack reserve should be rare enough anyway.
+ Catch::cerr()
+ << "Failed to reserve piece of stack."
+ << " Stack overflows will not be reported successfully.";
+ }
+ }
+
+ // We do not attempt to unset the stack guarantee, because
+ // Windows does not support lowering the stack size guarantee.
+ FatalConditionHandler::~FatalConditionHandler() = default;
+
+
+ void FatalConditionHandler::engage_platform() {
+ // Register as a the top level exception filter.
+ previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter);
+ }
+
+ void FatalConditionHandler::disengage_platform() noexcept {
+ if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) {
+ Catch::cerr()
+ << "Unexpected SEH unhandled exception filter on disengage."
+ << " The filter was restored, but might be rolled back unexpectedly.";
+ }
+ previousTopLevelExceptionFilter = nullptr;
+ }
+
+} // end namespace Catch
+
+#endif // CATCH_CONFIG_WINDOWS_SEH
+
+#if defined( CATCH_CONFIG_POSIX_SIGNALS )
+
+#include
+
+namespace Catch {
+
+ struct SignalDefs {
+ int id;
+ const char* name;
+ };
+
+ static SignalDefs signalDefs[] = {
+ { SIGINT, "SIGINT - Terminal interrupt signal" },
+ { SIGILL, "SIGILL - Illegal instruction signal" },
+ { SIGFPE, "SIGFPE - Floating point error signal" },
+ { SIGSEGV, "SIGSEGV - Segmentation violation signal" },
+ { SIGTERM, "SIGTERM - Termination request signal" },
+ { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" }
+ };
+
+// Older GCCs trigger -Wmissing-field-initializers for T foo = {}
+// which is zero initialization, but not explicit. We want to avoid
+// that.
+#if defined(__GNUC__)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
+#endif
+
+ static char* altStackMem = nullptr;
+ static std::size_t altStackSize = 0;
+ static stack_t oldSigStack{};
+ static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{};
+
+ static void restorePreviousSignalHandlers() noexcept {
+ // We set signal handlers back to the previous ones. Hopefully
+ // nobody overwrote them in the meantime, and doesn't expect
+ // their signal handlers to live past ours given that they
+ // installed them after ours..
+ for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {
+ sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);
+ }
+ // Return the old stack
+ sigaltstack(&oldSigStack, nullptr);
+ }
+
+ static void handleSignal( int sig ) {
+ char const * name = "";
+ for (auto const& def : signalDefs) {
+ if (sig == def.id) {
+ name = def.name;
+ break;
+ }
+ }
+ // We need to restore previous signal handlers and let them do
+ // their thing, so that the users can have the debugger break
+ // when a signal is raised, and so on.
+ restorePreviousSignalHandlers();
+ reportFatal( name );
+ raise( sig );
+ }
+
+ FatalConditionHandler::FatalConditionHandler() {
+ assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists");
+ if (altStackSize == 0) {
+ altStackSize = std::max(static_cast(SIGSTKSZ), minStackSizeForErrors);
+ }
+ altStackMem = new char[altStackSize]();
+ }
+
+ FatalConditionHandler::~FatalConditionHandler() {
+ delete[] altStackMem;
+ // We signal that another instance can be constructed by zeroing
+ // out the pointer.
+ altStackMem = nullptr;
+ }
+
+ void FatalConditionHandler::engage_platform() {
+ stack_t sigStack;
+ sigStack.ss_sp = altStackMem;
+ sigStack.ss_size = altStackSize;
+ sigStack.ss_flags = 0;
+ sigaltstack(&sigStack, &oldSigStack);
+ struct sigaction sa = { };
+
+ sa.sa_handler = handleSignal;
+ sa.sa_flags = SA_ONSTACK;
+ for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {
+ sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);
+ }
+ }
+
+#if defined(__GNUC__)
+# pragma GCC diagnostic pop
+#endif
+
+
+ void FatalConditionHandler::disengage_platform() noexcept {
+ restorePreviousSignalHandlers();
+ }
+
+} // end namespace Catch
+
+#endif // CATCH_CONFIG_POSIX_SIGNALS
+
+
+
+
+#include
+
+namespace Catch {
+ namespace Detail {
+
+ uint32_t convertToBits(float f) {
+ static_assert(sizeof(float) == sizeof(uint32_t), "Important ULP matcher assumption violated");
+ uint32_t i;
+ std::memcpy(&i, &f, sizeof(f));
+ return i;
+ }
+
+ uint64_t convertToBits(double d) {
+ static_assert(sizeof(double) == sizeof(uint64_t), "Important ULP matcher assumption violated");
+ uint64_t i;
+ std::memcpy(&i, &d, sizeof(d));
+ return i;
+ }
+
+ } // end namespace Detail
+} // end namespace Catch
+
+
+
+
+
+#include
+#include
+#include
+#include
+
+namespace Catch {
+
+ Catch::IStream::~IStream() = default;
+
+namespace Detail {
+ namespace {
+ template
+ class StreamBufImpl : public std::streambuf {
+ char data[bufferSize];
+ WriterF m_writer;
+
+ public:
+ StreamBufImpl() {
+ setp( data, data + sizeof(data) );
+ }
+
+ ~StreamBufImpl() noexcept override {
+ StreamBufImpl::sync();
+ }
+
+ private:
+ int overflow( int c ) override {
+ sync();
+
+ if( c != EOF ) {
+ if( pbase() == epptr() )
+ m_writer( std::string( 1, static_cast( c ) ) );
+ else
+ sputc( static_cast( c ) );
+ }
+ return 0;
+ }
+
+ int sync() override {
+ if( pbase() != pptr() ) {
+ m_writer( std::string( pbase(), static_cast( pptr() - pbase() ) ) );
+ setp( pbase(), epptr() );
+ }
+ return 0;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ struct OutputDebugWriter {
+
+ void operator()( std::string const& str ) {
+ if ( !str.empty() ) {
+ writeToDebugConsole( str );
+ }
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class FileStream : public IStream {
+ std::ofstream m_ofs;
+ public:
+ FileStream( std::string const& filename ) {
+ m_ofs.open( filename.c_str() );
+ CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << '\'' );
+ m_ofs << std::unitbuf;
+ }
+ ~FileStream() override = default;
+ public: // IStream
+ std::ostream& stream() override {
+ return m_ofs;
+ }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class CoutStream : public IStream {
+ std::ostream m_os;
+ public:
+ // Store the streambuf from cout up-front because
+ // cout may get redirected when running tests
+ CoutStream() : m_os( Catch::cout().rdbuf() ) {}
+ ~CoutStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() override { return m_os; }
+ bool isConsole() const override { return true; }
+ };
+
+ class CerrStream : public IStream {
+ std::ostream m_os;
+
+ public:
+ // Store the streambuf from cerr up-front because
+ // cout may get redirected when running tests
+ CerrStream(): m_os( Catch::cerr().rdbuf() ) {}
+ ~CerrStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() override { return m_os; }
+ bool isConsole() const override { return true; }
+ };
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ class DebugOutStream : public IStream {
+ Detail::unique_ptr> m_streamBuf;
+ std::ostream m_os;
+ public:
+ DebugOutStream()
+ : m_streamBuf( Detail::make_unique>() ),
+ m_os( m_streamBuf.get() )
+ {}
+
+ ~DebugOutStream() override = default;
+
+ public: // IStream
+ std::ostream& stream() override { return m_os; }
+ };
+
+ } // unnamed namespace
+} // namespace Detail
+
+ ///////////////////////////////////////////////////////////////////////////
+
+ auto makeStream( std::string const& filename ) -> Detail::unique_ptr {
+ if ( filename.empty() || filename == "-" ) {
+ return Detail::make_unique();
+ }
+ if( filename[0] == '%' ) {
+ if ( filename == "%debug" ) {
+ return Detail::make_unique();
+ } else if ( filename == "%stderr" ) {
+ return Detail::make_unique();
+ } else if ( filename == "%stdout" ) {
+ return Detail::make_unique();
+ } else {
+ CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' );
+ }
+ }
+ return Detail::make_unique( filename );
+ }
+
+}
+
+
+
+
+namespace Catch {
+
+ auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
+ if (lazyExpr.m_isNegated)
+ os << '!';
+
+ if (lazyExpr) {
+ if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
+ os << '(' << *lazyExpr.m_transientExpression << ')';
+ else
+ os << *lazyExpr.m_transientExpression;
+ } else {
+ os << "{** error - unchecked empty expression requested **}";
+ }
+ return os;
+ }
+
+} // namespace Catch
+
+
+
+
+#ifdef CATCH_CONFIG_WINDOWS_CRTDBG
+#include
+
+namespace Catch {
+
+ LeakDetector::LeakDetector() {
+ int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
+ flag |= _CRTDBG_LEAK_CHECK_DF;
+ flag |= _CRTDBG_ALLOC_MEM_DF;
+ _CrtSetDbgFlag(flag);
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ // Change this to leaking allocation's number to break there
+ _CrtSetBreakAlloc(-1);
+ }
+}
+
+#else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv
+
+ Catch::LeakDetector::LeakDetector() {}
+
+#endif // CATCH_CONFIG_WINDOWS_CRTDBG
+
+Catch::LeakDetector::~LeakDetector() {
+ Catch::cleanUp();
+}
+
+
+
+
+
+namespace Catch {
+ namespace {
+
+ void listTests(IEventListener& reporter, IConfig const& config) {
+ auto const& testSpec = config.testSpec();
+ auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
+ reporter.listTests(matchedTestCases);
+ }
+
+ void listTags(IEventListener& reporter, IConfig const& config) {
+ auto const& testSpec = config.testSpec();
+ std::vector matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
+
+ std::map tagCounts;
+ for (auto const& testCase : matchedTestCases) {
+ for (auto const& tagName : testCase.getTestCaseInfo().tags) {
+ auto it = tagCounts.find(tagName.original);
+ if (it == tagCounts.end())
+ it = tagCounts.insert(std::make_pair(tagName.original, TagInfo())).first;
+ it->second.add(tagName.original);
+ }
+ }
+
+ std::vector infos; infos.reserve(tagCounts.size());
+ for (auto& tagc : tagCounts) {
+ infos.push_back(CATCH_MOVE(tagc.second));
+ }
+
+ reporter.listTags(infos);
+ }
+
+ void listReporters(IEventListener& reporter) {
+ std::vector descriptions;
+
+ IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories();
+ descriptions.reserve(factories.size());
+ for (auto const& fac : factories) {
+ descriptions.push_back({ fac.first, fac.second->getDescription() });
+ }
+
+ reporter.listReporters(descriptions);
+ }
+
+ void listListeners(IEventListener& reporter) {
+ std::vector descriptions;
+
+ auto const& factories =
+ getRegistryHub().getReporterRegistry().getListeners();
+ descriptions.reserve( factories.size() );
+ for ( auto const& fac : factories ) {
+ descriptions.push_back( { fac->getName(), fac->getDescription() } );
+ }
+
+ reporter.listListeners( descriptions );
+ }
+
+ } // end anonymous namespace
+
+ void TagInfo::add( StringRef spelling ) {
+ ++count;
+ spellings.insert( spelling );
+ }
+
+ std::string TagInfo::all() const {
+ // 2 per tag for brackets '[' and ']'
+ size_t size = spellings.size() * 2;
+ for (auto const& spelling : spellings) {
+ size += spelling.size();
+ }
+
+ std::string out; out.reserve(size);
+ for (auto const& spelling : spellings) {
+ out += '[';
+ out += spelling;
+ out += ']';
+ }
+ return out;
+ }
+
+ bool list( IEventListener& reporter, Config const& config ) {
+ bool listed = false;
+ if (config.listTests()) {
+ listed = true;
+ listTests(reporter, config);
+ }
+ if (config.listTags()) {
+ listed = true;
+ listTags(reporter, config);
+ }
+ if (config.listReporters()) {
+ listed = true;
+ listReporters(reporter);
+ }
+ if ( config.listListeners() ) {
+ listed = true;
+ listListeners( reporter );
+ }
+ return listed;
+ }
+
+} // end namespace Catch
+
+
+
+namespace Catch {
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+ static LeakDetector leakDetector;
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
+}
+
+// Allow users of amalgamated .cpp file to remove our main and provide their own.
+#if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN)
+
+#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
+// Standard C/C++ main entry point
+int main (int argc, char * argv[]) {
+#endif
+
+ // We want to force the linker not to discard the global variable
+ // and its constructor, as it (optionally) registers leak detector
+ (void)&Catch::leakDetector;
+
+ return Catch::Session().run( argc, argv );
+}
+
+#endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN
+
+
+
+
+namespace Catch {
+
+ MessageInfo::MessageInfo( StringRef _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type )
+ : macroName( _macroName ),
+ lineInfo( _lineInfo ),
+ type( _type ),
+ sequence( ++globalCount )
+ {}
+
+ // This may need protecting if threading support is added
+ unsigned int MessageInfo::globalCount = 0;
+
+} // end namespace Catch
+
+
+
+#include
+#include
+#include
+
+#if defined(CATCH_CONFIG_NEW_CAPTURE)
+ #if defined(_MSC_VER)
+ #include