mirror of
https://github.com/Dark98/threeSD.git
synced 2026-07-02 16:49:04 +00:00
Use Github Actions instead of Travis
Moved MSVC to Github Actions as well.
This commit is contained in:
@@ -6,9 +6,7 @@ cp README.md "$REV_NAME"
|
||||
|
||||
cp dist/threeSDumper.gm9 "$REV_NAME/dist"
|
||||
|
||||
tar $COMPRESSION_FLAGS "$ARCHIVE_NAME" "$REV_NAME"
|
||||
7z a "$REV_NAME.7z" $REV_NAME
|
||||
7z a "$REV_NAME.zip" $REV_NAME
|
||||
|
||||
# move the compiled archive into the artifacts directory to be uploaded by travis releases
|
||||
mv "$ARCHIVE_NAME" artifacts/
|
||||
mv "$REV_NAME.7z" artifacts/
|
||||
# move the compiled archive into the artifacts directory to be uploaded by gh action releases
|
||||
mv "$REV_NAME.zip" artifacts/
|
||||
@@ -2,5 +2,10 @@
|
||||
|
||||
GITDATE="`git show -s --date=short --format='%ad' | sed 's/-//g'`"
|
||||
GITREV="`git show -s --format='%h'`"
|
||||
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||
GITNAME="${GITHUB_REF:10}"
|
||||
else
|
||||
GITNAME="${GITDATE}-${GITREV}"
|
||||
fi
|
||||
|
||||
mkdir -p artifacts
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
# Default clang-format points to default 3.5 version one
|
||||
CLANG_FORMAT=clang-format-10
|
||||
$CLANG_FORMAT --version
|
||||
|
||||
# Check everything
|
||||
files_to_lint="$(find src/ -name '*.cpp' -or -name '*.h')"
|
||||
|
||||
# Turn off tracing for this because it's too verbose
|
||||
set +x
|
||||
|
||||
for f in $files_to_lint; do
|
||||
d=$(diff -u "$f" <($CLANG_FORMAT "$f") || true)
|
||||
if ! [ -z "$d" ]; then
|
||||
echo "!!! $f not compliant to coding style, here is the fix:"
|
||||
echo "$d"
|
||||
fail=1
|
||||
fi
|
||||
done
|
||||
|
||||
set -x
|
||||
|
||||
if [ "$fail" = 1 ]; then
|
||||
exit 1
|
||||
fi
|
||||
@@ -1,7 +1,5 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
cd /threeSD
|
||||
|
||||
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++
|
||||
ninja
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
. .ci/common/pre-upload.sh
|
||||
|
||||
REV_NAME="threeSD-linux-${GITNAME}"
|
||||
|
||||
mkdir "$REV_NAME"
|
||||
cp build/bin/threeSD "$REV_NAME"
|
||||
|
||||
mkdir "$REV_NAME/dist"
|
||||
|
||||
. .ci/common/post-upload.sh
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
# override CI ccache size
|
||||
mkdir -p "$HOME/.ccache/"
|
||||
echo 'max_size = 3.0G' > "$HOME/.ccache/ccache.conf"
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DCMAKE_BUILD_TYPE=Release -DCOMPILE_WITH_DWARF=OFF
|
||||
ninja
|
||||
|
||||
ccache -s
|
||||
|
||||
echo 'Prepare binaries...'
|
||||
cd ..
|
||||
mkdir package
|
||||
|
||||
QT_PLATFORM_DLL_PATH='/usr/x86_64-w64-mingw32/lib/qt5/plugins/platforms/'
|
||||
find build/ -name "threeSD.exe" -exec cp {} 'package' \;
|
||||
|
||||
# copy Qt plugins
|
||||
mkdir package/platforms
|
||||
cp "${QT_PLATFORM_DLL_PATH}/qwindows.dll" package/platforms/
|
||||
cp -rv "${QT_PLATFORM_DLL_PATH}/../imageformats/" package/
|
||||
|
||||
python3 .ci/linux-mingw/scan_dll.py package/*.exe package/imageformats/*.dll "package/"
|
||||
@@ -0,0 +1,122 @@
|
||||
try:
|
||||
import lief
|
||||
except ImportError:
|
||||
import pefile
|
||||
import sys
|
||||
import re
|
||||
import os
|
||||
import queue
|
||||
import shutil
|
||||
|
||||
# constant definitions
|
||||
KNOWN_SYS_DLLS = ['WINMM.DLL', 'MSVCRT.DLL', 'VERSION.DLL', 'MPR.DLL',
|
||||
'DWMAPI.DLL', 'UXTHEME.DLL', 'DNSAPI.DLL', 'IPHLPAPI.DLL']
|
||||
# below is for Ubuntu 18.04 with specified PPA enabled, if you are using
|
||||
# other distro or different repositories, change the following accordingly
|
||||
DLL_PATH = [
|
||||
'/usr/x86_64-w64-mingw32/bin/',
|
||||
'/usr/x86_64-w64-mingw32/lib/',
|
||||
'/usr/lib/gcc/x86_64-w64-mingw32/9.3-posix/'
|
||||
]
|
||||
|
||||
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()
|
||||
|
||||
for entry in pe.DIRECTORY_ENTRY_IMPORT:
|
||||
current = entry.dll.decode()
|
||||
current_u = current.upper() # b/c Windows is often case insensitive
|
||||
# here we filter out system dlls
|
||||
# dll w/ names like *32.dll are likely to be system dlls
|
||||
if current_u.upper() not in KNOWN_SYS_DLLS and not re.match(string=current_u, pattern=r'.*32\.DLL'):
|
||||
results.append(current)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def parse_imports_recursive(file_name, path_list=[]):
|
||||
q = queue.Queue() # create a FIFO queue
|
||||
# file_name can be a string or a list for the convience
|
||||
if isinstance(file_name, str):
|
||||
q.put(file_name)
|
||||
elif isinstance(file_name, list):
|
||||
for i in file_name:
|
||||
q.put(i)
|
||||
full_list = []
|
||||
while q.qsize():
|
||||
current = q.get_nowait()
|
||||
print('> %s' % current)
|
||||
deps = parse_imports(current)
|
||||
# if this dll does not have any import, ignore it
|
||||
if not deps:
|
||||
continue
|
||||
for dep in deps:
|
||||
# the dependency already included in the list, skip
|
||||
if dep in full_list:
|
||||
continue
|
||||
# find the requested dll in the provided paths
|
||||
full_path = find_dll(dep)
|
||||
if not full_path:
|
||||
missing.append(dep)
|
||||
continue
|
||||
full_list.append(dep)
|
||||
q.put(full_path)
|
||||
path_list.append(full_path)
|
||||
return full_list
|
||||
|
||||
|
||||
def find_dll(name):
|
||||
for path in DLL_PATH:
|
||||
for root, _, files in os.walk(path):
|
||||
for f in files:
|
||||
if name.lower() == f.lower():
|
||||
return os.path.join(root, f)
|
||||
|
||||
|
||||
def deploy(name, dst, dry_run=False):
|
||||
dlls_path = []
|
||||
parse_imports_recursive(name, dlls_path)
|
||||
for dll_entry in dlls_path:
|
||||
if not dry_run:
|
||||
shutil.copy(dll_entry, dst)
|
||||
else:
|
||||
print('[Dry-Run] Copy %s to %s' % (dll_entry, dst))
|
||||
print('Deploy completed.')
|
||||
return dlls_path
|
||||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 3:
|
||||
print('Usage: %s [files to examine ...] [target deploy directory]')
|
||||
return 1
|
||||
to_deploy = sys.argv[1:-1]
|
||||
tgt_dir = sys.argv[-1]
|
||||
if not os.path.isdir(tgt_dir):
|
||||
print('%s is not a directory.' % tgt_dir)
|
||||
return 1
|
||||
print('Scanning dependencies...')
|
||||
deploy(to_deploy, tgt_dir)
|
||||
if missing:
|
||||
print('Following DLLs are not found: %s' % ('\n'.join(missing)))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
. .ci/common/pre-upload.sh
|
||||
|
||||
REV_NAME="threeSD-windows-mingw-${GITNAME}"
|
||||
|
||||
mkdir "$REV_NAME"
|
||||
# get around the permission issues
|
||||
cp -r package/* "$REV_NAME"
|
||||
|
||||
mkdir "$REV_NAME/dist"
|
||||
|
||||
. .ci/common/post-upload.sh
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
brew update
|
||||
brew unlink python@2 || true
|
||||
rm '/usr/local/bin/2to3' || true
|
||||
brew install qt5 sdl2 p7zip ccache llvm ninja || true
|
||||
pip3 install macpack
|
||||
@@ -1,19 +1,10 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
. .travis/common/pre-upload.sh
|
||||
. .ci/common/pre-upload.sh
|
||||
|
||||
# Find out what release we are building
|
||||
if [ -z $TRAVIS_TAG ]; then
|
||||
REV_NAME="threeSD-macos-${GITDATE}-${GITREV}"
|
||||
else
|
||||
REV_NAME="threeSD-macos-${TRAVIS_TAG}"
|
||||
fi
|
||||
|
||||
ARCHIVE_NAME="${REV_NAME}.tar.gz"
|
||||
COMPRESSION_FLAGS="-czvf"
|
||||
REV_NAME="threeSD-macos-${GITNAME}"
|
||||
|
||||
mkdir "$REV_NAME"
|
||||
|
||||
cp -r build/bin/threeSD.app "$REV_NAME"
|
||||
|
||||
# move libs into folder for deployment
|
||||
@@ -29,4 +20,4 @@ find "$REV_NAME" -exec otool -L {} \;
|
||||
|
||||
mkdir "$REV_NAME/dist"
|
||||
|
||||
. .travis/common/post-upload.sh
|
||||
. .ci/common/post-upload.sh
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -G Ninja -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MSVCCache.cmake" -DUSE_CCACHE=ON -DWARNINGS_AS_ERRORS=OFF -DUSE_BUNDLED_QT=1
|
||||
|
||||
ninja
|
||||
# show the caching efficiency
|
||||
buildcache -s
|
||||
Executable
+10
@@ -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/
|
||||
@@ -0,0 +1,119 @@
|
||||
name: threeSD-ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "*" ]
|
||||
tags: [ "*" ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
image: ["linux-clang-format", "linux-fresh", "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: little-core-labs/get-git-tag@v3.0.2
|
||||
id: tagName
|
||||
- name: Build
|
||||
run: ./.ci/${{ matrix.image }}/docker.sh
|
||||
- name: Pack
|
||||
run: ./.ci/${{ matrix.image }}/upload.sh
|
||||
if: ${{ matrix.image != 'linux-clang-format' }}
|
||||
env:
|
||||
NAME: ${{ matrix.image }}
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v2
|
||||
if: ${{ matrix.image != 'linux-mingw' && 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: little-core-labs/get-git-tag@v3.0.2
|
||||
id: tagName
|
||||
- name: Install dependencies
|
||||
run: ./.ci/macos/deps.sh
|
||||
- name: Build
|
||||
run: ./.ci/macos/build.sh
|
||||
env:
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
- 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"
|
||||
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: little-core-labs/get-git-tag@v3.0.2
|
||||
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: '["./**/*.zip"]'
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
language: cpp
|
||||
matrix:
|
||||
include:
|
||||
- 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
|
||||
- os: osx
|
||||
env: NAME="macos build"
|
||||
sudo: false
|
||||
osx_image: xcode10.2
|
||||
install: "./.travis/macos/deps.sh"
|
||||
script: "./.travis/macos/build.sh"
|
||||
after_success: "./.travis/macos/upload.sh"
|
||||
cache: ccache
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: m5ZWgdaBW7fCjP7eGh15E3uP0xkufPxi1MFifEAmjFjUm54d0yUhghoUxp/o9LUMrpRfveHyieJJzyBzCxr7ZhTs//4bPuQDpK7d1LMGobCvpnftwWRNG/cDBn57pc/Ixn9M0qPP8GAhTXg9hrmaUllRUOhUTxxlBB6Ew7ecEVMcqnZyYnTQTeaoYgiZENICpM43v9Pl7ew38qrEO4x6B3CqwGnYUEUuKxS/jRQBlbFQ7rdVj14AsJjDzI8WWuZfJwy21NtFqCnRnlObVY/YSEgSJgsD9JT6RSa7Q9AAAghVqFAv+kSf7vbpIdOIEWx4RSWAD1qFnPUsU+6/0QATbbt6s2McVRBBowQhwwg1nhWVkFDADV0fC9NgosVXsInqmk8ISHEvGa0tmG5gTnFVTcLtKlGJ2tsHMSQiOwqVaRxfui7NdoHIRhryP9DMlEGHMlsk82iSyM1cJXTeRewbXpIWPMY0yEG5VErC+v8uvfyt1LFqMMZvaGPjhrvup1zd0h3t699grAv+mFyq+RHYOMwn1SPLNdFt6LnUeam55ibBSijkhqGYWzY6LErdNmVNk81wUY9HksP1j0oKj9Xe3aLSclbsXv7UE0PruV2N762dykBloQYHl2s4zyt/wb/3tdF6uOhShwD5ZDs9Z73Op8q9wWFwE8v/4uZpCP/rTnw=
|
||||
file_glob: true
|
||||
file: "artifacts/*.7z"
|
||||
skip_cleanup: true
|
||||
draft: true
|
||||
on:
|
||||
branch: master
|
||||
repo: zhaowenlan1779/threeSD
|
||||
tags: true
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
mkdir -p "$HOME/.ccache"
|
||||
docker run -v $(pwd):/threeSD -v "$HOME/.ccache":/root/.ccache citraemu/build-environments:linux-fresh /bin/bash -ex /threeSD/.travis/linux/docker.sh
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
docker pull citraemu/build-environments:linux-fresh
|
||||
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash -ex
|
||||
|
||||
. .travis/common/pre-upload.sh
|
||||
|
||||
# Find out what release we are building
|
||||
if [ -z $TRAVIS_TAG ]; then
|
||||
REV_NAME="threeSD-linux-${GITDATE}-${GITREV}"
|
||||
else
|
||||
REV_NAME="threeSD-linux-${TRAVIS_TAG}"
|
||||
fi
|
||||
|
||||
ARCHIVE_NAME="${REV_NAME}.tar.xz"
|
||||
COMPRESSION_FLAGS="-cJvf"
|
||||
|
||||
mkdir "$REV_NAME"
|
||||
|
||||
cp build/bin/threeSD "$REV_NAME"
|
||||
|
||||
mkdir "$REV_NAME/dist"
|
||||
|
||||
. .travis/common/post-upload.sh
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/bin/sh -ex
|
||||
|
||||
brew update
|
||||
brew unlink python@2
|
||||
brew install qt5 sdl2 p7zip ccache
|
||||
pip3 install macpack
|
||||
@@ -79,6 +79,7 @@ message(STATUS "Target architecture: ${ARCHITECTURE}")
|
||||
# ===========================
|
||||
if (MSVC)
|
||||
add_compile_options(/std:c++latest)
|
||||
add_definitions(-D_HAS_DEPRECATED_RESULT_OF)
|
||||
else()
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,54 @@
|
||||
SET(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
SET(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
# Actually a hack, w/o this will cause some strange errors
|
||||
SET(CMAKE_HOST_WIN32 TRUE)
|
||||
|
||||
|
||||
SET(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
|
||||
SET(SDL2_PATH ${MINGW_PREFIX})
|
||||
SET(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
|
||||
|
||||
# Specify the cross compiler
|
||||
SET(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}gcc-posix)
|
||||
SET(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}g++-posix)
|
||||
SET(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
|
||||
|
||||
# Mingw tools
|
||||
SET(STRIP ${MINGW_TOOL_PREFIX}strip)
|
||||
SET(WINDRES ${MINGW_TOOL_PREFIX}windres)
|
||||
SET(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
|
||||
|
||||
# ccache wrapper
|
||||
OPTION(USE_CCACHE "Use ccache for compilation" OFF)
|
||||
IF(USE_CCACHE)
|
||||
FIND_PROGRAM(CCACHE ccache)
|
||||
IF (CCACHE)
|
||||
MESSAGE(STATUS "Using ccache 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 ccache found")
|
||||
ENDIF(CCACHE)
|
||||
ENDIF(USE_CCACHE)
|
||||
|
||||
# Search for programs in the build host directories
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
||||
|
||||
# Echo modified cmake vars to screen for debugging purposes
|
||||
IF(NOT DEFINED ENV{MINGW_DEBUG_INFO})
|
||||
MESSAGE("")
|
||||
MESSAGE("Custom cmake vars: (blank = system default)")
|
||||
MESSAGE("-----------------------------------------")
|
||||
MESSAGE("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
|
||||
MESSAGE("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
|
||||
MESSAGE("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
|
||||
MESSAGE("* WINDRES : ${WINDRES}")
|
||||
MESSAGE("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
|
||||
MESSAGE("* STRIP : ${STRIP}")
|
||||
MESSAGE("* USE_CCACHE : ${USE_CCACHE}")
|
||||
MESSAGE("")
|
||||
# So that the debug info only appears once
|
||||
SET(ENV{MINGW_DEBUG_INFO} SHOWN)
|
||||
ENDIF()
|
||||
@@ -25,4 +25,3 @@ Please refer to the [wiki](https://github.com/zhaowenlan1779/threeSD/wiki/Quicks
|
||||
* Clear all the `TODO`s in the code
|
||||
* Wireless transfer (probably FTP?)
|
||||
* but: slow, complex
|
||||
* MSVC build doesn't work for its crappy preprocessor, but this shouldn't really matter
|
||||
|
||||
+7
-38
@@ -10,7 +10,6 @@ environment:
|
||||
CHERE_INVOKING: 1
|
||||
matrix:
|
||||
- BUILD_TYPE: mingw
|
||||
- BUILD_TYPE: msvc
|
||||
|
||||
platform:
|
||||
- x64
|
||||
@@ -21,7 +20,6 @@ configuration:
|
||||
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-static"
|
||||
C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S $dependencies"
|
||||
# (HACK) Link these libs to really static link qt
|
||||
@@ -29,63 +27,35 @@ install:
|
||||
C:\msys64\usr\bin\bash -lc "rm /mingw64/lib/libz.dll.a && link /mingw64/lib/libz.a /mingw64/lib/libz.dll.a"
|
||||
# (HACK) ignore errors
|
||||
0
|
||||
}
|
||||
|
||||
before_build:
|
||||
- mkdir %BUILD_TYPE%_build
|
||||
- cd %BUILD_TYPE%_build
|
||||
- ps: |
|
||||
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 16 2019" -DUSE_BUNDLED_QT=OFF -DQt5_DIR=C:\Qt\5.14\msvc2017_64\lib\cmake\qt5 -DWARNINGS_AS_ERRORS=OFF .. 2>&1 && exit 0'
|
||||
} else {
|
||||
C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release -DMINGW_STATIC_BUILD=ON -DCOMPILE_WITH_DWARF=OFF .. 2>&1"
|
||||
}
|
||||
- C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DCMAKE_BUILD_TYPE=Release -DMINGW_STATIC_BUILD=ON -DCOMPILE_WITH_DWARF=OFF .. 2>&1"
|
||||
- cd ..
|
||||
|
||||
build_script:
|
||||
- ps: |
|
||||
if ($env:BUILD_TYPE -eq 'msvc') {
|
||||
# https://www.appveyor.com/docs/build-phase
|
||||
msbuild msvc_build/threeSD.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'
|
||||
}
|
||||
|
||||
- C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -j4 -C mingw_build/ 2>&1'
|
||||
after_build:
|
||||
- ps: |
|
||||
mkdir release
|
||||
mkdir release\dist
|
||||
|
||||
if ($env:BUILD_TYPE -eq 'msvc') {
|
||||
Remove-Item -Force .\msvc_build\bin\release\*.pdb
|
||||
Remove-Item -Force .\msvc_build\bin\release\platforms\*.pdb
|
||||
Remove-Item -Force .\msvc_build\bin\release\styles\*.pdb
|
||||
Copy-Item .\msvc_build\bin\release\* -Destination release -Recurse
|
||||
} else {
|
||||
C:\msys64\usr\bin\bash.exe -lc 'strip ./mingw_build/bin/threeSD.exe'
|
||||
Copy-Item .\mingw_build\bin\threeSD.exe -Destination release
|
||||
}
|
||||
|
||||
Copy-Item .\license.txt -Destination release
|
||||
Copy-Item .\README.md -Destination release
|
||||
Copy-Item .\dist\threeSDumper.gm9 -Destination release\dist
|
||||
|
||||
$GITDATE = $(git show -s --date=short --format='%ad') -replace "-",""
|
||||
$GITREV = $(git show -s --format='%h')
|
||||
|
||||
if ($env:APPVEYOR_REPO_TAG_NAME) {
|
||||
$BUILD_SEVENZIP = "threeSD-windows-$env:APPVEYOR_REPO_TAG_NAME.7z" -replace " ", ""
|
||||
$BUILD_ZIP = "threeSD-windows-$env:APPVEYOR_REPO_TAG_NAME.zip" -replace " ", ""
|
||||
} else {
|
||||
$BUILD_SEVENZIP = "threeSD-windows-$GITDATE-$GITREV.7z" -replace " ", ""
|
||||
$BUILD_ZIP = "threeSD-windows-$GITDATE-$GITREV.zip" -replace " ", ""
|
||||
}
|
||||
$env:BUILD_SEVENZIP = $BUILD_SEVENZIP
|
||||
|
||||
7z a $BUILD_SEVENZIP release
|
||||
|
||||
|
||||
$env:BUILD_ZIP = $BUILD_SEVENZIP
|
||||
7z a $BUILD_ZIP release
|
||||
artifacts:
|
||||
- path: $(BUILD_SEVENZIP)
|
||||
- path: $(BUILD_ZIP)
|
||||
name: build
|
||||
|
||||
deploy:
|
||||
@@ -93,7 +63,6 @@ deploy:
|
||||
auth_token:
|
||||
secure: 4xdt1ZdE/ZgP2amG5Jr073yvbitMmdV0ts48wKBKEWpR6PJwDG3bR0Attvm9Mgv8
|
||||
artifact: build
|
||||
draft: true
|
||||
on:
|
||||
branch: master
|
||||
APPVEYOR_REPO_NAME: zhaowenlan1779/threeSD
|
||||
|
||||
@@ -31,7 +31,8 @@ public:
|
||||
* @param destination Path to the destination file.
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool DecryptAndWriteFile(const std::string& source, const std::string& destination,
|
||||
bool DecryptAndWriteFile(
|
||||
const std::string& source, const std::string& destination,
|
||||
const ProgressCallback& callback = [](std::size_t, std::size_t) {});
|
||||
|
||||
void Abort();
|
||||
|
||||
@@ -272,7 +272,8 @@ public:
|
||||
* Decrypts this NCCH and write to the destination file.
|
||||
* @return ResultStatus result of function.
|
||||
*/
|
||||
ResultStatus DecryptToFile(std::shared_ptr<FileUtil::IOFile> dest_file,
|
||||
ResultStatus DecryptToFile(
|
||||
std::shared_ptr<FileUtil::IOFile> dest_file,
|
||||
const ProgressCallback& callback = [](std::size_t, std::size_t) {});
|
||||
|
||||
/**
|
||||
|
||||
@@ -38,11 +38,11 @@ public:
|
||||
* @param ctr AES CTR for decryption
|
||||
* @param aes_seek_pos The position to seek to for decryption.
|
||||
*/
|
||||
bool DecryptAndWriteFile(std::shared_ptr<FileUtil::IOFile> source, std::size_t size,
|
||||
bool DecryptAndWriteFile(
|
||||
std::shared_ptr<FileUtil::IOFile> source, std::size_t size,
|
||||
std::shared_ptr<FileUtil::IOFile> destination,
|
||||
const ProgressCallback& callback = [](std::size_t, std::size_t) {},
|
||||
bool decrypt = false, Core::Key::AESKey key = {},
|
||||
Core::Key::AESKey ctr = {}, std::size_t aes_seek_pos = 0);
|
||||
const ProgressCallback& callback = [](std::size_t, std::size_t) {}, bool decrypt = false,
|
||||
Core::Key::AESKey key = {}, Core::Key::AESKey ctr = {}, std::size_t aes_seek_pos = 0);
|
||||
|
||||
void DataReadLoop();
|
||||
void DataDecryptLoop();
|
||||
|
||||
Reference in New Issue
Block a user