Skip to content

Commit

Permalink
Add a combined version define in MaterialX C++ (AcademySoftwareFounda…
Browse files Browse the repository at this point in the history
…tion#2031)

PR for AcademySoftwareFoundation#1609

Also added a simple test in source/MaterialXTest/MaterialXCore
  • Loading branch information
ruiyang2021 authored Oct 24, 2024
1 parent 5cdb375 commit 1734e6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit 1734e6d

Please sign in to comment.