From 9839a55892876702fd2930405d14413ff8c9c605 Mon Sep 17 00:00:00 2001 From: Andrej Redeky Date: Mon, 3 Jul 2023 09:53:47 +0200 Subject: [PATCH] Better versioning + rename to Glacier 1 Audio Tool --- src/Config.h.in | 30 ++++++++++++++++++++++++++++++ src/Config.hpp | 13 +++++++++++++ src/Main.cpp | 6 ++++-- src/Precompiled.hpp | 2 ++ src/Tests.cpp | 2 +- xmake.lua | 14 ++++++++++---- 6 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 src/Config.hpp diff --git a/src/Config.h.in b/src/Config.h.in index 470ffc8..d42f8ea 100644 --- a/src/Config.h.in +++ b/src/Config.h.in @@ -3,3 +3,33 @@ // Copyright © 2015-2023 Feldarian Softworks. All rights reserved. // SPDX-License-Identifier: EUPL-1.2 // + +#pragma once + +#define G1AT_VERSION_STRING "${VERSION}" +#define G1AT_VERSION_MAJOR ${VERSION_MAJOR} +#define G1AT_VERSION_MINOR ${VERSION_MINOR} +#define G1AT_VERSION_PATCH ${VERSION_ALTER} + +#define G1AT_VERSION_STRING_GIT "${GIT_TAG_LONG}" + +#define G1AT_NAME "${G1AT_NAME}" +#define G1AT_DESCRIPTION "${G1AT_DESCRIPTION}" +#define G1AT_HOMEPAGE "${G1AT_HOMEPAGE}" + +#define G1AT_DEBUG_BUILD (${DEBUG}) +#define G1AT_RELEASE_BUILD (!(G1AT_DEBUG_BUILD)) + +#if !defined(_DEBUG) && G1AT_DEBUG_BUILD +#define _DEBUG 1 +#endif + +#if !defined(NDEBUG) && G1AT_RELEASE_BUILD +#define NDEBUG 1 +#endif + +#ifdef G1AT_DEBUG_BUILD + #define G1AT_TITLE G1AT_NAME " (" G1AT_VERSION_STRING_GIT ")" +#else + #define G1AT_TITLE G1AT_NAME " (" G1AT_VERSION_STRING ")" +#endif diff --git a/src/Config.hpp b/src/Config.hpp new file mode 100644 index 0000000..4283228 --- /dev/null +++ b/src/Config.hpp @@ -0,0 +1,13 @@ +// +// Created by Andrej Redeky. +// Copyright © 2015-2023 Feldarian Softworks. All rights reserved. +// SPDX-License-Identifier: EUPL-1.2 +// + +#pragma once + +extern "C" +{ +// Generated by xmake from "src/Config.h.in" +#include +} diff --git a/src/Main.cpp b/src/Main.cpp index 71c7df1..4d00981 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -6,6 +6,8 @@ #include "Precompiled.hpp" +#include "Config.hpp" + #include "Hitman1Dialog.hpp" #include "Hitman23Dialog.hpp" #include "Hitman4Dialog.hpp" @@ -137,7 +139,7 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) constexpr auto window_flags = static_cast(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); SDL_Window *window = - SDL_CreateWindow("Hitman Audio Tool", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, window_flags); + SDL_CreateWindow(G1AT_TITLE, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, window_flags); const auto gl_context = SDL_GL_CreateContext(window); SDL_GL_MakeCurrent(window, gl_context); SDL_GL_SetSwapInterval(1); @@ -249,7 +251,7 @@ int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) ImGui::SetNextWindowPos({}, ImGuiCond_Always); ImGui::SetNextWindowSize({static_cast(windowWidth), static_cast(windowHeight)}, ImGuiCond_Always); - ImGui::Begin("Hitman Audio Tool", nullptr, + ImGui::Begin(G1AT_NAME, nullptr, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); if (ImGui::BeginTabBar("##ToolsTab")) diff --git a/src/Precompiled.hpp b/src/Precompiled.hpp index 8ca70dc..3ec1cb6 100644 --- a/src/Precompiled.hpp +++ b/src/Precompiled.hpp @@ -8,7 +8,9 @@ extern "C" { + #include "Precompiled.h" + } #include diff --git a/src/Tests.cpp b/src/Tests.cpp index 5632bd8..3093003 100644 --- a/src/Tests.cpp +++ b/src/Tests.cpp @@ -6,7 +6,7 @@ #include "Precompiled.hpp" -#ifdef HAT_BUILD_TESTS +#ifdef G1AT_BUILD_TESTS namespace { diff --git a/xmake.lua b/xmake.lua index b0d9da7..eeeab46 100644 --- a/xmake.lua +++ b/xmake.lua @@ -95,11 +95,13 @@ package("libsamplerate") package_end() add_requires("libsamplerate 0.2.2", { configs = { shared = true } }) -target("HitmanAudioTool") +target("Glacier1AudioTool") + set_version("1.1.0") + set_rundir("$(projectdir)") add_defines("IMGUI_USER_CONFIG=\""..imguiUserConfig.."\"") - --add_defines("HAT_BUILD_TESTS") + --add_defines("G1AT_BUILD_TESTS") set_kind("binary") @@ -110,10 +112,14 @@ target("HitmanAudioTool") add_headerfiles("src/**.hpp") add_files("src/**.cpp") + set_configvar("G1AT_NAME", "Glacier 1 Audio Tool") + set_configvar("G1AT_DESCRIPTION", "Tool able to read, write, import and export selected Glacier 1 sound-related formats.") + set_configvar("G1AT_HOMEPAGE", "https://github.com/WSSDude/Glacier1AudioTool") + set_configdir("$(buildir)/src/Config") add_configfiles("src/Config.h.in") - - add_headerfiles("$(buildir)/src/Config") + add_includedirs("$(buildir)/src/Config/") + add_headerfiles("$(buildir)/src/Config/**.h") set_pcxxheader("src/Precompiled.hpp")