Skip to content

Commit 89edda2

Browse files
committed
Pushing some changes for basic doxygen file setup.
adding and changing the testing files. Updated the Catch2 to be on version 2.13.4 until version 3 is stable. Got a semi hacky test in for now. The instruction for CMake integration on Catch2 were failing. I am not sure why but spent a good chunk of time but couldn't figure it out. Testing is done by using the new test command to compile and run the tests.
1 parent 467ffa6 commit 89edda2

File tree

10 files changed

+60
-17619
lines changed

10 files changed

+60
-17619
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "third_party/Catch2"]
2+
path = third_party/Catch2
3+
url = https://github.com/catchorg/Catch2.git

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.10)
22

3-
project(DBC_Tests)
3+
project(DBC)
44

55
# specify the C++ standard
66
set(CMAKE_CXX_STANDARD 11)
@@ -14,4 +14,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COVERAGE_COMPILE_FLAGS}")
1414
include_directories(src)
1515
include_directories(test)
1616
add_subdirectory(test)
17+
add_subdirectory(doc)
1718

doc/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# add a target to generate API documentation with Doxygen
2+
find_package(Doxygen)
3+
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" ${DOXYGEN_FOUND})
4+
5+
if(BUILD_DOCUMENTATION)
6+
if(NOT DOXYGEN_FOUND)
7+
message(FATAL_ERROR "Doxygen is needed to build the documentation.")
8+
endif()
9+
10+
set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
11+
set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
12+
13+
configure_file(${doxyfile_in} ${doxyfile} @ONLY)
14+
15+
add_custom_target(doc
16+
COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
17+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
18+
COMMENT "Generating API documentation with Doxygen"
19+
VERBATIM)
20+
21+
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
22+
endif()

doc/Doxyfile.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
PROJECT_NAME = "@CMAKE_PROJECT_NAME@"
2+
PROJECT_NUMBER = @VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@
3+
STRIP_FROM_PATH = @PROJECT_SOURCE_DIR@ \
4+
@PROJECT_BINARY_DIR@
5+
INPUT = @doxy_main_page@ \
6+
@PROJECT_SOURCE_DIR@ \
7+
@PROJECT_BINARY_DIR@
8+
FILE_PATTERNS = *.h \
9+
*.cc
10+
RECURSIVE = YES
11+
USE_MDFILE_AS_MAINPAGE = @doxy_main_page@

src/dbc.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,11 @@ std::istream & getline( std::istream & stream, std::string & line ) {
3434

3535
}
3636

37+
38+
namespace dbc {
39+
40+
class parser {
41+
42+
};
43+
44+
}

test/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
add_executable(dbc_test main.cpp file_loading.cpp)
1+
project(tests VERSION 0.1.0)
2+
3+
include_directories(SYSTEM ${PROJECT_SOURCE_DIR}/third_party/Catch2/single_include)
4+
5+
add_executable(tests main.cpp file_loading.cpp)
6+
7+
add_custom_target(test
8+
COMMAND ${PROJECT_NAME}
9+
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
10+
DEPENDS ${PROJECT_NAME})

0 commit comments

Comments
 (0)