From 30944dabc7269dc53a4bb8f039e6e2199d848729 Mon Sep 17 00:00:00 2001 From: Lorenzooone Date: Tue, 28 May 2024 15:56:13 +0200 Subject: [PATCH] CD setup for automatic builds on all platforms (#1) --- .github/workflows/cd_main.yml | 71 +++++++++++++++++++++++++++++++++++ .github/workflows/cd_pr.yml | 45 ++++++++++++++++++++++ CMakeLists.txt | 24 +++++++++++- macos_setup_ftd3xx.sh | 7 +--- 4 files changed, 139 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/cd_main.yml create mode 100644 .github/workflows/cd_pr.yml diff --git a/.github/workflows/cd_main.yml b/.github/workflows/cd_main.yml new file mode 100644 index 0000000..31fc8a3 --- /dev/null +++ b/.github/workflows/cd_main.yml @@ -0,0 +1,71 @@ +name: CD + +on: + # Trigger the workflow on push, + # but only for the master branch + push: + branches: + - main + +jobs: + build: + name: ${{ matrix.platform.name }} ${{ matrix.config.name }} + runs-on: ${{ matrix.platform.os }} + + strategy: + fail-fast: false + matrix: + platform: + - { name: Windows VS2022, os: windows-2022 } + - { name: Linux GCC, os: ubuntu-latest } + - { name: macOS x64, os: macos-13 } + - { name: macOS Apple Silicon, os: macos-14 } + config: + - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } + + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev + + - name: Checkout + uses: actions/checkout@v3 + + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{matrix.platform.flags}} ${{matrix.config.flags}} + + - name: Build + shell: bash + run: cmake --build build --config Release + + - name: Pack + shell: bash + run: cd build && cpack -G ZIP + + - name: Archive resulting artifact + uses: actions/upload-artifact@v3 + with: + name: cc3dsfs_zip + path: build/cc3dsfs*.zip + + publish: + name: Publishing + runs-on: ubuntu-latest + needs: build + permissions: + contents: write + steps: + - name: Download a single artifact + uses: actions/download-artifact@v3 + with: + name: cc3dsfs_zip + - name: Auto-Release the zips + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "nightly-latest" + prerelease: true + title: "Automatic Build" + files: | + cc3dsfs*.zip diff --git a/.github/workflows/cd_pr.yml b/.github/workflows/cd_pr.yml new file mode 100644 index 0000000..ea676b8 --- /dev/null +++ b/.github/workflows/cd_pr.yml @@ -0,0 +1,45 @@ +name: CD + +on: [pull_request] + +jobs: + build: + name: ${{ matrix.platform.name }} ${{ matrix.config.name }} + runs-on: ${{ matrix.platform.os }} + + strategy: + fail-fast: false + matrix: + platform: + - { name: Windows VS2022, os: windows-2022 } + - { name: Linux GCC, os: ubuntu-latest } + - { name: macOS x64, os: macos-13 } + - { name: macOS Apple Silicon, os: macos-14 } + config: + - { name: Static, flags: -DBUILD_SHARED_LIBS=FALSE } + + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + run: sudo apt-get update && sudo apt-get install libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libegl1-mesa-dev + + - name: Checkout + uses: actions/checkout@v3 + + - name: Configure + shell: bash + run: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install ${{matrix.platform.flags}} ${{matrix.config.flags}} + + - name: Build + shell: bash + run: cmake --build build --config Release + + - name: Pack + shell: bash + run: cd build && cpack -G ZIP + + - name: Archive resulting artifact + uses: actions/upload-artifact@v3 + with: + name: cc3dsfs_zip + path: build/cc3dsfs*.zip diff --git a/CMakeLists.txt b/CMakeLists.txt index fde34a0..4b99086 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.16) -project(CMakeSFMLProject LANGUAGES CXX) +project(cc3dsfs VERSION 0.0.0 LANGUAGES CXX) include(ExternalProject) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -164,4 +164,24 @@ add_custom_command( VERBATIM ) -install(TARGETS ${OUTPUT_NAME}) +install(TARGETS ${OUTPUT_NAME} DESTINATION .) +install(FILES LICENSE README.md DESTINATION .) +if(WIN32) +install(FILES openal32.dll DESTINATION .) +endif() + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") +elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +else() +install(FILES 51-ftd3xx.rules DESTINATION .) +endif() + + +set(CPACK_PACKAGE_NAME ${OUTPUT_NAME}_${CMAKE_SYSTEM_PROCESSOR}) +set(CPACK_PACKAGE_VENDOR Lorenzooone) +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "3DS Capture Card Fullscreen software") + +set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME}) +set(CPACK_VERBATIM_VARIABLES TRUE) + +include(CPack) diff --git a/macos_setup_ftd3xx.sh b/macos_setup_ftd3xx.sh index 377cd51..bc342b3 100755 --- a/macos_setup_ftd3xx.sh +++ b/macos_setup_ftd3xx.sh @@ -1,9 +1,4 @@ - -VOL := d3xx-osx.${VER} -SRC_FOLDER := /Volumes/${VOL} -TAR := ${VOL}.dmg - hdiutil attach ${1} cp ${2}/${4} ${3} cp ${2}/*.h ${3} -hdiutil detach ${3} +hdiutil detach ${3} || true