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

Add a combined version define in MaterialX C++ #2031

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
5 changes: 5 additions & 0 deletions source/MaterialXCore/Library.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@

#include <MaterialXCore/Generated.h>

#define MATERIALX_GENERATE_INDEX(major, minor, build) \
((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(build)))
#define MATERIALX_VERSION_INDEX \
MATERIALX_GENERATE_INDEX(MATERIALX_MAJOR_VERSION, MATERIALX_MINOR_VERSION, MATERIALX_BUILD_VERSION)

/// Platform-specific macros for declaring imported and exported symbols.
#if defined(MATERIALX_BUILD_SHARED_LIBS)
#if defined(_WIN32)
Expand Down
6 changes: 6 additions & 0 deletions source/MaterialXTest/MaterialXCore/CoreUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@

namespace mx = MaterialX;

TEST_CASE("Version comparison", "[coreutil]")
{
// Test for version comparison
REQUIRE(MATERIALX_VERSION_INDEX > MATERIALX_GENERATE_INDEX(1, 38, 8));
}

TEST_CASE("String utilities", "[coreutil]")
{
std::string invalidName("test.name");
Expand Down