diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..34ad1b4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,101 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the master branch +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + name: ${{ matrix.config.name }}-${{ matrix.type }} + runs-on: ${{ matrix.config.os }} + strategy: + fail-fast: false + matrix: + config: + - { + name: "Windows x32", + os: windows-latest, + cpack_install_generator: -G WIX, + generator: "-G'Visual Studio 16 2019' -A Win32", + qt_arch: 'win32_msvc2017' + } + - { + name: "Windows x64", + os: windows-latest, + cpack_install_generator: -G WIX, + generator: "-G'Visual Studio 16 2019' -A x64", + qt_arch: 'win64_msvc2017_64' + } + - { + name: "Ubuntu", + os: ubuntu-latest, + cpack_install_generator: -G DEB + } + - { + name: "MacOS", + os: macos-latest, + cpack_install_generator: -G DragNDrop + } + type: [portable, installer] + + steps: + - name: 🐞Fixup chocolately + run: Remove-Item -Path $env:ChocolateyInstall\\bin\\cpack.exe -Force + shell: pwsh + if: "contains(matrix.config.os, 'windows')" + + - name: Checkout + uses: actions/checkout@v1 + with: + submodules: true + - name: Cache Qt + id: cache-qt + uses: actions/cache@v1 + with: + path: ../Qt + key: ${{ runner.os }}-QtCache-${{matrix.config.qt_arch}} + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: 5.12.8 + arch: ${{matrix.config.qt_arch}} + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + - name: CMake + run: | + echo -DBUILD_PORTABLE=$PORTABLE + cmake ${{matrix.config.generator}} -DCMAKE_BUILD_TYPE=Release . -DBUILD_PORTABLE=$PORTABLE + shell: bash + env: + PORTABLE: ${{contains(matrix.type, 'portable')}} + + - name: Build + run: cmake --build . --config Release + + - name: Package Install + run: cpack ${{matrix.config.cpack_install_generator}} -B "$GITHUB_WORKSPACE/Package" + if: "!contains(matrix.type, 'portable')" + shell: bash + + - name: Package Portable + run: | + cpack -G ZIP -B "$GITHUB_WORKSPACE/Package" + ls $GITHUB_WORKSPACE/Package + if: "contains(matrix.type, 'portable')" + shell: bash + + - name: Package Clean + run: rm -r $GITHUB_WORKSPACE/Package/_CPack_Packages + shell: bash + + - uses: actions/upload-artifact@v1 + with: + name: ${{ matrix.config.name }}-${{ matrix.type }} + path: ./Package/ + diff --git a/CMakeLists.txt b/CMakeLists.txt index a427a87..07d774d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,7 +141,7 @@ if(WIN32) set(INSTALL_RUNTIME_DIR ".") endif() -if(UNIX) +if(UNIX AND NOT APPLE) set(ICON_DIR "/usr/local/share/icons/hicolor/scalable/apps") if(BUILD_PORTABLE) set(ICON_DIR ".") @@ -158,6 +158,7 @@ install(TARGETS MinetestMapperGUI RUNTIME DESTINATION ${INSTALL_RUNTIME_DIR} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib + BUNDLE DESTINATION . ) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/translations/ @@ -189,7 +190,7 @@ if(WIN32) DESTINATION ${INSTALL_RUNTIME_DIR} CONFIGURATIONS RelWithDebInfo FILES_MATCHING PATTERN "*.dll") -elseif(UNIX) +elseif(UNIX AND NOT APPLE) install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/mtmapperenv.sh DESTINATION ${INSTALL_RUNTIME_DIR}) if(BUILD_PORTABLE) @@ -200,4 +201,7 @@ elseif(UNIX) endif() endif() + +set(CPACK_PACKAGE_CONTACT "https://github.com/adrido") + include(CPack)