From 8b6944d4e42dc42b7833a335c8af990e5a5bcc2b Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Fri, 17 Jun 2022 12:31:35 +0200 Subject: add install targets for frontends, link pthread, add CI --- .github/workflows/build.yml | 70 +++++++++++++++++++++++++++++++++++++++++++++ src/cli/CMakeLists.txt | 5 ++++ src/qt/CMakeLists.txt | 5 ++++ 3 files changed, 80 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..27ad46e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,70 @@ +name: CI + +env: + BUILD_TYPE: Debug + +on: + push: + branches: + - master + - dev + pull_request: + branches: + - master + - dev + +jobs: + build-linux: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get -y install qt5-default libcurl4-openssl-dev libjson-c-dev cmake make wget + + - name: Configure CMake + run: | + cmake $GITHUB_WORKSPACE -B "build" \ + -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ + -DBUILD_CLI=ON -DBUILD_QT=ON + + - name: Build + run: cmake --build build + + build-windows: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Install dependencies + run: | + sudo apt-key adv \ + --keyserver keyserver.ubuntu.com \ + --recv-keys 86B72ED9 && \ + sudo add-apt-repository \ + "deb [arch=amd64] https://pkg.mxe.cc/repos/apt `lsb_release -sc` main" && \ + sudo apt-get update + sudo apt-get -y install mxe-i686-w64-mingw32.static-{cc,cmake,qt5,curl,json-c} + + - name: Configure CMake + run: | + PATH=/usr/lib/mxe/usr/bin:$PATH \ + i686-w64-mingw32.static-cmake $GITHUB_WORKSPACE -B "build" \ + -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \ + -DBUILD_CLI=ON -DBUILD_QT=ON + + - name: Build + run: | + PATH=/usr/lib/mxe/usr/bin:$PATH \ + i686-w64-mingw32.static-cmake --build build + + - name: Upload Binaries + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v2 + with: + name: Windows Binaries + path: ${{runner.workspace}}/build/{OFQT,OFCL}.exe diff --git a/src/cli/CMakeLists.txt b/src/cli/CMakeLists.txt index 23f4553..38e5e13 100644 --- a/src/cli/CMakeLists.txt +++ b/src/cli/CMakeLists.txt @@ -8,5 +8,10 @@ SET(CLI_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/updater.h ) +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + add_executable(${FRONTEND_NAME} ${CLI_SOURCES}) target_link_libraries(${FRONTEND_NAME} PRIVATE tvn) +target_link_libraries(${FRONTEND_NAME} PRIVATE Threads::Threads) +install(TARGETS ${FRONTEND_NAME}) diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index d0d1eeb..56d16c4 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -28,7 +28,12 @@ if(WIN32) list(APPEND QT_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/version.rc) endif() +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) + add_executable(${FRONTEND_NAME} WIN32 ${QT_SOURCES}) target_link_libraries(${FRONTEND_NAME} PRIVATE tvn) +target_link_libraries(${FRONTEND_NAME} PRIVATE Threads::Threads) target_link_libraries(${FRONTEND_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) set_property(TARGET ${FRONTEND_NAME} PROPERTY CXX_STANDARD 11) +install(TARGETS ${FRONTEND_NAME}) -- cgit v1.2.3