Skip to content

Commit

Permalink
Ticktock export headers
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed May 4, 2022
1 parent 841fc7c commit f049aca
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 3 deletions.
40 changes: 39 additions & 1 deletion cmake/Export.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,49 @@


#ifndef IGN_DEPRECATED
// TODO(CH3): Remove on ticktock
// NOTE(CH3): This has no docstring since we'll make GZ_DEPRECATED the default
#define IGN_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS
#endif

#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

// NOTE(CH3): GZ_DEPRECATED_ALL_VERSIONS can't be ticktocked, it's generated
// On the bright side, it seems to be private
#define GZ_DEPRECATED(version) GZ_DEPRECATED_ALL_VERSIONS
#endif


// TICKTOCK IGNITION ========================================================
// TODO(CH3): Remove on ticktock, supports defining IGNITION macros if we're
// a lib is using GZ_ prefixed export macros
#define _GZ_EXPORT_BASE @_gz_export_base@
#if _GZ_EXPORT_BASE


#ifndef IGNITION_VISIBLE
/// For @lib_name@ developers: Apply this macro to @lib_name@
/// functions and classes which consumers of this library will need to be able
/// to call from their own programs or libraries.
#define IGNITION_VISIBLE \
DETAIL_@export_base@_VISIBLE
#endif


#ifndef IGNITION_HIDDEN
/// For @lib_name@ developers: Apply this macro to @lib_name@
/// functions and classes which must not be used by consumers of this library.
/// By default, this property is applied to all classes and functions which are
/// not tagged with IGNITION_VISIBLE, so this does not
/// generally need to be used.
#define IGNITION_HIDDEN \
DETAIL_@export_base@_HIDDEN
#endif


#endif // _GZ_EXPORT_BASE
#endif // @export_base@_EXPORT_HH_
16 changes: 14 additions & 2 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,9 @@ function(ign_create_core_library)
_ign_add_library_or_component(
LIB_NAME ${IGN_LIBRARY_TARGET_NAME}
INCLUDE_DIR "${PROJECT_INCLUDE_DIR}"
EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}

# Using GZ_ is deliberate, Export.hh.in has logic to deal with this
EXPORT_BASE GZ_${IGN_DESIGNATION_UPPER}
SOURCES ${sources}
${interface_option})

Expand Down Expand Up @@ -1554,7 +1556,7 @@ macro(_ign_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 @@ -1568,6 +1570,16 @@ macro(_ign_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
# _gz_export_base is used in Export.hh.in's configuration!
if(${export_base} MATCHES "^GZ_")
set(_gz_export_base 1)
else()
set(_gz_export_base 0)
endif()

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

0 comments on commit f049aca

Please sign in to comment.