-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
0 deletions.
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: | ||
"3.1.7": | ||
exe: | ||
url: "https://github.com/microsoft/vswhere/releases/download/3.1.7/vswhere.exe" | ||
sha256: "c54f3b7c9164ea9a0db8641e81ecdda80c2664ef5a47c4191406f848cc07c662" | ||
license: | ||
url: "https://raw.githubusercontent.com/microsoft/vswhere/3.1.7/LICENSE.txt" | ||
sha256: "a1e41a01dd80dbe3f8ad5edebfd746e64ccff9c2aae3d8f47922746cf83204ef" |
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,51 @@ | ||
import os | ||
|
||
from conan import ConanFile | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.files import copy, download | ||
from conan.tools.microsoft import is_msvc | ||
|
||
required_conan_version = ">=1.47.0" | ||
|
||
|
||
class VswhereConan(ConanFile): | ||
name = "vswhere" | ||
description = "Locate Visual Studio 2017 and newer installations" | ||
license = "MIT" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/microsoft/vswhere" | ||
topics = ("visual-studio", "pre-built") | ||
package_type = "application" | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
def layout(self): | ||
pass | ||
|
||
def package_id(self): | ||
del self.info.settings.compiler | ||
del self.info.settings.build_type | ||
|
||
def validate(self): | ||
if not is_msvc(self): | ||
raise ConanInvalidConfiguration("vswhere is only available for MSVC") | ||
|
||
def source(self): | ||
pass | ||
|
||
def build(self): | ||
download(self, **self.conan_data["sources"][self.version]["exe"], filename="vswhere.exe") | ||
download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE.txt") | ||
|
||
def package(self): | ||
copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) | ||
copy(self, "vswhere.exe", self.source_folder, os.path.join(self.package_folder, "bin")) | ||
|
||
def package_info(self): | ||
self.cpp_info.frameworkdirs = [] | ||
self.cpp_info.libdirs = [] | ||
self.cpp_info.resdirs = [] | ||
self.cpp_info.includedirs = [] | ||
|
||
# TODO: Legacy, to be removed on Conan 2.0 | ||
bin_folder = os.path.join(self.package_folder, "bin") | ||
self.env_info.PATH.append(bin_folder) |
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,13 @@ | ||
from conan import ConanFile | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "VirtualBuildEnv" | ||
test_type = "explicit" | ||
|
||
def build_requirements(self): | ||
self.tool_requires(self.tested_reference_str) | ||
|
||
def test(self): | ||
self.run("vswhere -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath") |
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: | ||
"3.1.7": | ||
folder: all |