Skip to content

Commit

Permalink
Migrate some IGNITION_* macros (#62)
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored May 18, 2022
1 parent fbec80f commit 521864c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/using_cli/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int main(int argc, char** argv)
CLI::App app{"Using ignition-utils CLI wrapper"};

app.add_flag_callback("-v,--version", [](){
std::cout << IGNITION_UTILS_VERSION_FULL << std::endl;
std::cout << GZ_UTILS_VERSION_FULL << std::endl;
throw CLI::Success();
});

Expand Down
8 changes: 4 additions & 4 deletions include/gz/utils/Environment.hh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace ignition
{
namespace utils
{
inline namespace IGNITION_UTILS_VERSION_NAMESPACE {
inline namespace GZ_UTILS_VERSION_NAMESPACE {

/// \brief Find the environment variable '_name' and return its value.
///
Expand All @@ -39,7 +39,7 @@ inline namespace IGNITION_UTILS_VERSION_NAMESPACE {
/// \param[in] _allowEmpty Allow set-but-empty variables.
/// (Unsupported on Windows)
/// \return True if the variable was found or false otherwise.
bool IGNITION_UTILS_VISIBLE env(
bool GZ_UTILS_VISIBLE env(
const std::string &_name, std::string &_value,
bool _allowEmpty = false);

Expand All @@ -54,7 +54,7 @@ bool IGNITION_UTILS_VISIBLE env(
/// \param[in] _name Name of the environment variable.
/// \param[in] _value Value of the variable to be set.
/// \return True if the variable was set or false otherwise.
bool IGNITION_UTILS_VISIBLE setenv(
bool GZ_UTILS_VISIBLE setenv(
const std::string &_name, const std::string &_value);

/// \brief Unset the environment variable '_name'.
Expand All @@ -64,7 +64,7 @@ bool IGNITION_UTILS_VISIBLE setenv(
///
/// \param[in] _name Name of the environment variable.
/// \return True if the variable was unset or false otherwise.
bool IGNITION_UTILS_VISIBLE unsetenv(const std::string &_name);
bool GZ_UTILS_VISIBLE unsetenv(const std::string &_name);

}
} // namespace utils
Expand Down
36 changes: 29 additions & 7 deletions include/gz/utils/config.hh.in
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
/*
* Copyright (C) 2022 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

/* Config.hh. Generated by CMake for @PROJECT_NAME_NO_VERSION@. */

#ifndef GZ_UTILS_CONFIG_HH_
#define GZ_UTILS_CONFIG_HH_

/* Version number */
#define IGNITION_UTILS_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}
#define IGNITION_UTILS_MINOR_VERSION ${PROJECT_VERSION_MINOR}
#define IGNITION_UTILS_PATCH_VERSION ${PROJECT_VERSION_PATCH}
#define GZ_UTILS_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}
#define GZ_UTILS_MINOR_VERSION ${PROJECT_VERSION_MINOR}
#define GZ_UTILS_PATCH_VERSION ${PROJECT_VERSION_PATCH}

#define IGNITION_UTILS_VERSION "${PROJECT_VERSION}"
#define IGNITION_UTILS_VERSION_FULL "${PROJECT_VERSION_FULL}"
#define GZ_UTILS_VERSION "${PROJECT_VERSION}"
#define GZ_UTILS_VERSION_FULL "${PROJECT_VERSION_FULL}"

#define IGNITION_UTILS_VERSION_NAMESPACE v${PROJECT_VERSION_MAJOR}
#define GZ_UTILS_VERSION_NAMESPACE v${PROJECT_VERSION_MAJOR}

#define IGNITION_UTILS_VERSION_HEADER "Ignition ${IGN_DESIGNATION}, version ${PROJECT_VERSION_FULL}\nCopyright (C) 2020 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n"
#define GZ_UTILS_VERSION_HEADER "Ignition ${IGN_DESIGNATION}, version ${PROJECT_VERSION_FULL}\nCopyright (C) 2020 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n"

#cmakedefine IGNITION_UTILS_BUILD_TYPE_PROFILE 1
#cmakedefine IGNITION_UTILS_BUILD_TYPE_DEBUG 1
#cmakedefine IGNITION_UTILS_BUILD_TYPE_RELEASE 1

#endif
16 changes: 16 additions & 0 deletions include/ignition/utils/config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@
*/

#include <gz/utils/config.hh>

#ifndef IGNITION_UTILS_CONFIG_HH_
#define IGNITION_UTILS_CONFIG_HH_

#define IGNITION_UTILS_MAJOR_VERSION GZ_UTILS_MAJOR_VERSION
#define IGNITION_UTILS_MINOR_VERSION GZ_UTILS_MINOR_VERSION
#define IGNITION_UTILS_PATCH_VERSION GZ_UTILS_PATCH_VERSION

#define IGNITION_UTILS_VERSION GZ_UTILS_VERSION
#define IGNITION_UTILS_VERSION_FULL GZ_UTILS_VERSION_FULL

#define IGNITION_UTILS_VERSION_NAMESPACE GZ_UTILS_VERSION_NAMESPACE

#define IGNITION_UTILS_VERSION_HEADER GZ_UTILS_VERSION_HEADER

#endif
2 changes: 1 addition & 1 deletion src/Environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace ignition
{
namespace utils
{
inline namespace IGNITION_UTILS_VERSION_NAMESPACE {
inline namespace GZ_UTILS_VERSION_NAMESPACE {

/////////////////////////////////////////////////
bool env(const std::string &_name, std::string &_value, bool _allowEmpty)
Expand Down
12 changes: 6 additions & 6 deletions test/integration/implptr/implptr_test_classes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
*/

#ifndef IGNITION_UTILS_TEST_IMPLPTR_TEST_CLASSES_HH_
#define IGNITION_UTILS_TEST_IMPLPTR_TEST_CLASSES_HH_
#ifndef GZ_UTILS_TEST_IMPLPTR_TEST_CLASSES_HH_
#define GZ_UTILS_TEST_IMPLPTR_TEST_CLASSES_HH_

#include <gz/utils/ImplPtr.hh>
#include <gz/utils/Export.hh>
Expand All @@ -32,7 +32,7 @@ namespace ignition
class ObjectPrivate;

/// \brief A PIMPL test class that can be copied.
class IGNITION_UTILS_VISIBLE CopyableObject
class GZ_UTILS_VISIBLE CopyableObject
{
/// \brief Constructor
public: CopyableObject(int _ivalue = 0,
Expand Down Expand Up @@ -62,7 +62,7 @@ namespace ignition
};

/// \brief A PIMPL test class that cannot be copied; it can only be moved.
class IGNITION_UTILS_VISIBLE MovableObject
class GZ_UTILS_VISIBLE MovableObject
{
/// \brief Constructor
public: MovableObject(int _ivalue = 0,
Expand Down Expand Up @@ -92,7 +92,7 @@ namespace ignition
};

/// \brief A PIMPL test class that can be copied (alternate definition)
class IGNITION_UTILS_VISIBLE CopyableObjectAlt
class GZ_UTILS_VISIBLE CopyableObjectAlt
{
/// \brief Constructor
public: CopyableObjectAlt(int _ivalue = 0,
Expand All @@ -119,4 +119,4 @@ namespace ignition
} // namespace implptr_test_classes
} // namespace ignition

#endif // IGNITION_UTILS_TEST_IMPLPTR_TEST_CLASSES_HH_
#endif // GZ_UTILS_TEST_IMPLPTR_TEST_CLASSES_HH_

0 comments on commit 521864c

Please sign in to comment.