Skip to content

Commit

Permalink
Tick-tock Export Headers (#249)
Browse files Browse the repository at this point in the history
* Ticktock export headers

Signed-off-by: methylDragon <methylDragon@gmail.com>

* Always use GZ_ prefixed export base

Signed-off-by: methylDragon <methylDragon@gmail.com>

* Revert extra gz/ignition target

Signed-off-by: methylDragon <methylDragon@gmail.com>

* Simplify Export.hh.in, remove comments

Signed-off-by: Steve Peters <scpeters@openrobotics.org>

* Update export comments

Signed-off-by: methylDragon <methylDragon@gmail.com>

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
  • Loading branch information
methylDragon and scpeters authored May 16, 2022
1 parent 4eab833 commit 98e431a
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 @@ -971,7 +971,7 @@ function(ign_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 @@ -1155,7 +1155,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 @@ -1357,6 +1357,8 @@ macro(_gz_add_library_or_component)
# - include_dir
# - export_base
# - lib_name
#
# - _ign_export_base

#------------------------------------
# Define the expected arguments
Expand Down Expand Up @@ -1442,7 +1444,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 @@ -1456,6 +1458,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 98e431a

Please sign in to comment.