diff --git a/.appveyor/FindDependencies.ps1 b/.appveyor/FindDependencies.ps1 deleted file mode 100644 index fd7476314..000000000 --- a/.appveyor/FindDependencies.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# Set-up Visual Studio Command Prompt environment for PowerShell -pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\" -cmd /c "VsDevCmd.bat -arch=x64 & set" | foreach { - if ($_ -match "=") { - $v = $_.split("="); Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])" - } -} -popd - -function Which ($search_path, $name) { - ($search_path).Split(";") | Get-ChildItem -Filter $name | Select -First 1 -Exp FullName -} - -function GetDeps ($search_path, $binary) { - ((dumpbin /dependents $binary).Where({ $_ -match "dependencies:"}, "SkipUntil") | Select-String "[^ ]*\.dll").Matches | foreach { - Which $search_path $_.Value - } -} - -function RecursivelyGetDeps ($search_path, $binary) { - $final_deps = @() - $deps_to_process = GetDeps $search_path $binary - while ($deps_to_process.Count -gt 0) { - $current, $deps_to_process = $deps_to_process - if ($final_deps -contains $current) { continue } - - # Is this a system dll file? - # We use the same algorithm that cmake uses to determine this. - if ($current -match "$([regex]::Escape($env:SystemRoot))\\sys") { continue } - if ($current -match "$([regex]::Escape($env:WinDir))\\sys") { continue } - if ($current -match "\\msvc[^\\]+dll") { continue } - if ($current -match "\\api-ms-win-[^\\]+dll") { continue } - - $final_deps += $current - $new_deps = GetDeps $search_path $current - $deps_to_process += ($new_deps | ?{-not ($final_deps -contains $_)}) - } - return $final_deps -} diff --git a/.appveyor/ProcessPdb.ps1 b/.appveyor/ProcessPdb.ps1 deleted file mode 100644 index 16a7243f3..000000000 --- a/.appveyor/ProcessPdb.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# Generate pdb files for mingw -if ($env:BUILD_TYPE -eq 'mingw') { - Invoke-WebRequest -Uri https://raw.githubusercontent.com/citra-emu/ext-windows-bin/master/cv2pdb/cv2pdb.exe -OutFile cv2pdb.exe - foreach ($exe in Get-ChildItem "$RELEASE_DIST" -Recurse -Filter "citra*.exe") { - .\cv2pdb $exe.FullName - } -} - -# Specify source locations in pdb via srcsrv.ini -$srcsrv = "SRCSRV: ini ------------------------------------------------`r`n" -$srcsrv += "VERSION=2`r`n" -$srcsrv += "VERCTRL=http`r`n" -$srcsrv += "SRCSRV: variables ------------------------------------------`r`n" -$srcsrv += "SRCSRVTRG=https://raw.githubusercontent.com/%var2%/%var3%/%var4%`r`n" -$srcsrv += "SRCSRV: source files ---------------------------------------`r`n" -foreach ($repo in @{ - "citra-emu/citra" = "" - "citra-emu/ext-boost" = "externals/boost" - "citra-emu/ext-soundtouch" = "externals/soundtouch" - "fmtlib/fmt" = "externals/fmt" - "herumi/xbyak" = "externals/xbyak" - "lsalzman/enet" = "externals/enet" - "MerryMage/dynarmic" = "externals/dynarmic" - "neobrain/nihstro" = "externals/nihstro" -}.GetEnumerator()) { - pushd - cd $repo.Value - $rev = git rev-parse HEAD - $files = git ls-tree --name-only --full-tree -r HEAD - foreach ($file in $files) { - $srcsrv += "$(pwd)\$($file -replace '/','\')*$($repo.Name)*$rev*$file`r`n" - } - popd -} -$srcsrv += "SRCSRV: end ------------------------------------------------`r`n" -Set-Content -Path srcsrv.ini -Value $srcsrv -foreach ($pdb in Get-ChildItem "$RELEASE_DIST" -Recurse -Filter "*.pdb") { - & "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\srcsrv\pdbstr.exe" -w -i:srcsrv.ini -p:$pdb.FullName -s:srcsrv -} diff --git a/.travis/common/post-upload.sh b/.ci/common/post-upload.sh similarity index 87% rename from .travis/common/post-upload.sh rename to .ci/common/post-upload.sh index 18162ba9a..f23e0af9a 100755 --- a/.travis/common/post-upload.sh +++ b/.ci/common/post-upload.sh @@ -10,10 +10,10 @@ cp -r dist/scripting "$REV_NAME" tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME" # Find out what release we are building -if [ -z $TRAVIS_TAG ]; then +if [ -z $GIT_TAG_NAME ]; then RELEASE_NAME=head else - RELEASE_NAME=$(echo $TRAVIS_TAG | cut -d- -f1) + RELEASE_NAME=$(echo $GIT_TAG_NAME | cut -d- -f1) if [ "$NAME" = "MinGW build" ]; then RELEASE_NAME="${RELEASE_NAME}-mingw" fi diff --git a/.travis/common/pre-upload.sh b/.ci/common/pre-upload.sh similarity index 100% rename from .travis/common/pre-upload.sh rename to .ci/common/pre-upload.sh diff --git a/.travis/common/travis-ci.env b/.ci/common/travis-ci.env similarity index 100% rename from .travis/common/travis-ci.env rename to .ci/common/travis-ci.env diff --git a/.travis/clang-format/build.sh b/.ci/linux-clang-format/build.sh similarity index 100% rename from .travis/clang-format/build.sh rename to .ci/linux-clang-format/build.sh diff --git a/.ci/linux-clang-format/docker.sh b/.ci/linux-clang-format/docker.sh new file mode 100755 index 000000000..9a2da17e3 --- /dev/null +++ b/.ci/linux-clang-format/docker.sh @@ -0,0 +1,4 @@ +#!/bin/bash -ex + +# Run clang-format +./.ci/linux-clang-format/script.sh diff --git a/.travis/clang-format/script.sh b/.ci/linux-clang-format/script.sh similarity index 96% rename from .travis/clang-format/script.sh rename to .ci/linux-clang-format/script.sh index 8ee837442..969ab637c 100755 --- a/.travis/clang-format/script.sh +++ b/.ci/linux-clang-format/script.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .travis* dist/*.desktop \ +if grep -nrI '\s$' src *.yml *.txt *.md Doxyfile .gitignore .gitmodules .ci* dist/*.desktop \ dist/*.svg dist/*.xml; then echo Trailing whitespace found, aborting exit 1 diff --git a/.travis/linux-flatpak/build.sh b/.ci/linux-flatpak/build.sh similarity index 100% rename from .travis/linux-flatpak/build.sh rename to .ci/linux-flatpak/build.sh diff --git a/.travis/linux-flatpak/docker.sh b/.ci/linux-flatpak/docker.sh similarity index 100% rename from .travis/linux-flatpak/docker.sh rename to .ci/linux-flatpak/docker.sh diff --git a/.travis/linux-flatpak/finish.sh b/.ci/linux-flatpak/finish.sh similarity index 100% rename from .travis/linux-flatpak/finish.sh rename to .ci/linux-flatpak/finish.sh diff --git a/.travis/linux-flatpak/generate-data.sh b/.ci/linux-flatpak/generate-data.sh similarity index 100% rename from .travis/linux-flatpak/generate-data.sh rename to .ci/linux-flatpak/generate-data.sh diff --git a/.travis/linux-flatpak/travis-ci-flatpak.env b/.ci/linux-flatpak/travis-ci-flatpak.env similarity index 100% rename from .travis/linux-flatpak/travis-ci-flatpak.env rename to .ci/linux-flatpak/travis-ci-flatpak.env diff --git a/.travis/linux/build.sh b/.ci/linux-fresh/build.sh similarity index 100% rename from .travis/linux/build.sh rename to .ci/linux-fresh/build.sh diff --git a/.travis/linux/docker.sh b/.ci/linux-fresh/docker.sh similarity index 97% rename from .travis/linux/docker.sh rename to .ci/linux-fresh/docker.sh index 4f4d63ed5..29bf52cf3 100755 --- a/.travis/linux/docker.sh +++ b/.ci/linux-fresh/docker.sh @@ -1,7 +1,5 @@ #!/bin/bash -ex -cd /citra - mkdir build && cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_FFMPEG_VIDEO_DUMPER=ON ninja diff --git a/.travis/linux/upload.sh b/.ci/linux-fresh/upload.sh similarity index 85% rename from .travis/linux/upload.sh rename to .ci/linux-fresh/upload.sh index c40c0d71e..9c783169e 100755 --- a/.travis/linux/upload.sh +++ b/.ci/linux-fresh/upload.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -. .travis/common/pre-upload.sh +. .ci/common/pre-upload.sh REV_NAME="citra-linux-${GITDATE}-${GITREV}" ARCHIVE_NAME="${REV_NAME}.tar.xz" @@ -16,4 +16,4 @@ cp build/bin/Release/citra-qt "$REV_NAME" mkdir "$REV_NAME/dist" cp dist/icon.png "$REV_NAME/dist/citra.png" -. .travis/common/post-upload.sh +. .ci/common/post-upload.sh diff --git a/.travis/linux-frozen/build.sh b/.ci/linux-frozen/build.sh similarity index 100% rename from .travis/linux-frozen/build.sh rename to .ci/linux-frozen/build.sh diff --git a/.travis/linux-frozen/docker.sh b/.ci/linux-frozen/docker.sh similarity index 97% rename from .travis/linux-frozen/docker.sh rename to .ci/linux-frozen/docker.sh index 9ba646d86..036ab8e49 100755 --- a/.travis/linux-frozen/docker.sh +++ b/.ci/linux-frozen/docker.sh @@ -7,7 +7,6 @@ chmod a+x ~/bin/gold/ld export CFLAGS="-B$HOME/bin/gold $CFLAGS" export CXXFLAGS="-B$HOME/bin/gold $CXXFLAGS" -cd /citra mkdir build && cd build cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ diff --git a/.travis/linux-frozen/install_package.py b/.ci/linux-frozen/install_package.py similarity index 100% rename from .travis/linux-frozen/install_package.py rename to .ci/linux-frozen/install_package.py diff --git a/.travis/linux-mingw/build.sh b/.ci/linux-mingw/build.sh similarity index 100% rename from .travis/linux-mingw/build.sh rename to .ci/linux-mingw/build.sh diff --git a/.travis/linux-mingw/docker.sh b/.ci/linux-mingw/docker.sh similarity index 87% rename from .travis/linux-mingw/docker.sh rename to .ci/linux-mingw/docker.sh index 0c539e510..06d0957e7 100755 --- a/.travis/linux-mingw/docker.sh +++ b/.ci/linux-mingw/docker.sh @@ -1,7 +1,7 @@ #!/bin/bash -ex -cd /citra -# override Travis CI unreasonable ccache size +# override CI ccache size +mkdir -p "$HOME/.ccache/" echo 'max_size = 3.0G' > "$HOME/.ccache/ccache.conf" mkdir build && cd build @@ -27,4 +27,4 @@ cp -rv "${QT_PLATFORM_DLL_PATH}/../mediaservice/" package/ cp -rv "${QT_PLATFORM_DLL_PATH}/../imageformats/" package/ rm -f package/mediaservice/*d.dll -python3 .travis/linux-mingw/scan_dll.py package/*.exe package/imageformats/*.dll "package/" +python3 .ci/linux-mingw/scan_dll.py package/*.exe package/imageformats/*.dll "package/" diff --git a/.travis/linux-mingw/scan_dll.py b/.ci/linux-mingw/scan_dll.py similarity index 88% rename from .travis/linux-mingw/scan_dll.py rename to .ci/linux-mingw/scan_dll.py index 910e26bcc..54f7828ac 100755 --- a/.travis/linux-mingw/scan_dll.py +++ b/.ci/linux-mingw/scan_dll.py @@ -1,4 +1,7 @@ -import pefile +try: + import lief +except ImportError: + import pefile import sys import re import os @@ -19,7 +22,20 @@ DLL_PATH = [ missing = [] +def parse_imports_lief(filename): + results = [] + pe = lief.parse(filename) + for entry in pe.imports: + name = entry.name + if name.upper() not in KNOWN_SYS_DLLS and not re.match(string=name, pattern=r'.*32\.DLL'): + results.append(name) + return results + + def parse_imports(file_name): + if globals().get('lief'): + return parse_imports_lief(file_name) + results = [] pe = pefile.PE(file_name, fast_load=True) pe.parse_data_directories() diff --git a/.travis/linux-mingw/upload.sh b/.ci/linux-mingw/upload.sh similarity index 77% rename from .travis/linux-mingw/upload.sh rename to .ci/linux-mingw/upload.sh index ff99a1fab..1f229291d 100755 --- a/.travis/linux-mingw/upload.sh +++ b/.ci/linux-mingw/upload.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -. .travis/common/pre-upload.sh +. .ci/common/pre-upload.sh REV_NAME="citra-windows-mingw-${GITDATE}-${GITREV}" ARCHIVE_NAME="${REV_NAME}.tar.gz" @@ -10,4 +10,4 @@ mkdir "$REV_NAME" # get around the permission issues cp -r package/* "$REV_NAME" -. .travis/common/post-upload.sh +. .ci/common/post-upload.sh diff --git a/.ci/macos/build.sh b/.ci/macos/build.sh new file mode 100755 index 000000000..d4f183201 --- /dev/null +++ b/.ci/macos/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash -ex + +set -o pipefail + +export Qt5_DIR=$(brew --prefix)/opt/qt5 +export PATH="/usr/local/opt/ccache/libexec:/usr/local/opt/llvm/bin:$PATH" +# ccache configurations +export CCACHE_CPP2=yes +export CCACHE_SLOPPINESS=time_macros + +export CC="ccache clang" +export CXX="ccache clang++" +export LDFLAGS="-L/usr/local/opt/llvm/lib" +export CPPFLAGS="-I/usr/local/opt/llvm/include" + +ccache -s + +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_FFMPEG_AUDIO_DECODER=ON -DENABLE_FFMPEG_VIDEO_DUMPER=ON -GNinja +ninja + +ccache -s + +ctest -VV -C Release diff --git a/.ci/macos/deps.sh b/.ci/macos/deps.sh new file mode 100755 index 000000000..539d8a0e1 --- /dev/null +++ b/.ci/macos/deps.sh @@ -0,0 +1,6 @@ +#!/bin/sh -ex + +brew update +brew unlink python@2 || true +brew install qt5 sdl2 p7zip ccache ffmpeg llvm ninja +pip3 install macpack diff --git a/.travis/macos/upload.sh b/.ci/macos/upload.sh similarity index 67% rename from .travis/macos/upload.sh rename to .ci/macos/upload.sh index 05760c0b4..392cc9c0a 100755 --- a/.travis/macos/upload.sh +++ b/.ci/macos/upload.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex -. .travis/common/pre-upload.sh +. .ci/common/pre-upload.sh REV_NAME="citra-osx-${GITDATE}-${GITREV}" ARCHIVE_NAME="${REV_NAME}.tar.gz" @@ -20,10 +20,14 @@ $(brew --prefix)/opt/qt5/bin/macdeployqt "${REV_NAME}/citra-qt.app" -executable= # move libs into folder for deployment macpack "${REV_NAME}/citra" -d "libs" +# workaround for libc++ +install_name_tool -change @loader_path/../Frameworks/libc++.1.0.dylib /usr/lib/libc++.1.dylib "${REV_NAME}/citra-qt.app/Contents/MacOS/citra-qt" +install_name_tool -change @loader_path/libs/libc++.1.0.dylib /usr/lib/libc++.1.dylib "${REV_NAME}/citra" + # Make the launching script executable chmod +x ${REV_NAME}/citra-qt.app/Contents/MacOS/citra-qt # Verify loader instructions -find "$REV_NAME" -exec otool -L {} \; +find "$REV_NAME" -type f -exec otool -L {} \; -. .travis/common/post-upload.sh +. .ci/common/post-upload.sh diff --git a/.travis/transifex/build.sh b/.ci/transifex/build.sh similarity index 100% rename from .travis/transifex/build.sh rename to .ci/transifex/build.sh diff --git a/.travis/transifex/docker.sh b/.ci/transifex/docker.sh similarity index 98% rename from .travis/transifex/docker.sh rename to .ci/transifex/docker.sh index 8d0d7e2d4..c8c023a7e 100644 --- a/.travis/transifex/docker.sh +++ b/.ci/transifex/docker.sh @@ -30,7 +30,6 @@ cmake --version gcc -v tx --version -cd /citra mkdir build && cd build cmake .. -DENABLE_QT_TRANSLATION=ON -DGENERATE_QT_TRANSLATION=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_SDL2=OFF make translation diff --git a/.ci/windows-msvc/build.sh b/.ci/windows-msvc/build.sh new file mode 100644 index 000000000..baf290405 --- /dev/null +++ b/.ci/windows-msvc/build.sh @@ -0,0 +1,10 @@ +#!/bin/sh -ex + +mkdir build && cd build +cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MSVCCache.cmake" -DUSE_CCACHE=ON -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_MF=ON -DENABLE_FFMPEG_VIDEO_DUMPER=ON + +ninja +# show the caching efficiency +buildcache -s + +ctest -VV -C Release || echo "::error ::Test error occurred on Windows MSVC build" diff --git a/.ci/windows-msvc/deps.sh b/.ci/windows-msvc/deps.sh new file mode 100644 index 000000000..769c9a707 --- /dev/null +++ b/.ci/windows-msvc/deps.sh @@ -0,0 +1,10 @@ +#!/bin/sh -ex + +BUILDCACHE_VERSION="0.22.3" + +choco install wget ninja +# Install buildcache +wget "https://github.com/mbitsnbites/buildcache/releases/download/v${BUILDCACHE_VERSION}/buildcache-win-mingw.zip" +7z x 'buildcache-win-mingw.zip' +mv ./buildcache/bin/buildcache.exe "/c/ProgramData/chocolatey/bin" +rm -rf ./buildcache/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f60b7560a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,130 @@ +name: citra-ci + +on: + push: + branches: [ "*" ] + tags: [ "*" ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + image: ["linux-clang-format", "linux-fresh", "linux-frozen", "linux-mingw"] + container: citraemu/build-environments:${{ matrix.image }} + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up cache + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-${{ matrix.image }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-${{ matrix.image }}- + - name: Query tag name + uses: olegtarasov/get-tag@v2 + id: tagName + - name: Build + run: ./.ci/${{ matrix.image }}/docker.sh + env: + ENABLE_COMPATIBILITY_REPORTING: "ON" + - name: Pack + run: ./.ci/${{ matrix.image }}/upload.sh + if: ${{ matrix.image != 'linux-frozen' && matrix.image != 'linux-clang-format' }} + - name: Upload + uses: actions/upload-artifact@v2 + if: ${{ matrix.image != 'linux-frozen' && matrix.image != 'linux-clang-format' }} + with: + name: ${{ matrix.image }} + path: artifacts/ + macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up cache + uses: actions/cache@v2 + with: + path: ~/Library/Caches/ccache + key: ${{ runner.os }}-macos-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-macos- + - name: Query tag name + uses: olegtarasov/get-tag@v2 + id: tagName + - name: Install dependencies + run: ./.ci/macos/deps.sh + - name: Build + run: ./.ci/macos/build.sh + env: + MACOSX_DEPLOYMENT_TARGET: "10.13" + ENABLE_COMPATIBILITY_REPORTING: "ON" + - name: Pack + run: ./.ci/macos/upload.sh + - name: Upload + uses: actions/upload-artifact@v2 + with: + name: macos + path: artifacts/ + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up cache + uses: actions/cache@v2 + with: + path: ~/.buildcache + key: ${{ runner.os }}-win-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-win- + - name: Install dependencies + run: ./.ci/windows-msvc/deps.sh + shell: bash + - name: Set up MSVC + uses: ilammy/msvc-dev-cmd@v1 + - name: Build + run: ./.ci/windows-msvc/build.sh + shell: bash + env: + ENABLE_COMPATIBILITY_REPORTING: "ON" + transifex: + runs-on: ubuntu-latest + container: citraemu/build-environments:linux-transifex + if: ${{ github.repository == 'citra-emu/citra' && !github.head_ref }} + steps: + - uses: actions/checkout@v2 + - name: Update Translation + run: ./.ci/transifex/docker.sh + env: + TRANSIFEX_API_TOKEN: ${{ secrets.TRANSIFEX_API_TOKEN }} + release: + runs-on: ubuntu-latest + needs: [build, macos] + if: ${{ startsWith(github.ref, 'refs/tags/') }} + steps: + - uses: actions/download-artifact@v2 + - name: Query tag name + uses: olegtarasov/get-tag@v2 + id: tagName + - name: Create release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.tagName.outputs.tag }} + release_name: ${{ steps.tagName.outputs.tag }} + draft: false + prerelease: false + - name: Upload artifacts + uses: alexellis/upload-assets@0.2.3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + asset_paths: '["./**/*.tar.*","./**/*.7z","./**/*.zip"]' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0da88aebb..000000000 --- a/.travis.yml +++ /dev/null @@ -1,87 +0,0 @@ -language: cpp -matrix: - include: - - os: linux - env: NAME="clang-format" - sudo: required - dist: trusty - services: docker - install: "./.travis/clang-format/deps.sh" - script: "./.travis/clang-format/build.sh" - - os: linux - env: NAME="linux build" - sudo: required - dist: trusty - services: docker - addons: - apt: - packages: - - p7zip-full - install: "./.travis/linux/deps.sh" - script: "./.travis/linux/build.sh" - after_success: "./.travis/linux/upload.sh" - cache: ccache - - if: repo = citra-emu/citra AND branch = master AND type = push - os: linux - env: NAME="transifex push" - sudo: required - dist: trusty - services: docker - install: "./.travis/transifex/deps.sh" - script: "./.travis/transifex/build.sh" - - os: osx - env: NAME="macos build" - sudo: false - osx_image: xcode10 - install: "./.travis/macos/deps.sh" - script: "./.travis/macos/build.sh" - after_success: "./.travis/macos/upload.sh" - cache: ccache - - os: linux - env: NAME="linux build (debug, frozen versions of dependencies, no additional CMake flags)" - sudo: required - dist: trusty - services: docker - cache: ccache - install: "./.travis/linux-frozen/deps.sh" - script: "./.travis/linux-frozen/build.sh" - - os: linux - env: NAME="MinGW build" - sudo: required - dist: trusty - services: docker - addons: - apt: - packages: - - p7zip-full - install: "./.travis/linux-mingw/deps.sh" - script: "./.travis/linux-mingw/build.sh" - after_success: "./.travis/linux-mingw/upload.sh" - cache: ccache - - if: repo =~ ^.*\/(citra-canary|citra-nightly)$ AND tag IS present - git: - depth: false - os: linux - env: NAME="flatpak build" - sudo: required - dist: trusty - services: docker - cache: ccache - install: "./.travis/linux-flatpak/deps.sh" - script: "./.travis/linux-flatpak/build.sh" - after_script: "./.travis/linux-flatpak/finish.sh" - -deploy: - provider: releases - api_key: - secure: Mck15DIWaJdxDiS3aYVlM9N3G6y8VKUI1rnwII7/iolfm1s94U+tgvbheZDmT7SSbFyaGaYO/E8HrV/uZR9Vvs7ev20sHsTN1u60OTWfDIIyHs9SqjhcGbtq95m9/dMFschOYqTOR+gAs5BsxjuoeAotHdhpQEwvkO2oo5oR0zhGy45gjFnVvtcxT/IfpZBIpVgcK3aLb9zT6ekcJbSiPmEB15iLq3xXd0nFUNtEZdX3D6Veye4n5jB6n72qN8JVoKvPZAwaC2K0pZxpcGJaXDchLsw1q+4eCvdz6UJfUemeQ/uMAmjfeQ3wrzYGXe3nCM3WmX5wosCsB0mw4zYatzl3si6CZ1W+0GkV4Rwlx03dfp7v3EeFhTsXYCaXqhwuLZnWOLUik8t9vaSoFUx4nUIRwfO9kAMUJQSpLuHNO2nT01s3GxvqxzczuLQ9he5nGSi0RRodUzDwek1qUp6I4uV3gRHKz4B07YIc1i2fK88NLXjyQ0uLVZ+7Oq1+kgDp6+N7vvXXZ5qZ17tdaysSbKEE0Y8zsoXw7Rk1tPN19vrCS+TSpomNMyQyne1k+I5iZ/qkxPTLAS5qI6Utc2dL3GJdxWRAEfGNO9AIX3GV/jmmKfdcvwGsCYP8hxqs5vLYfgacw3D8NLf1941lQUwavC17jm9EV9g5G3Pn1Cp516E= - file_glob: true - file: "artifacts/*" - skip_cleanup: true - on: - tags: true - -notifications: - webhooks: - urls: - - https://api.citra-emu.org/code/travis/notify diff --git a/.travis/clang-format/deps.sh b/.travis/clang-format/deps.sh deleted file mode 100755 index a15d164c7..000000000 --- a/.travis/clang-format/deps.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ex - -docker pull citraemu/build-environments:linux-clang-format diff --git a/.travis/clang-format/docker.sh b/.travis/clang-format/docker.sh deleted file mode 100755 index 6f3eab363..000000000 --- a/.travis/clang-format/docker.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -ex - -# Run clang-format -cd /citra -./.travis/clang-format/script.sh diff --git a/.travis/linux-flatpak/deps.sh b/.travis/linux-flatpak/deps.sh deleted file mode 100755 index b8fd4974c..000000000 --- a/.travis/linux-flatpak/deps.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -ex - -# Download the docker image that contains flatpak build dependencies -docker pull citraemu/build-environments:linux-flatpak diff --git a/.travis/linux-frozen/deps.sh b/.travis/linux-frozen/deps.sh deleted file mode 100755 index 9474a654b..000000000 --- a/.travis/linux-frozen/deps.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -ex - -sudo apt-get -y install binutils-gold - -docker pull citraemu/build-environments:linux-frozen diff --git a/.travis/linux-mingw/deps.sh b/.travis/linux-mingw/deps.sh deleted file mode 100755 index 20eb01fb9..000000000 --- a/.travis/linux-mingw/deps.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ex - -docker pull citraemu/build-environments:linux-mingw diff --git a/.travis/linux/deps.sh b/.travis/linux/deps.sh deleted file mode 100755 index 1db4ac519..000000000 --- a/.travis/linux/deps.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -ex - -docker pull citraemu/build-environments:linux-fresh diff --git a/.travis/macos/build.sh b/.travis/macos/build.sh deleted file mode 100755 index a9d21979f..000000000 --- a/.travis/macos/build.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -ex - -set -o pipefail - -export MACOSX_DEPLOYMENT_TARGET=10.13 -export Qt5_DIR=$(brew --prefix)/opt/qt5 -export PATH="/usr/local/opt/ccache/libexec:/usr/local/opt/llvm/bin:$PATH" - -export CC="clang" -export CXX="clang++" -export LDFLAGS="-L/usr/local/opt/llvm/lib" -export CPPFLAGS="-I/usr/local/opt/llvm/include" - -mkdir build && cd build -cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${ENABLE_COMPATIBILITY_REPORTING:-"OFF"} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_FFMPEG_AUDIO_DECODER=ON -DENABLE_FFMPEG_VIDEO_DUMPER=ON -# make -j4 takes more than 50 minutes when there is no ccache available on Travis CI -# and when Travis CI timeouts a job after 50 minutes it won't store any ccache get so far. -# To avoid to be stuck forever with failing build, gtimeout will stop make command before -# Travis CI timeouts, and this will allow Travis CI to successfully store any ccache get so far, -# and iterating this process, the ccache will build up till the make command will succeed. -# 50 minutes == 3000 seconds; ~1000 seconds are needed by deps.sh; hence: -gtimeout 1500 make -j4 - -ctest -VV -C Release diff --git a/.travis/macos/deps.sh b/.travis/macos/deps.sh deleted file mode 100755 index acac942eb..000000000 --- a/.travis/macos/deps.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -ex - -brew update -brew unlink python@2 -brew install qt5 sdl2 p7zip ccache ffmpeg llvm -pip3 install macpack diff --git a/.travis/transifex/deps.sh b/.travis/transifex/deps.sh deleted file mode 100755 index 5b8f249c5..000000000 --- a/.travis/transifex/deps.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -ex - -docker pull citraemu/build-environments:linux-transifex diff --git a/CMakeModules/GenerateSCMRev.cmake b/CMakeModules/GenerateSCMRev.cmake index fb9351f79..3ee4f6505 100644 --- a/CMakeModules/GenerateSCMRev.cmake +++ b/CMakeModules/GenerateSCMRev.cmake @@ -21,9 +21,9 @@ get_timestamp(BUILD_DATE) set(REPO_NAME "") set(BUILD_VERSION "0") if (DEFINED ENV{CI}) - if (DEFINED ENV{TRAVIS}) - set(BUILD_REPOSITORY $ENV{TRAVIS_REPO_SLUG}) - set(BUILD_TAG $ENV{TRAVIS_TAG}) + if (DEFINED ENV{GITHUB_ACTIONS}) + set(BUILD_REPOSITORY $ENV{GITHUB_REPOSITORY}) + set(BUILD_TAG $ENV{GIT_TAG_NAME}) elseif(DEFINED ENV{APPVEYOR}) set(BUILD_REPOSITORY $ENV{APPVEYOR_REPO_NAME}) set(BUILD_TAG $ENV{APPVEYOR_REPO_TAG_NAME}) diff --git a/CMakeModules/MSVCCache.cmake b/CMakeModules/MSVCCache.cmake new file mode 100755 index 000000000..8848e35ea --- /dev/null +++ b/CMakeModules/MSVCCache.cmake @@ -0,0 +1,12 @@ +# buildcache wrapper +OPTION(USE_CCACHE "Use buildcache for compilation" OFF) +IF(USE_CCACHE) + FIND_PROGRAM(CCACHE buildcache) + IF (CCACHE) + MESSAGE(STATUS "Using buildcache found in PATH") + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE}) + SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE}) + ELSE(CCACHE) + MESSAGE(WARNING "USE_CCACHE enabled, but no buildcache executable found") + ENDIF(CCACHE) +ENDIF(USE_CCACHE) diff --git a/CMakeModules/MinGWCross.cmake b/CMakeModules/MinGWCross.cmake index d3c99f4f5..7bcc5a3da 100644 --- a/CMakeModules/MinGWCross.cmake +++ b/CMakeModules/MinGWCross.cmake @@ -47,7 +47,7 @@ IF(NOT DEFINED ENV{MINGW_DEBUG_INFO}) MESSAGE("* WINDRES : ${WINDRES}") MESSAGE("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}") MESSAGE("* STRIP : ${STRIP}") - MESSAGE("* USE_CCACHE : ${USE_CCACHE}") + MESSAGE("* USE_CCACHE : ${USE_CCACHE}") MESSAGE("") # So that the debug info only appears once SET(ENV{MINGW_DEBUG_INFO} SHOWN) diff --git a/README.md b/README.md index 15ffb9aa9..9b9f79265 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ Citra ============== -[![Travis CI Build Status](https://travis-ci.com/citra-emu/citra.svg?branch=master)](https://travis-ci.com/citra-emu/citra) -[![AppVeyor CI Build Status](https://ci.appveyor.com/api/projects/status/sdf1o4kh3g1e68m9?svg=true)](https://ci.appveyor.com/project/bunnei/citra) +[![GitHub Actions Build Status](https://github.com/citra-emu/citra/workflows/citra-ci/badge.svg)](https://github.com/citra-emu/citra/actions) [![Bitrise CI Build Status](https://app.bitrise.io/app/4ccd8e5720f0d13b/status.svg?token=H32TmbCwxb3OQ-M66KbAyw&branch=master)](https://app.bitrise.io/app/4ccd8e5720f0d13b) [![Discord](https://img.shields.io/discord/220740965957107713?color=%237289DA&label=Citra&logo=discord&logoColor=white)](https://discord.gg/FAXfZV9) diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 7fe581944..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,173 +0,0 @@ -# shallow clone -clone_depth: 10 - -cache: - - C:\ProgramData\chocolatey\bin -> appveyor.yml - - C:\ProgramData\chocolatey\lib -> appveyor.yml - -os: Visual Studio 2017 - -environment: - # Tell msys2 to add mingw64 to the path - MSYSTEM: MINGW64 - # Tell msys2 to inherit the current directory when starting the shell - CHERE_INVOKING: 1 - matrix: - - BUILD_TYPE: mingw - - BUILD_TYPE: msvc - -platform: - - x64 - -configuration: - - Release - -install: - - git submodule update --init --recursive - - ps: | - if ($env:BUILD_TYPE -eq 'mingw') { - $dependencies = "mingw64/mingw-w64-x86_64-cmake mingw64/mingw-w64-x86_64-qt5 mingw64/mingw-w64-x86_64-ffmpeg" - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -U http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-SDL2-2.0.12-1-any.pkg.tar.xz" - C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S $dependencies" - # (HACK) ignore errors - 0 - } - -before_build: - - mkdir %BUILD_TYPE%_build - - cd %BUILD_TYPE%_build - - ps: | - $COMPAT = if ($env:ENABLE_COMPATIBILITY_REPORTING -eq $null) {0} else {$env:ENABLE_COMPATIBILITY_REPORTING} - if ($env:BUILD_TYPE -eq 'msvc') { - # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning - cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_MF=ON -DENABLE_FFMPEG_VIDEO_DUMPER=ON .. 2>&1 && exit 0' - } else { - C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release -DENABLE_QT_TRANSLATION=ON -DCITRA_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DUSE_DISCORD_PRESENCE=ON -DENABLE_MF=ON -DENABLE_FFMPEG_VIDEO_DUMPER=ON .. 2>&1" - } - - cd .. - -build_script: - - ps: | - if ($env:BUILD_TYPE -eq 'msvc') { - # https://www.appveyor.com/docs/build-phase - msbuild msvc_build/citra.sln /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - } else { - C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -j4 -C mingw_build/ 2>&1' - } - -after_build: - - ps: | - $GITDATE = $(git show -s --date=short --format='%ad') -replace "-","" - $GITREV = $(git show -s --format='%h') - - # Find out which kind of release we are producing by tag name - if ($env:APPVEYOR_REPO_TAG_NAME) { - $RELEASE_DIST, $RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME.split('-') - } else { - # There is no repo tag - make assumptions - $RELEASE_DIST = "head" - } - - if ($env:BUILD_TYPE -eq 'msvc') { - # Where are these spaces coming from? Regardless, let's remove them - $MSVC_BUILD_ZIP = "citra-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", "" - $MSVC_BUILD_PDB = "citra-windows-msvc-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", "" - $MSVC_SEVENZIP = "citra-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", "" - - # set the build names as env vars so the artifacts can upload them - $env:BUILD_ZIP = $MSVC_BUILD_ZIP - $env:BUILD_SYMBOLS = $MSVC_BUILD_PDB - $env:BUILD_UPDATE = $MSVC_SEVENZIP - - mkdir $RELEASE_DIST - Copy-Item .\msvc_build\bin\release\* -Destination $RELEASE_DIST -Recurse - Copy-Item .\license.txt -Destination $RELEASE_DIST - Copy-Item .\README.md -Destination $RELEASE_DIST - - # process PDBs - . "./.appveyor/ProcessPdb.ps1" - 7z a -tzip $MSVC_BUILD_PDB $RELEASE_DIST\*.pdb - rm $RELEASE_DIST\*.pdb - - 7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\* - 7z a $MSVC_SEVENZIP $RELEASE_DIST - } else { - $MINGW_BUILD_ZIP = "citra-windows-mingw-$GITDATE-$GITREV.zip" -replace " ", "" - $MINGW_BUILD_PDB = "citra-windows-mingw-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", "" - $MINGW_SEVENZIP = "citra-windows-mingw-$GITDATE-$GITREV.7z" -replace " ", "" - - # store the build information in env vars so we can use them as artifacts - $env:BUILD_ZIP = $MINGW_BUILD_ZIP - $env:BUILD_SYMBOLS = $MINGW_BUILD_PDB - $env:BUILD_UPDATE = $MINGW_SEVENZIP - - $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER" - $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build" - $RELEASE_DIST = $RELEASE_DIST + "-mingw" - - mkdir $RELEASE_DIST - mkdir $RELEASE_DIST/platforms - mkdir $RELEASE_DIST/mediaservice - mkdir $RELEASE_DIST/styles - mkdir $RELEASE_DIST/imageformats - - # copy the compiled binaries and other release files to the release folder - Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "citra*.exe" | Copy-Item -destination $RELEASE_DIST - Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST - Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST - - # copy the qt windows plugin dll to platforms - Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms" - - # copy the qt mediaservice plugin dll - Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/mediaservice/dsengine.dll" -force -destination "$RELEASE_DIST/mediaservice" - - # copy the qt windows vista style dll to platforms - Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/styles/qwindowsvistastyle.dll" -force -destination "$RELEASE_DIST/styles" - - # copy the qt imageformats plugin dlls to imageformats - Get-ChildItem "C:/msys64/mingw64/share/qt5/plugins/imageformats" -Exclude "*d.dll" | Copy-Item -force -destination "$RELEASE_DIST/imageformats" - - # copy all the dll dependencies to the release folder - . "./.appveyor/FindDependencies.ps1" - $DLLSearchPath = "C:\msys64\mingw64\bin;$env:PATH" - $MingwDLLs = RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\citra.exe" - $MingwDLLs += RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\citra-qt.exe" - $MingwDLLs += RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\imageformats\qjpeg.dll" - Write-Host "Detected the following dependencies:" - Write-Host $MingwDLLs - foreach ($file in $MingwDLLs) { - Copy-Item -path "$file" -force -destination "$RELEASE_DIST" - } - - # process PDBs - . "./.appveyor/ProcessPdb.ps1" - 7z a -tzip $MINGW_BUILD_PDB $RELEASE_DIST\*.pdb - rm $RELEASE_DIST\*.pdb - - 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\* - 7z a $MINGW_SEVENZIP $RELEASE_DIST - } - -test_script: - - cd %BUILD_TYPE%_build - - ps: | - if ($env:BUILD_TYPE -eq 'msvc') { - ctest -VV -C Release - } else { - C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release" - } - - cd .. - -artifacts: - - path: $(BUILD_ZIP) - name: build - type: zip - - path: $(BUILD_SYMBOLS) - name: debugsymbols - - path: $(BUILD_UPDATE) - name: update - -notifications: - - provider: Webhook - url: https://api.citra-emu.org/code/appveyor/notify diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1ada1b3eb..26d2fb869 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,8 +35,6 @@ if (MSVC) add_compile_options( /W3 /MP - /Zi - /Zo /permissive- /EHsc /volatile:iso @@ -49,6 +47,15 @@ if (MSVC) /external:W0 ) + # Since MSVC's debugging information is not very deterministic, so we have to disable it + # when using ccache or other caching tools + if (NOT USE_CCACHE) + add_compile_options( + /Zi + /Zo + ) + endif() + # /GS- - No stack buffer overflow checks add_compile_options("$<$:/GS->")