Skip to content

Commit

Permalink
FIX: deploy.sh modify version bug
Browse files Browse the repository at this point in the history
  • Loading branch information
KangLin committed Feb 23, 2024
1 parent 46e7250 commit 9aeed5a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 57 deletions.
37 changes: 37 additions & 0 deletions App/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,40 @@ ADD_TARGET(NAME ${PROJECT_NAME}
RABBITCOMMON
VERSION ${SerialPortAssistant_VERSION}
)

INSTALL(FILES ${CMAKE_SOURCE_DIR}/etc/SerialPortAssistant_logqt.ini
DESTINATION etc COMPONENT Runtime)

iF(WIN32)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/Install/Install.nsi
DESTINATION "${CMAKE_BINARY_DIR}"
COMPONENT Runtime)
endif()
# Install other files
set(OTHER_FILES
${CMAKE_SOURCE_DIR}/License.md
${CMAKE_SOURCE_DIR}/Authors.md
${CMAKE_SOURCE_DIR}/ChangeLog.md
${CMAKE_SOURCE_DIR}/Authors_zh_CN.md
${CMAKE_SOURCE_DIR}/ChangeLog_zh_CN.md)
if(ANDROID)
INSTALL(FILES ${OTHER_FILES} DESTINATION "assets" COMPONENT Runtime)
else()
INSTALL(FILES ${OTHER_FILES} DESTINATION "." COMPONENT Runtime)
endif()

INSTALL(FILES ${CMAKE_SOURCE_DIR}/App/SerialPortAssistant.ico
DESTINATION "."
COMPONENT Runtime)

if(UNIX AND NOT ANDROID)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/share/SerialPortAssistant.desktop
DESTINATION "share/applications"
COMPONENT Runtime)
INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/share/SerialPortAssistant.sh
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/App/Resource/png/SerialPortAssistant.png
DESTINATION "share/pixmaps"
COMPONENT Runtime)
endif()
7 changes: 1 addition & 6 deletions App/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,7 @@ int main(int argc, char *argv[])
#endif

#ifdef RABBITCOMMON
QString szLocale = CGlobal::Instance()->GetLanguage();
if("Default" == szLocale)
{
szLocale = QLocale::system().name();
}
RabbitCommon::CTools::Instance()->Init(szLocale);
RabbitCommon::CTools::Instance()->Init();
#endif

CMainWindow *w = new CMainWindow();
Expand Down
51 changes: 2 additions & 49 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ project(SerialPortAssistant)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF)
if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()
set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "verbose")

IF(MSVC)
Expand Down Expand Up @@ -44,7 +40,7 @@ SET(CMAKE_AUTORCC ON)

# Need qt components
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
SET(QT_COMPONENTS Core Gui Widgets SerialPort Network Xml)
SET(QT_COMPONENTS Core Gui Widgets SerialPort Network)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ${QT_COMPONENTS})
message("QT_VERSION:${Qt${QT_VERSION_MAJOR}_VERSION}")
if(Qt${QT_VERSION_MAJOR}_FOUND)
Expand All @@ -55,7 +51,7 @@ endif()
get_filename_component(QT_INSTALL_DIR "${Qt${QT_VERSION_MAJOR}_DIR}/../../.." ABSOLUTE)
message("Qt${QT_VERSION_MAJOR}_DIR:${Qt${QT_VERSION_MAJOR}_DIR}")
message("QT_INSTALL_DIR:${QT_INSTALL_DIR}")
message("${PROJECT_NAME} QT_LIBRARIES:${QT_LIBRARIES}")
message("QT_LIBRARIES:${QT_LIBRARIES}")

if(NOT RabbitCommon_DIR)
set(RabbitCommon_DIR $ENV{RabbitCommon_DIR})
Expand All @@ -82,47 +78,4 @@ else()
endif()
endif()

GET_VERSION(OUT_VERSION SerialPortAssistant_VERSION
OUT_REVISION SerialPortAssistant_Revision)
IF(NOT SerialPortAssistant_VERSION)
SET(SerialPortAssistant_VERSION "v0.5.14")
ENDIF()
message("SerialPortAssistant_VERSION:${SerialPortAssistant_VERSION};Revision:${SerialPortAssistant_Revision}")

