Ver código fonte

[conan] migrate to v2

Andrey Filipenkov 7 meses atrás
pai
commit
5028af75cf

+ 7 - 0
CI/conan/android-32

@@ -3,3 +3,10 @@ include(base/android)
 [settings]
 arch=armv7
 os.api_level=19
+
+[conf]
+# remove after switching to API level >= 24
+{% set file_funcs_macros = ['fseeko=fseek', 'ftello=ftell'] %}
+flac/*:tools.build:defines={{ file_funcs_macros }}
+luajit/*:tools.build:defines={{ file_funcs_macros }}
+opusfile/*:tools.build:defines={{ file_funcs_macros }}

+ 1 - 3
CI/conan/android-32-ndk

@@ -1,4 +1,2 @@
 include(android-32)
-
-[tool_requires]
-android-ndk/r25c
+include(base/android-ndk)

+ 1 - 3
CI/conan/android-64-ndk

@@ -1,4 +1,2 @@
 include(android-64)
-
-[tool_requires]
-android-ndk/r25c
+include(base/android-ndk)

+ 10 - 4
CI/conan/base/android

@@ -1,10 +1,16 @@
+include(common)
+
 [settings]
-build_type=Release
 compiler=clang
+compiler.cppstd=17
 compiler.libcxx=c++_shared
 compiler.version=14
 os=Android
 
-[buildenv]
-# fixes shared libiconv build
-LD=ld
+[replace_requires]
+zlib/*: zlib/[*]@system
+
+[conf]
+# https://github.com/conan-io/conan-center-index/issues/25342
+# https://github.com/conan-io/conan/issues/16468#issuecomment-2175877245
+tools.meson.mesontoolchain:extra_machine_files={{ [os.path.join(profile_dir, "meson_workaround.txt")] }}

+ 2 - 0
CI/conan/base/android-ndk

@@ -0,0 +1,2 @@
+[tool_requires]
+android-ndk/r25c

+ 10 - 6
CI/conan/base/apple

@@ -1,12 +1,16 @@
+include(common)
+
 [settings]
 compiler=apple-clang
-compiler.version=14
+compiler.cppstd=17
 compiler.libcxx=libc++
-build_type=Release
+compiler.version=16
 
-# required for Boost.Locale in versions >= 1.81
-compiler.cppstd=11
+[replace_requires]
+bzip2/*: bzip2/[*]@system
+libiconv/*: libiconv/[*]@system
+sqlite3/*: sqlite3/[*]@system
+zlib/*: zlib/[*]@system
 
 [conf]
-tools.apple:enable_bitcode = False
-tools.cmake.cmaketoolchain:generator = Ninja
+tools.apple:enable_bitcode=False

+ 14 - 0
CI/conan/base/common

@@ -0,0 +1,14 @@
+[settings]
+build_type=Release
+
+[platform_tool_requires]
+cmake/3.31.6
+ninja/1.12.1
+
+[replace_requires]
+# TODO: remove after https://github.com/conan-io/conan-center-index/pull/27125 is merged
+# Qt 5 depends on 0.4.8, but it doesn't build for iOS
+md4c/0.4.8: md4c/0.5.2
+
+[conf]
+tools.cmake.cmaketoolchain:generator=Ninja

+ 2 - 0
CI/conan/base/meson_workaround.txt

@@ -0,0 +1,2 @@
+[properties]
+sys_root = ''

+ 2 - 0
CMakeLists.txt

@@ -746,6 +746,8 @@ endif()
 #        Installation section         #
 #######################################
 
+vcmi_install_conan_deps()
+
 if(ANDROID)
 	string(REPLACE ";" "\n" ANDROID_GRADLE_PROPERTIES_MULTILINE "${ANDROID_GRADLE_PROPERTIES}")
 	file(WRITE "${androidPackageSourceDir}/vcmi-app/gradle.properties" "signingRoot=${CMAKE_SOURCE_DIR}/CI/android\n${ANDROID_GRADLE_PROPERTIES_MULTILINE}")

+ 1 - 1
client/media/CMusicHandler.cpp

@@ -269,7 +269,7 @@ void MusicEntry::load(const AudioPath & musicURI)
 		auto * musicFile = MakeSDLRWops(std::move(stream));
 		music = Mix_LoadMUS_RW(musicFile, SDL_TRUE);
 	}
-	catch(std::exception & e)
+	catch(const std::exception & e)
 	{
 		logGlobal->error("Failed to load music. setName=%s\tmusicURI=%s", setName, currentName.getOriginalName());
 		logGlobal->error("Exception: %s", e.what());

+ 0 - 3
clientapp/CMakeLists.txt

@@ -90,7 +90,6 @@ vcmi_set_output_dir(vcmiclient "")
 enable_pch(vcmiclient)
 
 if(APPLE_IOS)
-	vcmi_install_conan_deps("\${CMAKE_INSTALL_PREFIX}")
 	add_custom_command(TARGET vcmiclient POST_BUILD
 		COMMAND ios/set_build_version.sh "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
 		COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --component "${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
@@ -103,8 +102,6 @@ elseif(ANDROID)
 	find_program(androidDeployQt androiddeployqt
 		PATHS "${qtBinDir}"
 	)
-	vcmi_install_conan_deps("\${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
-
 	add_custom_target(android_deploy ALL
 		COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "${androidQtBuildDir}"
 		COMMAND "${androidDeployQt}" --input "${CMAKE_BINARY_DIR}/androiddeployqt.json" --output "${androidQtBuildDir}" --android-platform "android-${ANDROID_TARGET_SDK_VERSION}" --verbose $<$<NOT:$<CONFIG:Debug>>:--release> ${ANDROIDDEPLOYQT_OPTIONS}

+ 17 - 8
cmake_modules/VCMIUtils.cmake

@@ -128,15 +128,24 @@ function(install_vcpkg_imported_tgt tgt)
 	install(FILES ${TGT_DLL} DESTINATION ${BIN_DIR})
 endfunction(install_vcpkg_imported_tgt)
 
-# install dependencies from Conan, install_dir should contain \${CMAKE_INSTALL_PREFIX}
-function(vcmi_install_conan_deps install_dir)
+# install dependencies from Conan, CONAN_RUNTIME_LIBS_FILE is set in conanfile.py
+function(vcmi_install_conan_deps)
 	if(NOT USING_CONAN)
 		return()
 	endif()
-	install(CODE "
-		execute_process(COMMAND
-			conan imports \"${CMAKE_SOURCE_DIR}\" --install-folder \"${CONAN_INSTALL_FOLDER}\" --import-folder \"${install_dir}\"
-		)
-		file(REMOVE \"${install_dir}/conan_imports_manifest.txt\")
-	")
+
+	file(STRINGS "${CONAN_RUNTIME_LIBS_FILE}" runtimeLibs)
+	install(FILES ${runtimeLibs} DESTINATION ${LIB_DIR})
+endfunction()
+
+function(vcmi_deploy_qt deployQtToolName deployQtOptions)
+	# TODO: use qt_generate_deploy_app_script() with Qt 6
+	find_program(TOOL_DEPLOYQT NAMES ${deployQtToolName} PATHS "${qtBinDir}")
+	if(TOOL_DEPLOYQT)
+		install(CODE "
+			execute_process(COMMAND \"${TOOL_DEPLOYQT}\" ${deployQtOptions} -verbose 2)
+		")
+	else()
+		message(WARNING "${deployQtToolName} not found, running cpack would result in broken package")
+	endif()
 endfunction()

+ 135 - 154
conanfile.py

@@ -1,92 +1,64 @@
 from conan import ConanFile
-from conan.errors import ConanInvalidConfiguration
 from conan.tools.apple import is_apple_os
-from conan.tools.build import cross_building
-from conan.tools.cmake import CMakeDeps, CMakeToolchain
-from conans import tools
+from conan.tools.cmake import CMakeToolchain
+from conan.tools.files import save
+from conan.tools.microsoft import is_msvc
 
-required_conan_version = ">=1.51.3"
+from glob import glob
+import os
+
+required_conan_version = ">=2.13.0"
 
 class VCMI(ConanFile):
     settings = "os", "compiler", "build_type", "arch"
+    generators = "CMakeDeps"
 
     _libRequires = [
         "boost/[^1.69]",
-        "minizip/[~1.2.12]",
+        "luajit/2.1.0-beta3",
+        "minizip/[^1.2.12]",
+        "zlib/[^1.2.12]",
     ]
     _clientRequires = [
-        # Versions between 2.5-2.8 have broken loading of palette sdl images which a lot of mods use
-        # there is workaround that require disabling cmake flag which is not available in conan recipes. 
-        # Bug is fixed in version 2.8, however it is not available in conan at the moment
-        "sdl_image/2.0.5", 
-        "sdl_ttf/[>=2.0.18]",
-        "onetbb/[^2021.7 <2021.10]",  # 2021.10+ breaks mobile builds due to added hwloc dependency
-        "xz_utils/[>=5.2.5]", # Required for innoextract
+        "onetbb/[^2021.7]",
+        "sdl_image/[^2.8.2]",
+        "sdl_mixer/[^2.8.0]",
+        "sdl_ttf/[^2.0.18]",
     ]
-
-    requires = _libRequires + _clientRequires
+    _launcherRequires = [
+        "xz_utils/[^5.2.5]", # innoextract
+    ]
+    requires = _libRequires + _clientRequires + _launcherRequires
 
     options = {
-        "default_options_of_requirements": [True, False],
-        "with_apple_system_libs": [True, False],
         "with_ffmpeg": [True, False],
-        "with_luajit": [True, False],
     }
     default_options = {
-        "default_options_of_requirements": False,
-        "with_apple_system_libs": False,
         "with_ffmpeg": True,
-        "with_luajit": False,
 
         "boost/*:shared": True,
+        "bzip2/*:shared": True,
+        "libiconv/*:shared": True,
+        "libpng/*:shared": True,
         "minizip/*:shared": True,
+        "ogg/*:shared": True,
+        "opus/*:shared": True,
+        "xz_utils/*:shared": True,
+        "zlib/*:shared": True,
     }
 
     def configure(self):
-        self.options["ffmpeg"].shared = self.settings.os == "Android" # using shared version results in less total project size on Android
-        self.options["freetype"].shared = self.settings.os == "Android"
+        self.options["ffmpeg"].shared = is_msvc(self) # MSVC static build requires static runtime, but VCMI uses dynamic runtime
+        # self.options["freetype"].shared = self.settings.os == "Android" # TODO https://github.com/conan-io/conan-center-index/issues/26020
 
-        # SDL_image and Qt depend on it, in iOS both are static
-        self.options["libpng"].shared = self.settings.os != "iOS"
         # static Qt for iOS is the only viable option at the moment
         self.options["qt"].shared = self.settings.os != "iOS"
 
-        # TODO: enable for all platforms
-        if self.settings.os == "Android":
-            self.options["bzip2"].shared = True
-            self.options["libiconv"].shared = True
-            self.options["zlib"].shared = True
-
-        # TODO: enable for all platforms?
-        if self.settings.os == "Windows":
-            self.options["sdl"].shared = True
-            self.options["sdl_image"].shared = True
-            self.options["sdl_mixer"].shared = True
-            self.options["sdl_ttf"].shared = True
-
-        if self.settings.os == "iOS": 
-            # TODO: ios - newer sdl fails to link
-            self.requires("sdl/2.26.1")
-            self.requires("sdl_mixer/2.0.4")
-        elif self.settings.os == "Android":
-            # On Android SDL version must be same as version of Java wrapper for SDL in VCMI source code
-            # Wrapper can be found in following directory: android/vcmi-app/src/main/java/org/libsdl/app
-            self.requires("sdl/2.26.5")
-            self.requires("sdl_mixer/2.0.4")
-        else:
-            # upcoming SDL version 3.0+ is not supported at the moment due to API breakage
-            # SDL versions between 2.22-2.26.1 have broken sound
-            self.requires("sdl/[^2.26 || >=2.0.20 <=2.22.0]")
-            self.requires("sdl_mixer/[>=2.0.4]")
-
         if self.settings.os == "Android":
-            self.options["qt"].android_sdk = tools.get_env("ANDROID_HOME", default="")
-
-        if self.options.default_options_of_requirements:
-            return
+            self.options["qt"].android_sdk = os.getenv("ANDROID_HOME") # , default=""
 
         # we need only the following Boost parts:
-        # date_time filesystem iostreams locale program_options system thread
+        # date_time filesystem iostreams locale program_options system
         # some other parts are also enabled because they're dependents
         # see e.g. conan-center-index/recipes/boost/all/dependencies
         self.options["boost"].without_context = True
@@ -100,6 +72,7 @@ class VCMI(ConanFile):
         self.options["boost"].without_math = True
         self.options["boost"].without_mpi = True
         self.options["boost"].without_nowide = True
+        self.options["boost"].without_process = True
         self.options["boost"].without_python = True
         self.options["boost"].without_serialization = True
         self.options["boost"].without_stacktrace = True
@@ -120,7 +93,6 @@ class VCMI(ConanFile):
         self.options["ffmpeg"].disable_all_protocols = True
 
         self.options["ffmpeg"].with_asm = False
-        self.options["ffmpeg"].with_bzip2 = False
         self.options["ffmpeg"].with_freetype = False
         self.options["ffmpeg"].with_libaom = False
         self.options["ffmpeg"].with_libdav1d = False
@@ -134,12 +106,11 @@ class VCMI(ConanFile):
         self.options["ffmpeg"].with_lzma = True
         self.options["ffmpeg"].with_openh264 = False
         self.options["ffmpeg"].with_openjpeg = False
-        self.options["ffmpeg"].with_opus = False
         self.options["ffmpeg"].with_programs = False
         self.options["ffmpeg"].with_sdl = False
         self.options["ffmpeg"].with_ssl = False
         self.options["ffmpeg"].with_vorbis = False
-        self.options["ffmpeg"].with_zlib = False
+        # option not available on Android
         if self.settings.os != "Android":
             self.options["ffmpeg"].with_libfdk_aac = False
 
@@ -157,9 +128,32 @@ class VCMI(ConanFile):
         # and for mods - webm container / vp8 or vp9 video / opus sound
         # TODO: add av1 support for mods (requires enabling libdav1d which currently fails to build via Conan)
         self.options["ffmpeg"].enable_protocols = "file"
-        self.options["ffmpeg"].enable_demuxers = "bink,binka,ogg,smacker,webm_dash_manifest"
-        self.options["ffmpeg"].enable_parsers = "opus,vorbis,vp8,vp9,webp"
-        self.options["ffmpeg"].enable_decoders = "bink,binkaudio_dct,binkaudio_rdft,smackaud,smacker,theora,vorbis,vp8,vp9,opus"
+        self.options["ffmpeg"].enable_demuxers = ",".join([
+            "bink",
+            "binka",
+            "ogg",
+            "smacker",
+            "webm_dash_manifest",
+        ])
+        self.options["ffmpeg"].enable_parsers = ",".join([
+            "opus",
+            "vorbis",
+            "vp8",
+            "vp9",
+            "webp",
+        ])
+        self.options["ffmpeg"].enable_decoders = ",".join([
+            "bink",
+            "binkaudio_dct",
+            "binkaudio_rdft",
+            "opus",
+            "smackaud",
+            "smacker",
+            "theora",
+            "vorbis",
+            "vp8",
+            "vp9",
+        ])
 
         #optionally, for testing - enable ffplay/ffprobe binaries in conan package:
         #if self.settings.os == "Windows":
@@ -168,6 +162,11 @@ class VCMI(ConanFile):
         #    self.options["ffmpeg"].with_sdl = True
         #    self.options["ffmpeg"].enable_filters = "aresample,scale"
 
+        self.options["onetbb"].tbbbind = False
+        self.options["onetbb"].tbbmalloc = False
+        self.options["onetbb"].tbbproxy = False
+
+        self.options["sdl"].iconv = True
         self.options["sdl"].sdl2main = self.settings.os != "iOS"
         self.options["sdl"].vulkan = False
 
@@ -177,7 +176,7 @@ class VCMI(ConanFile):
         self.options["sdl_image"].lbm = False
         self.options["sdl_image"].pnm = False
         self.options["sdl_image"].pcx = False
-        #self.options["sdl_image"].qoi = False # sdl_image >=2.6
+        self.options["sdl_image"].qoi = False
         self.options["sdl_image"].svg = False
         self.options["sdl_image"].tga = False
         self.options["sdl_image"].with_libjpeg = False
@@ -189,17 +188,19 @@ class VCMI(ConanFile):
         if is_apple_os(self):
             self.options["sdl_image"].imageio = True
 
-        # mp3, ogg and wav are the only ones that needs to be supported
-        # opus is nice to have, but fails to build in CI
-        # flac can be considered, but generally unnecessary
-        self.options["sdl_mixer"].flac = False
+        # mp3, ogg and wav are the only ones that needs to be supported, flac is a bonus
+        self.options["sdl_mixer"].mad = False
+        self.options["sdl_mixer"].mikmod = False
         self.options["sdl_mixer"].modplug = False
-        self.options["sdl_mixer"].opus = False
-        if self.settings.os == "iOS" or self.settings.os == "Android":
-            # only available in older sdl_mixer version, removed in newer version
-            self.options["sdl_mixer"].mad = False
-            self.options["sdl_mixer"].mikmod = False
-            self.options["sdl_mixer"].nativemidi = False
+        self.options["sdl_mixer"].nativemidi = False
+        self.options["sdl_mixer"].tinymidi = False
+
+        # static on "single app" platforms
+        isSdlShared = self.settings.os != "iOS" and self.settings.os != "Android"
+        self.options["sdl"].shared = isSdlShared
+        self.options["sdl_image"].shared = isSdlShared
+        self.options["sdl_mixer"].shared = isSdlShared
+        self.options["sdl_ttf"].shared = isSdlShared
 
         def _disableQtOptions(disableFlag, options):
             return " ".join([f"-{disableFlag}-{tool}" for tool in options])
@@ -216,7 +217,7 @@ class VCMI(ConanFile):
                 "imageformat_ppm",
                 "imageformat_xbm",
 
-                # we need only macdeployqt
+                # we need only win/macdeployqt
                 # TODO: disabling these doesn't disable generation of CMake targets
                 # TODO: in Qt 6.3 it's a part of qtbase
                 # "assistant",
@@ -235,11 +236,11 @@ class VCMI(ConanFile):
             ]),
         ]
         self.options["qt"].config = " ".join(_qtOptions)
+        self.options["qt"].essential_modules = False
         self.options["qt"].qttools = True
         self.options["qt"].qtandroidextras = self.settings.os == "Android" # TODO: in Qt 6 it's part of Core
         self.options["qt"].with_freetype = self.settings.os == "Android"
         self.options["qt"].with_libjpeg = False
-        self.options["qt"].with_md4c = False
         self.options["qt"].with_mysql = False
         self.options["qt"].with_odbc = False
         self.options["qt"].with_openal = False
@@ -247,105 +248,85 @@ class VCMI(ConanFile):
         self.options["qt"].openssl = not is_apple_os(self)
         if self.settings.os == "iOS" or self.settings.os == "Android":
             self.options["qt"].opengl = "es2"
-        if not is_apple_os(self) and self.settings.os != "Android" and cross_building(self):
-            self.options["qt"].cross_compile = self.env["CONAN_CROSS_COMPILE"]
-        # TODO: add for all platforms after updating recipe
-        if self.settings.os == "Android":
-            self.options["qt"].essential_modules = False
-        # No Qt OpenGL for cross-compiling for Windows, Conan does not support it
-        if self.settings.os == "Windows" and cross_building(self):
-            self.options["qt"].opengl = "no"
 
         # transitive deps
         # doesn't link to overridden bzip2 & zlib, the tool isn't needed anyway
         self.options["pcre2"].build_pcre2grep = False
         # executable not needed
-        if self.settings.os == "Android":
-            self.options["sqlite3"].build_executable = False
+        self.options["sqlite3"].build_executable = False
+        # prevents pulling openssl in and isn't needed anyway
+        self.options["opusfile"].http = False
+        # programs not needed
+        self.options["zstd"].build_programs = False
 
     def requirements(self):
-        self.requires("freetype/[~2.12.1]", override=True) # sdl_ttf / Qt
-        self.requires("libpng/[~1.6.39]", override=True) # freetype / qt / sdl_image
-
         # client
         if self.options.with_ffmpeg:
             self.requires("ffmpeg/[>=4.4]")
 
+        # On Android SDL version must be the same as the version of Java wrapper for SDL in VCMI source code
+        # Wrapper can be found in the following directory: android/vcmi-app/src/main/java/org/libsdl/app
+        # TODO: try enabling version range once there's no conflict
+        # sdl_image & sdl_ttf depend on earlier version
+        # ERROR: Version conflict: Conflict between sdl/2.28.5 and sdl/2.28.3 in the graph.
+        # Conflict originates from sdl_mixer/2.8.0
+        # upcoming SDL version 3.0+ is not supported at the moment due to API breakage
+        # SDL versions between 2.22-2.26.1 have broken sound
+        # self.requires("sdl/[^2.26.1 || >=2.0.20 <=2.22.0]")
+        # versions before 2.30.7 don't build for Android with NDK 27: https://github.com/libsdl-org/SDL/issues/9792
+        self.requires("sdl/2.30.9", override=True)
+
         # launcher
         if self.settings.os == "Android":
-            self.requires("qt/[~5.15.14]")
+            self.requires("qt/[~5.15.14]") # earlier versions have serious bugs
         else:
             self.requires("qt/[~5.15.2]")
-        # TODO: version range doesn't work in Conan v1
-        if self.options["qt"].openssl:
-            self.requires("openssl/1.1.1s")
-
-        # use Apple system libraries instead of external ones
-        if self.options.with_apple_system_libs and is_apple_os(self):
-            systemLibsOverrides = [
-                "bzip2/1.0.8",
-                "libiconv/1.17",
-                "sqlite3/3.39.2",
-                "zlib/1.2.12",
-            ]
-            for lib in systemLibsOverrides:
-                self.requires(f"{lib}@vcmi/apple", override=True)
-        elif self.settings.os == "Android":
-            self.requires("zlib/1.2.12@vcmi/android", override=True)
-        else:
-            self.requires("zlib/[~1.2.13]", override=True) # minizip / Qt
-            self.requires("libiconv/[~1.17]", override=True) # ffmpeg / sdl
-
-        # TODO: the latest official release of LuaJIT (which is quite old) can't be built for arm
-        if self.options.with_luajit and not str(self.settings.arch).startswith("arm"):
-            self.requires("luajit/[~2.0.5]")
 
-    def validate(self):
-        if self.options.with_apple_system_libs and not is_apple_os(self):
-            raise ConanInvalidConfiguration("with_apple_system_libs is only for Apple platforms")
-        if self.options.with_apple_system_libs and self.options.default_options_of_requirements:
-            raise ConanInvalidConfiguration("with_apple_system_libs and default_options_of_requirements can't be True at the same time")
+    def _pathForCmake(self, path):
+        # CMake doesn't like \ in strings
+        return path.replace(os.path.sep, os.path.altsep) if os.path.altsep else path
+
+    def _generateRuntimeLibsFile(self):
+        # create file with list of libs to copy to the package for distribution
+        runtimeLibsFile = self._pathForCmake(os.path.join(self.build_folder, "_runtime_libs.txt"))
+
+        runtimeLibExtension = {
+            "Android": "so",
+            "iOS":     "dylib",
+            "Macos":   "dylib",
+            "Windows": "dll",
+        }.get(str(self.settings.os))
+
+        runtimeLibs = []
+        for _, dep in self.dependencies.host.items():
+            # Qt libs are copied using *deployqt
+            if dep.ref.name == "qt":
+                continue
+
+            runtimeLibDir = ''
+            if self.settings.os == "Windows":
+                if len(dep.cpp_info.bindirs) > 0:
+                    runtimeLibDir = dep.cpp_info.bindir
+            elif len(dep.cpp_info.libdirs) > 0:
+                runtimeLibDir = dep.cpp_info.libdir
+            if len(runtimeLibDir) > 0:
+                runtimeLibs += glob(os.path.join(runtimeLibDir, f"*.{runtimeLibExtension}"))
+        save(self, runtimeLibsFile, "\n".join(runtimeLibs))
+
+        return runtimeLibsFile
 
     def generate(self):
         tc = CMakeToolchain(self)
         tc.variables["USING_CONAN"] = True
-        tc.variables["CONAN_INSTALL_FOLDER"] = self.install_folder
+        tc.variables["CONAN_RUNTIME_LIBS_FILE"] = self._generateRuntimeLibsFile()
         if self.settings.os == "Android":
             tc.variables["CMAKE_ANDROID_API"] = str(self.settings.os.api_level)
             tc.variables["ANDROID_SYSROOT_LIB_SUBDIR"] = {
-                'armv7': 'arm-linux-androideabi',
-                'armv8': 'aarch64-linux-android',
-                'x86': 'i686-linux-android',
-                'x86_64': 'x86_64-linux-android',
+                "armv7": "arm-linux-androideabi",
+                "armv8": "aarch64-linux-android",
+                "x86": "i686-linux-android",
+                "x86_64": "x86_64-linux-android",
             }.get(str(self.settings.arch))
-        if cross_building(self) and self.settings.os == "Windows":
-            tc.variables["CONAN_SYSTEM_LIBRARY_LOCATION"] = self.env["CONAN_SYSTEM_LIBRARY_LOCATION"]
-        tc.generate()
-
-        deps = CMakeDeps(self)
-        if tools.get_env("GENERATE_ONLY_BUILT_CONFIG", default=False):
-            deps.generate()
-            return
-
-        # allow using prebuilt deps with all configs
-        # credits to https://github.com/conan-io/conan/issues/11607#issuecomment-1188500937 for the workaround
-        configs = [
-            "Debug",
-            "MinSizeRel",
-            "Release",
-            "RelWithDebInfo",
-        ]
-        for config in configs:
-            print(f"generating CMakeDeps for {config}")
-            deps.configuration = config
-            deps.generate()
-
-    def imports(self):
-        if is_apple_os(self):
-            self.copy("*.dylib", "Frameworks", "lib")
         elif self.settings.os == "Windows":
-            self.copy("*.dll", src="bin/archdatadir/plugins/platforms", dst="platforms")
-            self.copy("*.dll", src="bin/archdatadir/plugins/styles", dst="styles")
-            self.copy("*.dll", src="@bindirs", dst="", excludes="archdatadir/*")
-        elif self.settings.os == "Android":
-            self.copy("*.so", ".", "lib")
+            tc.variables["CONAN_RUNENV_SCRIPT"] = self._pathForCmake(os.path.join(self.build_folder, "conanrun.bat"))
+        tc.generate()

+ 0 - 5
launcher/CMakeLists.txt

@@ -248,11 +248,6 @@ if(APPLE_IOS)
 		"-framework UniformTypeIdentifiers"
 	)
 
-	# TODO: remove after switching prebuilt deps to a newer Conan's Qt recipe
-	if(XCODE_VERSION VERSION_GREATER_EQUAL 14.0)
-		target_link_libraries(vcmilauncher "-framework IOKit")
-	endif()
-
 	# workaround https://github.com/conan-io/conan-center-index/issues/13332
 	if(USING_CONAN)
 		file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/QIOSIntegrationPlugin.h

+ 2 - 33
osx/CMakeLists.txt

@@ -5,41 +5,10 @@ if(APPLE_MACOS)
 	set(bundleContentsDir "${bundleDir}/Contents")
 
 	if(ENABLE_LAUNCHER OR ENABLE_EDITOR)
-		if(USING_CONAN)
-			# simulate macdeployqt behavior, main Qt libs are copied by conan
-			execute_process(COMMAND
-				"${qmakePath}" -query QT_INSTALL_PLUGINS
-				OUTPUT_VARIABLE qtPluginsDir
-				OUTPUT_STRIP_TRAILING_WHITESPACE
-			)
-			install(DIRECTORY
-				${qtPluginsDir}/
-				DESTINATION ${APP_BUNDLE_DIR}/Contents/PlugIns
-			)
-			install(CODE "
-				file(WRITE ${bundleContentsDir}/Resources/qt.conf
-					\"[Paths]\nPlugins = PlugIns\"
-				)
-			")
-		else()
-			# note: cross-compiled Qt 5 builds macdeployqt for target platform instead of host
-			# deploy Qt dylibs with macdeployqt
-			find_program(TOOL_MACDEPLOYQT NAMES macdeployqt PATHS "${qtBinDir}")
-			if(TOOL_MACDEPLOYQT)
-				install(CODE "
-					execute_process(COMMAND
-						\"${TOOL_MACDEPLOYQT}\" \"${bundleDir}\" -verbose=2
-					)
-				")
-			else()
-				message(WARNING "macdeployqt not found, running cpack would result in broken package")
-			endif()
-		endif()
+		# note: cross-compiled Qt 5 builds macdeployqt for target platform instead of host
+		vcmi_deploy_qt(macdeployqt "\"${bundleDir}\"")
 	endif()
 
-	# deploy other dylibs with conan
-	vcmi_install_conan_deps("${bundleContentsDir}")
-
 	# perform ad-hoc codesigning
 	# Intel Macs don't need it
 	if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")