Ver código fonte

move all Conan files to the dependencies repo

Andrey Filipenkov 4 meses atrás
pai
commit
45fffc5a50

+ 0 - 12
CI/conan/android-32

@@ -1,12 +0,0 @@
-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 }}

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

@@ -1,2 +0,0 @@
-include(android-32)
-include(base/android-ndk)

+ 0 - 5
CI/conan/android-64

@@ -1,5 +0,0 @@
-include(base/android)
-
-[settings]
-arch=armv8
-os.api_level=21

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

@@ -1,2 +0,0 @@
-include(android-64)
-include(base/android-ndk)

+ 0 - 30
CI/conan/base/android

@@ -1,30 +0,0 @@
-{% import 'vars.jinja' as vars %}
-
-include(common)
-
-[settings]
-compiler=clang
-compiler.cppstd={{ vars.cppstd }}
-compiler.libcxx=c++_shared
-compiler.version=14
-os=Android
-
-[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")] }}
-
-[options]
-# TODO https://github.com/conan-io/conan-center-index/issues/26020
-# freetype/*:shared=True
-sdl/*:shared=False
-sdl_image/*:shared=False
-sdl_mixer/*:shared=False
-sdl_ttf/*:shared=False
-
-qt/*:opengl=es2
-qt/*:qtandroidextras=True
-qt/*:with_freetype=True

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

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

+ 0 - 22
CI/conan/base/apple

@@ -1,22 +0,0 @@
-{% import 'vars.jinja' as vars %}
-
-include(common)
-
-[settings]
-compiler=apple-clang
-compiler.cppstd={{ vars.cppstd }}
-compiler.libcxx=libc++
-compiler.version=16
-
-[replace_requires]
-bzip2/*: bzip2/[*]@system
-libiconv/*: libiconv/[*]@system
-sqlite3/*: sqlite3/[*]@system
-zlib/*: zlib/[*]@system
-
-[conf]
-tools.apple:enable_bitcode=False
-
-[options]
-qt/*:openssl=False
-sdl_image/*:imageio=True

+ 0 - 223
CI/conan/base/common

@@ -1,223 +0,0 @@
-[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
-
-[options]
-# shared (dynamic) libs
-boost/*:shared=True
-bzip2/*:shared=True
-libiconv/*:shared=True
-libpng/*:shared=True
-minizip/*:shared=True
-ogg/*:shared=True
-opus/*:shared=True
-qt/*:shared=True
-sdl/*:shared=True
-sdl_image/*:shared=True
-sdl_mixer/*:shared=True
-sdl_ttf/*:shared=True
-xz_utils/*:shared=True
-zlib/*:shared=True
-
-# Boost
-# we need only the following parts:
-# 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
-boost/*:without_context=True
-boost/*:without_contract=True
-boost/*:without_coroutine=True
-boost/*:without_fiber=True
-boost/*:without_graph=True
-boost/*:without_graph_parallel=True
-boost/*:without_json=True
-boost/*:without_log=True
-boost/*:without_math=True
-boost/*:without_mpi=True
-boost/*:without_nowide=True
-boost/*:without_process=True
-boost/*:without_python=True
-boost/*:without_serialization=True
-boost/*:without_stacktrace=True
-boost/*:without_test=True
-boost/*:without_timer=True
-boost/*:without_type_erasure=True
-boost/*:without_wave=True
-boost/*:without_url=True
-
-# FFmpeg
-ffmpeg/*:avcodec=True
-ffmpeg/*:avdevice=False
-ffmpeg/*:avfilter=False
-ffmpeg/*:avformat=True
-ffmpeg/*:postproc=False
-# for resampling of audio in 'planar' formats
-ffmpeg/*:swresample=True
-# for video scaling
-ffmpeg/*:swscale=True
-
-ffmpeg/*:disable_all_bitstream_filters=True
-ffmpeg/*:disable_all_decoders=True
-ffmpeg/*:disable_all_demuxers=True
-ffmpeg/*:disable_all_encoders=True
-ffmpeg/*:disable_all_filters=True
-ffmpeg/*:disable_all_hardware_accelerators=True
-ffmpeg/*:disable_all_muxers=True
-ffmpeg/*:disable_all_parsers=True
-ffmpeg/*:disable_all_protocols=True
-
-ffmpeg/*:with_asm=False
-ffmpeg/*:with_freetype=False
-ffmpeg/*:with_libaom=False
-ffmpeg/*:with_libdav1d=False
-ffmpeg/*:with_libfdk_aac=False
-ffmpeg/*:with_libiconv=False
-ffmpeg/*:with_libmp3lame=False
-ffmpeg/*:with_libsvtav1=False
-ffmpeg/*:with_libvpx=False
-ffmpeg/*:with_libwebp=False
-ffmpeg/*:with_libx264=False
-ffmpeg/*:with_libx265=False
-ffmpeg/*:with_lzma=True
-ffmpeg/*:with_openh264=False
-ffmpeg/*:with_openjpeg=False
-ffmpeg/*:with_programs=False
-ffmpeg/*:with_sdl=False
-ffmpeg/*:with_ssl=False
-ffmpeg/*:with_vorbis=False
-
-# We want following options supported:
-# H3:SoD - .bik and .smk
-# H3:HD  -  ogg container / theora video / vorbis sound (not supported by VCMI at the moment, but might be supported in future)
-# and for mods - webm container / vp8 or vp9 video / opus sound
-# TODO: add av1 support for mods (requires enabling libdav1d)
-{% set ffDecoders = [
-    'bink',
-    'binkaudio_dct',
-    'binkaudio_rdft',
-    'opus',
-    'smackaud',
-    'smacker',
-    'theora',
-    'vorbis',
-    'vp8',
-    'vp9',
-] %}
-{% set ffDemuxers = [
-    'bink',
-    'binka',
-    'ogg',
-    'smacker',
-    'webm_dash_manifest',
-] %}
-{% set ffParsers = [
-    'opus',
-    'vorbis',
-    'vp8',
-    'vp9',
-    'webp',
-] %}
-{% set ffProtocols = [
-    'file',
-] %}
-ffmpeg/*:enable_decoders={{ ffDecoders|join(',') }}
-ffmpeg/*:enable_demuxers={{ ffDemuxers|join(',') }}
-ffmpeg/*:enable_parsers={{ ffParsers|join(',') }}
-ffmpeg/*:enable_protocols={{ ffProtocols|join(',') }}
-
-# optionally, for testing - enable ffplay/ffprobe binaries:
-# ffmpeg/*:avfilter=True
-# ffmpeg/*:enable_filters=aresample,scale
-# ffmpeg/*:with_programs=True
-# ffmpeg/*:with_sdl=True
-
-# oneTBB
-onetbb/*:tbbbind=False
-onetbb/*:tbbmalloc=False
-onetbb/*:tbbproxy=False
-
-# Qt
-# xpm format is required for Drag'n'Drop support
-# 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
-# '-no-feature-assistant',
-# '-no-feature-designer',
-# '-no-feature-distancefieldgenerator',
-# '-no-feature-kmap2qmap',
-# '-no-feature-linguist',
-# '-no-feature-makeqpf',
-# '-no-feature-pixeltool',
-# '-no-feature-qdbus',
-# '-no-feature-qev',
-# '-no-feature-qtattributionsscanner',
-# '-no-feature-qtdiag',
-# '-no-feature-qtpaths',
-# '-no-feature-qtplugininfo',
-{% set qtConfig = [
-    '-no-gif',
-    '-no-ico',
-
-    '-no-feature-imageformat_bmp',
-    '-no-feature-imageformat_jpeg',
-    '-no-feature-imageformat_ppm',
-    '-no-feature-imageformat_xbm',
-] %}
-qt/*:config={{ qtConfig|join(' ') }}
-qt/*:essential_modules=False
-qt/*:openssl=True
-qt/*:qttools=True
-qt/*:with_freetype=False
-qt/*:with_libjpeg=False
-qt/*:with_mysql=False
-qt/*:with_odbc=False
-qt/*:with_openal=False
-qt/*:with_pq=False
-
-# SDL
-sdl/*:iconv=True
-sdl/*:sdl2main=True
-sdl/*:vulkan=False
-
-# SDL_image
-# bmp, png are the only ones that needs to be supported
-# dds support may be useful for HD edition, but not supported by sdl_image at the moment
-sdl_image/*:gif=False
-sdl_image/*:lbm=False
-sdl_image/*:pcx=False
-sdl_image/*:pnm=False
-sdl_image/*:qoi=False
-sdl_image/*:svg=False
-sdl_image/*:tga=False
-sdl_image/*:with_libjpeg=False
-sdl_image/*:with_libtiff=False
-sdl_image/*:with_libwebp=False
-sdl_image/*:xcf=False
-sdl_image/*:xpm=False
-sdl_image/*:xv=False
-
-# SDL_mixer
-# mp3, ogg and wav are the only ones that needs to be supported, flac is a bonus
-sdl_mixer/*:mad=False
-sdl_mixer/*:mikmod=False
-sdl_mixer/*:modplug=False
-sdl_mixer/*:nativemidi=False
-sdl_mixer/*:tinymidi=False
-
-# transitive deps, stuff that's not needed
-# doesn't link to bzip2 & zlib from "system" recipes
-pcre2/*:build_pcre2grep=False
-sqlite3/*:build_executable=False
-opusfile/*:http=False
-zstd/*:build_programs=False

+ 0 - 15
CI/conan/base/ios

@@ -1,15 +0,0 @@
-include(apple)
-
-[settings]
-os=iOS
-os.sdk=iphoneos
-
-[options]
-qt/*:shared=False
-sdl/*:shared=False
-sdl_image/*:shared=False
-sdl_mixer/*:shared=False
-sdl_ttf/*:shared=False
-
-qt/*:opengl=es2
-sdl/*:sdl2main=False

+ 0 - 4
CI/conan/base/macos

@@ -1,4 +0,0 @@
-include(apple)
-
-[settings]
-os=Macos

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

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

+ 0 - 26
CI/conan/base/msvc

@@ -1,26 +0,0 @@
-{% import 'vars.jinja' as vars %}
-
-include(common)
-
-[settings]
-compiler=msvc
-compiler.cppstd={{ vars.cppstd }}
-compiler.runtime=dynamic
-compiler.version=194
-os=Windows
-
-[conf]
-# https://walbourn.github.io/a-brief-history-of-windows-sdks/
-# https://learn.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt
-# https://learn.microsoft.com/en-us/windows/win32/WinProg/using-the-windows-headers
-{% set _WIN32_WINNT_WIN7 = '0x0601' %}
-{% set NTDDI_WIN7 = '0x06010000' %}
-{% set win7_defines = [
-    '_WIN32_WINNT={}'.format(_WIN32_WINNT_WIN7),
-    'WINVER={}'.format(_WIN32_WINNT_WIN7),
-    'NTDDI_VERSION={}'.format(NTDDI_WIN7),
-] %}
-tools.build:defines={{ win7_defines }}
-
-[options]
-ffmpeg/*:shared=True

+ 0 - 1
CI/conan/base/vars.jinja

@@ -1 +0,0 @@
-{% set cppstd = '17' %}

+ 0 - 5
CI/conan/ios-arm64

@@ -1,5 +0,0 @@
-include(base/ios)
-
-[settings]
-os.version=12.0
-arch=armv8

+ 0 - 8
CI/conan/ios-armv7

@@ -1,8 +0,0 @@
-include(base/ios)
-
-[settings]
-os.version=10.0
-arch=armv7
-
-# Xcode 13.x is the last version that can build for armv7
-compiler.version=13

+ 0 - 5
CI/conan/macos-arm

@@ -1,5 +0,0 @@
-include(base/macos)
-
-[settings]
-os.version=11.0
-arch=armv8

+ 0 - 5
CI/conan/macos-intel

@@ -1,5 +0,0 @@
-include(base/macos)
-
-[settings]
-os.version=10.13
-arch=x86_64

+ 0 - 4
CI/conan/msvc-x64

@@ -1,4 +0,0 @@
-include(base/msvc)
-
-[settings]
-arch=x86_64

+ 0 - 4
CI/conan/msvc-x86

@@ -1,4 +0,0 @@
-include(base/msvc)
-
-[settings]
-arch=x86

+ 0 - 152
conanfile.py

@@ -1,152 +0,0 @@
-from conan import ConanFile
-from conan.errors import ConanInvalidConfiguration
-from conan.tools.apple import is_apple_os
-from conan.tools.cmake import CMakeToolchain
-from conan.tools.files import save
-from conan.tools.microsoft import is_msvc
-
-from glob import glob
-import os
-
-required_conan_version = ">=2.13.0"
-
-class VCMI(ConanFile):
-    settings = "os", "compiler", "build_type", "arch"
-    generators = "CMakeDeps"
-
-    _libRequires = [
-        "luajit/2.1.0-beta3",
-        "minizip/[^1.2.12]",
-        "zlib/[^1.2.12]",
-    ]
-    _clientRequires = [
-        "onetbb/[^2021.7]",
-        "sdl_image/[^2.8.2]",
-        "sdl_mixer/[^2.8.0]",
-        "sdl_ttf/[^2.0.18]",
-    ]
-    _launcherRequires = [
-        "xz_utils/[^5.2.5]", # innoextract
-    ]
-    requires = _libRequires + _clientRequires + _launcherRequires
-
-    options = {
-        "target_pre_windows10": [True, False],
-        "with_ffmpeg": [True, False],
-    }
-    default_options = {
-        "target_pre_windows10": False,
-        "with_ffmpeg": True,
-    }
-
-    @property
-    def _isMobilePlatform(self):
-        return self.settings.os == "iOS" or self.settings.os == "Android"
-
-    def config_options(self):
-        # static on "single app" platforms
-        isSdlShared = not self._isMobilePlatform
-        self.options["sdl"].shared = isSdlShared
-        self.options["sdl_image"].shared = isSdlShared
-        self.options["sdl_mixer"].shared = isSdlShared
-        self.options["sdl_ttf"].shared = isSdlShared
-
-        if self.settings.os == "Android":
-            self.options["qt"].android_sdk = os.getenv("ANDROID_HOME")
-
-        if self.settings.os != "Windows":
-            del self.options.target_pre_windows10
-
-    def requirements(self):
-        # lib
-        # boost::filesystem removed support for Windows < 10 in v1.87
-        boostMinVersion = "1.69"
-        if self.options.get_safe("target_pre_windows10", False):
-            self.requires(f"boost/[>={boostMinVersion} <1.87]")
-        else:
-            self.requires(f"boost/[^{boostMinVersion}]")
-
-        # 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]") # earlier versions have serious bugs
-        else:
-            self.requires("qt/[~5.15.2]")
-
-    def validate(self):
-        # FFmpeg
-        if is_msvc(self) and self.options.with_ffmpeg and self.dependencies["ffmpeg"].options.shared != True:
-            raise ConanInvalidConfiguration("MSVC FFmpeg static build requires static runtime, but VCMI uses dynamic runtime. You must build FFmpeg as shared.")
-
-        # SDL
-        sdl2mainValue = self.settings.os != "iOS"
-        if self.dependencies["sdl"].options.sdl2main != sdl2mainValue:
-            raise ConanInvalidConfiguration(f"sdl:sdl2main option for {self.settings.os} must be set to {sdl2mainValue}")
-
-        # Qt
-        qtDep = self.dependencies["qt"]
-        if qtDep.options.qttools != True:
-            raise ConanInvalidConfiguration("qt:qttools option must be set to True")
-        if self.settings.os == "Android" and qtDep.options.qtandroidextras != True:
-            # TODO: in Qt 6 this option doesn't exist
-            raise ConanInvalidConfiguration("qt:qtandroidextras option for Android must be set to True")
-        if not is_apple_os(self) and qtDep.options.openssl != True:
-            raise ConanInvalidConfiguration("qt:openssl option for non-Apple OS must be set to True, otherwise mods can't be downloaded")
-
-    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_RUNTIME_LIBS_FILE"] = self._generateRuntimeLibsFile()
-        if self.settings.os == "Android":
-            tc.variables["CMAKE_ANDROID_API"] = str(self.settings.os.api_level)
-        elif self.settings.os == "Windows":
-            tc.variables["CONAN_RUNENV_SCRIPT"] = self._pathForCmake(os.path.join(self.build_folder, "conanrun.bat"))
-        tc.generate()