add_subdirectory(App)

INSTALL(FILES ${CMAKE_SOURCE_DIR}/etc/SerialPortAssistant_logqt.ini
DESTINATION etc COMPONENT Runtime)

iF(WIN32)
INSTALL(FILES Install/Install.nsi DESTINATION "${CMAKE_BINARY_DIR}"
COMPONENT Runtime)
endif()
# Install other files
set(OTHER_FILES
License.md
Authors.md
ChangeLog.md
Authors_zh_CN.md
ChangeLog_zh_CN.md)
if(ANDROID)
INSTALL(FILES ${OTHER_FILES} DESTINATION "assets" COMPONENT Runtime)
else()
INSTALL(FILES ${OTHER_FILES} DESTINATION "." COMPONENT Runtime)
endif()

INSTALL(FILES ${CMAKE_SOURCE_DIR}/App/SerialPortAssistant.ico
DESTINATION "."
COMPONENT Runtime)

if(UNIX AND NOT ANDROID)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/share/SerialPortAssistant.desktop
DESTINATION "share/applications"
COMPONENT Runtime)
INSTALL(PROGRAMS ${CMAKE_SOURCE_DIR}/share/SerialPortAssistant.sh
DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/App/Resource/png/SerialPortAssistant.png
DESTINATION "share/pixmaps"
COMPONENT Runtime)
endif()
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ sed -i "s/SerialPortAssistant_VERSION:.*/SerialPortAssistant_VERSION: \"${VERSIO
#sed -i "s/export VERSION=.*/export VERSION=\"${VERSION}\"/g" ${SOURCE_DIR}/.travis.yml
#sed -i "s/^\ - export VERSION=.*/\ - export VERSION=\"${VERSION}\"/g" ${SOURCE_DIR}/.travis.yml

#sed -i "s/<VERSION>.*</<VERSION>${VERSION}</g" ${SOURCE_DIR}/Update/update.xml
sed -i "s/SET(SerialPortAssistant_VERSION=.*\"v\?[0-9]\+\.[0-9]\+\.[0-9]\+\")/SET(SerialPortAssistant_VERSION \"${VERSION}\")/g" ${SOURCE_DIR}/App/CMakeLists.txt
sed -i "s/SerialPortAssistant_VERSION:.*/SerialPortAssistant_VERSION: ${VERSION}/g" ${SOURCE_DIR}/.github/workflows/build.yml
sed -i "s/SerialPortAssistant_VERSION:.*/SerialPortAssistant_VERSION: ${VERSION}/g" ${SOURCE_DIR}/.github/workflows/msvc.yml
sed -i "s/SerialPortAssistant_VERSION:.*/SerialPortAssistant_VERSION: ${VERSION}/g" ${SOURCE_DIR}/.github/workflows/mingw.yml
sed -i "s/SerialPortAssistant_VERSION:.*/SerialPortAssistant_VERSION: ${VERSION}/g" ${SOURCE_DIR}/.github/workflows/android.yml
sed -i "s/v[0-9]\+\.[0-9]\+\.[0-9]\+/${VERSION}/g" ${SOURCE_DIR}/README*.md
sed -i "s/ \"version\":[[:blank:]]*\"v\?[0-9]\+\.[0-9]\+\.[0-9]\+\"/ \"version\":\"${VERSION}\"/g" ${SOURCE_DIR}/Update/update.json
if [ -f ${SOURCE_DIR}/vcpkg.json ]; then
sed -i "s/\"version-string\":[0-9]\+\.[0-9]\+\.[0-9]\+\".*\"/\"version-string\":\"${DEBIAN_VERSION}\"/g" ${SOURCE_DIR}/vcpkg.json
sed -i "s/^ \"version-string\":\"[0-9]\+\.[0-9]\+\.[0-9]\+\",/ \"version-string\":\"${DEBIAN_VERSION}\",/g" ${SOURCE_DIR}/vcpkg.json
fi

DEBIAN_VERSION=`echo ${VERSION}|cut -d "v" -f 2`
Expand Down

0 comments on commit 9aeed5a

Please sign in to comment.