mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-22 19:00:07 +08:00
update
This commit is contained in:
parent
df2e461084
commit
47bde34671
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@ -58,7 +58,7 @@ jobs:
|
||||
# 先删除所有dSYM文件,减少包的体积
|
||||
sudo find /Users/runner/work/FluentUI/Qt/${{ matrix.qt_ver }}/macos/qml -name "*.dSYM" | xargs rm -r
|
||||
# 拷贝依赖
|
||||
sudo macdeployqt bin/release/${targetName}.app -qmldir=. -dmg
|
||||
sudo macdeployqt bin/Release/${targetName}.app -qmldir=. -dmg
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
2
.github/workflows/ubuntu.yml
vendored
2
.github/workflows/ubuntu.yml
vendored
@ -74,7 +74,7 @@ jobs:
|
||||
# make sure Qt plugin finds QML sources so it can deploy the imported files
|
||||
export QML_SOURCES_PATHS=./
|
||||
# 拷贝依赖
|
||||
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/release/${targetName} --appdir bin/release/
|
||||
linuxdeploy-x86_64.AppImage --plugin=qt --output=appimage --create-desktop-file --icon-file=${targetName}.svg --executable=bin/Release/${targetName} --appdir bin/release/
|
||||
mv ${{ env.targetName }}-*.AppImage ${{ env.targetName }}.AppImage
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
|
@ -12,11 +12,7 @@ if(FLUENTUI_BUILD_STATIC_LIB)
|
||||
endif()
|
||||
|
||||
#设置可执行文件输出目录
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||
else()
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||
endif()
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
|
||||
|
||||
if(APPLE)
|
||||
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
|
||||
@ -135,8 +131,8 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
#复制FluentUI源码到运行目录下,用于脚手架生成
|
||||
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/source)
|
||||
file(COPY ${CMAKE_SOURCE_DIR}/src/ DESTINATION ${APPLICATION_DIR_PATH}/source)
|
||||
file(MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/source/)
|
||||
file(COPY ${CMAKE_SOURCE_DIR}/src/ DESTINATION ${APPLICATION_DIR_PATH}/source/)
|
||||
|
||||
if(QT_VERSION VERSION_GREATER_EQUAL "6.2")
|
||||
#如果是Qt6.2以上,则使用qt_add_qml_module添加资源文件
|
||||
|
@ -207,5 +207,6 @@
|
||||
<file>res/template/src/main.qml.in</file>
|
||||
<file>res/template/src/qml.qrc.in</file>
|
||||
<file>res/template/src/zh_CN.ts.in</file>
|
||||
<file>res/template/src/README.md.in</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -9,16 +9,12 @@ set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(APPLICATION_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||
else()
|
||||
set(APPLICATION_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||
endif()
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE})
|
||||
|
||||
if(APPLE)
|
||||
set(APPLICATION_REAL_PATH ${APPLICATION_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
|
||||
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}.app/Contents/MacOS)
|
||||
else()
|
||||
set(APPLICATION_REAL_PATH ${APPLICATION_OUTPUT_DIRECTORY})
|
||||
set(APPLICATION_DIR_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
endif()
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
|
||||
@ -27,13 +23,13 @@ find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)
|
||||
find_program(QT_LUPDATE NAMES lupdate)
|
||||
find_program(QT_LRELEASE NAMES lrelease)
|
||||
file(GLOB TS_FILE_PATHS ${CMAKE_CURRENT_LIST_DIR}/ *.ts)
|
||||
add_custom_target(UpdateTranslations
|
||||
add_custom_target(Script-UpdateTranslations
|
||||
COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
COMMAND ${QT_LUPDATE} ${CMAKE_CURRENT_LIST_DIR} -ts ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_en_US.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
COMMAND ${QT_LRELEASE} ${PROJECT_NAME}_zh_CN.ts WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APPLICATION_REAL_PATH}/i18n
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_NAME}_en_US.qm ${PROJECT_NAME}_zh_CN.qm ${APPLICATION_REAL_PATH}/i18n
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${APPLICATION_DIR_PATH}/i18n
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_NAME}_en_US.qm ${PROJECT_NAME}_zh_CN.qm ${APPLICATION_DIR_PATH}/i18n
|
||||
SOURCES ${TS_FILE_PATHS}
|
||||
)
|
||||
|
||||
@ -53,12 +49,7 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
add_dependencies(${PROJECT_NAME} UpdateTranslations)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${APPLICATION_OUTPUT_DIRECTORY}"
|
||||
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${APPLICATION_OUTPUT_DIRECTORY}"
|
||||
)
|
||||
add_dependencies(${PROJECT_NAME} Script-UpdateTranslations)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Core
|
||||
@ -86,3 +77,28 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_import_qml_plugins(${PROJECT_NAME})
|
||||
qt_finalize_executable(${PROJECT_NAME})
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES "Release")
|
||||
if (APPLE)
|
||||
find_program(QT_DEPLOY_QT NAMES macdeployqt)
|
||||
add_custom_target(Script-DeployRelease
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
|
||||
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/%1 -qmldir=${CMAKE_CURRENT_LIST_DIR}
|
||||
COMMENT "Deploying Qt Dependencies After Build........."
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/README.md
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
endif()
|
||||
if(WIN32)
|
||||
find_program(QT_DEPLOY_QT NAMES windeployqt)
|
||||
add_custom_target(Script-DeployRelease
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/dist
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR}/dist
|
||||
COMMAND ${QT_DEPLOY_QT} ${CMAKE_SOURCE_DIR}/dist/%1.exe -qmldir=${CMAKE_CURRENT_LIST_DIR}
|
||||
COMMENT "Deploying Qt Dependencies After Build........."
|
||||
SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/README.md
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -104,5 +104,6 @@ void InitalizrHelper::generate(const QString& name,const QString& path){
|
||||
copyFile(":/example/res/template/src/App.qml.in",projectDir.filePath("src/App.qml"));
|
||||
copyFile(":/example/res/template/src/qml.qrc.in",projectDir.filePath("src/qml.qrc"));
|
||||
copyFile(":/example/res/template/src/logo.ico.in",projectDir.filePath("src/logo.ico"));
|
||||
copyFile(":/example/res/template/src/README.md.in",projectDir.filePath("src/README.md"));
|
||||
return this->success(projectPath);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ function Main() {
|
||||
|
||||
New-Item -ItemType Directory dist
|
||||
# 拷贝exe
|
||||
Copy-Item bin\release\* dist\ -Force -Recurse | Out-Null
|
||||
Copy-Item bin\Release\* dist\ -Force -Recurse | Out-Null
|
||||
# 拷贝依赖
|
||||
windeployqt --qmldir . --plugindir dist\plugins --no-translations --compiler-runtime dist\$targetName
|
||||
# 删除不必要的文件
|
||||
|
@ -27,7 +27,7 @@ function Main() {
|
||||
|
||||
New-Item -ItemType Directory dist
|
||||
# 拷贝exe
|
||||
Copy-Item bin\release\* dist -Force -Recurse | Out-Null
|
||||
Copy-Item bin\Release\* dist -Force -Recurse | Out-Null
|
||||
# 拷贝依赖
|
||||
windeployqt --qmldir . --plugindir dist\plugins --no-translations --compiler-runtime dist\$targetName
|
||||
# 删除不必要的文件
|
||||
|
Loading…
Reference in New Issue
Block a user