Skip to content

Commit 5b26435

Browse files
committed
Format code
1 parent 5dc3591 commit 5b26435

20 files changed

Lines changed: 227 additions & 132 deletions

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text=auto
1+
* text=auto eol=lf

CMakeLists.txt

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,29 @@ if(PROJECT_IS_TOP_LEVEL)
2424
)
2525
endif()
2626

27-
target_sources(msft_proxy4
27+
target_sources(
28+
msft_proxy4
2829
INTERFACE
2930
FILE_SET public_headers
30-
TYPE HEADERS
31-
BASE_DIRS include
32-
FILES
33-
include/proxy/proxy.h
34-
include/proxy/proxy_macros.h
35-
include/proxy/proxy_fmt.h
36-
include/proxy/v4/proxy.ixx
37-
include/proxy/v4/proxy.h
38-
include/proxy/v4/proxy_macros.h
39-
include/proxy/v4/proxy_fmt.h
31+
TYPE HEADERS
32+
BASE_DIRS include
33+
FILES
34+
include/proxy/proxy.h
35+
include/proxy/proxy_macros.h
36+
include/proxy/proxy_fmt.h
37+
include/proxy/v4/proxy.ixx
38+
include/proxy/v4/proxy.h
39+
include/proxy/v4/proxy_macros.h
40+
include/proxy/v4/proxy_fmt.h
4041
)
4142

4243
target_compile_features(msft_proxy4 INTERFACE cxx_std_20)
43-
target_include_directories(msft_proxy4 INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
44-
$<INSTALL_INTERFACE:include>)
44+
target_include_directories(
45+
msft_proxy4
46+
INTERFACE
47+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
48+
$<INSTALL_INTERFACE:include>
49+
)
4550

4651
# Do not set the module target if proxy is consumed as a subdirectory.
4752
if(PROJECT_IS_TOP_LEVEL)
@@ -58,9 +63,10 @@ endif()
5863

5964
include(GNUInstallDirs)
6065

61-
install(TARGETS msft_proxy4
62-
EXPORT msft_proxy4Targets
63-
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
66+
install(
67+
TARGETS msft_proxy4
68+
EXPORT msft_proxy4Targets
69+
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
6470
)
6571

6672
install(
@@ -83,19 +89,21 @@ configure_package_config_file(
8389
)
8490

8591
include(CMakePackageConfigHelpers)
86-
write_basic_package_version_file(cmake/msft_proxy4ConfigVersion.cmake
87-
COMPATIBILITY SameMajorVersion
88-
ARCH_INDEPENDENT)
92+
write_basic_package_version_file(
93+
cmake/msft_proxy4ConfigVersion.cmake
94+
COMPATIBILITY SameMajorVersion
95+
ARCH_INDEPENDENT
96+
)
8997

9098
install(
91-
FILES
99+
FILES
92100
${CMAKE_CURRENT_BINARY_DIR}/cmake/msft_proxy4Config.cmake
93101
${CMAKE_CURRENT_BINARY_DIR}/cmake/msft_proxy4ConfigVersion.cmake
94102
DESTINATION ${CMAKE_INSTALL_DATADIR}/msft_proxy4
95103
)
96104

97105
# build tests if BUILD_TESTING is ON
98-
if (BUILD_TESTING)
106+
if(BUILD_TESTING)
99107
include(CTest)
100108

101109
include(FetchContent)
@@ -108,7 +116,8 @@ if (BUILD_TESTING)
108116
FetchContent_Declare(
109117
fmt
110118
URL https://github.com/fmtlib/fmt/archive/refs/tags/12.1.0.tar.gz
111-
URL_HASH SHA256=ea7de4299689e12b6dddd392f9896f08fb0777ac7168897a244a6d6085043fea
119+
URL_HASH
120+
SHA256=ea7de4299689e12b6dddd392f9896f08fb0777ac7168897a244a6d6085043fea
112121
SYSTEM
113122
)
114123
FetchContent_MakeAvailable(fmt)
@@ -117,7 +126,13 @@ if (BUILD_TESTING)
117126
set(PROXY_BUILD_FLAGS /utf-8 /W4)
118127
set(PROXY_STRICT_WARNING_FLAGS ${PROXY_BUILD_FLAGS} /WX)
119128
else()
120-
set(PROXY_BUILD_FLAGS -Wall -Wextra -Wpedantic $<$<CXX_COMPILER_ID:Clang>:-Wno-c++2b-extensions>)
129+
set(
130+
PROXY_BUILD_FLAGS
131+
-Wall
132+
-Wextra
133+
-Wpedantic
134+
$<$<CXX_COMPILER_ID:Clang>:-Wno-c++2b-extensions>
135+
)
121136
set(PROXY_STRICT_WARNING_FLAGS ${PROXY_BUILD_FLAGS} -Werror)
122137
endif()
123138

MODULE.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ module(
66
bazel_dep(name = "platforms", version = "1.1.0")
77
bazel_dep(name = "rules_cc", version = "0.2.18")
88
bazel_dep(name = "bazel_skylib", version = "1.8.2")
9+
910
bazel_dep(name = "googletest", version = "1.17.0.bcr.2", dev_dependency = True)
1011
bazel_dep(name = "google_benchmark", version = "1.9.5", dev_dependency = True)
1112
bazel_dep(name = "fmt", version = "12.1.0", dev_dependency = True)
1213
bazel_dep(name = "rules_python", version = "2.0.2", dev_dependency = True)
1314

1415
python = use_extension("@rules_python//python/extensions:python.bzl", "python", dev_dependency = True)
15-
python.toolchain(python_version = "3.12", is_default = True)
16+
python.toolchain(
17+
is_default = True,
18+
python_version = "3.12",
19+
)
1620
use_repo(python, bootstrap_python = "python_3_12_host")
1721

1822
use_repo_rule("//tools:doc_examples.bzl", "doc_examples")(name = "doc_examples")

SUPPORT.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Support
2-
3-
## How to file issues and get help
4-
5-
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
6-
issues before filing new ones to avoid duplicates. For new issues, file your bug or feature request
7-
as a new issue.
8-
9-
For help and questions about using this project, please use GitHub Discussions:
10-
11-
- https://github.com/ngcpp/proxy/discussions
12-
13-
## Support Policy
14-
15-
Support for this project is provided on a best-effort basis by the community and maintainers via
16-
the resources listed above.
1+
# Support
2+
3+
## How to file issues and get help
4+
5+
This project uses GitHub Issues to track bugs and feature requests. Please search the existing
6+
issues before filing new ones to avoid duplicates. For new issues, file your bug or feature request
7+
as a new issue.
8+
9+
For help and questions about using this project, please use GitHub Discussions:
10+
11+
- https://github.com/ngcpp/proxy/discussions
12+
13+
## Support Policy
14+
15+
Support for this project is provided on a best-effort basis by the community and maintainers via
16+
the resources listed above.

benchmarks/CMakeLists.txt

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,35 @@ project(msft_proxy_benchmarks)
33
FetchContent_Declare(
44
benchmark
55
URL https://github.com/google/benchmark/archive/refs/tags/v1.9.5.tar.gz
6-
URL_HASH SHA256=9631341c82bac4a288bef951f8b26b41f69021794184ece969f8473977eaa340
6+
URL_HASH
7+
SHA256=9631341c82bac4a288bef951f8b26b41f69021794184ece969f8473977eaa340
8+
)
9+
set(
10+
BENCHMARK_ENABLE_TESTING
11+
OFF
12+
CACHE BOOL
13+
"Disable tests for google benchmark"
14+
)
15+
set(
16+
BENCHMARK_ENABLE_GTEST_TESTS
17+
OFF
18+
CACHE BOOL
19+
"Disable google benchmark unit tests"
720
)
8-
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable tests for google benchmark")
9-
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable google benchmark unit tests")
1021
FetchContent_MakeAvailable(benchmark)
1122

12-
add_executable(msft_proxy_benchmarks
23+
add_executable(
24+
msft_proxy_benchmarks
1325
proxy_creation_benchmark.cpp
1426
proxy_operation_benchmark_context.cpp
1527
proxy_operation_benchmark.cpp
1628
)
1729
target_include_directories(msft_proxy_benchmarks PRIVATE .)
18-
target_link_libraries(msft_proxy_benchmarks PRIVATE msft_proxy4::proxy benchmark::benchmark benchmark::benchmark_main)
19-
target_compile_options(msft_proxy_benchmarks PRIVATE ${PROXY_BUILD_FLAGS} $<$<BOOL:${MSVC}>:/bigobj>)
30+
target_link_libraries(
31+
msft_proxy_benchmarks
32+
PRIVATE msft_proxy4::proxy benchmark::benchmark benchmark::benchmark_main
33+
)
34+
target_compile_options(
35+
msft_proxy_benchmarks
36+
PRIVATE ${PROXY_BUILD_FLAGS} $<$<BOOL:${MSVC}>:/bigobj>
37+
)
Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,34 @@
11
if(NOT DEFINED msft_proxy4_INCLUDE_DIR)
2-
message(FATAL_ERROR "`msft_proxy4_INCLUDE_DIR` must be defined to use this script.")
2+
message(
3+
FATAL_ERROR
4+
"`msft_proxy4_INCLUDE_DIR` must be defined to use this script."
5+
)
36
endif()
47

5-
message(STATUS "Declaring `msft_proxy4::proxy_module` target for include path `${msft_proxy4_INCLUDE_DIR}`")
8+
message(
9+
STATUS
10+
"Declaring `msft_proxy4::proxy_module` target for include path `${msft_proxy4_INCLUDE_DIR}`"
11+
)
612

713
add_library(msft_proxy4_module)
814
set_target_properties(
915
msft_proxy4_module
10-
PROPERTIES
11-
SYSTEM TRUE
12-
EXCLUDE_FROM_ALL TRUE
16+
PROPERTIES SYSTEM TRUE EXCLUDE_FROM_ALL TRUE
1317
)
1418

1519
add_library(msft_proxy4::proxy_module ALIAS msft_proxy4_module)
16-
target_sources(msft_proxy4_module PUBLIC
17-
FILE_SET CXX_MODULES
18-
BASE_DIRS ${msft_proxy4_INCLUDE_DIR}
19-
FILES
20-
${msft_proxy4_INCLUDE_DIR}/proxy/v4/proxy.ixx
20+
target_sources(
21+
msft_proxy4_module
22+
PUBLIC
23+
FILE_SET CXX_MODULES
24+
BASE_DIRS ${msft_proxy4_INCLUDE_DIR}
25+
FILES ${msft_proxy4_INCLUDE_DIR}/proxy/v4/proxy.ixx
2126
)
2227
target_compile_features(msft_proxy4_module PUBLIC cxx_std_20)
23-
target_compile_options(msft_proxy4_module PRIVATE
24-
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
25-
$<$<CXX_COMPILER_ID:Clang>:-Wno-c++2b-extensions>
28+
target_compile_options(
29+
msft_proxy4_module
30+
PRIVATE
31+
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
32+
$<$<CXX_COMPILER_ID:Clang>:-Wno-c++2b-extensions>
2633
)
2734
target_link_libraries(msft_proxy4_module PUBLIC msft_proxy4::proxy)

docs/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
load("@doc_examples//:doc_examples.bzl", "DOC_EXAMPLES")
12
load("@rules_cc//cc:defs.bzl", "cc_test")
23
load("//:copts.bzl", "PROXY_BUILD_COPTS")
3-
load("@doc_examples//:doc_examples.bzl", "DOC_EXAMPLES")
44

55
package(default_visibility = ["//visibility:private"])
66

docs/CMakeLists.txt

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,51 +9,59 @@ file(MAKE_DIRECTORY "${EXAMPLES_DIR}")
99

1010
# Re-run configure when any doc Markdown file or the generator script changes.
1111
file(GLOB_RECURSE _MD_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*.md")
12-
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${_MD_FILES} "${_GEN_SCRIPT}")
12+
set_property(
13+
DIRECTORY
14+
APPEND
15+
PROPERTY CMAKE_CONFIGURE_DEPENDS ${_MD_FILES} "${_GEN_SCRIPT}"
16+
)
1317

1418
# Generate the example list at configure time and capture JSON to a variable.
1519
execute_process(
16-
COMMAND ${Python3_EXECUTABLE} "${_GEN_SCRIPT}" --format json
17-
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
18-
OUTPUT_VARIABLE _doc_examples_json
19-
ERROR_VARIABLE _gen_error
20-
RESULT_VARIABLE _gen_result
20+
COMMAND ${Python3_EXECUTABLE} "${_GEN_SCRIPT}" --format json
21+
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
22+
OUTPUT_VARIABLE _doc_examples_json
23+
ERROR_VARIABLE _gen_error
24+
RESULT_VARIABLE _gen_result
2125
)
2226
if(_gen_result)
23-
message(FATAL_ERROR "gen_doc_examples.py failed:\n${_gen_error}")
27+
message(FATAL_ERROR "gen_doc_examples.py failed:\n${_gen_error}")
2428
endif()
2529

2630
# Parse JSON array: [{md: <path>, deps: [<cmake-target>, ...]}, ...]
2731
string(JSON _len LENGTH "${_doc_examples_json}")
2832
math(EXPR _last "${_len} - 1")
2933
foreach(i RANGE 0 ${_last})
30-
string(JSON _md GET "${_doc_examples_json}" ${i} "md")
31-
string(JSON _n_deps LENGTH "${_doc_examples_json}" ${i} "deps")
32-
33-
set(_dep_names "")
34-
if(_n_deps GREATER 0)
35-
math(EXPR _d_last "${_n_deps} - 1")
36-
foreach(j RANGE 0 ${_d_last})
37-
string(JSON _dep GET "${_doc_examples_json}" ${i} "deps" ${j})
38-
list(APPEND _dep_names "${_dep}")
39-
endforeach()
40-
endif()
41-
42-
string(REPLACE "/" "_" _suffix "${_md}")
43-
string(REPLACE ".md" "" _suffix "${_suffix}")
44-
set(_cpp "${EXAMPLES_DIR}/${_suffix}.cpp")
45-
46-
add_custom_command(
47-
OUTPUT "${_cpp}"
48-
COMMAND ${Python3_EXECUTABLE} "${_EXTRACT_SCRIPT}"
49-
"${CMAKE_CURRENT_SOURCE_DIR}/${_md}" "${_cpp}"
50-
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_md}" "${_EXTRACT_SCRIPT}"
51-
VERBATIM
52-
)
53-
set_source_files_properties("${_cpp}" PROPERTIES GENERATED TRUE)
54-
55-
add_executable(example_${_suffix} "${_cpp}")
56-
target_link_libraries(example_${_suffix} PRIVATE msft_proxy4::proxy ${_dep_names})
57-
target_compile_options(example_${_suffix} PRIVATE ${PROXY_BUILD_FLAGS})
58-
add_test(NAME example_${_suffix} COMMAND example_${_suffix})
34+
string(JSON _md GET "${_doc_examples_json}" ${i} "md")
35+
string(JSON _n_deps LENGTH "${_doc_examples_json}" ${i} "deps")
36+
37+
set(_dep_names "")
38+
if(_n_deps GREATER 0)
39+
math(EXPR _d_last "${_n_deps} - 1")
40+
foreach(j RANGE 0 ${_d_last})
41+
string(JSON _dep GET "${_doc_examples_json}" ${i} "deps" ${j})
42+
list(APPEND _dep_names "${_dep}")
43+
endforeach()
44+
endif()
45+
46+
string(REPLACE "/" "_" _suffix "${_md}")
47+
string(REPLACE ".md" "" _suffix "${_suffix}")
48+
set(_cpp "${EXAMPLES_DIR}/${_suffix}.cpp")
49+
50+
add_custom_command(
51+
OUTPUT "${_cpp}"
52+
COMMAND
53+
${Python3_EXECUTABLE} "${_EXTRACT_SCRIPT}"
54+
"${CMAKE_CURRENT_SOURCE_DIR}/${_md}" "${_cpp}"
55+
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${_md}" "${_EXTRACT_SCRIPT}"
56+
VERBATIM
57+
)
58+
set_source_files_properties("${_cpp}" PROPERTIES GENERATED TRUE)
59+
60+
add_executable(example_${_suffix} "${_cpp}")
61+
target_link_libraries(
62+
example_${_suffix}
63+
PRIVATE msft_proxy4::proxy ${_dep_names}
64+
)
65+
target_compile_options(example_${_suffix} PRIVATE ${PROXY_BUILD_FLAGS})
66+
add_test(NAME example_${_suffix} COMMAND example_${_suffix})
5967
endforeach()

docs/meson.build

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ extract_example = find_program('../tools/extract_example_code.py')
22
gen_doc_examples = find_program('../tools/gen_doc_examples.py')
33

44
# Generate the example list at configure time (txt format: "<md>" or "<md>:<var1>,...").
5-
_gen = run_command(gen_doc_examples, '--format', 'txt', check: true)
5+
_gen = run_command(
6+
gen_doc_examples,
7+
'--format',
8+
'txt',
9+
check: true,
10+
)
611

712
examples = []
813

@@ -30,7 +35,11 @@ foreach line : _gen.stdout().split('\n')
3035
build_by_default: false,
3136
)
3237
examples += _ex
33-
test(suffix, _ex, suite: 'ProxyExamples')
38+
test(
39+
suffix,
40+
_ex,
41+
suite: 'ProxyExamples',
42+
)
3443
endif
3544
endforeach
3645

docs/modules_support.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ int main() {
9191
```
9292

9393
- (1) This is a traditional header rather than a module. It should be declared in global fragment (after `module` and before `export module`).
94-
- (2) This makes all `PRO_DEF_` macros available. This header file contains only some macros and are therefore very fast to compile.
94+
- (2) This makes all `PRO_DEF_` macros available. This header file contains only some macros and are therefore very fast to compile.
9595
- (3) `import proxy.v4;` makes all public interfaces from `pro::v4` namespace available in the current translation unit.
9696
- (4) As of 2025-05-11, clangd requires the accessor struct to be either `export`-ed, or be declared within an `extern "C++"` block, in order to have auto completion working.
97-

0 commit comments

Comments
 (0)