Skip to content
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
3 changes: 3 additions & 0 deletions doc/source/cmfprocessor/cmfprocessor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Inspection and Debugging
dumpjson
validate
hash
versioninfo

Metadata Management
^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -89,6 +90,8 @@ Command Summary
- Validates a CMF file to ensure structural integrity and format compliance
* - :doc:`hash <hash>`
- Computes and prints the MD5 hash of any file for integrity verification
* - :doc:`versioninfo <versioninfo>`
- Prints current version information for the CMF Processor tool and CMF file format version
* - :doc:`metadata <metadata>`
- Adds, modifies, or removes metadata key-value pairs in CMF files
* - :doc:`gltfconverter <gltfconverter>`
Expand Down
56 changes: 56 additions & 0 deletions doc/source/cmfprocessor/versioninfo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
versioninfo
===========

Description
-----------

Prints current version information for the CMF Processor tool and CMF file format version.

The version information is printed to stdout as a JSON object.

Syntax
------

.. code-block:: bash

cmfprocessor versioninfo


Output Format
-------------

The output is a string representation of a JSON object:

.. code-block:: text

{
"cmfprocessor": cmprocessor_version,
"format": cmf_format_version
}

Note that `cmprocessor_version` is a string, but `cmf_format_version` is a number.

Examples
--------

Compute hash of an FBX file:

.. code-block:: bash

cmfprocessor versioninfo


Compute hash in a script (PowerShell):

.. code-block:: powershell

$versioninfo = cmfprocessor versioninfo
Write-Host "Version Info: $versioninfo"

Compute hash in a script (Bash):

.. code-block:: bash

versioninfo=$(cmfprocessor versioninfo)
echo "Version Info: $versioninfo"

1 change: 1 addition & 0 deletions src/processor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ set(PROCESSOR_SOURCES
main.cpp
metadata.cpp
validate.cpp
versioninfo.cpp
gltfconverter.cpp
)

Expand Down
2 changes: 1 addition & 1 deletion src/processor/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <nlohmann/json.hpp>
#include "cmffile.h"

const char* CMF_PROCESSOR_VERSION = "1.0.0";
const char* CMF_PROCESSOR_VERSION = "1.1.0";


int main( int argc, char** argv )
Expand Down
25 changes: 25 additions & 0 deletions src/processor/versioninfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright © 2026 CCP ehf.

#include "commands.h"
#include "cmffile.h"

#include <nlohmann/json.hpp>

extern const char* CMF_PROCESSOR_VERSION;

namespace
{
struct NoOptions
{
};

void VersionInfo( CLI::App& app, NoOptions& noOptions )
{
app.final_callback( []() {
auto j = nlohmann::json{ { "format", cmf::FILE_VERSION }, { "cmfprocessor", CMF_PROCESSOR_VERSION } };
printf( "%s\n", j.dump( 4 ).c_str() ); // NOLINT(cppcoreguidelines-pro-type-vararg)
} );
}
}

REGISTER_COMMAND( "versioninfo", "Print out CMF version information (file format version and cmfprocessor version) as a JSON object", &VersionInfo );
Comment thread
filipppavlov marked this conversation as resolved.
Loading