Skip to content

Commit

Permalink
Conditionaly vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
alxvth committed Oct 9, 2024
1 parent ff52ae2 commit 07d97c3
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,28 @@ def generate(self):
tc.variables["MV_UNITY_BUILD"] = "ON"

# Install vcpkg dependencies
vcpkg_dir = pathlib.Path(os.environ["VCPKG_ROOT"])
vcpkg_exe = vcpkg_dir / "vcpkg.exe" if self.settings.os == "Windows" else vcpkg_dir / "vcpkg"
vcpkg_tc = vcpkg_dir / "scripts" / "buildsystems" / "vcpkg.cmake"

vcpkg_triplet = "x64-windows"
if self.settings.os == "Macos":
vcpkg_triplet = "x64-osx"
if self.settings.os == "Linux":
vcpkg_triplet = "x64-linux"

print("vcpkg_dir: ", vcpkg_dir)
print("vcpkg_exe: ", vcpkg_exe)
print("vcpkg_tc: ", vcpkg_tc)
print("vcpkg_triplet: ", vcpkg_triplet)

tc.variables["VCPKG_LIBRARY_LINKAGE"] = "dynamic"
tc.variables["VCPKG_TARGET_TRIPLET"] = vcpkg_triplet
tc.variables["VCPKG_HOST_TRIPLET"] = vcpkg_triplet
tc.variables["VCPKG_ROOT"] = vcpkg_dir.as_posix()

tc.variables["CMAKE_PROJECT_INCLUDE"] = vcpkg_tc.as_posix()
if os.environ.get("VCPKG_ROOT", None):
vcpkg_dir = pathlib.Path(os.environ["VCPKG_ROOT"])
vcpkg_exe = vcpkg_dir / "vcpkg.exe" if self.settings.os == "Windows" else vcpkg_dir / "vcpkg"
vcpkg_tc = vcpkg_dir / "scripts" / "buildsystems" / "vcpkg.cmake"

vcpkg_triplet = "x64-windows"
if self.settings.os == "Macos":
vcpkg_triplet = "x64-osx"
if self.settings.os == "Linux":
vcpkg_triplet = "x64-linux"

print("vcpkg_dir: ", vcpkg_dir)
print("vcpkg_exe: ", vcpkg_exe)
print("vcpkg_tc: ", vcpkg_tc)
print("vcpkg_triplet: ", vcpkg_triplet)

tc.variables["VCPKG_LIBRARY_LINKAGE"] = "dynamic"
tc.variables["VCPKG_TARGET_TRIPLET"] = vcpkg_triplet
tc.variables["VCPKG_HOST_TRIPLET"] = vcpkg_triplet
tc.variables["VCPKG_ROOT"] = vcpkg_dir.as_posix()

tc.variables["CMAKE_PROJECT_INCLUDE"] = vcpkg_tc.as_posix()

tc.generate()

Expand Down

0 comments on commit 07d97c3

Please sign in to comment.