From df7898b36aa2df34f30c5635f8d3b4f28c380317 Mon Sep 17 00:00:00 2001 From: Artemis Rosman <73006620+rozukke@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:12:10 +1000 Subject: [PATCH] Rearrange cmake --- .github/workflows/ci.yml | 22 +++---- .github/workflows/package-release.yml | 92 --------------------------- CMakeLists.txt | 18 ++---- 3 files changed, 18 insertions(+), 114 deletions(-) delete mode 100644 .github/workflows/package-release.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b062a53..6836d2d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,22 +16,13 @@ jobs: runs-on: ${{ matrix.os }} steps: - # Start and join the Spigot Server - - name: Set up Minecraft testing environment - uses: nhatdongdang/mc-env-setup@v1.1 - # Checkout the mcpp repository for building and testing - name: Checkout mcpp uses: actions/checkout@v4 - # Build files using CMake + # Build CMake cache - name: Build file - run: cmake -Bbuild - - # Run the test suite using ctest - - name: Run test suite - working-directory: ./build - run: make test_suite && ctest -R full -V + run: cmake --debug-output -B build - name: Install library working-directory: ./build @@ -45,6 +36,15 @@ jobs: working-directory: ./build run: make examples + # Start and join the Spigot Server + - name: Set up Minecraft testing environment + uses: nhatdongdang/mc-env-setup@v1.1 + + # Run the test suite using ctest + - name: Run test suite + working-directory: ./build + run: make test_suite && ctest -R full -V + - name: Run example working-directory: ./build run: ./hello_minecraft diff --git a/.github/workflows/package-release.yml b/.github/workflows/package-release.yml deleted file mode 100644 index d4f9de48..00000000 --- a/.github/workflows/package-release.yml +++ /dev/null @@ -1,92 +0,0 @@ -name: package-release - -on: - push: - branches: 'version-**' - release: - types: [published] - -jobs: - check-commit-message: - outputs: - commit_message: ${{ steps.capture_message.outputs.message }} - name: Get commit message - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Capturing commit message - id: capture_message - run: | - echo "message=$(git log --format=%B -n 1 ${{ github.event.after }})" >> $GITHUB_OUTPUT - - linux: - strategy: - fail-fast: false - matrix: - distro: [stable] - needs: check-commit-message - if: ${{ contains(needs.check-commit-message.outputs.commit_message, 'RELEASE') }} - name: Deb packaging ${{ matrix.distro }} - runs-on: ubuntu-latest - container: debian:${{ matrix.distro }} - steps: - - name: Set up git - run: | - apt-get update - apt-get install -y git - - name: Add Safe Directory for Git - run: | - git config --global --add safe.directory /__w/mcpp/mcpp - - - name: Get version - id: get_version - shell: bash - run: | - VERSION=$(echo $GITHUB_REF_NAME | cut -d - -f 2) - echo "VERSION=$VERSION" >> $GITHUB_OUTPUT - - - name: Checking out sources - uses: actions/checkout@v4 - - - name: Install build dependencies - run: | - apt-get install -y build-essential ninja-build qtbase5-dev qttools5-dev cmake pkgconf bash libspdlog-dev - - - name: Configure build - run: | - mkdir build - cd build - cmake .. -GNinja -DPROJECT_VERSION=${{ steps.get_version.outputs.VERSION }} - echo "VERSION=${{ steps.get_version.outputs.VERSION }}" - - - name: Build - run: | - cd build - cmake --build . --target package --parallel $(nproc) - - - name: Get package name - shell: bash - id: get_package - run: | - NAME=$(basename build/mcpp-*.deb) - echo "NAME=$NAME" >> $GITHUB_OUTPUT - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: mcpp-debian-${{ matrix.distro }}.deb - path: build/${{ steps.get_package.outputs.NAME }} - - - name: Create tag - run: | - git tag mcpp-${{ steps.get_version.outputs.VERSION }} - git push origin mcpp-${{ steps.get_version.outputs.VERSION }} --force - - - name: Upload package to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/${{ steps.get_package.outputs.NAME }} - asset_name: mcpp_amd64_ubuntu.deb - tag: mcpp-${{ steps.get_version.outputs.VERSION }} - overwrite: true diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e185554..da3d534f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,21 +51,17 @@ install(TARGETS ${PROJECT_NAME} # Build examples add_executable(hello_minecraft EXCLUDE_FROM_ALL example/hello_minecraft.cpp) -target_link_libraries(hello_minecraft ${PROJECT_NAME}) add_executable(pyramid EXCLUDE_FROM_ALL example/pyramid.cpp) -target_link_libraries(pyramid ${PROJECT_NAME}) add_executable(game_of_life EXCLUDE_FROM_ALL example/game-of-life/game_of_life.cpp) -target_link_libraries(game_of_life ${PROJECT_NAME}) add_executable(minesweeper EXCLUDE_FROM_ALL example/minesweeper/minesweeper.cpp) -target_link_libraries(minesweeper ${PROJECT_NAME}) add_executable(video_mc EXCLUDE_FROM_ALL example/video-generation/video-mc.cpp) -target_link_libraries(video_mc ${PROJECT_NAME}) add_executable(obj_mc EXCLUDE_FROM_ALL example/model-generation/obj-mc.cpp) + +target_link_libraries(hello_minecraft ${PROJECT_NAME}) +target_link_libraries(pyramid ${PROJECT_NAME}) +target_link_libraries(game_of_life ${PROJECT_NAME}) +target_link_libraries(minesweeper ${PROJECT_NAME}) +target_link_libraries(video_mc ${PROJECT_NAME}) target_link_libraries(obj_mc ${PROJECT_NAME}) -add_custom_target(examples DEPENDS hello_minecraft pyramid game_of_life minesweeper video_mc obj_mc) -# CPack setup -SET(CPACK_GENERATOR "DEB") -SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "rozukke") -INCLUDE(CPack) +add_custom_target(examples DEPENDS hello_minecraft pyramid game_of_life minesweeper video_mc obj_mc)