Skip to content

Commit

Permalink
conanfile.py: Use conan conf for enabling codesigning instead of options
Browse files Browse the repository at this point in the history
  • Loading branch information
jwatson0 committed Oct 25, 2024
1 parent 9906555 commit bb6e5c5
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,11 @@ class ConanSlmPackage(ConanFile):
#settings = "os", "arch", "compiler", "build_type"
settings = "os", "arch"

# use an option to request codesigning of the output executable
# but allow building with codesigned or not
options = {"codesign": [True, False, None]}
default_build_options = {"slm/*:codesign": None}

# hide all dependencies from consumers
# https://blog.conan.io/2024/07/09/Introducing-vendoring-packages.html
vendor = True


# config_options(): Configure options while computing dependency graph
def config_options(self):
# codesigning only supported on windows
if self.settings.os != "Windows":
self.options.rm_safe("codesign")


# set_name(): Dynamically define the name of a package
def set_name(self):
self.output.info("conanfile.py: set_name()")
Expand All @@ -64,7 +52,7 @@ def validate_build(self):
self.output.info("conanfile.py: validate_build()")

# if codesigning is enabled
if self.options.get_safe("codesign", default=False):
if self.conf.get("user.jitx.slm:codesign") and self.settings.os == "Windows":
# Verify that the required environment variables and programs exist
### required environment variables for authentication with DigiCert
# example: SM_API_KEY="00000000000000000000000000_0000000000000000000000000000000000000000000000000000000000000000"
Expand Down Expand Up @@ -244,7 +232,7 @@ def package(self):
self.output.info("conanfile.py: package()")
outerlibname = self.name.removeprefix("slm-")

if self.options.get_safe("codesign", default=False):
if self.conf.get("user.jitx.slm:codesign") and self.settings.os == "Windows":
self._codesign()

copy2(os.path.join(self.source_folder, "slm.toml"), self.package_folder)
Expand Down

0 comments on commit bb6e5c5

Please sign in to comment.