Skip to content

Commit

Permalink
Get version from version.hpp, bump to v1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitalita committed Sep 29, 2023
1 parent 6fc7f7d commit 5853ec1
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
18 changes: 16 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
cmake_policy(SET CMP0048 NEW) # VERSION variables
cmake_policy(SET CMP0091 NEW) # CMAKE_MSVC_RUNTIME_LIBRARY

# Get the version number from Decompiler/Version.hpp
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/Decompiler/Version.hpp" CHAMPOLLION_VERSION_FILE)
string(REGEX MATCH "define CHAMPOLLION_VERSION_MAJOR ([0-9]*)" _ ${CHAMPOLLION_VERSION_FILE})
math(EXPR CHAMPOLLION_VERSION_MAJOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "define CHAMPOLLION_VERSION_MINOR ([0-9]*)" _ ${CHAMPOLLION_VERSION_FILE})
math(EXPR CHAMPOLLION_VERSION_MINOR "${CMAKE_MATCH_1}")
string(REGEX MATCH "define CHAMPOLLION_VERSION_PATCH ([0-9]*)" _ ${CHAMPOLLION_VERSION_FILE})
math(EXPR CHAMPOLLION_VERSION_PATCH "${CMAKE_MATCH_1}")
#Get the Champollion version as a semver number literal, not as a string
set(CHAMPOLLION_VERSION ${CHAMPOLLION_VERSION_MAJOR}.${CHAMPOLLION_VERSION_MINOR}.${CHAMPOLLION_VERSION_PATCH})

message(STATUS "Champollion version: ${CHAMPOLLION_VERSION}")

# package information
set(PACKAGE_NAME "Champollion")
set(PACKAGE_VERSION "1.1.3")
set(PACKAGE_VERSION "${CHAMPOLLION_VERSION}")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/Orvid/champollion/issues")
Expand All @@ -13,7 +27,7 @@ if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
CACHE STRING "")
endif()

project(${PACKAGE_NAME} VERSION 1.1.3 LANGUAGES CXX)
project(${PACKAGE_NAME} VERSION ${PACKAGE_VERSION} LANGUAGES CXX)
include(GNUInstallDirs)


Expand Down
3 changes: 2 additions & 1 deletion Champollion/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace fs = std::filesystem;
#include "Decompiler/PscCoder.hpp"

#include "Decompiler/StreamWriter.hpp"
#include "Decompiler/Version.hpp"
#include "glob.hpp"

struct Params
Expand Down Expand Up @@ -69,7 +70,7 @@ OptionsResult getProgramOptions(int argc, char* argv[], Params& params)
params.assemblyDir = fs::current_path();
params.papyrusDir = fs::current_path();

std::string version_string = "Champollion PEX decompiler v1.3.1";
std::string version_string = "Champollion PEX decompiler " + std::string(CHAMPOLLION_VERSION_STRING);
options::options_description desc(version_string);
desc.add_options()
("help,h", "Display the help message")
Expand Down
4 changes: 2 additions & 2 deletions Decompiler/PscCoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <regex>

#include "PscDecompiler.hpp"

#include "Version.hpp"
#include "EventNames.hpp"

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ void Decompiler::PscCoder::writeHeader(const Pex::Binary &pex)
{
auto& header = pex.getHeader();
auto& debug = pex.getDebugInfo();
write(";/ Decompiled by Champollion V1.1.3"); // TODO: Make this get the version number dynamically
write(";/ Decompiled by Champollion " + std::string(CHAMPOLLION_VERSION_STRING));
write(indent(0) << "PEX format v" << (int)header.getMajorVersion() << "." << (int)header.getMinorVersion() << " GameID: " << header.getGameID());
write(indent(0) << "Source : " << header.getSourceFileName());
if (debug.getModificationTime() != 0)
Expand Down
10 changes: 10 additions & 0 deletions Decompiler/Version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#define CHAMPOLLION_VERSION_MAJOR 1
#define CHAMPOLLION_VERSION_MINOR 3
#define CHAMPOLLION_VERSION_PATCH 2

#define MAKE_STR_HELPER(a_str) #a_str
#define MAKE_STR(a_str) MAKE_STR_HELPER(a_str)

#define CHAMPOLLION_VERSION_STRING "v" MAKE_STR(CHAMPOLLION_VERSION_MAJOR) "." MAKE_STR(CHAMPOLLION_VERSION_MINOR) "." MAKE_STR(CHAMPOLLION_VERSION_PATCH)
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/master/docs/vcpkg.schema.json",
"name": "champollion",
"version-semver": "1.1.3",
"version-semver": "1.3.2",
"port-version": 0,
"description": "Papyrus Script Decompiler.",
"homepage": "https://github.com/Orvid/Champollion",
Expand Down

0 comments on commit 5853ec1

Please sign in to comment.