Skip to content

Commit 411cbc0

Browse files
committed
refactor: merge format component into main component
1 parent cca0fce commit 411cbc0

File tree

10 files changed

+14
-48
lines changed

10 files changed

+14
-48
lines changed

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,26 @@ target_sources(
4747
errors PUBLIC
4848
FILE_SET HEADERS
4949
BASE_DIRS include
50-
FILES include/errors/error.hpp
50+
FILES
51+
include/errors/error.hpp
52+
include/errors/format.hpp
5153
)
5254

5355
if(NOT SUBPROJECT AND BUILD_TESTING)
5456
# Import Catch2 as the main testing framework
5557
cpmaddpackage(gh:catchorg/[email protected])
5658
include(${Catch2_SOURCE_DIR}/extras/Catch.cmake)
5759

60+
cpmaddpackage("gh:fmtlib/fmt#10.2.1")
61+
5862
# Append the main library properties instead of linking the library.
5963
get_target_property(errors_SOURCES errors SOURCES)
6064
get_target_property(errors_HEADER_DIRS errors HEADER_DIRS)
6165

6266
# Build tests for the main library
63-
add_executable(errors_test test/error_test.cpp ${errors_SOURCES})
67+
add_executable(errors_test test/error_test.cpp test/format_test.cpp ${errors_SOURCES})
6468
target_include_directories(errors_test PRIVATE ${errors_HEADER_DIRS})
65-
target_link_libraries(errors_test PRIVATE Catch2::Catch2WithMain)
69+
target_link_libraries(errors_test PRIVATE Catch2::Catch2WithMain fmt)
6670

6771
# Enable support to check for test coverage
6872
include(CheckCoverage)
@@ -76,8 +80,6 @@ if(NOT SUBPROJECT AND BUILD_DOCS)
7680
target_generate_xml_docs(errors)
7781
endif()
7882

79-
add_subdirectory(components)
80-
8183
if(NOT SUBPROJECT AND BUILD_DOCS)
8284
add_subdirectory(docs)
8385
endif()
@@ -87,7 +89,7 @@ if(NOT SUBPROJECT AND BUILD_EXAMPLES)
8789
endif()
8890

8991
install(
90-
TARGETS errors errors_format
92+
TARGETS errors
9193
EXPORT errors_targets
9294
LIBRARY DESTINATION lib
9395
RUNTIME DESTINATION bin

components/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

components/format/CMakeLists.txt

Lines changed: 0 additions & 31 deletions
This file was deleted.

docs/CMakeLists.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ if(NOT RES EQUAL 0 )
1212
endif()
1313

1414
get_target_property(errors_docs_BINARY_DIR errors_docs BINARY_DIR)
15-
get_target_property(errors_format_docs_BINARY_DIR errors_format_docs BINARY_DIR)
1615

1716
add_custom_command(
1817
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
@@ -21,8 +20,7 @@ add_custom_command(
2120
${CMAKE_CURRENT_SOURCE_DIR}/conf.py
2221
${CMAKE_CURRENT_SOURCE_DIR}/index.rst
2322
${errors_docs_BINARY_DIR}/errors_docs.stamp
24-
${errors_format_docs_BINARY_DIR}/errors_format_docs.stamp
2523
)
2624

2725
add_custom_target(docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html)
28-
add_dependencies(docs errors_docs errors_format_docs)
26+
add_dependencies(docs errors_docs)

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
extensions = ['breathe']
1010

1111
subprocess.call('cmake .. -B ../build -D BUILD_DOCS=ON', shell=True)
12-
subprocess.call('cmake --build ../build --target errors_docs --target errors_format_docs', shell=True)
12+
subprocess.call('cmake --build ../build --target errors_docs', shell=True)
1313

1414
breathe_projects = {
1515
"errors": "../build/errors_docs",
16-
"errors_format": "../build/components/format/errors_format_docs"
1716
}
1817

1918
html_theme = 'furo'

docs/index.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,8 @@ API Docs
114114
.. doxygenfunction:: errors::nil
115115
:project: errors
116116

117-
Format Component
118-
^^^^^^^^^^^^^^^^
119-
120117
.. doxygenfunction:: errors::format
121-
:project: errors_format
118+
:project: errors
122119

123120
License
124121
-------

examples/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
cpmaddpackage("gh:fmtlib/fmt#10.2.1")
2+
13
add_custom_target(examples)
24

35
add_executable(example_print_hex print_hex.cpp)
46
target_link_libraries(example_print_hex PRIVATE errors)
57
add_dependencies(examples example_print_hex)
68

79
add_executable(example_read_file read_file.cpp)
8-
target_link_libraries(example_read_file PRIVATE errors errors_format)
10+
target_link_libraries(example_read_file PRIVATE errors fmt)
911
add_dependencies(examples example_read_file)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)