Skip to content

Commit

Permalink
update cmake version str
Browse files Browse the repository at this point in the history
  • Loading branch information
jared2020 committed Nov 9, 2020
1 parent 354a747 commit fc070bb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 26 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if (NOT CMAKE_BUILD_TYPE)
endif()
message("Build Type " ${CMAKE_BUILD_TYPE})


set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
Expand Down
15 changes: 8 additions & 7 deletions cmake/taoVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@ if (OUTPUT)
string(SUBSTRING ${OUTPUT} 0 10 REVISION)
endif()
message("REVISION ${REVISION}")
add_definitions(TaoREVISION=${REVISION})
add_definitions(TaoREVISION="\"${REVISION}\"")
add_compile_definitions(TaoREVISION=${REVISION})
add_compile_definitions(TaoREVISION="${REVISION}")

set (TAG "0.0.0.0")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE TAG)
message("TAG ${TAG}")
add_definitions(TaoVer="\"${TAG}\"")
add_compile_definitions(TaoVer="${TAG}")
string(REPLACE "." ";" VERSION_LIST ${TAG})
list(GET VERSION_LIST 0 TAG_VERSION_MAJOR)
list(GET VERSION_LIST 1 TAG_VERSION_MINOR)
list(GET VERSION_LIST 2 TAG_VERSION_PATCH)
add_definitions(TaoMAJ=${TAG_VERSION_MAJOR})
add_definitions(TaoMIN=${TAG_VERSION_MINOR})
add_definitions(TaoPAT=${TAG_VERSION_PATCH})
add_compile_definitions(TaoMAJ=${TAG_VERSION_MAJOR})
add_compile_definitions(TaoMIN=${TAG_VERSION_MINOR})
add_compile_definitions(TaoPAT=${TAG_VERSION_PATCH})

string(TIMESTAMP DateTime "%Y-%m-%d %H:%M")
add_definitions(TaoDATETIME="\"${DateTime}\"")
add_compile_definitions(TaoDATETIME="${DateTime}")
add_compile_definitions(CXX_COMPILER_ID="${CMAKE_CXX_COMPILER_ID}")
18 changes: 7 additions & 11 deletions examples/TaoQuickShow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
get_filename_component(TargetName ${CMAKE_CURRENT_SOURCE_DIR} NAME)


find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Quick QuickControls2 REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Quick QuickControls2 REQUIRED)
if(Qt${QT_VERSION_MAJOR}Core_Found)
if (Qt::Core_VERSION VERSION_LESS 5.9.0)
message(FATAL_ERROR "TaoQuick minimum supported Qt5 version is 5.9.0")
else ()
message("Qt::Core_VERSION ${Qt::Core_VERSION}")
endif()
endif(Qt::Core_Found)
message("QT_VERSION ${QT_VERSION}")
if (QT_VERSION VERSION_LESS 5.9.0)
message(FATAL_ERROR "TaoQuick minimum supported Qt5 version is 5.9.0")
endif()

aux_source_directory(./Src SRC1)
aux_source_directory(./Src/DeviceAddTable SRC2)
include(taoVersion)

add_compile_definitions(TaoCommon_NO_LIB)
add_subdirectory(${CMAKE_SOURCE_DIR}/3rdparty ${CMAKE_SOURCE_DIR}/build/3rdparty)
message("TaoCommonPath ${TaoCommonPath}")
message("TaoCommonFiles ${TaoCommonFiles}")
#message("TaoCommonPath ${TaoCommonPath}")
#message("TaoCommonFiles ${TaoCommonFiles}")

include(taoQuick)
message("TaoQuickRes ${TaoQuickRes}")
Expand All @@ -30,7 +26,7 @@ if (CMAKE_BUILD_TYPE MATCHES "Release")
${SRC2}
${TaoCommonFiles}
${Res}
# App.rc
App.rc
${TaoQuickRes}
)
elseif(APPLE)
Expand Down
15 changes: 8 additions & 7 deletions examples/TaoQuickShow/Src/AppInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#include "AppInfo.h"
#include <QQmlContext>
#include <QSysInfo>
#include "Ver-u8.h"
AppInfo::AppInfo(QObject *parent) : QObject(parent)
{
m_appName = VER_PRODUCTNAME_STR;
// m_appVersion = TaoVer;
// m_latestVersion = TaoVer;
// m_buildDateTime = TaoDATETIME;
// m_buildRevision = TaoREVISIONSTR;
// m_copyRight = VER_LEGALCOPYRIGHT_STR;
// m_descript = QString::fromLocal8Bit(VER_FILEDESCRIPTION_STR);
// m_compilerVendor = TaoCompilerVendor;
m_appVersion = TaoVer;
m_latestVersion = TaoVer;
m_buildDateTime = TaoDATETIME;
m_buildRevision = TaoREVISIONSTR;
m_copyRight = VER_LEGALCOPYRIGHT_STR;
m_descript = QString::fromLocal8Bit(VER_FILEDESCRIPTION_STR);
m_compilerVendor = QString("%1(%2 %3)").arg(QT_VERSION_STR).arg(CXX_COMPILER_ID).arg(QSysInfo::buildCpuArchitecture());
}

void AppInfo::beforeUiReady(QQmlContext *ctx)
Expand Down
2 changes: 1 addition & 1 deletion mkspecs/features/taoVersion.prf
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ defineTest(setTaoVersion) {
DEFINES += TaoMIN=$${MIN}
DEFINES += TaoPAT=$${PAT}
DEFINES += TaoDATETIME=\"\\\"$${_DATE_}\\\"\"
DEFINES += TaoCompilerVendor=\"\\\"$${QT_VERSION} $${QMAKE_PLATFORM} $${QMAKE_COMPILER} $${QMAKE_TARGET.arch}\\\"\"
DEFINES += CXX_COMPILER_ID=\"\\\"$${QMAKE_COMPILER}\\\"\"

export(CONFIG)
export(VER_MAJ)
Expand Down

0 comments on commit fc070bb

Please sign in to comment.