diff options
author | Saturneric <[email protected]> | 2021-06-20 17:34:27 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-06-20 17:34:27 +0000 |
commit | 510ae2fd8b21d2eab0dea88a738b165e9eae29e8 (patch) | |
tree | d37805cf808e005c492b36d80bc496e7de623221 | |
parent | Repair and improve the internationalization structure. (diff) | |
parent | Fix cmake.yml For Windows Build (diff) | |
download | GpgFrontend-510ae2fd8b21d2eab0dea88a738b165e9eae29e8.tar.gz GpgFrontend-510ae2fd8b21d2eab0dea88a738b165e9eae29e8.zip |
Merge branch 'main' of ssh://tunnel.bktus.com:30412/Saturneric/GPGFrontend into develop
Conflicts:
include/GpgFrontend.h
src/CMakeLists.txt
-rw-r--r-- | .github/workflows/cmake.yml | 97 | ||||
-rw-r--r-- | CMakeLists.txt | 19 |
2 files changed, 114 insertions, 2 deletions
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 00000000..143afd94 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,97 @@ +name: Build and Upload Binary Package + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + EXECUTABLE_OUTPUT_PATH: ./ + +jobs: + build: + strategy: + matrix: + os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Install Dependence (Linux) + run: | + sudo apt-get update + sudo apt-get -y install build-essential binutils git autoconf automake + sudo apt-get -y install gcc g++ + sudo apt-get -y install libgpgme-dev gpg + if: matrix.os == 'ubuntu-latest' + + - name: Install Dependence (macOS) + run: | + brew install cmake git autoconf automake qt@5 + if: matrix.os == 'macos-latest' + + - name: Install Qt + uses: jurplel/install-qt-action@v2 + if: matrix.os == 'ubuntu-latest' + + - name: Set up MinGW (Windows) + uses: msys2/setup-msys2@v2 + with: + install: git msys2-devel base-devel binutils pactoys-git mercurial cvs wget p7zip perl ruby mingw-w64-x86_64-toolchain + update: true + if: matrix.os == 'windows-latest' + + - name: Set up Dependence (Windows) + shell: msys2 {0} + run: | + pacman --noconfirm -Syu cmake autoconf automake mingw-w64-x86_64-qt-creator + if: matrix.os == 'windows-latest' + + - name: Set up Python3.8 (Windows) + uses: actions/setup-python@v2 + with: + python-version: '3.8' + if: matrix.os == 'windows-latest' + + - name: Build GpgME + run: | + git clone https://github.com/gpg/gpgme + cd gpgme + ./autogen.sh + ./configure && make -j2 + sudo make install + cd .. + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DEXECUTABLE_OUTPUT_PATH=${{env.EXECUTABLE_OUTPUT_PATH}} + + - name: Build GpgFrontend + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- -j 2 + + - name: Upload Artifact(Linux) + uses: actions/upload-artifact@master + with: + name: gpgfrontend-linux-release + path: ${{github.workspace}}/build/release/* + if: matrix.os == 'ubuntu-latest' + + - name: Upload Artifact(macOS) + uses: actions/upload-artifact@master + with: + name: gpgfrontend-macos-release + path: ${{github.workspace}}/build/release/* + if: matrix.os == 'macos-latest' + + - name: Upload Artifact(Windows) + uses: actions/upload-artifact@master + with: + name: gpgfrontend-windows-release + path: ${{github.workspace}}/build/release/* + if: matrix.os == 'windows-latest' diff --git a/CMakeLists.txt b/CMakeLists.txt index 37ad7c6e..cdfceaae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,17 +4,32 @@ project(GpgFrontend VERSION 1.0.0 LANGUAGES CXX) message(STATUS "GPGFrontend Build Configuration Started CMAKE Version ${CMAKE_VERSION}") +# C++ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) +# Qt set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +# Check Env Variables Before Configuring + +if(NOT DEFINED ENV{CMAKE_BUILD_TYPE}) + set(CMAKE_BUILD_TYPE "Release") +endif() + +if(NOT DEFINED ENV{EXECUTABLE_OUTPUT_PATH}) + set(EXECUTABLE_OUTPUT_PATH "./") +endif() + +# Output Env Variables +message(STATUS "Define EXECUTABLE_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}") +message(STATUS "Define CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}") if(${CMAKE_BUILD_TYPE} STREQUAL "Release") message(STATUS "Build Type RELEASE") @@ -74,7 +89,7 @@ endif() if(APPLE) - message(STATUS, "Configuration For OS Platform MacOS") + message(STATUS "Configuration For OS Platform MacOS") set(ENV{Qt5_DIR} /usr/local/opt/qt5/lib/cmake) |