|
1 | 1 | from conan import ConanFile
|
2 | 2 | from conan.errors import ConanInvalidConfiguration
|
3 | 3 | from conan.tools.apple import is_apple_os
|
4 |
| -from conan.tools.cmake import CMakeToolchain |
5 |
| -from conan.tools.files import save |
6 | 4 | from conan.tools.microsoft import is_msvc
|
7 | 5 |
|
8 |
| -from glob import glob |
9 |
| -import os |
| 6 | +from os import getenv |
10 | 7 |
|
11 | 8 | required_conan_version = ">=2.13.0"
|
12 | 9 |
|
13 | 10 | class VCMI(ConanFile):
|
14 | 11 | settings = "os", "compiler", "build_type", "arch"
|
15 |
| - generators = "CMakeDeps" |
16 | 12 |
|
17 | 13 | _libRequires = [
|
18 | 14 | "minizip/[^1.2.12]",
|
@@ -49,7 +45,7 @@ def config_options(self):
|
49 | 45 | self.options["sdl_ttf"].shared = isSdlShared
|
50 | 46 |
|
51 | 47 | if self.settings.os == "Android":
|
52 |
| - self.options["qt"].android_sdk = os.getenv("ANDROID_HOME") |
| 48 | + self.options["qt"].android_sdk = getenv("ANDROID_HOME") |
53 | 49 |
|
54 | 50 | if self.settings.os != "Windows":
|
55 | 51 | del self.options.target_pre_windows10
|
@@ -110,47 +106,3 @@ def validate(self):
|
110 | 106 | raise ConanInvalidConfiguration("qt:qtandroidextras option for Android must be set to True")
|
111 | 107 | if not is_apple_os(self) and qtDep.options.openssl != True:
|
112 | 108 | raise ConanInvalidConfiguration("qt:openssl option for non-Apple OS must be set to True, otherwise mods can't be downloaded")
|
113 |
| - |
114 |
| - def _pathForCmake(self, path) -> str: |
115 |
| - # CMake doesn't like \ in strings |
116 |
| - return path.replace(os.path.sep, os.path.altsep) if os.path.altsep else path |
117 |
| - |
118 |
| - def _generateRuntimeLibsFile(self) -> str: |
119 |
| - # create file with list of libs to copy to the package for distribution |
120 |
| - runtimeLibsFile = self._pathForCmake(os.path.join(self.build_folder, "_runtime_libs.txt")) |
121 |
| - |
122 |
| - runtimeLibExtension = { |
123 |
| - "Android": "so", |
124 |
| - "iOS": "dylib", |
125 |
| - "Macos": "dylib", |
126 |
| - "Windows": "dll", |
127 |
| - }.get(str(self.settings.os)) |
128 |
| - |
129 |
| - runtimeLibs = [] |
130 |
| - for _, dep in self.dependencies.host.items(): |
131 |
| - # Qt libs are copied using *deployqt |
132 |
| - if dep.ref.name == "qt": |
133 |
| - continue |
134 |
| - |
135 |
| - runtimeLibDir = '' |
136 |
| - if self.settings.os == "Windows": |
137 |
| - if len(dep.cpp_info.bindirs) > 0: |
138 |
| - runtimeLibDir = dep.cpp_info.bindir |
139 |
| - elif len(dep.cpp_info.libdirs) > 0: |
140 |
| - runtimeLibDir = dep.cpp_info.libdir |
141 |
| - if len(runtimeLibDir) > 0: |
142 |
| - runtimeLibs += glob(os.path.join(runtimeLibDir, f"*.{runtimeLibExtension}")) |
143 |
| - save(self, runtimeLibsFile, "\n".join(runtimeLibs)) |
144 |
| - |
145 |
| - return runtimeLibsFile |
146 |
| - |
147 |
| - def generate(self): |
148 |
| - tc = CMakeToolchain(self) |
149 |
| - tc.variables["USING_CONAN"] = True |
150 |
| - tc.variables["CONAN_RUNTIME_LIBS_FILE"] = self._generateRuntimeLibsFile() |
151 |
| - if self.settings.os == "Android": |
152 |
| - tc.variables["CMAKE_ANDROID_API"] = str(self.settings.os.api_level) |
153 |
| - tc.variables["SDL_JAVA_SRC_DIR"] = os.path.join(self.dependencies.host["sdl"].package_folder, "share", "java", "SDL2") |
154 |
| - elif self.settings.os == "Windows": |
155 |
| - tc.variables["CONAN_RUNENV_SCRIPT"] = self._pathForCmake(os.path.join(self.build_folder, "conanrun.bat")) |
156 |
| - tc.generate() |
0 commit comments