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

HPX_DEBUG/CMAKE_BUILD_TYPE not correctly decoupled/consistently used. #5907

Open
Neumann-A opened this issue Jun 1, 2022 · 1 comment
Open

Comments

@Neumann-A
Copy link
Contributor

#if !defined(HPX_WINDOWS)
# if defined(HPX_DEBUG)
# define HPX_MAKE_DLL_STRING(n) "lib" + n + "d" + HPX_SHARED_LIB_EXTENSION
# else
# define HPX_MAKE_DLL_STRING(n) "lib" + n + HPX_SHARED_LIB_EXTENSION
# endif
#elif defined(HPX_DEBUG)
# define HPX_MAKE_DLL_STRING(n) (n) + "d" + HPX_SHARED_LIB_EXTENSION
#else
# define HPX_MAKE_DLL_STRING(n) (n) + HPX_SHARED_LIB_EXTENSION
#endif
#if defined(HPX_DEBUG)
# define HPX_MANGLE_NAME(n) HPX_PP_CAT(n, d)
# define HPX_MANGLE_STRING(n) (n) + "d"
#else
# define HPX_MANGLE_NAME(n) n
# define HPX_MANGLE_STRING(n) n
#endif

assumes HPX_DEBUG for name mangling.
(different issue: assumes fixed library prefixes and suffixes which can be easily changed by cmake variables. )

hpx/CMakeLists.txt

Lines 2191 to 2192 in a7ea579

set(CMAKE_DEBUG_POSTFIX "d")
set(HPX_DEBUG_POSTFIX "d")

Hardcodes d suffix dependent on CMAKE_BUILD_TYPE

# HPX_DEBUG must be set without a generator expression as it determines ABI
# compatibility. Projects in Release mode using HPX in Debug mode must have
# HPX_DEBUG set, and projects in Debug mode using HPX in Release mode must not
# have HPX_DEBUG set. HPX_DEBUG must also not be set by projects using HPX.
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
target_compile_definitions(hpx_private_flags INTERFACE HPX_DEBUG)
target_compile_definitions(hpx_public_flags INTERFACE HPX_DEBUG)
endif()

Tries to decouple HPX_DEBUG from CMAKE_BUILD_TYPE (which of course isn't correct if the above is done.)

Looking at that mess at least the third code fragment should be changed to

   target_compile_definitions(hpx_private_flags INTERFACE "$<$<CONFIG:DEBUG>:HPX_DEBUG>") 
   target_compile_definitions(hpx_public_flags INTERFACE "$<$<CONFIG:DEBUG>:HPX_DEBUG>") 

or the second fragment must be applied to all <CONFIG> suffixes.

@hkaiser
Copy link
Member

hkaiser commented Jun 1, 2022

@Neumann-A: Good catch! Thanks for the analysis.

@hkaiser hkaiser added this to the 1.9.0 milestone Jun 1, 2022
@hkaiser hkaiser modified the milestones: 1.9.0, 1.8.1 Jul 5, 2022
@hkaiser hkaiser modified the milestones: 1.9.0, 1.10.0 Apr 20, 2023
@hkaiser hkaiser modified the milestones: 1.10.0, 1.11.0 May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants