Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,12 @@ add_library(

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${PROJECT_NAME}
PRIVATE
RCUTILS_BUILDING_DLL
PUBLIC
$<$<BOOL:${RCUTILS_NO_THREAD_SUPPORT}>:RCUTILS_NO_THREAD_SUPPORT>
$<$<BOOL:${RCUTILS_NO_FILESYSTEM}>:RCUTILS_NO_FILESYSTEM>
$<$<BOOL:${RCUTILS_AVOID_DYNAMIC_ALLOCATION}>:RCUTILS_AVOID_DYNAMIC_ALLOCATION>
)
target_compile_definitions(${PROJECT_NAME} PRIVATE "RCUTILS_BUILDING_DLL")

configure_file(

Choose a reason for hiding this comment

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

Why do you keep the target_compile_definitions?
Why there is not RCUTILS_NO_THREAD_SUPPORT in configuration_flags.h?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

"${PROJECT_SOURCE_DIR}/include/rcutils/configuration_flags.h.in"
"${PROJECT_BINARY_DIR}/include/rcutils/configuration_flags.h"
)

# Needed if pthread is used for thread local storage.
if(IOS AND IOS_SDK_VERSION LESS 10.0)
Expand Down
18 changes: 18 additions & 0 deletions include/rcutils/configuration_flags.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#ifndef RCUTILS__CONFIGURATION_FLAGS_H_
#define RCUTILS__CONFIGURATION_FLAGS_H_

#ifdef __cplusplus
extern "C"
{
#endif

#cmakedefine RCUTILS_NO_FILESYSTEM
#cmakedefine RCUTILS_AVOID_DYNAMIC_ALLOCATION
#cmakedefine RCUTILS_NO_THREAD_SUPPORT

#ifdef __cplusplus
}
#endif

#endif // RCUTILS__CONFIGURATION_FLAGS_H_
1 change: 1 addition & 0 deletions include/rcutils/error_handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern "C"
#include "rcutils/snprintf.h"
#include "rcutils/types/rcutils_ret.h"
#include "rcutils/visibility_control.h"
#include "rcutils/configuration_flags.h"

#if defined(__STDC_LIB_EXT1__) && !defined(RCUTILS_NO_FILESYSTEM)
// Limit the buffer size in the `fwrite` call to give an upper bound to buffer overrun in the case
Expand Down
4 changes: 3 additions & 1 deletion include/rcutils/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ extern "C"
{
#endif

#include "rcutils/configuration_flags.h"

#ifndef _WIN32
#define RCUTILS_WARN_UNUSED __attribute__((warn_unused_result))
#else
Expand All @@ -28,7 +30,7 @@ extern "C"

// Note: this block was migrated from rmw/macros.h
// This block either sets RCUTILS_THREAD_LOCAL or RCUTILS_THREAD_LOCAL_PTHREAD.
#if RCUTILS_NO_THREAD_SUPPORT
#if defined(RCUTILS_NO_THREAD_SUPPORT)
#define RCUTILS_THREAD_LOCAL
#elif defined _WIN32 || defined __CYGWIN__
// Windows or Cygwin
Expand Down