Skip to content
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

PROTON-2331 Allow producing a RelWithDebInfo build with asserts enabled #297

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jiridanek
Copy link
Contributor

No description provided.

@jiridanek jiridanek self-assigned this Feb 9, 2021
@@ -132,6 +132,38 @@ if (CMAKE_BUILD_TYPE MATCHES "Coverage")
COMMAND ${CMAKE_SOURCE_DIR}/scripts/record-coverage.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
endif()

# Enable asserts for C/C++ code if requested
# from the LLVM project, https://opensource.apple.com/source/llvmCore/llvmCore-2358.3/CMakeLists.txt.auto.html
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm considering moving all this into a .cmake file and then including it here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be better - I'm not sure.

Copy link
Member

@astitcher astitcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder whether it would be better to create a new CMAKE_BUILD_TYPE for this rather than modify RelWithDebInfo perhaps call it SensibleRelWithDebInfo :) or more seriously maybe RelWithDebInfoAsserts. Then you can just use a different CMAKE_BUILD_TYPE to get this. I think this is more idiomatic maybe? We do this for coverage too so it's not a new idea for us.

Comment on lines +138 to +142
option(PN_ENABLE_ASSERTIONS "Enable assertions" ON)
else()
option(PN_ENABLE_ASSERTIONS "Enable assertions" OFF)
endif()
if(PN_ENABLE_ASSERTIONS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please call this ENABLE_ASSERTIONS - we don't use a PN_ prefix as everything in the build is Proton!

Copy link
Contributor Author

@jiridanek jiridanek Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, will rename.

It has the same justification as the pn_ prefix in the C library. Somebody might include this CMake build in their own project (as a subproject: CMake supports fetching subprojects over HTTP, Git, ....) and then there would be value in being able to configure options for each project separately. I admit that here is a poor place where to start introducing the convention. Especially since I dont intend to apply it uniformly everywhere.

Comment on lines +144 to +146
if(NOT MSVC)
add_definitions(-D_DEBUG)
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary at all - all we need to do is not define NDEBUG no need to define _DEBUG which does nothing for our code or any compiler library except MSVC.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, it does look useless. I only included it because thats what LLVM does, and it did not look harmful in any way.

@@ -117,7 +117,7 @@ jobs:
env:
- PATH="/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH"
- PKG_CONFIG_PATH='/usr/local/opt/openssl@1.1/lib/pkgconfig'
- QPID_PROTON_CMAKE_ARGS='-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DTHREADERCISER=ON'
- QPID_PROTON_CMAKE_ARGS='-DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DPN_ENABLE_ASSERTIONS=ON -DTHREADERCISER=ON'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below

@@ -132,6 +132,38 @@ if (CMAKE_BUILD_TYPE MATCHES "Coverage")
COMMAND ${CMAKE_SOURCE_DIR}/scripts/record-coverage.sh ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR})
endif()

# Enable asserts for C/C++ code if requested
# from the LLVM project, https://opensource.apple.com/source/llvmCore/llvmCore-2358.3/CMakeLists.txt.auto.html
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be better - I'm not sure.

@Gauravmauryaios
Copy link

I want to contribute.. this project

@jiridanek
Copy link
Contributor Author

I want to contribute.. this project

@Gauravmauryaios Know any C++? Try solving one of the coverage improvement tasks. This one looks good https://issues.apache.org/jira/browse/PROTON-2363. If you need help, read previous questions on the mailing list here https://lists.apache.org/thread.html/r061203f3269108ccc5e7fd853e4ad519fc311cb96d3d6bdd9360965e%40%3Cusers.qpid.apache.org%3E, or ask your own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants