From fb79ba2c6c00f42055961e1af6d8df59e8864dd2 Mon Sep 17 00:00:00 2001 From: Bradley Austin Davis Date: Thu, 31 Aug 2017 10:49:49 -0700 Subject: [PATCH 1/3] Migrate to vcpkg version of OpenSSL --- cmake/modules/FindOpenSSL.cmake | 60 ++++----------------------------- 1 file changed, 6 insertions(+), 54 deletions(-) diff --git a/cmake/modules/FindOpenSSL.cmake b/cmake/modules/FindOpenSSL.cmake index 69b6c367ca..338dee7bc8 100644 --- a/cmake/modules/FindOpenSSL.cmake +++ b/cmake/modules/FindOpenSSL.cmake @@ -34,26 +34,11 @@ if (UNIX) endif () if (WIN32) - - file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) - - if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") - # http://www.slproweb.com/products/Win32OpenSSL.html - set(_OPENSSL_ROOT_HINTS ${OPENSSL_ROOT_DIR} $ENV{OPENSSL_ROOT_DIR} $ENV{HIFI_LIB_DIR}/openssl - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" - ) - set(_OPENSSL_ROOT_PATHS "${_programfiles}/OpenSSL" "${_programfiles}/OpenSSL-Win64" "C:/OpenSSL/" "C:/OpenSSL-Win64/") + if (("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")) + set(_OPENSSL_ROOT_HINTS_AND_PATHS $ENV{VCPKG_ROOT}/installed/x64-windows) else() - # http://www.slproweb.com/products/Win32OpenSSL.html - set(_OPENSSL_ROOT_HINTS ${OPENSSL_ROOT_DIR} $ENV{OPENSSL_ROOT_DIR} $ENV{HIFI_LIB_DIR}/openssl - "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" - ) - set(_OPENSSL_ROOT_PATHS "${_programfiles}/OpenSSL" "${_programfiles}/OpenSSL-Win32" "C:/OpenSSL/" "C:/OpenSSL-Win32/") + set(_OPENSSL_ROOT_HINTS_AND_PATHS $ENV{VCPKG_ROOT}/installed/x86-windows) endif() - - unset(_programfiles) - set(_OPENSSL_ROOT_HINTS_AND_PATHS HINTS ${_OPENSSL_ROOT_HINTS} PATHS ${_OPENSSL_ROOT_PATHS}) - else () include("${MACRO_DIR}/HifiLibrarySearchHints.cmake") hifi_library_search_hints("openssl") @@ -67,47 +52,14 @@ find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h HINTS ${_OPENSSL_ROOT_HINTS_AN if (WIN32 AND NOT CYGWIN) if (MSVC) - - # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix: - # * MD for dynamic-release - # * MDd for dynamic-debug - # * MT for static-release - # * MTd for static-debug - - # Implementation details: - # We are using the libraries located in the VC subdir instead of the parent directory eventhough : - # libeay32MD.lib is identical to ../libeay32.lib, and - # ssleay32MD.lib is identical to ../ssleay32.lib - - # The Kitware FindOpenSSL module has been modified here by High Fidelity to look specifically for static libraries - - find_library(LIB_EAY_DEBUG NAMES libeay32MTd - ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib/VC/static" - ) - - find_library(LIB_EAY_RELEASE NAMES libeay32MT - ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib/VC/static" - ) - - find_library(SSL_EAY_DEBUG NAMES ssleay32MTd - ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib/VC/static" - ) - - find_library(SSL_EAY_RELEASE NAMES ssleay32MT - ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib/VC/static" - ) - - set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") - set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}") - set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}") - set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}") + # Using vcpkg builds of openssl + find_library(LIB_EAY_LIBRARY_RELEASE NAMES libeay32 HINTS ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib") + find_library(SSL_EAY_LIBRARY_RELEASE NAMES ssleay32 HINTS ${_OPENSSL_ROOT_HINTS_AND_PATHS} PATH_SUFFIXES "lib") include(SelectLibraryConfigurations) select_library_configurations(LIB_EAY) select_library_configurations(SSL_EAY) - set(OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY}) - find_path(OPENSSL_DLL_PATH NAMES ssleay32.dll PATH_SUFFIXES "bin" ${_OPENSSL_ROOT_HINTS_AND_PATHS}) endif() else() From 984503ce2937eeb7caf2804f39c292436d9edce4 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 31 Aug 2017 11:55:53 -0700 Subject: [PATCH 2/3] Update build instructions for vcpkg usage --- BUILD_WIN.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 1a33088237..659699940e 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -27,11 +27,20 @@ Go to `Control Panel > System > Advanced System Settings > Environment Variables * Set "Variable name": `QT_CMAKE_PREFIX_PATH` * Set "Variable value": `C:\Qt\5.9.1\msvc2017_64\lib\cmake` -### Step 5. Installing OpenSSL +### Step 5. Installing [vcpkg](https://github.com/Microsoft/vcpkg) -Download and install the Win64 OpenSSL v1.0.2 Installer[https://slproweb.com/products/Win32OpenSSL.html]. + * Clone the VCPKG [repository](https://github.com/Microsoft/vcpkg) + * Follow the instructions in the [readme](https://github.com/Microsoft/vcpkg/blob/master/README.md) to bootstrap vcpkg + * Note, you may need to do these in a _Developer Command Prompt_ + * Set an environment variable VCPKG_ROOT to the location of the cloned repository + * Close and re-open any command prompts after setting the environment variable so that they will pick up the change -### Step 6. Running CMake to Generate Build Files +### Step 6. Installing OpenSSL via vcpkg + + * In the vcpkg directory, install the 64 bit OpenSSL package with the command `vcpkg install openssl:x64-windows` + * Once the build completes you should have a file `ssl.h` in `${VCPKG_ROOT}/installed/x64-windows/include/openssl` + +### Step 7. Running CMake to Generate Build Files Run Command Prompt from Start and run the following commands: ``` @@ -43,7 +52,7 @@ cmake .. -G "Visual Studio 15 Win64" Where `%HIFI_DIR%` is the directory for the highfidelity repository. -### Step 7. Making a Build +### Step 8. Making a Build Open `%HIFI_DIR%\build\hifi.sln` using Visual Studio. @@ -51,7 +60,7 @@ Change the Solution Configuration (next to the green play button) from "Debug" t Run `Build > Build Solution`. -### Step 8. Testing Interface +### Step 9. Testing Interface Create another environment variable (see Step #4) * Set "Variable name": `_NO_DEBUG_HEAP` @@ -65,16 +74,20 @@ Note: You can also run Interface by launching it from command line or File Explo ## Troubleshooting -For any problems after Step #6, first try this: +For any problems after Step #7, first try this: * Delete your locally cloned copy of the highfidelity repository * Restart your computer * Redownload the [repository](https://github.com/highfidelity/hifi) -* Restart directions from Step #6 +* Restart directions from Step #7 #### CMake gives you the same error message repeatedly after the build fails Remove `CMakeCache.txt` found in the `%HIFI_DIR%\build` directory. +#### CMake can't find OpenSSL + +Remove `CMakeCache.txt` found in the `%HIFI_DIR%\build` directory. Verify that your VCPKG_ROOT environment variable is set and pointing to the correct location. Verify that the file `${VCPKG_ROOT}/installed/x64-windows/include/openssl/ssl.h` exists. + #### Qt is throwing an error Make sure you have the correct version (5.9.1) installed and `QT_CMAKE_PREFIX_PATH` environment variable is set correctly. From 71a403f03fb125894aae723bd5be12b060535a2f Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Thu, 31 Aug 2017 11:56:27 -0700 Subject: [PATCH 3/3] Update BUILD_WIN.md --- BUILD_WIN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD_WIN.md b/BUILD_WIN.md index 659699940e..eea1f85e5b 100644 --- a/BUILD_WIN.md +++ b/BUILD_WIN.md @@ -31,9 +31,9 @@ Go to `Control Panel > System > Advanced System Settings > Environment Variables * Clone the VCPKG [repository](https://github.com/Microsoft/vcpkg) * Follow the instructions in the [readme](https://github.com/Microsoft/vcpkg/blob/master/README.md) to bootstrap vcpkg - * Note, you may need to do these in a _Developer Command Prompt_ + * Note, you may need to do these in a _Developer Command Prompt_ * Set an environment variable VCPKG_ROOT to the location of the cloned repository - * Close and re-open any command prompts after setting the environment variable so that they will pick up the change + * Close and re-open any command prompts after setting the environment variable so that they will pick up the change ### Step 6. Installing OpenSSL via vcpkg