mirror of
https://github.com/x-tools-author/x-tools.git
synced 2025-09-15 15:28:40 +08:00
chore: update files of project
This commit is contained in:
parent
174105ba67
commit
b4ee213de2
@ -8,6 +8,8 @@ add_compile_definitions(SAK_AUTHOR_EMAIL="qsaker@foxmail.com")
|
||||
add_compile_definitions(SAK_GITEE_REPOSITORY_URL="https://gitee.com/qsaker/QtSwissArmyKnife")
|
||||
add_compile_definitions(SAK_GITHUB_REPOSITORY_URL="https://github.com/qsaker/QtSwissArmyKnife")
|
||||
|
||||
set(SAK_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/sak)
|
||||
|
||||
# Set the suffix of the library.
|
||||
if(${CMAKE_BUILD_TYPE} STREQUAL "Release")
|
||||
|
||||
@ -48,9 +50,18 @@ macro(sak_find_qt_package modules)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${modules})
|
||||
endmacro()
|
||||
|
||||
function(sak_copy_glog target)
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_FILE:glog::glog>
|
||||
${SAK_RUNTIME_OUTPUT_DIRECTORY}/${target}/$<TARGET_FILE_NAME:glog::glog>)
|
||||
endfunction()
|
||||
|
||||
# Add executable. It can be used by Qt5 and Qt6.
|
||||
function(sak_add_executable target sources)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/sak/${target}")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SAK_RUNTIME_OUTPUT_DIRECTORY}/${target}")
|
||||
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
||||
qt_add_executable(${target} MANUAL_FINALIZATION)
|
||||
else()
|
||||
@ -67,6 +78,8 @@ function(sak_add_executable target sources)
|
||||
target_sources(${target} PRIVATE ${ARGV${INDEX}})
|
||||
endwhile()
|
||||
|
||||
sak_copy_glog(${target})
|
||||
|
||||
if(QT_VERSION_MAJOR EQUAL 6)
|
||||
qt_finalize_executable(${target})
|
||||
endif()
|
||||
@ -81,3 +94,15 @@ function(sak_set_target_properties target)
|
||||
TRUE WIN32_EXECUTABLE
|
||||
TRUE)
|
||||
endfunction()
|
||||
|
||||
function(sak_tar_target target)
|
||||
string(TOLOWER ${target} lower_target)
|
||||
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} lower_system_name)
|
||||
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} lower_system_processor)
|
||||
set(TAR_FILE_NAME ${lower_target}-${lower_system_name}-${lower_system_processor})
|
||||
add_custom_command(
|
||||
TARGET ${target}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E tar "cf" ${TAR_FILE_NAME}.zip --format=zip ${target}
|
||||
WORKING_DIRECTORY ${SAK_RUNTIME_OUTPUT_DIRECTORY})
|
||||
endfunction()
|
||||
31
.github/workflows/build-daily.yml
vendored
31
.github/workflows/build-daily.yml
vendored
@ -1,5 +1,7 @@
|
||||
name: build-daily
|
||||
on: push
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
jobs:
|
||||
new-release:
|
||||
@ -11,8 +13,6 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
- name: Delete old release
|
||||
uses: liudonghua123/delete-release-action@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
release_name: 'continuous'
|
||||
- name: Create Release
|
||||
@ -20,4 +20,29 @@ jobs:
|
||||
with:
|
||||
tag: 'continuous'
|
||||
allowUpdates: true
|
||||
|
||||
build-for-windows:
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Qt
|
||||
uses: jurplel/install-qt-action@v3
|
||||
with:
|
||||
version: '6.5.3'
|
||||
target: 'desktop'
|
||||
arch: 'win64_msvc2019_64'
|
||||
dir: ${{ github.workspace }}
|
||||
modules: 'qtcharts qtserialbus qtserialport qtwebsockets'
|
||||
- name: Build for Windows
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
|
||||
cmake -DCMAKE_PREFIX_PATH='${{ github.workspace }}/Qt/6.5.3/win64_msvc2019_64/lib/cmake/Qt6' -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ../
|
||||
nmake
|
||||
- name: Upload Release Asset for Windnows
|
||||
uses: Shopify/upload-to-release@v1
|
||||
with:
|
||||
name: 'continuous'
|
||||
path: 'build/sak/qtswissarmyknife-windows-amd64.zip'
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -150,20 +150,21 @@ if(SAK_IMPORT_MODULE_BLUETOOTH)
|
||||
include_directories(src/optional/bluetooth)
|
||||
endif()
|
||||
|
||||
sak_add_executable("SwissArmyKnife" ${SAK_APP_SOURCES})
|
||||
sak_auto_execute_deployqt(SwissArmyKnife)
|
||||
sak_set_target_properties(SwissArmyKnife)
|
||||
sak_add_executable("QtSwissArmyKnife" ${SAK_APP_SOURCES})
|
||||
sak_auto_execute_deployqt(QtSwissArmyKnife)
|
||||
sak_tar_target(QtSwissArmyKnife)
|
||||
sak_set_target_properties(QtSwissArmyKnife)
|
||||
target_link_libraries(
|
||||
SwissArmyKnife
|
||||
QtSwissArmyKnife
|
||||
PRIVATE glog::glog Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::WebSockets
|
||||
Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::SerialPort
|
||||
Qt${QT_VERSION_MAJOR}::SerialBus)
|
||||
if(SAK_IMPORT_MODULE_BLUETOOTH)
|
||||
target_link_libraries(SwissArmyKnife PRIVATE Qt${QT_VERSION_MAJOR}::Bluetooth)
|
||||
target_link_libraries(QtSwissArmyKnife PRIVATE Qt${QT_VERSION_MAJOR}::Bluetooth)
|
||||
endif()
|
||||
|
||||
install(
|
||||
TARGETS SwissArmyKnife
|
||||
TARGETS QtSwissArmyKnife
|
||||
BUNDLE DESTINATION .
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user