|
| 1 | +/* |
| 2 | + * SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
| 3 | + * Copyright (c) 2025 Robert Leahy. All rights reserved. |
| 4 | + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 5 | + * |
| 6 | + * Licensed under the Apache License, Version 2.0 with LLVM Exceptions (the "License"); |
| 7 | + * you may not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * https://llvm.org/LICENSE.txt |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, software |
| 13 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + * See the License for the specific language governing permissions and |
| 16 | + * limitations under the License. |
| 17 | + */ |
| 18 | + |
| 19 | +#pragma once |
| 20 | + |
| 21 | +#cmakedefine01 ASIOEXEC_USES_STANDALONE |
| 22 | +#cmakedefine01 ASIOEXEC_USES_BOOST |
| 23 | + |
| 24 | +#if ASIOEXEC_USES_BOOST |
| 25 | +# include <boost/asio.hpp> |
| 26 | +# include <boost/system/errc.hpp> |
| 27 | +# include <boost/system/error_code.hpp> |
| 28 | +# include <boost/system/system_error.hpp> |
| 29 | +# define ASIOEXEC_ASIO_NAMESPACE boost::asio |
| 30 | +#elif ASIOEXEC_USES_STANDALONE |
| 31 | +# include <system_error> |
| 32 | +# include <asio.hpp> |
| 33 | +# define ASIOEXEC_ASIO_NAMESPACE asio |
| 34 | +#endif |
| 35 | + |
| 36 | +namespace asioexec { |
| 37 | +#if ASIOEXEC_USES_BOOST |
| 38 | + namespace asio_impl = ::boost::asio; |
| 39 | + using error_code = ::boost::system::error_code; |
| 40 | + using error_condition = ::boost::system::error_condition; |
| 41 | + namespace errc = ::boost::system::errc; |
| 42 | + using system_error = ::boost::system::system_error; |
| 43 | +#elif ASIOEXEC_USES_STANDALONE |
| 44 | + namespace asio_impl = ::asio; |
| 45 | + using error_code = std::error_code; |
| 46 | + using error_condition = std::error_condition; |
| 47 | + using errc = std::errc; |
| 48 | + using system_error = std::system_error; |
| 49 | +#endif |
| 50 | +} |
0 commit comments