From 79fb34a90bfc318ba73445e4db32f5693042493b Mon Sep 17 00:00:00 2001 From: OJ Date: Wed, 15 Apr 2020 13:12:31 +1000 Subject: [PATCH 1/6] Add support for use of static MSVC runtimes In certain contexts LibreSSL needs to be built with `/MT` instead of `/MD` for inclusion in other projects. These changes allow for the command-line option `USE_STATIC_MSVC_RUNTIMES` to be set to `ON` if the use wishes to generate projects that will build with static runtimes. This feature requires CMAKE version 3.15+, hence the minimum required version has changed as well. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e198f7c..a577d29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.0) +cmake_minimum_required (VERSION 3.15) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckLibraryExists) @@ -9,6 +9,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH}) include(cmake_export_symbol) include(GNUInstallDirs) +cmake_policy(SET CMP0091 NEW) project (LibreSSL C ASM) enable_testing() @@ -36,6 +37,11 @@ option(ENABLE_EXTRATESTS "Enable extra tests that may be unreliable on some plat option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) +option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF) +if( USE_STATIC_MSVC_RUNTIMES ) + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") +endif() + if(NOT LIBRESSL_SKIP_INSTALL) set( ENABLE_LIBRESSL_INSTALL ON ) endif(NOT LIBRESSL_SKIP_INSTALL) From 4d07b727d2785d6387e69bd3a6848ea95c42050a Mon Sep 17 00:00:00 2001 From: OJ Date: Mon, 20 Apr 2020 20:28:48 +1000 Subject: [PATCH 2/6] Force use of 3.15.7 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a577d29..cd35af2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.15) +cmake_minimum_required (VERSION 3.15.7) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckLibraryExists) From 1c3377bac0a55e6a5e86e25556bf1635bb1c7bdb Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 1 May 2020 04:09:57 -0500 Subject: [PATCH 3/6] bump cmake and appveyor build environment --- CMakeLists.txt | 2 +- appveyor.yml | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd35af2..fb36210 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.15.7) +cmake_minimum_required (VERSION 3.16.4) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckLibraryExists) diff --git a/appveyor.yml b/appveyor.yml index 8ac2045..3d11467 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,25 +1,24 @@ image: - - Visual Studio 2015 - #- Visual Studio 2017 + - Visual Studio 2019 environment: PATH: C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\Windows\System32;C:\Windows;%PATH% matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - GENERATOR: Visual Studio 14 2015 Win64 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + GENERATOR: Visual Studio 16 2019 Win64 CONFIG: Release SHARED_LIBS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - GENERATOR: Visual Studio 14 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + GENERATOR: Visual Studio 16 2019 CONFIG: Release SHARED_LIBS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - GENERATOR: Visual Studio 14 2015 Win64 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + GENERATOR: Visual Studio 16 2019 Win64 CONFIG: Release SHARED_LIBS: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - GENERATOR: Visual Studio 14 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + GENERATOR: Visual Studio 16 2019 CONFIG: Release SHARED_LIBS: OFF From 13159a59e1d1715046e5b912d307c6e35d3b4631 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 1 May 2020 04:34:48 -0500 Subject: [PATCH 4/6] make cmake version bump conditional on MSVC --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb36210..31d2fba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,8 @@ +if(MSVC) cmake_minimum_required (VERSION 3.16.4) +else() +cmake_minimum_required (VERSION 3.0) +endif() include(CheckFunctionExists) include(CheckSymbolExists) include(CheckLibraryExists) @@ -38,7 +42,7 @@ option(ENABLE_NC "Enable installing TLS-enabled nc(1)" OFF) set(OPENSSLDIR ${OPENSSLDIR} CACHE PATH "Set the default openssl directory" FORCE) option(USE_STATIC_MSVC_RUNTIMES "Use /MT instead of /MD in MSVC" OFF) -if( USE_STATIC_MSVC_RUNTIMES ) +if(USE_STATIC_MSVC_RUNTIMES) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() From ee9d53e2714cf6671dc6abf8bdc7654a13981bd5 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 1 May 2020 04:58:48 -0500 Subject: [PATCH 5/6] specify architecture separately --- appveyor.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 3d11467..b29c39d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,19 +6,13 @@ environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - GENERATOR: Visual Studio 16 2019 Win64 + GENERATOR: Visual Studio 16 2019 + ARCHITECTURE: Win64 CONFIG: Release SHARED_LIBS: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 GENERATOR: Visual Studio 16 2019 - CONFIG: Release - SHARED_LIBS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - GENERATOR: Visual Studio 16 2019 Win64 - CONFIG: Release - SHARED_LIBS: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - GENERATOR: Visual Studio 16 2019 + ARCHITECTURE: Win64 CONFIG: Release SHARED_LIBS: OFF @@ -33,7 +27,7 @@ before_build: - bash autogen.sh - mkdir build - cd build - - cmake .. -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%SHARED_LIBS% -DCMAKE_INSTALL_PREFIX=../local + - cmake .. -G "%GENERATOR%" -A "%ARCHITECTURE%" -DBUILD_SHARED_LIBS=%SHARED_LIBS% -DCMAKE_INSTALL_PREFIX=../local build_script: - cmake --build . --config %CONFIG% From 012014df35b7ff951363b4127c0bcaf9ad555bfe Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Fri, 1 May 2020 08:31:11 -0500 Subject: [PATCH 6/6] more MSVC build/test tweaks --- CMakeLists.txt | 2 +- appveyor.yml | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31d2fba..515b3fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ if(MSVC) cmake_minimum_required (VERSION 3.16.4) +cmake_policy(SET CMP0091 NEW) else() cmake_minimum_required (VERSION 3.0) endif() @@ -13,7 +14,6 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ${CMAKE_MODULE_PATH}) include(cmake_export_symbol) include(GNUInstallDirs) -cmake_policy(SET CMP0091 NEW) project (LibreSSL C ASM) enable_testing() diff --git a/appveyor.yml b/appveyor.yml index b29c39d..4e0b488 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,12 +7,22 @@ environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 GENERATOR: Visual Studio 16 2019 - ARCHITECTURE: Win64 + ARCHITECTURE: Win32 CONFIG: Release SHARED_LIBS: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 GENERATOR: Visual Studio 16 2019 - ARCHITECTURE: Win64 + ARCHITECTURE: Win32 + CONFIG: Release + SHARED_LIBS: OFF + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + GENERATOR: Visual Studio 16 2019 + ARCHITECTURE: x64 + CONFIG: Release + SHARED_LIBS: ON + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + GENERATOR: Visual Studio 16 2019 + ARCHITECTURE: x64 CONFIG: Release SHARED_LIBS: OFF