Skip to content

Commit

Permalink
Merge branch 'main' into chapulina/3/ign_deprecations_3
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed May 16, 2022
2 parents 7923d0e + 98e431a commit 1a87c1a
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
25 changes: 23 additions & 2 deletions cmake/Export.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,33 @@
#endif


#ifndef IGN_DEPRECATED
#ifndef GZ_DEPRECATED
/// For @lib_name@ developers: Use this macro to indicate that a
/// function or class has been deprecated and should no longer be used. A
/// version should be specified to provide context to the user about when the
/// function became deprecated.
#define IGN_DEPRECATED(version) IGN_DEPRECATED_ALL_VERSIONS
#define GZ_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS
#endif


// TICKTOCK IGNITION ========================================================
// TODO(CH3): Remove on ticktock, supports defining IGNITION macros if a lib
// is using GZ_ prefixed export macros
#ifndef @_ign_export_base@_VISIBLE
#define @_ign_export_base@_VISIBLE @export_base@_VISIBLE
#endif

#ifndef @_ign_export_base@_HIDDEN
#define @_ign_export_base@_HIDDEN @export_base@_HIDDEN
#endif

#ifndef IGN_DEPRECATED_ALL_VERSIONS
#define IGN_DEPRECATED_ALL_VERSIONS GZ_DEPRECATED_ALL_VERSIONS
#endif

#ifndef IGN_DEPRECATED
#define IGN_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS
#endif


#endif // @export_base@_EXPORT_HH_
14 changes: 11 additions & 3 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ function(gz_create_core_library)
_gz_add_library_or_component(
LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME}
INCLUDE_DIR "${PROJECT_INCLUDE_DIR}"
EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}
EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER}
SOURCES ${sources}
${interface_option})

Expand Down Expand Up @@ -1174,7 +1174,7 @@ function(ign_add_component component_name)
_gz_add_library_or_component(
LIB_NAME ${component_target_name}
INCLUDE_DIR "${PROJECT_INCLUDE_DIR}/${include_subdir}"
EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}_${component_name_upper}
EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER}_${component_name_upper}
SOURCES ${sources}
${interface_option})

Expand Down Expand Up @@ -1376,6 +1376,8 @@ macro(_gz_add_library_or_component)
# - include_dir
# - export_base
# - lib_name
#
# - _ign_export_base

#------------------------------------
# Define the expected arguments
Expand Down Expand Up @@ -1461,7 +1463,7 @@ macro(_gz_add_library_or_component)
EXPORT_FILE_NAME ${implementation_file_name}
EXPORT_MACRO_NAME DETAIL_${export_base}_VISIBLE
NO_EXPORT_MACRO_NAME DETAIL_${export_base}_HIDDEN
DEPRECATED_MACRO_NAME IGN_DEPRECATED_ALL_VERSIONS)
DEPRECATED_MACRO_NAME GZ_DEPRECATED_ALL_VERSIONS)

set(install_include_dir
"${IGN_INCLUDE_INSTALL_DIR_FULL}/${include_dir}")
Expand All @@ -1475,6 +1477,12 @@ macro(_gz_add_library_or_component)
# Configure the public-facing header for exporting and deprecating. This
# header provides commentary for the macros so that developers can know their
# purpose.

# TODO(CH3): Remove this on ticktock
# This is to allow IGNITION_ prefixed export macros to generate in Export.hh
# _using_gz_export_base is used in Export.hh.in's configuration!
string(REGEX REPLACE "^GZ_" "IGNITION_" _ign_export_base ${export_base})

configure_file(
"${IGNITION_CMAKE_DIR}/Export.hh.in"
"${binary_include_dir}/Export.hh")
Expand Down

0 comments on commit 1a87c1a

Please sign in to comment.