This commit is contained in:
zhuzihcu
2023-04-27 15:43:45 +08:00
parent a258d429c2
commit afeb6daea5
7 changed files with 106 additions and 6 deletions

View File

@ -5,6 +5,9 @@ project(example VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#设置版本号
add_definitions(-DVERSION=1,2,9,0)
#获取文件路径分隔符(解决执行命令的时候有些平台会报错)
file(TO_CMAKE_PATH "/" PATH_SEPARATOR)
@ -39,9 +42,16 @@ foreach(filepath ${RES_PATHS})
endforeach(filepath)
#添加可执行文件
qt_add_executable(example
${sources_files}
)
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
qt_add_executable(example
${sources_files}
example.rc
)
else ()
qt_add_executable(example
${sources_files}
)
endif ()
#复制动态库到可执行文件同级目录下
if(WIN32)

42
example/example.rc Normal file
View File

@ -0,0 +1,42 @@
#include <windows.h>
IDI_ICON1 ICON "favicon.ico"
#define STR(x) #x
#define VER_JOIN(a,b,c,d) STR(a.b.c.d)
#define VER_JOIN_(x) VER_JOIN x
#define VER_STR VER_JOIN_((VERSION))
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION
PRODUCTVERSION VERSION
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "Comments", "Built by the FluentUI."
VALUE "CompanyName", "zhuzichu"
VALUE "FileDescription", "example"
VALUE "FileVersion", VER_STR
VALUE "InternalName", ""
VALUE "LegalCopyright", "Copyright (C) 2023"
VALUE "OriginalFilename", ""
VALUE "ProductName", "example"
VALUE "ProductVersion", VER_STR
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

BIN
example/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

View File

@ -1,11 +1,17 @@
#include "AppInfo.h"
#include "lang/En.h"
#include "lang/Zh.h"
#include <QDebug>
#define STR(x) #x
#define VER_JOIN(a,b,c,d) STR(a.b.c.d)
#define VER_JOIN_(x) VER_JOIN x
#define VER_STR VER_JOIN_((VERSION))
AppInfo::AppInfo(QObject *parent)
: QObject{parent}
{
version("1.2.8");
version(VER_STR);
lang(new En());
}