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

Fix windows compilation by setting right visibility attributes #550

Merged
merged 16 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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: 20 additions & 5 deletions testing/include/gz/common/testing/CMakeTestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,36 @@ namespace gz::common::testing
///
/// It is not intended that users will directly construct this, but rather
/// utilize the TestPathFactory.

/// TODO(jrivero) Remove warning disable when bumping MSVC on CI
/// MSVC v16.11.25 complains about the TestPaths class not having a DLL although
/// relevant members of it have visiblity defined:
/// "non dll-interface class 'gz::common::testing::TestPaths' used as base for
/// dll-interface class 'gz::common::testing::CMakeTestPaths'"
///
/// Workaround on this problems triggers new warnings and suffering and
/// more recent versions of MSVC do not trigger that warning anymore.
/// Conclusion: disable the warning.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
class GZ_COMMON_TESTING_VISIBLE CMakeTestPaths: public TestPaths
{
/// \brief Constructor from TestPaths
public: using TestPaths::TestPaths;

/// \brief Destructor
public: GZ_COMMON_TESTING_VISIBLE ~CMakeTestPaths() override;
public: ~CMakeTestPaths() override;

/// Documentation inherited
public: bool GZ_COMMON_TESTING_VISIBLE
ProjectSourcePath(std::string &_sourceDir) override;
public: bool ProjectSourcePath(std::string &_sourceDir) override;

/// Documentation inherited
public: bool GZ_COMMON_TESTING_VISIBLE
TestTmpPath(std::string &_tmpDir) override;
public: bool TestTmpPath(std::string &_tmpDir) override;
};
} // namespace gz::common::testing
#ifdef _MSC_VER
# pragma warning( pop )
mjcarroll marked this conversation as resolved.
Show resolved Hide resolved
#endif
#endif // GZ_COMMON_TESTING_CMAKETESTPATHS_HH_
15 changes: 5 additions & 10 deletions testing/include/gz/common/testing/TestPaths.hh
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,22 @@ class TestPaths
{
/// \brief Constructor
/// \param[in] _projectSourcePath Path to the root of the project source
public: GZ_COMMON_TESTING_VISIBLE
explicit TestPaths(const std::string &_projectSourcePath =
kTestingProjectSourceDir);
public: explicit GZ_COMMON_TESTING_VISIBLE TestPaths(
const std::string &_projectSourcePath = kTestingProjectSourceDir);

/// \brief Destructor
public: GZ_COMMON_TESTING_VISIBLE
virtual ~TestPaths() = 0;
public: virtual ~TestPaths() = 0;
mjcarroll marked this conversation as resolved.
Show resolved Hide resolved

/// brief Populate the path to the root project source directory
/// \param[out] _sourceDir path to the root project source directory
/// \return True if path successfully found and set, false otherwise
public: virtual bool GZ_COMMON_TESTING_VISIBLE
ProjectSourcePath(std::string &_sourceDir) = 0;
public: virtual bool ProjectSourcePath(std::string &_sourceDir) = 0;

/// \brief Populate the path to a temporary directory
/// \param[out] _tmpDir path to the root temporary directory
/// \return True if path successfully found and set, false otherwise
public: virtual bool GZ_COMMON_TESTING_VISIBLE
TestTmpPath(std::string &_tmpDir) = 0;
public: virtual bool TestTmpPath(std::string &_tmpDir) = 0;

/// \brief Path to the root of the project source
Copy link
Member

Choose a reason for hiding this comment

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

restore this comment?

protected: std::string projectSourcePath;
};

Expand Down
Loading