From cbbf570fae2505ae691b330d9033f43fdde0db20 Mon Sep 17 00:00:00 2001 From: Sergey Yagovtsev Date: Sun, 4 Dec 2016 16:40:00 +0300 Subject: [PATCH] Define EASY_PRODUCT_VERSION by concatenating major, minor and patch strings --- easy_profiler_core/CMakeLists.txt | 13 +++++++++---- easy_profiler_core/profile_manager.cpp | 5 +++++ easy_profiler_core/resources.rc | 8 ++++++++ profiler_gui/resources.rc | 8 ++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/easy_profiler_core/CMakeLists.txt b/easy_profiler_core/CMakeLists.txt index a5ad4ea..599946c 100644 --- a/easy_profiler_core/CMakeLists.txt +++ b/easy_profiler_core/CMakeLists.txt @@ -33,7 +33,7 @@ set(INCLUDE_FILES source_group(include FILES ${INCLUDE_FILES}) -if(NOT DEFINED EASY_PRODUCT_VERSION_STRING) +if(NOT DEFINED EASY_PROGRAM_VERSION_MAJOR) file (STRINGS ${CMAKE_CURRENT_LIST_DIR}/version.info EASY_PRODUCT_VERSION_STRING) string(REPLACE "." ";" VERSION_LIST ${EASY_PRODUCT_VERSION_STRING}) @@ -50,16 +50,21 @@ if(NOT DEFINED EASY_PRODUCT_VERSION_STRING) -DEASY_PROFILER_VERSION_MAJOR=${EASY_PROGRAM_VERSION_MAJOR} -DEASY_PROFILER_VERSION_MINOR=${EASY_PROGRAM_VERSION_MINOR} -DEASY_PROFILER_VERSION_PATCH=${EASY_PROGRAM_VERSION_PATCH} - -DEASY_PROFILER_PRODUCT_VERSION=\"v${EASY_PRODUCT_VERSION_STRING}\" ) # EasyProfiler version set(EASY_PROGRAM_VERSION_MAJOR ${EASY_PROGRAM_VERSION_MAJOR} PARENT_SCOPE) set(EASY_PROGRAM_VERSION_MINOR ${EASY_PROGRAM_VERSION_MINOR} PARENT_SCOPE) set(EASY_PROGRAM_VERSION_PATCH ${EASY_PROGRAM_VERSION_PATCH} PARENT_SCOPE) - set(EASY_PRODUCT_VERSION_STRING ${EASY_PRODUCT_VERSION_STRING} PARENT_SCOPE) -endif(NOT DEFINED EASY_PRODUCT_VERSION_STRING) +endif(NOT DEFINED EASY_PROGRAM_VERSION_MAJOR) + +if(WIN32) + add_definitions( + -D_CRT_SECURE_NO_WARNINGS + ) +endif(WIN32) + set(SOURCES ${CPP_FILES} diff --git a/easy_profiler_core/profile_manager.cpp b/easy_profiler_core/profile_manager.cpp index e06d53b..fbdd8ef 100644 --- a/easy_profiler_core/profile_manager.cpp +++ b/easy_profiler_core/profile_manager.cpp @@ -47,6 +47,7 @@ #include "event_trace_win.h" #include "current_time.h" + #ifndef _WIN32 #include #endif @@ -66,6 +67,10 @@ using namespace profiler; # endif #endif +#define EASY_PROFILER_PRODUCT_VERSION "v" EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MAJOR) "." \ + EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MINOR) "." \ + EASY_STRINGIFICATION(EASY_PROFILER_VERSION_PATCH) + # define EASY_VERSION_INT(v_major, v_minor, v_patch) ((static_cast(v_major) << 24) | (static_cast(v_minor) << 16) | static_cast(v_patch)) extern const uint32_t PROFILER_SIGNATURE = ('E' << 24) | ('a' << 16) | ('s' << 8) | 'y'; extern const uint32_t EASY_CURRENT_VERSION = EASY_VERSION_INT(EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH); diff --git a/easy_profiler_core/resources.rc b/easy_profiler_core/resources.rc index cc767b8..a656eca 100644 --- a/easy_profiler_core/resources.rc +++ b/easy_profiler_core/resources.rc @@ -1,4 +1,12 @@ 1 VERSIONINFO + +# define EASY_STRINGIFY(a) #a +# define EASY_STRINGIFICATION(a) EASY_STRINGIFY(a) + +#define EASY_PROFILER_PRODUCT_VERSION "v" EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MAJOR) "." \ + EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MINOR) "." \ + EASY_STRINGIFICATION(EASY_PROFILER_VERSION_PATCH) + FILEVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH PRODUCTVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH BEGIN diff --git a/profiler_gui/resources.rc b/profiler_gui/resources.rc index e1254ce..898eaf6 100644 --- a/profiler_gui/resources.rc +++ b/profiler_gui/resources.rc @@ -2,6 +2,14 @@ IDI_ICON1 ICON DISCARDABLE "icons/logo.ico" 1 VERSIONINFO FILEVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH PRODUCTVERSION EASY_PROFILER_VERSION_MAJOR, EASY_PROFILER_VERSION_MINOR, EASY_PROFILER_VERSION_PATCH + +# define EASY_STRINGIFY(a) #a +# define EASY_STRINGIFICATION(a) EASY_STRINGIFY(a) + +#define EASY_PROFILER_PRODUCT_VERSION "v" EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MAJOR) "." \ + EASY_STRINGIFICATION(EASY_PROFILER_VERSION_MINOR) "." \ + EASY_STRINGIFICATION(EASY_PROFILER_VERSION_PATCH) + BEGIN BLOCK "StringFileInfo" BEGIN