Skip to content

Commit

Permalink
get version info from project file
Browse files Browse the repository at this point in the history
  • Loading branch information
ScrelliCopter committed Mar 25, 2024
1 parent 59e3612 commit 73b5d44
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
cmake_minimum_required(VERSION "3.15" FATAL_ERROR)
project(tmx2gba VERSION "0.3")
project(tmx2gba
VERSION "0.7"
DESCRIPTION "Simple CLI utility for converting Tiled (.tmx) maps to GBA-friendly charmaps."
HOMEPAGE_URL "https://github.com/ScrelliCopter/tmx2gba")

# Options
option(TMX2GBA_DKP_INSTALL "Install into DEVKITPRO prefix" OFF)
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ add_executable(tmx2gba
swriter.hpp swriter.cpp
tmx2gba.cpp)

configure_file(config.h.in config.h @ONLY)
target_sources(tmx2gba PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/config.h)
target_include_directories(tmx2gba PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

set_target_properties(tmx2gba PROPERTIES CXX_STANDARD 20)

# Enable strong warnings
Expand Down
6 changes: 6 additions & 0 deletions src/config.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#ifndef CONFIG_H
#define CONFIG_H

#define TMX2GBA_VERSION "@PROJECT_VERSION@"

#endif//CONFIG_H
5 changes: 2 additions & 3 deletions src/tmx2gba.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
#include "convert.hpp"
#include "headerwriter.hpp"
#include "swriter.hpp"
#include "config.h"
#include <iostream>
#include <map>
#include <algorithm>


static const char* versionStr = "tmx2gba version 0.3, (c) 2015-2022 a dinosaur";

struct Arguments
{
std::string inPath, outPath;
Expand Down Expand Up @@ -148,7 +147,7 @@ int main(int argc, char** argv)
}
if (p.showVersion)
{
std::cout << versionStr << std::endl;
std::cout << "tmx2gba version " << TMX2GBA_VERSION << ", (c) 2015-2024 a dinosaur" << std::endl;
return 0;
}

Expand Down

0 comments on commit 73b5d44

Please sign in to comment.