浏览代码

Add shared library option to 2021.2.0 ls-std recipe

Patrick-Christopher Mattulat 3 年之前
父节点
当前提交
18818eceb9
共有 1 个文件被更改,包括 16 次插入9 次删除
  1. 16 9
      recipes/ls-std/2021_2_0/conanfile.py

+ 16 - 9
recipes/ls-std/2021_2_0/conanfile.py

@@ -5,31 +5,38 @@ class LsStdConan(ConanFile):
     name = "ls-std"
     version = "2021.2.0"
     license = "MIT"
-    url = "<Package recipe repository url here, for issues about the package>"
+    url = "https://vcs.lynarstudios.de/public/ls-standard-library.git"
     description = "This library provides standard functionalities like serialization, json, xml, file operations, " \
                   "boxing, state machine, event handling."
     topics = ("serialization", "events", "boxing", "xml", "json", "files", "state machine")
     settings = "os", "compiler", "build_type", "arch"
-    options = {"shared": [True, False]}
-    default_options = {"shared": False}
+    options = {"shared": [True, False], "static": [True, False]}
+    default_options = {"shared": False, "static": True}
     generators = "cmake"
 
     def source(self):
-        self.run("git clone https://vcs.lynarstudios.de/public/ls-standard-library.git --branch v" + self.version +
-                 " --single-branch")
+        self.run("git clone " + self.url + " --branch v" + self.version + " --single-branch")
 
     def build(self):
         cmake = CMake(self)
+
+        if self.options.shared:
+            cmake.definitions["LS_STD_BUILD_SHARED"] = "ON"
+            cmake.definitions["LS_STD_BUILD_STATIC"] = "OFF"
+
         cmake.configure(source_folder="ls-standard-library")
-        cmake.build()
+        self.run("cmake --build . --config Release")
 
     def package(self):
         self.copy("*.hpp", dst="include", src="ls-standard-library/include")
-        self.copy("*ls_std_" + self.version + "_static.lib", dst="lib", keep_path=False)
-        self.copy("*.dll", dst="bin", keep_path=False)
+        self.copy("*.lib", dst="lib", keep_path=False)
+        self.copy("*.dll", dst="lib", keep_path=False)
         self.copy("*.so", dst="lib", keep_path=False)
         self.copy("*.dylib", dst="lib", keep_path=False)
         self.copy("*.a", dst="lib", keep_path=False)
 
     def package_info(self):
-        self.cpp_info.libs = ["ls_std_" + self.version + "_static"]
+        if self.options.shared:
+            self.cpp_info.libs = ["ls_std_" + self.version + "_shared"]
+        else:
+            self.cpp_info.libs = ["ls_std_" + self.version + "_static"]