Skip to content

Commit

Permalink
chore: 多平台编译
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Porter committed Jul 7, 2024
1 parent c5c95f5 commit 4eac55f
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 15 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/without-sdk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build

on:
push:
branches:
- without-aws
#可以手动触发
workflow_dispatch:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest]
build-type: [Debug, Release]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive

- name: Setup Qt
if: matrix.os == 'windows-latest'
uses: jurplel/install-qt-action@v4
with:
version: '6.7.2'
target: 'desktop'
arch: 'win64_mingw'
cache: true

- name: Setup Qt
if: matrix.os == 'ubuntu-latest'
uses: jurplel/install-qt-action@v4
with:
version: '6.7.2'
target: 'desktop'
arch: 'linux_gcc_64'
cache: true

- uses: lukka/get-cmake@latest

- name: Run CMake
run: |
cmake -B build -S . -G Ninja -DCMAKE_PREFIX_PATH=$env:QTDIR -DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
cmake --build build --config ${{ matrix.build-type }} --parallel 32
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: build/${{ matrix.build-type }}
name: ${{ matrix.build-type }}-${{ runner.os }}

- name: Use windeployqt
if: matrix.os == 'windows-latest'
run: |
windeployqt.exe build/${{ matrix.build-type }}/QSyncUi.exe
- name: Upload artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
path: build/${{ matrix.build-type }}
name: ${{ matrix.build-type }}-deployed


- name: Compress artifacts
if: startsWith(github.ref, 'refs/tags/')
run: |
7z a build/${{ matrix.build-type }}.7z build/${{ matrix.build-type }}
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
body_path: ext/${{github.ref_name}}-CHANGELOG

- name: Upload Release Asset
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
build/${{ matrix.build-type }}-${{runner.os}}.7z
18 changes: 9 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(WINDOWS_BUILD ${MSVC})
#set(WINDOWS_BUILD ${MSVC})
set(SERVICE_COMPONENTS s3)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

if (WINDOWS_BUILD) # Set the location where CMake can find the installed libraries for the AWS SDK.
message(STATUS "CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")
message(STATUS "SYSTEM_MODULE_PATH: ${SYSTEM_MODULE_PATH}")
string(REPLACE ";" "/aws;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws")
list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
message(STATUS "SYSTEM_MODULE_PATH: ${SYSTEM_MODULE_PATH}")
endif ()
#if (WINDOWS_BUILD) # Set the location where CMake can find the installed libraries for the AWS SDK.
# message(STATUS "CMAKE_SYSTEM_PREFIX_PATH: ${CMAKE_SYSTEM_PREFIX_PATH}")
# message(STATUS "SYSTEM_MODULE_PATH: ${SYSTEM_MODULE_PATH}")
# string(REPLACE ";" "/aws;" SYSTEM_MODULE_PATH "${CMAKE_SYSTEM_PREFIX_PATH}/aws")
# list(APPEND CMAKE_PREFIX_PATH ${SYSTEM_MODULE_PATH})
# message(STATUS "SYSTEM_MODULE_PATH: ${SYSTEM_MODULE_PATH}")
#endif ()
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets Core Network Sql)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Core Network Sql)
# Find the AWS SDK for C++ package.
find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})
#find_package(AWSSDK REQUIRED COMPONENTS ${SERVICE_COMPONENTS})
message(STATUS "CMAKE: ${CMAKE_CURRENT_BINARY_DIR}")
if (WINDOWS_BUILD AND AWSSDK_INSTALL_AS_SHARED_LIBS)
# Copy relevant AWS SDK for C++ libraries into the current binary directory for running and debugging.
Expand Down
3 changes: 2 additions & 1 deletion awsutils.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <aws/core/Aws.h>
/*#include <aws/core/Aws.h>
#include "awsutils.h"
AWSUtils::AWSUtils()
Expand All @@ -12,3 +12,4 @@ AWSUtils::~AWSUtils()
{
Aws::ShutdownAPI(options);
}
*/
10 changes: 5 additions & 5 deletions awsutils.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef AWSUTILS_H
#define AWSUTILS_H

/*
#include <QObject>
#include <aws/core/Aws.h>
#include <aws/core/auth/AWSCredentialsProvider.h>
#include <aws/s3/S3Client.h>
//#include <aws/core/Aws.h>
//#include <aws/core/auth/AWSCredentialsProvider.h>
//#include <aws/s3/S3Client.h>
//using namespace Aws;
//using namespace Aws::Auth;
Expand All @@ -31,5 +31,5 @@ class AWSUtils : public QObject
};
~AWSUtils();
};

*/
#endif // AWSUTILS_H

0 comments on commit 4eac55f

Please sign in to comment.