summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar James Rowe2017-09-09 11:24:13 -0600
committerGravatar James Rowe2017-09-11 09:10:17 -0600
commit9e847b754933f09bdf19be0dc45fc32a65052965 (patch)
treefb904cde766d925d20fe78c41fb6a24eb742195c
parentMerge pull request #2865 from wwylele/gs++ (diff)
downloadyuzu-9e847b754933f09bdf19be0dc45fc32a65052965.tar.gz
yuzu-9e847b754933f09bdf19be0dc45fc32a65052965.tar.xz
yuzu-9e847b754933f09bdf19be0dc45fc32a65052965.zip
Build: Enable SSL in mingw by linking against WinSSL
The mingw builds aren't submitting telemetry because the curl library they are linked against is configured to use openSSL and openSSL looks for the certificates in the users home folder. This keeps it from contacting web services because it can't communicate over SSL. This commit adds a download in mingw builds that will download a precompiled curl for mingw linked against winssl and sspi.
-rw-r--r--CMakeLists.txt28
-rw-r--r--CMakeModules/DownloadExternals.cmake18
-rw-r--r--appveyor.yml11
-rw-r--r--externals/CMakeLists.txt19
4 files changed, 49 insertions, 27 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f8060270e..d9c2f78a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,7 @@
2cmake_minimum_required(VERSION 3.6) 2cmake_minimum_required(VERSION 3.6)
3list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") 3list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
4list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") 4list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
5include(DownloadExternals)
5 6
6project(citra) 7project(citra)
7 8
@@ -12,6 +13,15 @@ option(ENABLE_QT "Enable the Qt frontend" ON)
12option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF) 13option(CITRA_USE_BUNDLED_QT "Download bundled Qt binaries" OFF)
13 14
14option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) 15option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
16option(CITRA_USE_BUNDLED_CURL "FOR MINGW ONLY: Download curl configured against winssl instead of openssl" OFF)
17if (ENABLE_WEB_SERVICE AND CITRA_USE_BUNDLED_CURL AND WINDOWS AND MSVC)
18 message("Turning off use bundled curl as msvc can compile curl on cpr")
19 SET(CITRA_USE_BUNDLED_CURL OFF CACHE BOOL "" FORCE)
20endif()
21if (ENABLE_WEB_SERVICE AND NOT CITRA_USE_BUNDLED_CURL AND MINGW)
22 message(AUTHOR_WARNING "Turning on CITRA_USE_BUNDLED_CURL. Override it only if you know what you are doing.")
23 SET(CITRA_USE_BUNDLED_CURL ON CACHE BOOL "" FORCE)
24endif()
15 25
16if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit) 26if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
17 message(STATUS "Copying pre-commit hook") 27 message(STATUS "Copying pre-commit hook")
@@ -151,24 +161,6 @@ set_property(DIRECTORY APPEND PROPERTY
151# System imported libraries 161# System imported libraries
152# ====================== 162# ======================
153 163
154# This function downloads a binary library package from our external repo.
155# Params:
156# remote_path: path to the file to download, relative to the remote repository root
157# prefix_var: name of a variable which will be set with the path to the extracted contents
158function(download_bundled_external remote_path lib_name prefix_var)
159 set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}")
160 if (NOT EXISTS "${prefix}")
161 message(STATUS "Downloading binaries for ${lib_name}...")
162 file(DOWNLOAD
163 https://github.com/citra-emu/ext-windows-bin/raw/master/${remote_path}${lib_name}.7z
164 "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" SHOW_PROGRESS)
165 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z"
166 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
167 endif()
168 message(STATUS "Using bundled binaries at ${prefix}")
169 set(${prefix_var} "${prefix}" PARENT_SCOPE)
170endfunction()
171
172find_package(PNG QUIET) 164find_package(PNG QUIET)
173if (NOT PNG_FOUND) 165if (NOT PNG_FOUND)
174 message(STATUS "libpng not found. Some debugging features have been disabled.") 166 message(STATUS "libpng not found. Some debugging features have been disabled.")
diff --git a/CMakeModules/DownloadExternals.cmake b/CMakeModules/DownloadExternals.cmake
new file mode 100644
index 000000000..138a15d5a
--- /dev/null
+++ b/CMakeModules/DownloadExternals.cmake
@@ -0,0 +1,18 @@
1
2# This function downloads a binary library package from our external repo.
3# Params:
4# remote_path: path to the file to download, relative to the remote repository root
5# prefix_var: name of a variable which will be set with the path to the extracted contents
6function(download_bundled_external remote_path lib_name prefix_var)
7set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}")
8if (NOT EXISTS "${prefix}")
9 message(STATUS "Downloading binaries for ${lib_name}...")
10 file(DOWNLOAD
11 https://github.com/citra-emu/ext-windows-bin/raw/master/${remote_path}${lib_name}.7z
12 "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z" SHOW_PROGRESS)
13 execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}.7z"
14 WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
15endif()
16message(STATUS "Using bundled binaries at ${prefix}")
17set(${prefix_var} "${prefix}" PARENT_SCOPE)
18endfunction() \ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index ec9ca3747..5524eb576 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -44,7 +44,7 @@ before_build:
44 # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning 44 # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
45 cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 -DCMAKE_USE_OPENSSL=0 .. 2>&1 && exit 0' 45 cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DCITRA_USE_BUNDLED_QT=1 -DCITRA_USE_BUNDLED_SDL2=1 -DCMAKE_USE_OPENSSL=0 .. 2>&1 && exit 0'
46 } else { 46 } else {
47 C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DUSE_SYSTEM_CURL=1 -DCMAKE_BUILD_TYPE=Release .. 2>&1" 47 C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DUSE_SYSTEM_CURL=1 -DCITRA_USE_BUNDLED_CURL=1 -DCMAKE_BUILD_TYPE=Release .. 2>&1"
48 } 48 }
49 - cd .. 49 - cd ..
50 50
@@ -112,9 +112,10 @@ after_build:
112 112
113 # copy the compiled binaries and other release files to the release folder 113 # copy the compiled binaries and other release files to the release folder
114 Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "citra*.exe" | Copy-Item -destination $RELEASE_DIST 114 Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "citra*.exe" | Copy-Item -destination $RELEASE_DIST
115 # copy the libcurl dll
116 Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "libcurl.dll" | Copy-Item -destination $RELEASE_DIST
115 Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST 117 Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
116 Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST 118 Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
117
118 # copy all the dll dependencies to the release folder 119 # copy all the dll dependencies to the release folder
119 # hardcoded list because we don't build static and determining the list of dlls from the binary is a pain. 120 # hardcoded list because we don't build static and determining the list of dlls from the binary is a pain.
120 $MingwDLLs = "Qt5Core.dll","Qt5Widgets.dll","Qt5Gui.dll","Qt5OpenGL.dll", 121 $MingwDLLs = "Qt5Core.dll","Qt5Widgets.dll","Qt5Gui.dll","Qt5OpenGL.dll",
@@ -123,11 +124,7 @@ after_build:
123 "libfreetype-*.dll","libglib-*.dll","libgobject-*.dll","libgraphite2.dll","libiconv-*.dll", 124 "libfreetype-*.dll","libglib-*.dll","libgobject-*.dll","libgraphite2.dll","libiconv-*.dll",
124 "libharfbuzz-*.dll","libintl-*.dll","libpcre-*.dll","libpcre16-*.dll","libpng16-*.dll", 125 "libharfbuzz-*.dll","libintl-*.dll","libpcre-*.dll","libpcre16-*.dll","libpng16-*.dll",
125 # Runtime/Other dependencies 126 # Runtime/Other dependencies
126 "libgcc_s_seh-*.dll","libstdc++-*.dll","libwinpthread-*.dll","SDL2.dll","zlib1.dll", 127 "libgcc_s_seh-*.dll","libstdc++-*.dll","libwinpthread-*.dll","SDL2.dll","zlib1.dll"
127 # curl dependencies
128 "libcurl-*.dll","libnghttp2-*.dll","libeay32.dll","libgmp-*.dll","librtmp-*.dll",
129 "libgnutls-*.dll","libhogweed-*.dll","libnettle-*.dll","libssh2-*.dll",
130 "ssleay32.dll","libidn-*.dll","libp11-kit-*.dll","libtasn1-*.dll","libunistring-*.dll"
131 foreach ($file in $MingwDLLs) { 128 foreach ($file in $MingwDLLs) {
132 Copy-Item -path "C:/msys64/mingw64/bin/$file" -force -destination "$RELEASE_DIST" 129 Copy-Item -path "C:/msys64/mingw64/bin/$file" -force -destination "$RELEASE_DIST"
133 } 130 }
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt
index 8e4bcf21f..4a4ba1101 100644
--- a/externals/CMakeLists.txt
+++ b/externals/CMakeLists.txt
@@ -1,5 +1,8 @@
1# Definitions for all external bundled libraries 1# Definitions for all external bundled libraries
2 2
3set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
4include(DownloadExternals)
5
3# Catch 6# Catch
4add_library(catch-single-include INTERFACE) 7add_library(catch-single-include INTERFACE)
5target_include_directories(catch-single-include INTERFACE catch/single_include) 8target_include_directories(catch-single-include INTERFACE catch/single_include)
@@ -54,9 +57,21 @@ add_subdirectory(enet)
54target_include_directories(enet INTERFACE ./enet/include) 57target_include_directories(enet INTERFACE ./enet/include)
55 58
56if (ENABLE_WEB_SERVICE) 59if (ENABLE_WEB_SERVICE)
60 # msys installed curl is configured to use openssl, but that isn't portable
61 # since it relies on having the bundled certs install in the home folder for SSL
62 # by default on mingw, download the precompiled curl thats linked against windows native ssl
63 if (MINGW AND CITRA_USE_BUNDLED_CURL)
64 download_bundled_external("curl/" "curl-7_55_1" CURL_PREFIX)
65 set(CURL_PREFIX "${CMAKE_BINARY_DIR}/externals/curl-7_55_1")
66 set(CURL_FOUND YES)
67 set(CURL_INCLUDE_DIR "${CURL_PREFIX}/include" CACHE PATH "Path to curl headers")
68 set(CURL_LIBRARY "${CURL_PREFIX}/lib/libcurldll.a" CACHE PATH "Path to curl library")
69 set(CURL_DLL_DIR "${CURL_PREFIX}/lib/" CACHE PATH "Path to curl.dll")
70 set(USE_SYSTEM_CURL ON CACHE BOOL "")
71 endif()
57 # CPR 72 # CPR
58 option(BUILD_TESTING OFF) 73 set(BUILD_TESTING OFF CACHE BOOL "")
59 option(BUILD_CPR_TESTS OFF) 74 set(BUILD_CPR_TESTS OFF CACHE BOOL "")
60 add_subdirectory(cpr) 75 add_subdirectory(cpr)
61 target_include_directories(cpr INTERFACE ./cpr/include) 76 target_include_directories(cpr INTERFACE ./cpr/include)
62 77