From 6c52ce482b0a27bf13d4aee1347431205ed324e0 Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 12 Jun 2023 16:56:00 +0200 Subject: [PATCH 1/4] update VS to match tpm2-openssl project Signed-off-by: Philipp Unger --- .appveyor.yml | 2 +- src/tss2-esys/tss2-esys.vcxproj | 12 ++++++------ src/tss2-mu/tss2-mu.vcxproj | 10 +++++----- src/tss2-rc/tss2-rc.vcxproj | 12 ++++++------ src/tss2-sys/tss2-sys.vcxproj | 12 ++++++------ src/tss2-tcti/tss2-tcti-mssim.vcxproj | 12 ++++++------ src/tss2-tcti/tss2-tcti-swtpm.vcxproj | 8 ++++---- src/tss2-tcti/tss2-tcti-tbs.vcxproj | 12 ++++++------ src/tss2-tcti/tss2-tctildr.vcxproj | 12 ++++++------ tpm2-tss.sln | 4 ++-- 10 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5ea3f7c61..3cd0a753a 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,7 +2,7 @@ version: '{build}' pull_requests: do_not_increment_build_number: true skip_tags: true -image: Visual Studio 2017 +image: Visual Studio 2019 configuration: - Debug - Release diff --git a/src/tss2-esys/tss2-esys.vcxproj b/src/tss2-esys/tss2-esys.vcxproj index d80ce88cf..24b64ec9c 100644 --- a/src/tss2-esys/tss2-esys.vcxproj +++ b/src/tss2-esys/tss2-esys.vcxproj @@ -22,28 +22,28 @@ 15.0 {BE0516D7-994C-4133-BD91-A21239D8B087} Win32Proj - 10.0.17134.0 + 10.0 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL @@ -260,4 +260,4 @@ - + \ No newline at end of file diff --git a/src/tss2-mu/tss2-mu.vcxproj b/src/tss2-mu/tss2-mu.vcxproj index ebf56a9b8..043d17f8b 100644 --- a/src/tss2-mu/tss2-mu.vcxproj +++ b/src/tss2-mu/tss2-mu.vcxproj @@ -37,28 +37,28 @@ Clang libtss2_mu 14.0 - 10.0.17134.0 + 10 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL diff --git a/src/tss2-rc/tss2-rc.vcxproj b/src/tss2-rc/tss2-rc.vcxproj index 15f911548..11d7e287e 100644 --- a/src/tss2-rc/tss2-rc.vcxproj +++ b/src/tss2-rc/tss2-rc.vcxproj @@ -31,28 +31,28 @@ Clang libtss2_rc 14.0 - 10.0.17134.0 + 10 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL @@ -75,4 +75,4 @@ - + \ No newline at end of file diff --git a/src/tss2-sys/tss2-sys.vcxproj b/src/tss2-sys/tss2-sys.vcxproj index d9c055732..68fc57aff 100644 --- a/src/tss2-sys/tss2-sys.vcxproj +++ b/src/tss2-sys/tss2-sys.vcxproj @@ -173,28 +173,28 @@ Clang tss2_sys 14.0 - 10.0.17134.0 + 10 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL @@ -218,4 +218,4 @@ - + \ No newline at end of file diff --git a/src/tss2-tcti/tss2-tcti-mssim.vcxproj b/src/tss2-tcti/tss2-tcti-mssim.vcxproj index 77e778cee..3566da0f8 100644 --- a/src/tss2-tcti/tss2-tcti-mssim.vcxproj +++ b/src/tss2-tcti/tss2-tcti-mssim.vcxproj @@ -22,28 +22,28 @@ 15.0 {89B6B774-2886-48CF-B1D0-534AC449E0FD} Win32Proj - 10.0.17134.0 + 10 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL @@ -136,4 +136,4 @@ - + \ No newline at end of file diff --git a/src/tss2-tcti/tss2-tcti-swtpm.vcxproj b/src/tss2-tcti/tss2-tcti-swtpm.vcxproj index c8812a93f..54f81a580 100644 --- a/src/tss2-tcti/tss2-tcti-swtpm.vcxproj +++ b/src/tss2-tcti/tss2-tcti-swtpm.vcxproj @@ -28,22 +28,22 @@ DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL diff --git a/src/tss2-tcti/tss2-tcti-tbs.vcxproj b/src/tss2-tcti/tss2-tcti-tbs.vcxproj index 0ad9e7453..8d639131d 100644 --- a/src/tss2-tcti/tss2-tcti-tbs.vcxproj +++ b/src/tss2-tcti/tss2-tcti-tbs.vcxproj @@ -22,28 +22,28 @@ 15.0 {6BA6146F-8B38-49A2-A156-769E0F2CC302} Win32Proj - 10.0.17134.0 + 10 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL @@ -133,4 +133,4 @@ - + \ No newline at end of file diff --git a/src/tss2-tcti/tss2-tctildr.vcxproj b/src/tss2-tcti/tss2-tctildr.vcxproj index 28d0af261..fe501133f 100644 --- a/src/tss2-tcti/tss2-tctildr.vcxproj +++ b/src/tss2-tcti/tss2-tctildr.vcxproj @@ -22,28 +22,28 @@ 15.0 {40EC0A14-E90F-450F-B250-2071B05ED099} Win32Proj - 10.0.17134.0 + 10 DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL DynamicLibrary true - v141_clang_c2 + ClangCL DynamicLibrary false - v141_clang_c2 + ClangCL @@ -134,4 +134,4 @@ - + \ No newline at end of file diff --git a/tpm2-tss.sln b/tpm2-tss.sln index 630ce6990..edf5ab7a1 100644 --- a/tpm2-tss.sln +++ b/tpm2-tss.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2027 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32505.173 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tss2-mu", "src\tss2-mu\tss2-mu.vcxproj", "{A6D8F061-6827-492F-80C3-32C4DD4FC52E}" EndProject From 1f07b67c2a56304765762d1090d09331cd1cbf7c Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Mon, 12 Jun 2023 17:05:55 +0200 Subject: [PATCH 2/4] add openssl.props to replace hard-coded OpenSSL path strings Signed-off-by: Philipp Unger --- src/tss2-esys/openssl.props | 11 +++++++++++ src/tss2-esys/tss2-esys.vcxproj | 20 ++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 src/tss2-esys/openssl.props diff --git a/src/tss2-esys/openssl.props b/src/tss2-esys/openssl.props new file mode 100644 index 000000000..cb6e5de30 --- /dev/null +++ b/src/tss2-esys/openssl.props @@ -0,0 +1,11 @@ + + + + + C:\OpenSSL-v11-Win64 + C:\OpenSSL-v11-Win32 + + + + + diff --git a/src/tss2-esys/tss2-esys.vcxproj b/src/tss2-esys/tss2-esys.vcxproj index 24b64ec9c..39bcf15f0 100644 --- a/src/tss2-esys/tss2-esys.vcxproj +++ b/src/tss2-esys/tss2-esys.vcxproj @@ -52,15 +52,19 @@ + + + + @@ -69,13 +73,13 @@ MultiThreadedDebugDLL Level3 Disabled - $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;C:\OpenSSL-v11-Win32\include;%(AdditionalIncludeDirectories) + $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;$(OpenSslDir32Bit)\include;%(AdditionalIncludeDirectories) MachineX86 true Windows - $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;C:\OpenSSL-v11-Win32\lib\libcrypto.lib;C:\OpenSSL-v11-Win32\lib\libcrypto.lib;%(AdditionalDependencies) + $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;$(OpenSslDir32Bit)\lib\libcrypto.lib;$(OpenSslDir32Bit)\lib\libcrypto.lib;%(AdditionalDependencies) $(SolutionDir)\lib\tss2-esys.def @@ -84,7 +88,7 @@ WIN32;NDEBUG;_WINDOWS;_USRDLL;TSS2ESYS_EXPORTS;MAXLOGLEVEL=6;strtok_r=strtok_s;OSSL;%(PreprocessorDefinitions) MultiThreadedDLL Level3 - $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;C:\OpenSSL-v11-Win32\include;%(AdditionalIncludeDirectories) + $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;$(OpenSslDir32Bit)\include;%(AdditionalIncludeDirectories) MachineX86 @@ -92,27 +96,27 @@ Windows true true - $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;C:\OpenSSL-v11-Win32\lib\libcrypto.lib;%(AdditionalDependencies) + $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;$(OpenSslDir32Bit)\lib\libcrypto.lib;%(AdditionalDependencies) $(SolutionDir)\lib\tss2-esys.def - $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;C:\OpenSSL-v11-Win64\include;%(AdditionalIncludeDirectories) + $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;$(OpenSslDir)\include;%(AdditionalIncludeDirectories) _DEBUG;_WINDOWS;_USRDLL;TSS2ESYS_EXPORTS;MAXLOGLEVEL=6;strtok_r=strtok_s;OSSL;%(PreprocessorDefinitions) - $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;C:\OpenSSL-v11-Win64\lib\libcrypto.lib;%(AdditionalDependencies) + $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;$(OpenSslDir)\lib\libcrypto.lib;%(AdditionalDependencies) $(SolutionDir)\lib\tss2-esys.def - $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;C:\OpenSSL-v11-Win64\include;%(AdditionalIncludeDirectories) + $(SolutionDir);$(SolutionDir)\src;$(SolutionDir)\include\tss2;$(SolutionDir)\src\tss2-mu;$(SolutionDir)\src\tss2-sys;$(SolutionDir)\src\tss2-esys;$(OpenSslDir)\include;%(AdditionalIncludeDirectories) NDEBUG;_WINDOWS;_USRDLL;TSS2ESYS_EXPORTS;MAXLOGLEVEL=6;strtok_r=strtok_s;OSSL;%(PreprocessorDefinitions) - $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;C:\OpenSSL-v11-Win64\lib\libcrypto.lib;%(AdditionalDependencies) + $(OutDir)\tss2-mu.lib;$(OutDir)\tss2-sys.lib;$(OutDir)\tss2-tctildr.lib;$(OpenSslDir)\lib\libcrypto.lib;%(AdditionalDependencies) $(SolutionDir)\lib\tss2-esys.def From 39f4306993ac0300feba5eac3c19f7a1b75077cb Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Fri, 10 Nov 2023 23:52:22 +0100 Subject: [PATCH 3/4] update INSTALL.md with VS 2019+ build instructions Signed-off-by: Philipp Unger --- INSTALL.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index 9bd85d553..6bc1268ab 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -84,12 +84,10 @@ $ sudo dnf install libuuid-devel ``` ## Windows -Windows dlls built using the Clang/LLVM "Platform Toolset" are currently -prototypes. We have only tested using Visual Studio 2017 with the Universal -C Runtime (UCRT) version 10.0.16299.0. Building the type marshaling library -(tss2-mu.dll) and the system API (tss2-sapi.dll) should be as simple as -loading the tpm2-tss solution (tpm2-tss.sln) with a compatible and properly -configured version of Visual Studio 2017 and pressing the 'build' button. +Windows dlls are built using the LLVM (clang-cl) toolset. We have only tested +using Visual Studio 2019, but Visual Studio 2022 should also be supported. +Building should be as simple as loading the tpm2-tss solution (tpm2-tss.sln) with +a compatible and properly configured version of Visual Studio 2019+ and pressing the 'build' button. ### References Visual Studio 2017 with "Clang for Windows": https://blogs.msdn.microsoft.com/vcblog/2017/03/07/use-any-c-compiler-with-visual-studio/ From 4fae5ccc583b53a01d1dfb437b94800e8f2cc7fc Mon Sep 17 00:00:00 2001 From: Philipp Unger Date: Thu, 16 Nov 2023 10:53:42 +0100 Subject: [PATCH 4/4] update references to VS 2019 with clang in INSTALL.md Signed-off-by: Philipp Unger --- INSTALL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL.md b/INSTALL.md index 6bc1268ab..61573ae2d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -90,7 +90,7 @@ Building should be as simple as loading the tpm2-tss solution (tpm2-tss.sln) wit a compatible and properly configured version of Visual Studio 2019+ and pressing the 'build' button. ### References -Visual Studio 2017 with "Clang for Windows": https://blogs.msdn.microsoft.com/vcblog/2017/03/07/use-any-c-compiler-with-visual-studio/ +Visual Studio 2019+ with "Clang for Windows": https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild Universal CRT overview & setup instructions: https://docs.microsoft.com/en-us/cpp/porting/upgrade-your-code-to-the-universal-crt # Building From Source