From 8b6b83d3f993a993bcbb22b366c07acca78e604a Mon Sep 17 00:00:00 2001 From: balintkissdev Date: Tue, 23 Mar 2021 21:04:28 +0100 Subject: [PATCH] Create CI --- .github/workflows/main.yml | 58 ++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 7 +++-- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..6c5d5ce --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,58 @@ +name: Raycaster CI + +on: [push, pull_request] + +jobs: + executable-build: + runs-on: ${{ matrix.config.os }} + strategy: + matrix: + config: + - { name: "Ubuntu Latest GCC", os: ubuntu-latest, cxx: g++, cc: gcc } + - { + name: "Windows Latest MSVC", + os: windows-latest, + cxx: cl.exe, + cc: cl.exe, + } + + steps: + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Set compiler environment + uses: lukka/set-shell-env@v1 + with: + CXX: ${{ matrix.config.cxx }} + CC: ${{ matrix.config.cc }} + + - name: Set compiler environment for Windows + if: matrix.config.os == 'windows-latest' + uses: lukka/set-shell-env@v1 + with: + VS160COMNTOOLS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools + + - name: Checkout + uses: actions/checkout@v2.0.0 + + - uses: lukka/get-cmake@latest + + - name: Build project + uses: lukka/run-cmake@v3 + with: + cmakeAppendedArgs: "-DCMAKE_BUILD_TYPE=Release" + buildDirectory: "${{ github.workspace }}/build/" + + - name: Generate package + run: | + cd build + cpack -C "Release" + + - name: Publish release + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v1 + with: + files: | + build/*.tar.gz + build/*.zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index d57002d..182c9d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,7 +41,7 @@ endif() if(WIN32) if (MINGW) - target_link_options(${PROJECT_NAME} -static-libgcc -static-libstdc++) + target_link_options(${PROJECT_NAME} PRIVATE -static-libgcc -static-libstdc++) endif() endif() @@ -81,12 +81,15 @@ else() endif() set(CPACK_PACKAGE_NAME "Raycaster") +set(CPACK_PACKAGE_DESCRIPTION "C++ raycasting pseudo-3D engine") set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) +set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README.md") +install(FILES "${CPACK_RESOURCE_FILE_LICENSE}" "${CPACK_RESOURCE_FILE_README}" DESTINATION ".") install(TARGETS ${PROJECT_NAME} RUNTIME CONFIGURATIONS Release DESTINATION ".") -install(FILES "${PROJECT_SOURCE_DIR}/README.md" DESTINATION ".") install(DIRECTORY "${PROJECT_SOURCE_DIR}/resources/" DESTINATION "resources") if(WIN32) set(CPACK_GENERATOR ZIP)