-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tssmsr/cci.20201117 #4552
Closed
Closed
Add tssmsr/cci.20201117 #4552
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sources: | ||
"cci.20201117": | ||
url: "https://github.com/microsoft/TSS.MSR/archive/04eba4ac647c5fc2436adbeea49fc3372418de7b.tar.gz" | ||
sha256: cfbc77dad59d3bf01e6d18c43946100541690240bed524b13d361073e529b62e | ||
patches: | ||
"cci.20201117": | ||
- patch_file: "patches/0001-Add-conan-openssl-dependency-to-Makefile.patch" | ||
base_path: "source_subfolder" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,87 @@ | ||||||||
import os | ||||||||
from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools | ||||||||
from conans.errors import ConanInvalidConfiguration | ||||||||
from glob import glob | ||||||||
|
||||||||
|
||||||||
class TssMsrConan(ConanFile): | ||||||||
name = "tssmsr" | ||||||||
description = "TPM Software Stack (TSS) implementations from Microsoft" | ||||||||
topics = ("tpm", "tss", "crypto", "microsoft") | ||||||||
homepage = "https://github.com/microsoft/TSS.MSR" | ||||||||
url = "https://github.com/conan-io/conan-center-index" | ||||||||
license = "MIT" | ||||||||
settings = "os", "compiler", "arch", "build_type" | ||||||||
generators = "make" | ||||||||
exports_sources = "patches/*" | ||||||||
|
||||||||
@property | ||||||||
def _source_subfolder(self): | ||||||||
return "source_subfolder" | ||||||||
|
||||||||
@property | ||||||||
def _build_subfolder(self): | ||||||||
return os.path.join(self._source_subfolder, "TSS.CPP") | ||||||||
|
||||||||
@property | ||||||||
def _minimum_cpp_standard(self): | ||||||||
return 11 | ||||||||
|
||||||||
@property | ||||||||
def _minimum_compilers_version(self): | ||||||||
return { | ||||||||
"Visual Studio": "14", | ||||||||
"gcc": "5", | ||||||||
"clang": "3.9", | ||||||||
"apple-clang": "8", | ||||||||
} | ||||||||
|
||||||||
def configure(self): | ||||||||
if self.settings.compiler.get_safe("cppstd"): | ||||||||
tools.check_min_cppstd(self, self._minimum_cpp_standard) | ||||||||
min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) | ||||||||
if not min_version: | ||||||||
self.output.warn("{} recipe lacks information about the {} compiler support.".format( | ||||||||
self.name, self.settings.compiler)) | ||||||||
else: | ||||||||
if tools.Version(self.settings.compiler.version) < min_version: | ||||||||
raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( | ||||||||
self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) | ||||||||
|
||||||||
def requirements(self): | ||||||||
# VC builds link against openssl included in the sources | ||||||||
if not self.settings.compiler == "Visual Studio": | ||||||||
self.requires("openssl/1.1.1g") | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
def source(self): | ||||||||
tools.get(**self.conan_data["sources"][self.version]) | ||||||||
extracted_dir = glob("TSS.MSR-*")[0] | ||||||||
os.rename(extracted_dir, self._source_subfolder) | ||||||||
|
||||||||
def build(self): | ||||||||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||||||||
tools.patch(**patch) | ||||||||
if self.settings.compiler == "Visual Studio": | ||||||||
msbuild = MSBuild(self) | ||||||||
msbuild.build(os.path.join(self._build_subfolder, "TSS.CPP.sln"), targets=["TSS_CPP"]) | ||||||||
else: | ||||||||
autotools = AutoToolsBuildEnvironment(self) | ||||||||
autotools.make( | ||||||||
args=[f"CONFIG={str(self.settings.build_type).lower()}", "-C", self._build_subfolder]) | ||||||||
|
||||||||
def package(self): | ||||||||
self.copy(pattern="LICENSE", dst="licenses", | ||||||||
src=self._source_subfolder) | ||||||||
self.copy("*.h", dst="include", | ||||||||
src=os.path.join(self._build_subfolder, "include")) | ||||||||
self.copy("**/libtss*.a", dst="lib", keep_path=False) | ||||||||
self.copy("**/libtss*.so", dst="lib", keep_path=False) | ||||||||
self.copy("**/TSS.CPP.dll", dst="bin", keep_path=False) | ||||||||
self.copy("**/TSS.CPP.lib", dst="lib", keep_path=False) | ||||||||
|
||||||||
def package_info(self): | ||||||||
if tools.os_info.is_windows: | ||||||||
self.cpp_info.libs = ["tss.cpp"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
else: | ||||||||
self.cpp_info.libs = [ | ||||||||
"tss" + ("d" if self.settings.build_type == "Debug" else "")] |
48 changes: 48 additions & 0 deletions
48
recipes/tssmsr/all/patches/0001-Add-conan-openssl-dependency-to-Makefile.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
From 73fc74859e3f91a02062311c36cdf85abb2ba13e Mon Sep 17 00:00:00 2001 | ||
From: =?UTF-8?q?R=C3=A9my=20Salim?= <remy.salim@echosens.com> | ||
Date: Fri, 18 Sep 2020 10:33:07 +0200 | ||
Subject: [PATCH 1/1] Add conan openssl dependency to Makefile | ||
|
||
--- | ||
TSS.CPP/Makefile | 11 +++++++---- | ||
1 file changed, 7 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/TSS.CPP/Makefile b/TSS.CPP/Makefile | ||
index b6d9c83..608b06e 100644 | ||
--- a/TSS.CPP/Makefile | ||
+++ b/TSS.CPP/Makefile | ||
@@ -3,7 +3,9 @@ CC = g++ | ||
CFLAGS_DBG = -g -DDEBUG -D_DEBUG | ||
CFLAGS_REL = -O2 -DNDEBUG | ||
|
||
-_CFLAGS = -Wall -std=c++11 -Iinclude | ||
+-include ../../conanbuildinfo.mak | ||
+ | ||
+_CFLAGS = -Wall -std=c++11 -Iinclude -I$(CONAN_INCLUDE_DIRS_OPENSSL) -DOPENSSL_NO_SM3 | ||
CFLAGS_SRC = $(_CFLAGS) -fPIC -D_TPMCPPLIB | ||
CFLAGS_SMPL = $(_CFLAGS) | ||
|
||
@@ -11,8 +13,8 @@ SRCDIR = Src | ||
SMPLDIR = Samples | ||
BINDIR = bin | ||
|
||
-TSS_A = $(BINDIR)/tss$(SUFF).a | ||
-TSS_SO = $(BINDIR)/tss$(SUFF).so | ||
+TSS_A = $(BINDIR)/libtss$(SUFF).a | ||
+TSS_SO = $(BINDIR)/libtss$(SUFF).so | ||
SAMPLES = $(BINDIR)/samples | ||
|
||
OBJDIR = $(BINDIR)/obj | ||
@@ -87,7 +89,8 @@ $(DEPFILES_SMPL): | ||
|
||
|
||
$(SAMPLES): $(SMPL_OBJS) $(TSS_A) | ||
- $(CC) -o $@ $(SMPL_OBJS) $(TSS_A) $(CFLAGS_SMPL) -L/usr/lib -lcrypto -ldl | ||
+ $(CC) -o $@ $(SMPL_OBJS) $(TSS_A) $(CFLAGS_SMPL) -L/usr/lib -lcrypto -ldl \ | ||
+ -L$(CONAN_LIB_DIRS_OPENSSL) $(addprefix -l,$(CONAN_LIBS_OPENSSL)) $(addprefix -l,$(CONAN_SYSTEM_LIBS_OPENSSL)) | ||
|
||
samples: $(SAMPLES) | ||
|
||
-- | ||
2.25.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${CMAKE_DL_LIBS}) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <Tpm2.h> | ||
|
||
using namespace std; | ||
using namespace TpmCpp; | ||
|
||
int main() { | ||
TpmTbsDevice device; | ||
Tpm2 tpm(device); | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"cci.20201117": | ||
folder: all |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's different about the inline one? Typically we use a small patch to make sure it uses the Conan one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just looks like an old one, you should be able to remove it and include the msbuild props generated from conan 🤞