-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
boost: Adds with_stacktrace_noop option #7503
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,8 +82,13 @@ if(NOT HEADER_ONLY) | |
if(WITH_STACKTRACE) | ||
find_package(Boost COMPONENTS stacktrace REQUIRED) | ||
|
||
add_executable(stacktrace_noop_exe stacktrace.cpp) | ||
target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) | ||
add_executable(stacktrace_noop_exe stacktrace.cpp) | ||
if(WITH_STACKTRACE_NOOP) | ||
target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) | ||
else() | ||
# BOOST_STACKTRACE_USE_NOOP is not defined in this case, so we set it here only for this target | ||
target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4 PRIVATE BOOST_STACKTRACE_USE_NOOP) | ||
endif() | ||
Comment on lines
+85
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix your formatting (space, 4chars). The only thing it does is enable/disable exposure of |
||
target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This target will not be available when stacktrace_noop is disabled. |
||
|
||
if(WIN32) | ||
|
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.
stacktrace_noop is a header-only library.
So the component is always available (when stacktrace is enabled)
Sure, you can add an option to specifically disable it, but is it worth it?
If you push further, please also do the following:
configure
, dodel self.options.with_stcktrace_noop
if stacktrace is disabled.do
del self.info.options.with_stacktrace_noopin
package_id` (this can be done unconditionally)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.
What do you mean stacktrace_noop is a header-only library? From what I understand, the noop is an implementation detail that is activated with the
BOOST_STACKTRACE_USE_NOOP
define. I'm new to the conan package, so is there another way to disable the noop define? Thanks!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.
Look in the main recipe, there is only one
noop
match:conan-center-index/recipes/boost/all/conanfile.py
Line 1570 in 4f4a376
This component is set when stacktrace is enabled:
conan-center-index/recipes/boost/all/conanfile.py
Line 1552 in 4f4a376
It does not add any libs.
self.cpp_info.components["stacktrace_noop"].libs = [...]
is not present.When writing the stacktrace tests, I found out that noop is the fallback backend of stacktrace.
If no implementation can be found, then nothing (=no-op) will be done.
The only way to disable no-op, is to make sure that another backend is available and used.
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.
I see, then shouldn't the backtrace backend (which is
True
by default) disable no-op?conan-center-index/recipes/boost/all/conanfile.py
Line 136 in 4f4a376
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.
No? no-op is always available, even when the addr2line/libbacktrace backend is built.
All three boost_stacktrace backends (noop/addr2line/libbacktrace) can be available in the same pacakge, just not used in the same target when using the cmake targets.
You can switch between the backends by carefully setting the definitions and linking to the correct libraries.
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.
Will do, thanks!
Also, you mentioned that
cmake
would be deprecated as a generator. Is that forconan
as a whole or justboost
?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.
I mean only for Conan.
conanbuiodinfo.cmake
will be a thing of the past.I'm taking about Conan 2.0, coming in the (near) future.
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.
I see, thanks!
As an aside, what build system would you recommend outside of
cmake
these days?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.
To be honest, I use cmake for all of my private and professional c/c++ projects.
All other build systems have disadvantages that are showstoppers for me.
Though, a simple Makefile might be useful for something that has nothing to do with compiling sources.
[Meson}(https://mesonbuild.com/) is used by some OSS projects.
But I find its documentation hard to read + it is opiniated.
It has a potential though.
A meson syntax with a cmake backend would be very nice..
The grandfather of build systems for OSS is of course autotools (autoconf + automake + libtool).
But that is geared mostly towards Linux + gcc. It can work with MSVC on Windows, but it's harder.
If you really don't care about portability, you can also of course just use Visual Studio projects (.snl and .vcxproj files).
So in general, I can't really recommend anything but cmake.
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.
Thank you, appreciate your insights!