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

Tick-tock Export Headers #249

Merged
merged 5 commits into from
May 16, 2022
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
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
Copy link
Member

Choose a reason for hiding this comment

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

do we want to define IGNITION_ versions of _VISIBLE and _HIDDEN as well?

if so, we should create an ign_export_base variable to use when configuring this file

Copy link
Contributor Author

@methylDragon methylDragon May 5, 2022

Choose a reason for hiding this comment

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

They're defined in here already, using the _ign_export_base variable! 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

thanks; I could have done a better job reading the pull request changes before making comments like that. I was a little confused on first glance to see all the Doxygen for the redirection macros; I think we could remove them. See my suggested changes in ee17946

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changes incorporated!

#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