-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cmake-init generated CMake files #4
base: develop
Are you sure you want to change the base?
Conversation
Add and use cmake workflow presets file Add CMAKE_VERIFY_INTERFACE_HEADER_SETS Use ccache if available
Install cmake config package to <prefix>/lib Install files less verbose Add examples to cmake project Use debug postfix for install asio library
ef14579
to
7fcf4a4
Compare
module; | ||
|
||
#include <asio.hpp> | ||
#include <asio/ssl.hpp> | ||
|
||
export module asio; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: the asio module
but MSVC does not compile it:
[5/8] Building CXX object CMakeFiles\asio_module.dir\D_\a\asio\asio\asio\stagedir\lib\cmake\asio\module\asio.cppm.obj
asio.cppm
Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:
- add -D_WIN32_WINNT=0x0601 to the compiler command line; or
- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.
Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
D:\a\asio\asio\asio\stagedir\include\asio/detail/impl/win_mutex.ipp(39): note: sorry: 'inline' function definition for
'int asio::detail::win_mutex::do_init(void)' could not be written to module due to unrecognized expression
or statement at 'D:\a\asio\asio\asio\stagedir\include\asio/detail/impl/win_mutex.ipp(55)'.
If possible please provide a repro here: https://developercommunity.visualstudio.com/
Add wrapper for CXX_MODULES The example module test needs oppenssl
ca7d2ae
to
3dd1161
Compare
MSVC supports CXX_MODULES too, give it a try
1dce944
to
3de812a
Compare
Fix install prefix Use developer command prompt on Windows
45ea47e
to
bf27e93
Compare
use try {} catch() {}
33e17ec
to
47d4cd3
Compare
Windows makes me crazy:
|
Use ssl::error::make_error_code() Be less pedantic on Windows
a06ec59
to
3846d69
Compare
I encountered and reported the first error you mention: https://developercommunity.visualstudio.com/t/Using-__try-in-an-inline-function-in-a-h/10186252 |
Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this OK?
@@ -64,10 +64,11 @@ int win_mutex::do_init() | |||
return ::GetLastError(); | |||
# endif | |||
} | |||
__except(GetExceptionCode() == STATUS_NO_MEMORY | |||
? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) | |||
catch (const std::bad_alloc&) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anarthal This was my quick solution for ths MSVC inline problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like GitHub had an issue yesterday, I got some 500 errors when trying to post my comments.
This doesn't do what you'd expect. SEH __catch
clauses do catch C++ exceptions, but C++ catch
doesn't catch SEH exceptions AFAIK. There's no std::bad_alloc
exception in SEH to begin with.
If I'm not mistaken, the SEH handler there is only relevant for Windows XP/Windows Server 2003 and previous versions (see the InitializeCriticalSection docs). I don't think you can target these systems with a C++20 compiler, so you can likely remove the SEH try/catch in your prototype without loss of functionality.
@@ -111,12 +111,15 @@ int win_static_mutex::do_init() | |||
} | |||
# endif | |||
} | |||
__except(GetExceptionCode() == STATUS_NO_MEMORY | |||
? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) | |||
catch (const std::bad_alloc&) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anarthal This was my quick solution for ths MSVC inline problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies here.
The remaining problem seems a const problem to be: cannot convert argument 1 from 'asio::this_coro::executor_t' to 'const asio::any_io_executor &'
|
I got the |
The other issue you're seeing is likely due to this warning you're getting:
Which is related to this: Actually, Asio declares them as This, however, relies on |
By the way, what is your final intention with this repository? Are you planning to PR it to Asio, or is it just to experiment? |
Both, but no success to add cmake support to the asio cmake PR But a a site effect, I created I found a better way and dit it for boost, fmt, asio: a cmake adapter to improve the cmake support. i.e. |
cmake workflow presets
fileCMAKE_VERIFY_INTERFACE_HEADER_SETS
ccache
if availableCXX_MODULE
CXX_MODULE
support yet!)CXX_MODULE
)find installed CXX_MODULE
test on CI!macOS
with both versions?see too https://anarthal.github.io/cppblog/modules2
and fmt-module