Skip to content

Commit

Permalink
Fix version printing (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrinktofit authored Aug 30, 2023
1 parent ced72e8 commit d4e9306
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cli/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include ("${CMAKE_CURRENT_LIST_DIR}/../Core/CMakeLists.txt")

# LIB

add_library (FBX-glTF-conv-lib STATIC "${CMAKE_CURRENT_LIST_DIR}/ReadCliArgs.cpp")
add_library (FBX-glTF-conv-lib STATIC "${CMAKE_CURRENT_LIST_DIR}/ReadCliArgs.cpp" "${CMAKE_CURRENT_LIST_DIR}/Version.cpp")

set_target_properties (FBX-glTF-conv-lib PROPERTIES CXX_STANDARD 20)

Expand Down
2 changes: 1 addition & 1 deletion Cli/Cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int main(int argc_, const char *argv_[]) {

if (std::holds_alternative<beecli::VersionCommand>(*parsedCommand)) {
const auto &command = std::get<beecli::VersionCommand>(*parsedCommand);
std::cout << beecli::version_string << std::endl;
std::cout << beecli::version_string << std::flush;
return 0;
}

Expand Down
13 changes: 13 additions & 0 deletions Cli/Version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "./Version.h"

#ifndef FBX_GLTF_CONV_CLI_VERSION
# define FBX_GLTF_CONV_CLI_VERSION_STRING ""
#else
# define TO_FBX_GLTF_CONV_CLI_VERSION_STRING(x) #x
# define TO_FBX_GLTF_CONV_CLI_VERSION_STRING2(x) TO_FBX_GLTF_CONV_CLI_VERSION_STRING(x)
# define FBX_GLTF_CONV_CLI_VERSION_STRING TO_FBX_GLTF_CONV_CLI_VERSION_STRING2(FBX_GLTF_CONV_CLI_VERSION)
#endif

namespace beecli {
const std::string version_string = FBX_GLTF_CONV_CLI_VERSION_STRING;
} // namespace beecli
10 changes: 1 addition & 9 deletions Cli/Version.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,5 @@
#include <string>

namespace beecli {
#ifndef FBX_GLTF_CONV_CLI_VERSION
# define FBX_GLTF_CONV_CLI_VERSION_STRING ""
#else
# define TO_FBX_GLTF_CONV_CLI_VERSION_STRING(x) #x
# define TO_FBX_GLTF_CONV_CLI_VERSION_STRING2(x) TO_FBX_GLTF_CONV_CLI_VERSION_STRING(x)
# define FBX_GLTF_CONV_CLI_VERSION_STRING TO_FBX_GLTF_CONV_CLI_VERSION_STRING2(FBX_GLTF_CONV_CLI_VERSION)
#endif

inline const std::string version_string = FBX_GLTF_CONV_CLI_VERSION_STRING;
extern const std::string version_string;
} // namespace beecli

0 comments on commit d4e9306

Please sign in to comment.