summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml13
-rwxr-xr-x.travis/common/post-upload.sh3
-rwxr-xr-x.travis/linux-mingw/build.sh3
-rwxr-xr-x.travis/linux-mingw/deps.sh3
-rwxr-xr-x.travis/linux-mingw/docker.sh59
-rw-r--r--.travis/linux-mingw/scan_dll.py106
-rwxr-xr-x.travis/linux-mingw/upload.sh13
-rwxr-xr-x.travis/linux/docker.sh4
-rwxr-xr-x.travis/macos/build.sh4
-rw-r--r--CMakeLists.txt17
-rw-r--r--CMakeModules/MinGWCross.cmake54
-rw-r--r--appveyor.yml10
12 files changed, 273 insertions, 16 deletions
diff --git a/.travis.yml b/.travis.yml
index dee34a8e3..4d363cbc9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,6 +29,19 @@ matrix:
29 script: "./.travis/macos/build.sh" 29 script: "./.travis/macos/build.sh"
30 after_success: "./.travis/macos/upload.sh" 30 after_success: "./.travis/macos/upload.sh"
31 cache: ccache 31 cache: ccache
32 - os: linux
33 env: NAME="MinGW build"
34 sudo: required
35 dist: trusty
36 services: docker
37 addons:
38 apt:
39 packages:
40 - p7zip-full
41 install: "./.travis/linux-mingw/deps.sh"
42 script: "./.travis/linux-mingw/build.sh"
43 after_success: "./.travis/linux-mingw/upload.sh"
44 cache: ccache
32 45
33deploy: 46deploy:
34 provider: releases 47 provider: releases
diff --git a/.travis/common/post-upload.sh b/.travis/common/post-upload.sh
index 90deaaec8..28735a9cf 100755
--- a/.travis/common/post-upload.sh
+++ b/.travis/common/post-upload.sh
@@ -11,6 +11,9 @@ if [ -z $TRAVIS_TAG ]; then
11 RELEASE_NAME=head 11 RELEASE_NAME=head
12else 12else
13 RELEASE_NAME=$(echo $TRAVIS_TAG | cut -d- -f1) 13 RELEASE_NAME=$(echo $TRAVIS_TAG | cut -d- -f1)
14 if [ "$NAME" = "MinGW build" ]; then
15 RELEASE_NAME="${RELEASE_NAME}-mingw"
16 fi
14fi 17fi
15 18
16mv "$REV_NAME" $RELEASE_NAME 19mv "$REV_NAME" $RELEASE_NAME
diff --git a/.travis/linux-mingw/build.sh b/.travis/linux-mingw/build.sh
new file mode 100755
index 000000000..be03cc0f3
--- /dev/null
+++ b/.travis/linux-mingw/build.sh
@@ -0,0 +1,3 @@
1#!/bin/bash -ex
2mkdir "$HOME/.ccache" || true
3docker run --env-file .travis/common/travis-ci.env -v $(pwd):/yuzu -v "$HOME/.ccache":/root/.ccache ubuntu:18.04 /bin/bash -ex /yuzu/.travis/linux-mingw/docker.sh
diff --git a/.travis/linux-mingw/deps.sh b/.travis/linux-mingw/deps.sh
new file mode 100755
index 000000000..540bb934a
--- /dev/null
+++ b/.travis/linux-mingw/deps.sh
@@ -0,0 +1,3 @@
1#!/bin/sh -ex
2
3docker pull ubuntu:18.04
diff --git a/.travis/linux-mingw/docker.sh b/.travis/linux-mingw/docker.sh
new file mode 100755
index 000000000..d15c3f6e8
--- /dev/null
+++ b/.travis/linux-mingw/docker.sh
@@ -0,0 +1,59 @@
1#!/bin/bash -ex
2
3cd /yuzu
4MINGW_PACKAGES="sdl2-mingw-w64 qt5base-mingw-w64 qt5tools-mingw-w64 libsamplerate-mingw-w64 qt5multimedia-mingw-w64"
5apt-get update
6apt-get install -y gpg wget git python3-pip python ccache g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64 mingw-w64-tools cmake
7echo 'deb http://ppa.launchpad.net/tobydox/mingw-w64/ubuntu bionic main ' > /etc/apt/sources.list.d/extras.list
8apt-key adv --keyserver keyserver.ubuntu.com --recv '72931B477E22FEFD47F8DECE02FE5F12ADDE29B2'
9apt-get update
10apt-get install -y ${MINGW_PACKAGES}
11
12# fix a problem in current MinGW headers
13wget -q https://raw.githubusercontent.com/Alexpux/mingw-w64/d0d7f784833bbb0b2d279310ddc6afb52fe47a46/mingw-w64-headers/crt/errno.h -O /usr/x86_64-w64-mingw32/include/errno.h
14# override Travis CI unreasonable ccache size
15echo 'max_size = 3.0G' > "$HOME/.ccache/ccache.conf"
16
17# Dirty hack to trick unicorn makefile into believing we are in a MINGW system
18mv /bin/uname /bin/uname1 && echo -e '#!/bin/sh\necho MINGW64' >> /bin/uname
19chmod +x /bin/uname
20
21# Dirty hack to trick unicorn makefile into believing we have cmd
22echo '' >> /bin/cmd
23chmod +x /bin/cmd
24
25mkdir build && cd build
26cmake .. -DCMAKE_TOOLCHAIN_FILE="$(pwd)/../CMakeModules/MinGWCross.cmake" -DUSE_CCACHE=ON -DYUZU_USE_BUNDLED_UNICORN=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DCMAKE_BUILD_TYPE=Release
27make -j4
28
29# Clean up the dirty hacks
30rm /bin/uname && mv /bin/uname1 /bin/uname
31rm /bin/cmd
32
33ccache -s
34
35echo "Tests skipped"
36#ctest -VV -C Release
37
38echo 'Prepare binaries...'
39cd ..
40mkdir package
41
42QT_PLATFORM_DLL_PATH='/usr/x86_64-w64-mingw32/lib/qt5/plugins/platforms/'
43find build/ -name "yuzu*.exe" -exec cp {} 'package' \;
44
45# copy Qt plugins
46mkdir package/platforms
47cp "${QT_PLATFORM_DLL_PATH}/qwindows.dll" package/platforms/
48cp -rv "${QT_PLATFORM_DLL_PATH}/../mediaservice/" package/
49cp -rv "${QT_PLATFORM_DLL_PATH}/../imageformats/" package/
50rm -f package/mediaservice/*d.dll
51
52for i in package/*.exe; do
53 # we need to process pdb here, however, cv2pdb
54 # does not work here, so we just simply strip all the debug symbols
55 x86_64-w64-mingw32-strip "${i}"
56done
57
58pip3 install pefile
59python3 .travis/linux-mingw/scan_dll.py package/*.exe "package/"
diff --git a/.travis/linux-mingw/scan_dll.py b/.travis/linux-mingw/scan_dll.py
new file mode 100644
index 000000000..163183f2e
--- /dev/null
+++ b/.travis/linux-mingw/scan_dll.py
@@ -0,0 +1,106 @@
1import pefile
2import sys
3import re
4import os
5import queue
6import shutil
7
8# constant definitions
9KNOWN_SYS_DLLS = ['WINMM.DLL', 'MSVCRT.DLL', 'VERSION.DLL', 'MPR.DLL',
10 'DWMAPI.DLL', 'UXTHEME.DLL', 'DNSAPI.DLL', 'IPHLPAPI.DLL']
11# below is for Ubuntu 18.04 with specified PPA enabled, if you are using
12# other distro or different repositories, change the following accordingly
13DLL_PATH = [
14 '/usr/x86_64-w64-mingw32/bin/',
15 '/usr/x86_64-w64-mingw32/lib/',
16 '/usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/'
17]
18
19missing = []
20
21
22def parse_imports(file_name):
23 results = []
24 pe = pefile.PE(file_name, fast_load=True)
25 pe.parse_data_directories()
26
27 for entry in pe.DIRECTORY_ENTRY_IMPORT:
28 current = entry.dll.decode()
29 current_u = current.upper() # b/c Windows is often case insensitive
30 # here we filter out system dlls
31 # dll w/ names like *32.dll are likely to be system dlls
32 if current_u.upper() not in KNOWN_SYS_DLLS and not re.match(string=current_u, pattern=r'.*32\.DLL'):
33 results.append(current)
34
35 return results
36
37
38def parse_imports_recursive(file_name, path_list=[]):
39 q = queue.Queue() # create a FIFO queue
40 # file_name can be a string or a list for the convience
41 if isinstance(file_name, str):
42 q.put(file_name)
43 elif isinstance(file_name, list):
44 for i in file_name:
45 q.put(i)
46 full_list = []
47 while q.qsize():
48 current = q.get_nowait()
49 print('> %s' % current)
50 deps = parse_imports(current)
51 # if this dll does not have any import, ignore it
52 if not deps:
53 continue
54 for dep in deps:
55 # the dependency already included in the list, skip
56 if dep in full_list:
57 continue
58 # find the requested dll in the provided paths
59 full_path = find_dll(dep)
60 if not full_path:
61 missing.append(dep)
62 continue
63 full_list.append(dep)
64 q.put(full_path)
65 path_list.append(full_path)
66 return full_list
67
68
69def find_dll(name):
70 for path in DLL_PATH:
71 for root, _, files in os.walk(path):
72 for f in files:
73 if name.lower() == f.lower():
74 return os.path.join(root, f)
75
76
77def deploy(name, dst, dry_run=False):
78 dlls_path = []
79 parse_imports_recursive(name, dlls_path)
80 for dll_entry in dlls_path:
81 if not dry_run:
82 shutil.copy(dll_entry, dst)
83 else:
84 print('[Dry-Run] Copy %s to %s' % (dll_entry, dst))
85 print('Deploy completed.')
86 return dlls_path
87
88
89def main():
90 if len(sys.argv) < 3:
91 print('Usage: %s [files to examine ...] [target deploy directory]')
92 return 1
93 to_deploy = sys.argv[1:-1]
94 tgt_dir = sys.argv[-1]
95 if not os.path.isdir(tgt_dir):
96 print('%s is not a directory.' % tgt_dir)
97 return 1
98 print('Scanning dependencies...')
99 deploy(to_deploy, tgt_dir)
100 if missing:
101 print('Following DLLs are not found: %s' % ('\n'.join(missing)))
102 return 0
103
104
105if __name__ == '__main__':
106 main()
diff --git a/.travis/linux-mingw/upload.sh b/.travis/linux-mingw/upload.sh
new file mode 100755
index 000000000..66e896bc4
--- /dev/null
+++ b/.travis/linux-mingw/upload.sh
@@ -0,0 +1,13 @@
1#!/bin/bash -ex
2
3. .travis/common/pre-upload.sh
4
5REV_NAME="yuzu-windows-mingw-${GITDATE}-${GITREV}"
6ARCHIVE_NAME="${REV_NAME}.tar.gz"
7COMPRESSION_FLAGS="-czvf"
8
9mkdir "$REV_NAME"
10# get around the permission issues
11cp -r package/* "$REV_NAME"
12
13. .travis/common/post-upload.sh
diff --git a/.travis/linux/docker.sh b/.travis/linux/docker.sh
index 459d6bc75..892d2480a 100755
--- a/.travis/linux/docker.sh
+++ b/.travis/linux/docker.sh
@@ -6,7 +6,9 @@ apt-get install --no-install-recommends -y build-essential git libqt5opengl5-dev
6cd /yuzu 6cd /yuzu
7 7
8mkdir build && cd build 8mkdir build && cd build
9cmake .. -DYUZU_BUILD_UNICORN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -G Ninja 9cmake .. -DYUZU_USE_BUNDLED_UNICORN=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/lib/ccache/gcc -DCMAKE_CXX_COMPILER=/usr/lib/ccache/g++ -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -G Ninja
10ninja 10ninja
11 11
12ccache -s
13
12ctest -VV -C Release 14ctest -VV -C Release
diff --git a/.travis/macos/build.sh b/.travis/macos/build.sh
index b76a153be..b881fa190 100755
--- a/.travis/macos/build.sh
+++ b/.travis/macos/build.sh
@@ -9,7 +9,9 @@ export PATH="/usr/local/opt/ccache/libexec:$PATH"
9 9
10mkdir build && cd build 10mkdir build && cd build
11cmake --version 11cmake --version
12cmake .. -DYUZU_BUILD_UNICORN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON 12cmake .. -DYUZU_USE_BUNDLED_UNICORN=ON -DCMAKE_BUILD_TYPE=Release -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON
13make -j4 13make -j4
14 14
15ccache -s
16
15ctest -VV -C Release 17ctest -VV -C Release
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f32ecfba..203c3cf56 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -269,10 +269,18 @@ if (YUZU_USE_BUNDLED_UNICORN)
269 269
270 find_package(PythonInterp 2.7 REQUIRED) 270 find_package(PythonInterp 2.7 REQUIRED)
271 271
272 add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY} 272 if (MINGW)
273 COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh macos-universal-no 273 add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
274 WORKING_DIRECTORY ${UNICORN_PREFIX} 274 COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh cross-win64
275 ) 275 WORKING_DIRECTORY ${UNICORN_PREFIX}
276 )
277 else()
278 add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
279 COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh macos-universal-no
280 WORKING_DIRECTORY ${UNICORN_PREFIX}
281 )
282 endif()
283
276 # ALL makes this custom target build every time 284 # ALL makes this custom target build every time
277 # but it won't actually build if LIBUNICORN_LIBRARY is up to date 285 # but it won't actually build if LIBUNICORN_LIBRARY is up to date
278 add_custom_target(unicorn-build ALL 286 add_custom_target(unicorn-build ALL
@@ -286,6 +294,7 @@ endif()
286 294
287if (UNICORN_FOUND) 295if (UNICORN_FOUND)
288 add_library(unicorn INTERFACE) 296 add_library(unicorn INTERFACE)
297 add_dependencies(unicorn unicorn-build)
289 target_link_libraries(unicorn INTERFACE "${LIBUNICORN_LIBRARY}") 298 target_link_libraries(unicorn INTERFACE "${LIBUNICORN_LIBRARY}")
290 target_include_directories(unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}") 299 target_include_directories(unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}")
291else() 300else()
diff --git a/CMakeModules/MinGWCross.cmake b/CMakeModules/MinGWCross.cmake
new file mode 100644
index 000000000..25750f521
--- /dev/null
+++ b/CMakeModules/MinGWCross.cmake
@@ -0,0 +1,54 @@
1SET(MINGW_PREFIX /usr/x86_64-w64-mingw32/)
2SET(CMAKE_SYSTEM_NAME Windows)
3SET(CMAKE_SYSTEM_PROCESSOR x86_64)
4# Actually a hack, w/o this will cause some strange errors
5SET(CMAKE_HOST_WIN32 TRUE)
6
7
8SET(CMAKE_FIND_ROOT_PATH ${MINGW_PREFIX})
9SET(SDL2_PATH ${MINGW_PREFIX})
10SET(MINGW_TOOL_PREFIX ${CMAKE_SYSTEM_PROCESSOR}-w64-mingw32-)
11
12# Specify the cross compiler
13SET(CMAKE_C_COMPILER ${MINGW_TOOL_PREFIX}gcc-posix)
14SET(CMAKE_CXX_COMPILER ${MINGW_TOOL_PREFIX}g++-posix)
15SET(CMAKE_RC_COMPILER ${MINGW_TOOL_PREFIX}windres)
16
17# Mingw tools
18SET(STRIP ${MINGW_TOOL_PREFIX}strip)
19SET(WINDRES ${MINGW_TOOL_PREFIX}windres)
20SET(ENV{PKG_CONFIG} ${MINGW_TOOL_PREFIX}pkg-config)
21
22# ccache wrapper
23OPTION(USE_CCACHE "Use ccache for compilation" OFF)
24IF(USE_CCACHE)
25 FIND_PROGRAM(CCACHE ccache)
26 IF (CCACHE)
27 MESSAGE(STATUS "Using ccache found in PATH")
28 SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
29 SET_PROPERTY(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
30 ELSE(CCACHE)
31 MESSAGE(WARNING "USE_CCACHE enabled, but no ccache found")
32 ENDIF(CCACHE)
33ENDIF(USE_CCACHE)
34
35# Search for programs in the build host directories
36SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
37
38
39# Echo modified cmake vars to screen for debugging purposes
40IF(NOT DEFINED ENV{MINGW_DEBUG_INFO})
41 MESSAGE("")
42 MESSAGE("Custom cmake vars: (blank = system default)")
43 MESSAGE("-----------------------------------------")
44 MESSAGE("* CMAKE_C_COMPILER : ${CMAKE_C_COMPILER}")
45 MESSAGE("* CMAKE_CXX_COMPILER : ${CMAKE_CXX_COMPILER}")
46 MESSAGE("* CMAKE_RC_COMPILER : ${CMAKE_RC_COMPILER}")
47 MESSAGE("* WINDRES : ${WINDRES}")
48 MESSAGE("* ENV{PKG_CONFIG} : $ENV{PKG_CONFIG}")
49 MESSAGE("* STRIP : ${STRIP}")
50 MESSAGE("* USE_CCACHE : ${USE_CCACHE}")
51 MESSAGE("")
52 # So that the debug info only appears once
53 SET(ENV{MINGW_DEBUG_INFO} SHOWN)
54ENDIF()
diff --git a/appveyor.yml b/appveyor.yml
index d68ae87b1..a6a39a545 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -167,13 +167,3 @@ artifacts:
167 - path: $(BUILD_UPDATE) 167 - path: $(BUILD_UPDATE)
168 name: update 168 name: update
169 169
170deploy:
171 provider: GitHub
172 release: $(appveyor_repo_tag_name)
173 auth_token:
174 secure: QqePPnXbkzmXct5c8hZ2X5AbsthbI6cS1Sr+VBzcD8oUOIjfWJJKXVAQGUbQAbb0
175 artifact: update,build
176 draft: false
177 prerelease: false
178 on:
179 appveyor_repo_tag: true