1
0
mirror of https://github.com/ScrelliCopter/tmx2gba.git synced 2025-02-21 03:29:25 +11:00

get version info from project file

This commit is contained in:
2024-03-25 15:36:07 +11:00
parent 59e36125f5
commit 73b5d44b46
4 changed files with 16 additions and 4 deletions

View File

@@ -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)

View File

@@ -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

6
src/config.h.in Normal file
View File

@@ -0,0 +1,6 @@
#ifndef CONFIG_H
#define CONFIG_H
#define TMX2GBA_VERSION "@PROJECT_VERSION@"
#endif//CONFIG_H

View File

@@ -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;
@@ -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;
}