Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper shared build support #13

Merged
merged 1 commit into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 41 additions & 14 deletions .github/workflows/build-qi-qmp-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,38 @@ jobs:
build-qi-qmp:
name: Build QI-QMP - Linux (Debug/Release)
strategy:
fail-fast: false
matrix:
qt_linkage: [shared, static]
runs-on: ubuntu-20.04
os: [ubuntu-20.04, ubuntu-22.04]
compiler: [gcc, clang]
lib_linkage: [shared, static]
include:
- os: ubuntu-20.04
compiler: gcc
c_comp: gcc-10
cxx_comp: g++-10
qt_comp: clang12
- os: ubuntu-20.04
compiler: clang
c_comp: clang-12
cxx_comp: clang++-12
qt_comp: clang12
- os: ubuntu-22.04
compiler: gcc
c_comp: gcc-12
cxx_comp: g++-12
qt_comp: clang14
- os: ubuntu-22.04
compiler: clang
c_comp: clang-14
cxx_comp: clang++-14
qt_comp: clang14
- lib_linkage: shared
cmake_bsl: ON
- lib_linkage: static
cmake_bsl: OFF
runs-on: ${{ matrix.os }}
env:
c_comp: clang-12
cxx_comp: clang++-12
cmake_gen: Ninja Multi-Config
steps:
- name: Set derived variables with shell because GitHub Actions env context sucks
Expand All @@ -34,8 +60,8 @@ jobs:
with:
version: 6.4.2
os: linux
compiler: clang12
linkage: ${{ matrix.qt_linkage }}
compiler: ${{ matrix.qt_comp }}
linkage: ${{ matrix.lib_linkage }}
path: ${{ env.qt_install_dir }}
credentials: ${{ secrets.qt_ffynnon_cred }}
- name: Install OpenGL lib
Expand All @@ -52,6 +78,9 @@ jobs:
run: sudo apt-get install ninja-build
- name: Install Harfbuzz
run: sudo apt-get install libharfbuzz-dev
- name: Install EGL [22.04]
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get install libegl1-mesa-dev
- name: Checkout QI-QMP
uses: actions/checkout@v3
with:
Expand All @@ -61,27 +90,25 @@ jobs:
working-directory: ${{ env.qi_qmp_src_dir }}
run: |
echo Configuring CMake...
"$qt_cmake" -G "$cmake_gen" -S "$qi_qmp_src_dir" -B "$qi_qmp_build_dir" -D QI_QMP_DOCS=ON -D CMAKE_CXX_COMPILER="$cxx_comp" -D CMAKE_C_COMPILER="$c_comp"
"$qt_cmake" -G "$cmake_gen" -S "$qi_qmp_src_dir" -B "$qi_qmp_build_dir" -D QI_QMP_DOCS=ON -D BUILD_SHARED_LIBS="${{ matrix.cmake_bsl }}" -D CMAKE_CXX_COMPILER="${{ matrix.cxx_comp }}" -D CMAKE_C_COMPILER="${{ matrix.c_comp }}"
echo Changing to build directory...
cd "$qi_qmp_build_dir"
echo Building QI-QMP debug...
echo Building QI-QMP Debug...
cmake --build . --target all --config Debug
echo Building QI-QMP release...
echo Building QI-QMP Release/Docs...
cmake --build . --target all --config Release
echo Building QI-QMP docs...
cmake --build . --target qi_qmp_docs --config Release
echo Installing QI-QMP Debug
cmake --build . --target install --config Debug
cmake --install . --config Debug
echo Installing QI-QMP Release/Docs...
cmake --build . --target install --config Release
cmake --install . --config Release
echo Packaging QI-QMP...
cpack -C "Debug;Release"
echo Build complete.
- name: Get QI-QMP artifact name
id: get_artifact_name
run: |
cpack_name=$(find "${{ env.qi_qmp_package_path }}" -type f -name "*.zip")
artifact_name=$(basename "$cpack_name" .zip)
artifact_name="$(basename "$cpack_name" .zip) [${{ matrix.cxx_comp }}]"
echo "current_artifact_name=$artifact_name" >> $GITHUB_ENV
- name: Upload QI-QMP build artifact
uses: actions/upload-artifact@v3
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/build-qi-qmp-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ jobs:
build-qi-qmp:
name: Build QI-QMP - Windows (Debug/Release)
strategy:
fail-fast: false
matrix:
qt_linkage: [shared, static]
lib_linkage: [shared, static]
include:
- lib_linkage: shared
cmake_bsl: ON
- lib_linkage: static
cmake_bsl: OFF
runs-on: windows-latest
env:
vs_dir: C:/Program Files/Microsoft Visual Studio/2022/Enterprise
Expand All @@ -37,10 +43,10 @@ jobs:
- name: Install Qt (custom build)
uses: oblivioncth/actions/general/install-and-cache-qt-from-ffynnon@dev
with:
version: 6.4.0
version: 6.4.2
os: windows
compiler: msvc2022
linkage: ${{ matrix.qt_linkage }}
linkage: ${{ matrix.lib_linkage }}
path: ${{ env.qt_install_dir }}
credentials: ${{ secrets.qt_ffynnon_cred }}
- name: Install Doxygen & Graphviz
Expand All @@ -59,19 +65,17 @@ jobs:
echo "Setup C++ Build Environment..."
CALL "${{ env.vs_dir }}\Common7\Tools\VsDevCmd.bat" -arch=amd64
echo "Configure CMake using Qt wrapper..."
CALL "${{ env.qt_cmake }}" -G "${{ env.cmake_gen }}" -S "${{ env.qi_qmp_src_dir}}" -B "${{ env.qi_qmp_build_dir }}" -D QI_QMP_DOCS=ON"
CALL "${{ env.qt_cmake }}" -G "${{ env.cmake_gen }}" -S "${{ env.qi_qmp_src_dir}}" -B "${{ env.qi_qmp_build_dir }}" -D QI_QMP_DOCS=ON -D BUILD_SHARED_LIBS=${{ matrix.cmake_bsl }}"
echo "Changing to build directory..."
cd "%qi_qmp_build_dir%"
echo "Building QI-QMP debug..."
echo "Building QI-QMP Debug..."
cmake --build . --target all --config Debug
echo "Building QI-QMP release..."
echo "Building QI-QMP Release/Docs..."
cmake --build . --target all --config Release
echo "Building QI-QMP docs..."
cmake --build . --target qi_qmp_docs --config Release
echo "Installing QI-QMP Debug"
cmake --build . --target install --config Debug
cmake --install . --config Debug
echo "Installing QI-QMP Release/Docs..."
cmake --build . --target install --config Release
cmake --install . --config Release
echo "Packaging QI-QMP..."
cpack -C "Debug;Release"
echo "Build complete."
Expand All @@ -81,7 +85,7 @@ jobs:
echo "current_artifact_name=$artifact_name" >> $Env:GITHUB_ENV
- name: Set doc artifact name
id: set_doc_artifact_name
if: matrix.qt_linkage == 'static'
if: matrix.lib_linkage == 'static'
run: echo "doc_artifact_name=$current_artifact_name" >> $Env:GITHUB_OUTPUT
- name: Upload QI-QMP build artifact
uses: actions/upload-artifact@v3
Expand Down
5 changes: 4 additions & 1 deletion lib/include/qi-qmp/qmpi.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#ifndef QMPI_H
#define QMPI_H

// Shared Lib Support
#include "qi-qmp/qmpi_export.h"

// Standard Library Includes
#include <any>
#include <queue>
Expand All @@ -13,7 +16,7 @@
#include <QJsonArray>
#include <QTimer>

class Qmpi : public QObject
class QI_QMP_QMPI_EXPORT Qmpi : public QObject
{
Q_OBJECT
//-Class Enums--------------------------------------------------------------------------------------------------------------
Expand Down