Skip to content

Commit 8ac85f6

Browse files
SidneyCogdillSidneyCogdill
andauthored
Separate macro definitions and add cppm files (#293)
* Separate macro definitions and add cppm files * Remove modules from msft_proxy target... and provide workarounds in the docs. * fix typo * Update to address problems mentioned in review... 1. Removed details directory 2. Use 2 space indention 3. `.ixx` suffix for module 4. Merged `proxy_interface` into `proxy` * Add some docs for the CMake script... and change some "proxy.h" to <proxy/proxy.h> * change `.cppm` to `.ixx` in doc * (Try to) Use Ninja Generator instead. * Propagate `proxy_INCLUDE_DIR` to parent project .. ... if it's consumed as subdirectory. * Update the doc test generator ... The doc test is now capable of handling multiple sources in a doc, with template support for CMake target definition. The C++ module example is also updated to take advantage of the new doc test generator. GitHub Actions is tweaked: - The compatibility CI now has reversed order, sorting from latest to oldest. - Known-incompatible compilers now have module disabled. * Add back the compiler warning flags for doc tests * Avoid creating empty dircetory ... ... by deferring creating directory after checking if code_blocks is empty. * Add "auto-generated" note for generated CMakeLists.txt * Add common snippet to template system for future proof * Make PROXY_BUILDING_WITH_MODULE actually useful... I forgot to actually use it to decide if module target should be declared. How careless. * Make PROXY_BUILDING_WITH_MODULE really really useful ... This time I locally tested it rather than assuming it will work. And it compiles with -D=PROXY_BUILDING_WITH_MODULE=FALSE. * Fix typo (issue #295) * Disable module for older version of compilers * Switch back to Unix Makefiles for older compilers ... They don't have proper modules support anyway. Maybe switching to Ninja Generator actually caused the CI to fail, as it tries to enable incomplete module support in older compilers. * Re-add "auto-generated" note for generated CMakeLists.txt ... Don't know why it's removed by me. Perhaps I accidentally reverted it? * resolve problems mentioned in code review ... 1. Reverted `extract_example_code_from_docs.py`. 2. Added "Module definition:" and "Client:" to cpp20_modules_support.md, to exclude it from the doc test generator. 3. Minor formatting issues (trailing EOL, empty lines ...) are fixed. * Removed line paddings in proxy.ixx * revert docs/CMakeLists.txt * Merge module test target with main test target * trailing EOL characters * remove `target_compile_features` from `tests/CMakeLists.txt` * remove trailing space * remove `docs/cpp20_modules_support.cmake.in` * Take CPM into consideration for C++ modules doc --------- Co-authored-by: SidneyCogdill <no@localhost>
1 parent a3d65a0 commit 8ac85f6

File tree

83 files changed

+616
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+616
-284
lines changed

.github/workflows/bvt-appleclang.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
2121
- name: build and run test with AppleClang
2222
run: |
23-
cmake -B build -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release
23+
cmake -B build -GNinja -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
2424
cmake --build build -j
2525
ctest --test-dir build -j
2626
mkdir build/drop

.github/workflows/bvt-clang.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
2727
- name: build and run test with clang 20
2828
run: |
29-
cmake -B build -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release
29+
cmake -B build -GNinja -DCMAKE_C_COMPILER=clang-20 -DCMAKE_CXX_COMPILER=clang++-20 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=TRUE
3030
cmake --build build -j
3131
ctest --test-dir build -j
3232
mkdir build/drop

.github/workflows/bvt-compatibility.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,39 +26,39 @@ jobs:
2626
clang++-18 --version
2727
clang++-19 --version
2828
29-
- name: build and run test with gcc 13
30-
run: |
31-
cmake -B build-gcc-13 -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Release
32-
cmake --build build-gcc-13 -j
33-
ctest --test-dir build-gcc-13 -j
34-
3529
- name: build and run test with gcc 14
3630
run: |
37-
cmake -B build-gcc-14 -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_BUILD_TYPE=Release
31+
cmake -B build-gcc-14 -GNinja -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=TRUE
3832
cmake --build build-gcc-14 -j
3933
ctest --test-dir build-gcc-14 -j
4034
41-
# Note that libc++ in Clang 19 is not compatible with Clang 16. Therefore, we fallback to libstdc++.
42-
- name: build and run test with clang 16
35+
- name: build and run test with gcc 13
4336
run: |
44-
cmake -B build-clang-16 -DCMAKE_C_COMPILER=clang-16 -DCMAKE_CXX_COMPILER=clang++-16 -DCMAKE_BUILD_TYPE=Release
45-
cmake --build build-clang-16 -j
46-
ctest --test-dir build-clang-16 -j
37+
cmake -B build-gcc-13 -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
38+
cmake --build build-gcc-13 -j
39+
ctest --test-dir build-gcc-13 -j
4740
48-
- name: build and run test with clang 17
41+
- name: build and run test with clang 19
4942
run: |
50-
cmake -B build-clang-17 -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release
51-
cmake --build build-clang-17 -j
52-
ctest --test-dir build-clang-17 -j
43+
cmake -B build-clang-19 -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
44+
cmake --build build-clang-19 -j
45+
ctest --test-dir build-clang-19 -j
5346
5447
- name: build and run test with clang 18
5548
run: |
56-
cmake -B build-clang-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release
49+
cmake -B build-clang-18 -DCMAKE_C_COMPILER=clang-18 -DCMAKE_CXX_COMPILER=clang++-18 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
5750
cmake --build build-clang-18 -j
5851
ctest --test-dir build-clang-18 -j
5952
60-
- name: build and run test with clang 19
53+
- name: build and run test with clang 17
6154
run: |
62-
cmake -B build-clang-19 -DCMAKE_C_COMPILER=clang-19 -DCMAKE_CXX_COMPILER=clang++-19 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release
63-
cmake --build build-clang-19 -j
64-
ctest --test-dir build-clang-19 -j
55+
cmake -B build-clang-17 -DCMAKE_C_COMPILER=clang-17 -DCMAKE_CXX_COMPILER=clang++-17 -DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
56+
cmake --build build-clang-17 -j
57+
ctest --test-dir build-clang-17 -j
58+
59+
# Note that libc++ in Clang 19 is not compatible with Clang 16. Therefore, we fallback to libstdc++.
60+
- name: build and run test with clang 16
61+
run: |
62+
cmake -B build-clang-16 -DCMAKE_C_COMPILER=clang-16 -DCMAKE_CXX_COMPILER=clang++-16 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
63+
cmake --build build-clang-16 -j
64+
ctest --test-dir build-clang-16 -j

.github/workflows/bvt-gcc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
2424
- name: build and run test with gcc 14
2525
run: |
26-
cmake -B build -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release
26+
cmake -B build -GNinja -DCMAKE_C_COMPILER=gcc-14 -DCMAKE_CXX_COMPILER=g++-14 -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=TRUE
2727
cmake --build build -j
2828
ctest --test-dir build -j
2929
mkdir build/drop

.github/workflows/bvt-msvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
- name: build and run test with MSVC
2020
run: |
21-
cmake -B build -DCMAKE_CXX_STANDARD=23
21+
cmake -B build -DCMAKE_CXX_STANDARD=23 -DPROXY_BUILD_MODULES=TRUE
2222
cmake --build build --config Release -j
2323
ctest --test-dir build -j
2424
mkdir build\drop > $null

.github/workflows/bvt-nvhpc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: build and run test with NVHPC 24.9
2424
run: |
2525
PATH=/opt/nvidia/hpc_sdk/Linux_x86_64/24.9/compilers/bin:$PATH; export PATH
26-
cmake -B build -DCMAKE_C_COMPILER=nvc -DCMAKE_CXX_COMPILER=nvc++ -DCMAKE_BUILD_TYPE=Release
26+
cmake -B build -GNinja -DCMAKE_C_COMPILER=nvc -DCMAKE_CXX_COMPILER=nvc++ -DCMAKE_BUILD_TYPE=Release -DPROXY_BUILD_MODULES=FALSE
2727
cmake --build build -j
2828
ctest --test-dir build -j
2929
mkdir build/drop

CMakeLists.txt

Lines changed: 68 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,86 @@
1-
cmake_minimum_required(VERSION 3.10)
1+
cmake_minimum_required(VERSION 3.28)
22

33
project(msft_proxy VERSION 3.3.0 LANGUAGES CXX)
44
add_library(msft_proxy INTERFACE)
5+
6+
# Do not enable building tests if proxy is consumed as
7+
# subdirectory (e.g. by CMake FetchContent_Declare).
8+
if(PROJECT_IS_TOP_LEVEL)
9+
option(BUILD_TESTING "Build tests" ON)
10+
else()
11+
option(BUILD_TESTING "Build tests" OFF)
12+
endif()
13+
14+
if(PROJECT_IS_TOP_LEVEL)
15+
option(
16+
PROXY_BUILD_MODULES
17+
"When this project is top level, build the docs and tests with C++ module support."
18+
OFF
19+
)
20+
endif()
21+
22+
target_sources(msft_proxy
23+
INTERFACE
24+
FILE_SET public_headers
25+
TYPE HEADERS
26+
BASE_DIRS include
27+
FILES
28+
include/proxy/proxy.h
29+
include/proxy/proxy_macros.h
30+
include/proxy/proxy_fmt.h
31+
include/proxy/proxy.ixx
32+
)
33+
534
target_compile_features(msft_proxy INTERFACE cxx_std_20)
6-
target_include_directories(msft_proxy INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
35+
target_include_directories(msft_proxy INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
736
$<INSTALL_INTERFACE:include>)
837

38+
# Do not set the module target if proxy is consumed as a subdirectory.
39+
if(PROJECT_IS_TOP_LEVEL)
40+
set(proxy_INCLUDE_DIR include)
41+
if(PROXY_BUILD_MODULES)
42+
include(cmake/proxyModuleTargets.cmake)
43+
endif()
44+
else()
45+
# Propagate the variable to the parent project
46+
set(proxy_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include PARENT_SCOPE)
47+
endif()
48+
949
# install and export the project. project name - proxy
50+
1051
include(GNUInstallDirs)
52+
1153
install(TARGETS msft_proxy
12-
EXPORT proxyConfig)
13-
install(FILES proxy.h proxy_fmt.h
14-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/proxy)
15-
install(EXPORT proxyConfig DESTINATION ${CMAKE_INSTALL_DATADIR}/proxy)
16-
export(TARGETS msft_proxy FILE proxyConfig.cmake)
54+
EXPORT proxyTargets
55+
FILE_SET public_headers DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
56+
)
57+
58+
install(EXPORT proxyTargets DESTINATION ${CMAKE_INSTALL_DATADIR}/proxy)
59+
export(TARGETS msft_proxy FILE proxyTargets.cmake)
60+
1761
include(CMakePackageConfigHelpers)
18-
write_basic_package_version_file(proxyConfigVersion.cmake
62+
configure_package_config_file(
63+
cmake/proxyConfig.cmake.in
64+
${CMAKE_CURRENT_BINARY_DIR}/cmake/proxyConfig.cmake
65+
INSTALL_DESTINATION ${CMAKE_INSTALL_DATADIR}/proxy
66+
PATH_VARS CMAKE_INSTALL_INCLUDEDIR
67+
)
68+
69+
include(CMakePackageConfigHelpers)
70+
write_basic_package_version_file(cmake/proxyConfigVersion.cmake
1971
COMPATIBILITY SameMajorVersion
2072
ARCH_INDEPENDENT)
21-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/proxyConfigVersion.cmake
22-
DESTINATION ${CMAKE_INSTALL_DATADIR}/proxy)
73+
74+
install(
75+
FILES
76+
${CMAKE_CURRENT_BINARY_DIR}/cmake/proxyConfig.cmake
77+
${CMAKE_CURRENT_BINARY_DIR}/cmake/proxyConfigVersion.cmake
78+
DESTINATION ${CMAKE_INSTALL_DATADIR}/proxy
79+
)
2380

2481
# build tests if BUILD_TESTING is ON
25-
include(CTest)
2682
if (BUILD_TESTING)
83+
include(CTest)
2784
add_subdirectory(tests)
2885
add_subdirectory(benchmarks)
2986
add_subdirectory(docs)

README.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,21 @@ Please refer to the [Proxy's Frequently Asked Questions](https://microsoft.githu
2727

2828
## Quick Start
2929

30-
"Proxy" is a header-only C++20 library. To use the library, make sure your compiler meets the [minimum requirements](#compiler-req) and just include the header file [proxy.h](https://github.com/microsoft/proxy/blob/main/proxy.h) in your source code. Alternatively, you can install the library via [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/overview) or [conan](https://conan.io/), by searching for "proxy" (see [vcpkg.io](https://vcpkg.io/en/package/proxy) and [conan.io](https://conan.io/center/recipes/proxy)).
30+
"Proxy" is a header-only C++20 library. To use the library, make sure your compiler meets the [minimum requirements](#compiler-req) and just put the [proxy](https://github.com/microsoft/proxy/tree/main/include/proxy) directory in your project's include directory. Alternatively, you can install the library via:
31+
32+
- [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/overview): [proxy port on vcpkg.io](https://vcpkg.io/en/package/proxy)
33+
- [conan](https://conan.io/): [proxy recipe on conan.io](https://conan.io/center/recipes/proxy)
34+
- [CPM](https://github.com/cpm-cmake/CPM.cmake) / CMake [FetchContent_Declare](https://cmake.org/cmake/help/latest/module/FetchContent.html):
35+
36+
```cmake
37+
CPMAddPackage(
38+
NAME proxy
39+
GIT_TAG 4.0.0 # or above
40+
GIT_REPOSITORY https://github.com/microsoft/proxy.git
41+
)
42+
43+
target_link_libraries(main PRIVATE msft_proxy)
44+
```
3145
3246
### Hello World
3347
@@ -38,7 +52,7 @@ Let's get started with the following "Hello World" example ([run](https://godbol
3852
#include <iostream>
3953
#include <string>
4054
41-
#include "proxy.h"
55+
#include <proxy/proxy.h>
4256
4357
struct Formattable : pro::facade_builder
4458
::support<pro::skills::format>
@@ -62,7 +76,7 @@ Here is a step-by-step explanation:
6276
- `#include <format>`: For [`std::format`](https://en.cppreference.com/w/cpp/utility/format/format).
6377
- `#include <iostream>`: For [`std::cout`](https://en.cppreference.com/w/cpp/io/cout).
6478
- `#include <string>`: For [`std::string`](https://en.cppreference.com/w/cpp/string/basic_string).
65-
- `#include "proxy.h"`: For the "Proxy" library. Most of the facilities of the library are defined in namespace `pro`. If the library is consumed via [vcpkg](https://learn.microsoft.com/en-us/vcpkg/get_started/overview) or [conan](https://conan.io/), this line should be changed into `#include <proxy/proxy.h>`.
79+
- `#include <proxy/proxy.h>`: For the "Proxy" library. Most of the facilities of the library are defined in namespace `pro`.
6680
- `struct Formattable : pro::facade_builder ... ::build {}`: Defines a facade type `Formattable`. The term "facade", formally defined as the [*ProFacade* requirements](https://microsoft.github.io/proxy/docs/ProFacade.html), is how the "Proxy" library models runtime abstraction. Specifically,
6781
- [`pro::facade_builder`](https://microsoft.github.io/proxy/docs/basic_facade_builder.html): Provides capability to build a facade type at compile-time.
6882
- [`support_format`](https://microsoft.github.io/proxy/docs/basic_facade_builder/support_format.html): Specifies the capability of formatting (via [standard formatting functions](https://en.cppreference.com/w/cpp/utility/format)).
@@ -78,6 +92,8 @@ Here is a step-by-step explanation:
7892
- `std::format("p3 = {:.2f}\n", *p3)`: Formats `*p3` as "3.14" as per the [standard format specification](https://en.cppreference.com/w/cpp/utility/format/spec) with no surprises.
7993
- When `main` returns, `p2` and `p3` will destroy the underlying objects, while `p1` does nothing because it holds a raw pointer that does not have ownership of the underlying `std::string`.
8094

95+
Note: If you prefer the library to be consumed as a (C++20) module, refer to [C++20 Modules support](https://microsoft.github.io/proxy/docs/cpp20_modules_support.html).
96+
8197
### Hello World (Stream Version)
8298

8399
In the previous "Hello Word" example, we demonstrated how `proxy` could manage different types of objects and be formatted with `std::format`. While `std::format` is not the only option to print objects in C++, can we simply make `proxy` work with `std::cout`? The answer is "yes". The previous example is equivalent to the following implementation ([run](https://godbolt.org/z/q1b14WGff)):
@@ -87,7 +103,7 @@ In the previous "Hello Word" example, we demonstrated how `proxy` could manage d
87103
#include <iostream>
88104
#include <string>
89105

90-
#include "proxy.h"
106+
#include <proxy/proxy.h>
91107

92108
struct Streamable : pro::facade_builder
93109
::add_convention<pro::operator_dispatch<"<<", true>, std::ostream&(std::ostream& out) const>
@@ -108,10 +124,10 @@ int main() {
108124
109125
Here is a step-by-step explanation:
110126
111-
- `#include <iostream>`: For [`std::setprecision`](https://en.cppreference.com/w/cpp/io/manip/setprecision).
127+
- `#include <iomanip>`: For [`std::setprecision`](https://en.cppreference.com/w/cpp/io/manip/setprecision).
112128
- `#include <iostream>`: For [`std::cout`](https://en.cppreference.com/w/cpp/io/cout).
113129
- `#include <string>`: For [`std::string`](https://en.cppreference.com/w/cpp/string/basic_string).
114-
- `#include "proxy.h"`: For the "Proxy" library.
130+
- `#include <proxy/proxy.h>`: For the "Proxy" library.
115131
- `struct Streamable : pro::facade_builder ... ::build {}`: Defines a facade type `Streamable`. Specifically,
116132
- [`pro::facade_builder`](https://microsoft.github.io/proxy/docs/basic_facade_builder.html): Gets prepared to build another facade.
117133
- [`add_convention`](https://microsoft.github.io/proxy/docs/basic_facade_builder/add_convention.html): Adds a generalized "calling convention", defined by a "dispatch" and several "overloads", to the build context.
@@ -142,7 +158,7 @@ Note that some facilities are provided as macro, because C++ templates today do
142158
#include <iostream>
143159
#include <sstream>
144160
145-
#include "proxy.h"
161+
#include <proxy/proxy.h>
146162
147163
PRO_DEF_MEM_DISPATCH(MemDraw, Draw);
148164
PRO_DEF_MEM_DISPATCH(MemArea, Area);
@@ -187,7 +203,7 @@ Here is a step-by-step explanation:
187203

188204
- `#include <iostream>`: For [`std::cout`](https://en.cppreference.com/w/cpp/io/cout).
189205
- `#include <sstream>`: For [`std::stringstream`](https://en.cppreference.com/w/cpp/io/basic_stringstream).
190-
- `#include "proxy.h"`: For the "Proxy" library.
206+
- `#include <proxy/proxy.h>`: For the "Proxy" library.
191207
- [`PRO_DEF_MEM_DISPATCH`](https://microsoft.github.io/proxy/docs/PRO_DEF_MEM_DISPATCH.html)`(MemDraw, Draw)`: Defines a dispatch type `MemDraw` for expressions of calling member function `Draw`.
192208
- [`PRO_DEF_MEM_DISPATCH`](https://microsoft.github.io/proxy/docs/PRO_DEF_MEM_DISPATCH.html)`(MemArea, Area)`: Defines a dispatch type `MemArea` for expressions of calling member function `Area`.
193209
- `struct Drawable : pro::facade_builder ... ::build {}`: Defines a facade type `Drawable`. Specifically,

benchmarks/proxy_invocation_benchmark_context.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <memory>
55
#include <vector>
66

7-
#include "proxy.h"
7+
#include <proxy/proxy.h>
88

99
PRO_DEF_MEM_DISPATCH(MemFun, Fun);
1010

benchmarks/proxy_management_benchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include <benchmark/benchmark.h>
1111

12-
#include "proxy.h"
12+
#include <proxy/proxy.h>
1313

1414
namespace {
1515

cmake/proxyConfig.cmake.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@PACKAGE_INIT@
2+
3+
include("${CMAKE_CURRENT_LIST_DIR}/proxyTargets.cmake")
4+
5+
set(proxy_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")

cmake/proxyModuleTargets.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
if(NOT DEFINED proxy_INCLUDE_DIR)
3+
message(FATAL_ERROR "proxy_INCLUDE_DIR must be defined to use this script.")
4+
endif()
5+
6+
message(STATUS "Declaring `msft_proxy::module` target for include path ${proxy_INCLUDE_DIR}")
7+
8+
add_library(msft_proxy_module)
9+
set_target_properties(
10+
msft_proxy_module
11+
PROPERTIES
12+
SYSTEM TRUE
13+
EXCLUDE_FROM_ALL TRUE
14+
)
15+
16+
add_library(msft_proxy::module ALIAS msft_proxy_module)
17+
target_sources(msft_proxy_module PUBLIC
18+
FILE_SET CXX_MODULES
19+
BASE_DIRS ${proxy_INCLUDE_DIR}
20+
FILES
21+
${proxy_INCLUDE_DIR}/proxy/proxy.ixx
22+
)
23+
target_compile_features(msft_proxy_module PUBLIC cxx_std_20)
24+
target_link_libraries(msft_proxy_module PUBLIC msft_proxy)
25+

docs/PRO_DEF_FREE_AS_MEM_DISPATCH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct dispatch_name {
5151
#include <iostream>
5252
#include <string>
5353
54-
#include "proxy.h"
54+
#include <proxy/proxy.h>
5555
5656
PRO_DEF_FREE_AS_MEM_DISPATCH(FreeToString, std::to_string, ToString);
5757

docs/PRO_DEF_FREE_DISPATCH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct dispatch_name {
4949
#include <iostream>
5050
#include <string>
5151
52-
#include "proxy.h"
52+
#include <proxy/proxy.h>
5353
5454
PRO_DEF_FREE_DISPATCH(FreeToString, std::to_string, ToString);
5555

docs/PRO_DEF_MEM_DISPATCH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct dispatch_name {
5252
#include <string>
5353
#include <vector>
5454
55-
#include "proxy.h"
55+
#include <proxy/proxy.h>
5656
5757
PRO_DEF_MEM_DISPATCH(MemAt, at);
5858

docs/access_proxy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Similar to [`proxy_invoke`](proxy_invoke.md), this function can be used to imple
3333
#include <iostream>
3434
#include <string>
3535
36-
#include "proxy.h"
36+
#include <proxy/proxy.h>
3737
3838
PRO_DEF_FREE_DISPATCH(FreeToString, std::to_string, ToString);
3939

docs/allocate_proxy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The implementation of `allocated-ptr` may vary depending on the definition of `F
4141
```cpp
4242
#include <array>
4343
44-
#include "proxy.h"
44+
#include <proxy/proxy.h>
4545
4646
// By default, the maximum pointer size defined by pro::facade_builder
4747
// is 2 * sizeof(void*). This value can be overridden by `restrict_layout`.

docs/allocate_proxy_shared.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The implementation of `strong-compact-ptr` may vary depending on the definition
4242
#include <iostream>
4343
#include <memory_resource>
4444
45-
#include "proxy.h"
45+
#include <proxy/proxy.h>
4646
4747
struct RttiAware : pro::facade_builder
4848
::support_copy<pro::constraint_level::nothrow>

0 commit comments

Comments
 (0)