Pārlūkot izejas kodu

Merge pull request #4545 from vcmi/update_prebuilts

Update conan prebuilt package
Ivan Savenko 1 gadu atpakaļ
vecāks
revīzija
5894d51f89

+ 57 - 37
.github/workflows/github.yml

@@ -17,20 +17,22 @@ env:
 jobs:
   build:
     strategy:
-      fail-fast: false
       matrix:
         include:
           - platform: linux-qt6
             os: ubuntu-24.04
             test: 0
+            before_install: linux_qt6.sh
             preset: linux-clang-test
           - platform: linux
             os: ubuntu-24.04
             test: 1
+            before_install: linux_qt5.sh
             preset: linux-gcc-test
           - platform: linux
             os: ubuntu-20.04
             test: 0
+            before_install: linux_qt5.sh
             preset: linux-gcc-debug
           - platform: mac-intel
             os: macos-13
@@ -38,8 +40,10 @@ jobs:
             pack: 1
             pack_type: Release
             extension: dmg
+            before_install: macos.sh
             preset: macos-conan-ninja-release
             conan_profile: macos-intel
+            conan_prebuilts: dependencies-mac-intel
             conan_options: --options with_apple_system_libs=True
             artifact_platform: intel
           - platform: mac-arm
@@ -48,8 +52,10 @@ jobs:
             pack: 1
             pack_type: Release
             extension: dmg
+            before_install: macos.sh
             preset: macos-arm-conan-ninja-release
             conan_profile: macos-arm
+            conan_prebuilts: dependencies-mac-arm
             conan_options: --options with_apple_system_libs=True
             artifact_platform: arm
           - platform: ios
@@ -58,8 +64,10 @@ jobs:
             pack: 1
             pack_type: Release
             extension: ipa
+            before_install: macos.sh
             preset: ios-release-conan-ccache
             conan_profile: ios-arm64
+            conan_prebuilts: dependencies-ios
             conan_options: --options with_apple_system_libs=True
           - platform: msvc
             os: windows-latest
@@ -67,40 +75,45 @@ jobs:
             pack: 1
             pack_type: RelWithDebInfo
             extension: exe
+            before_install: msvc.sh
             preset: windows-msvc-release
-          - platform: mingw
-            os: ubuntu-22.04
+          - platform: mingw_x86_64
+            os: ubuntu-24.04
             test: 0
             pack: 1
             pack_type: Release
             extension: exe
-            cpack_args: -D CPACK_NSIS_EXECUTABLE=`which makensis`
             cmake_args: -G Ninja
+            before_install: mingw.sh
             preset: windows-mingw-conan-linux
             conan_profile: mingw64-linux.jinja
-          - platform: mingw-32
-            os: ubuntu-22.04
+            conan_prebuilts: dependencies-mingw-x86-64
+          - platform: mingw_x86
+            os: ubuntu-24.04
             test: 0
             pack: 1
             pack_type: Release
             extension: exe
-            cpack_args: -D CPACK_NSIS_EXECUTABLE=`which makensis`
             cmake_args: -G Ninja
+            before_install: mingw.sh
             preset: windows-mingw-conan-linux
             conan_profile: mingw32-linux.jinja
+            conan_prebuilts: dependencies-mingw-x86
           - platform: android-32
-            os: macos-14
+            os: ubuntu-24.04
             extension: apk
             preset: android-conan-ninja-release
-            conan_profile: android-32
-            conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT
+            before_install: android.sh
+            conan_profile: android-32-ndk
+            conan_prebuilts: dependencies-android-armeabi-v7a
             artifact_platform: armeabi-v7a
           - platform: android-64
-            os: macos-14
+            os: ubuntu-24.04
             extension: apk
             preset: android-conan-ninja-release
-            conan_profile: android-64
-            conan_options: --conf tools.android:ndk_path=$ANDROID_NDK_ROOT
+            before_install: android.sh
+            conan_profile: android-64-ndk
+            conan_prebuilts: dependencies-android-arm64-v8a
             artifact_platform: arm64-v8a
     runs-on: ${{ matrix.os }}
     defaults:
@@ -108,15 +121,21 @@ jobs:
         shell: bash
 
     steps:
-    - uses: actions/checkout@v4
+    - name: Checkout repository
+      uses: actions/checkout@v4
       with:
         submodules: recursive
 
-    - name: Dependencies
-      run: source '${{github.workspace}}/CI/${{matrix.platform}}/before_install.sh'
+    - name: Prepare CI
+      if: "${{ matrix.before_install != '' }}"
+      run: source '${{github.workspace}}/CI/before_install/${{matrix.before_install}}'
       env:
         VCMI_BUILD_PLATFORM: x64
 
+    - name: Install Conan Dependencies
+      if: "${{ matrix.conan_prebuilts != '' }}"
+      run: source '${{github.workspace}}/CI/install_conan_dependencies.sh' '${{matrix.conan_prebuilts}}'
+
     # ensure the ccache for each PR is separate so they don't interfere with each other
     # fall back to ccache of the vcmi/vcmi repo if no PR-specific ccache is found
     - name: ccache for PRs
@@ -158,15 +177,13 @@ jobs:
         mkdir -p ~/.local/share/vcmi/
         mv h3_assets/* ~/.local/share/vcmi/
 
-    - uses: actions/setup-python@v5
+    - name: Install Conan
       if: "${{ matrix.conan_profile != '' }}"
-      with:
-        python-version: '3.10'
+      run: pipx install 'conan<2.0'
 
-    - name: Conan setup
+    - name: Install Conan profile
       if: "${{ matrix.conan_profile != '' }}"
       run: |
-        pip3 install 'conan<2.0'
         conan profile new default --detect
         conan install . \
           --install-folder=conan-generated \
@@ -178,7 +195,13 @@ jobs:
       env:
         GENERATE_ONLY_BUILT_CONFIG: 1
 
-    - uses: actions/setup-java@v4
+    # Workaround for gradle not discovering SDK that was installed via conan
+    - name: Find Android NDK
+      if: ${{ startsWith(matrix.platform, 'android') }}
+      run: sudo ln -s -T /home/runner/.conan/data/android-ndk/r25c/_/_/package/4db1be536558d833e52e862fd84d64d75c2b3656/bin /usr/local/lib/android/sdk/ndk/25.2.9519653
+
+    - name: Install Java
+      uses: actions/setup-java@v4
       if: ${{ startsWith(matrix.platform, 'android') }}
       with:
         distribution: 'temurin'
@@ -243,11 +266,13 @@ jobs:
       if: ${{ matrix.pack == 1 }}
       run: |
         cd '${{github.workspace}}/out/build/${{matrix.preset}}'
-        CPACK_PATH=`which -a cpack | grep -m1 -v -i chocolatey`
-        counter=0; until "$CPACK_PATH" -C ${{matrix.pack_type}} ${{ matrix.cpack_args }} || ((counter > 20)); do sleep 3; ((counter++)); done
-        test -f '${{github.workspace}}/CI/${{matrix.platform}}/post_pack.sh' \
-          && '${{github.workspace}}/CI/${{matrix.platform}}/post_pack.sh' '${{github.workspace}}' "$(ls '${{ env.VCMI_PACKAGE_FILE_NAME }}'.*)"
-        rm -rf _CPack_Packages
+        
+        # Workaround for CPack bug on macOS 13
+        counter=0
+        until cpack -C ${{matrix.pack_type}} || ((counter > 20)); do
+            sleep 3
+            ((counter++))
+        done
 
     - name: Artifacts
       if: ${{ matrix.pack == 1 }}
@@ -269,7 +294,7 @@ jobs:
         echo "ANDROID_APK_PATH=$ANDROID_APK_PATH" >> $GITHUB_ENV
         echo "ANDROID_AAB_PATH=$ANDROID_AAB_PATH" >> $GITHUB_ENV
 
-    - name: Android apk artifacts
+    - name: Upload android apk artifacts
       if: ${{ startsWith(matrix.platform, 'android') }}
       uses: actions/upload-artifact@v4
       with:
@@ -277,15 +302,15 @@ jobs:
         path: |
           ${{ env.ANDROID_APK_PATH }}
 
-    - name: Android aab artifacts
-      if: ${{ startsWith(matrix.platform, 'android') }}
+    - name: Upload Android aab artifacts
+      if: ${{ startsWith(matrix.platform, 'android') && github.ref == 'refs/heads/master' }}
       uses: actions/upload-artifact@v4
       with:
         name: ${{ env.VCMI_PACKAGE_FILE_NAME }} - ${{ matrix.platform }} - aab
         path: |
           ${{ env.ANDROID_AAB_PATH }}
 
-    - name: Symbols
+    - name: Upload debug symbols
       if: ${{ matrix.platform == 'msvc' }}
       uses: actions/upload-artifact@v4
       with:
@@ -344,11 +369,6 @@ jobs:
     steps:
         - uses: actions/checkout@v4
 
-        - uses: actions/setup-python@v5
-          if: "${{ matrix.conan_profile != '' }}"
-          with:
-            python-version: '3.10'
-
         - name: Ensure LF line endings
           run: |
             find . -path ./.git -prune -o -path ./AI/FuzzyLite -prune -o -path ./test/googletest \
@@ -359,4 +379,4 @@ jobs:
         - name: Validate JSON
           run: |
             sudo apt install python3-jstyleson
-            python3 CI/linux-qt6/validate_json.py
+            python3 CI/validate_json.py

+ 0 - 4
CI/android-32/before_install.sh

@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-DEPS_FILENAME=dependencies-android-32
-. CI/android/before_install.sh

+ 0 - 4
CI/android-64/before_install.sh

@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-DEPS_FILENAME=dependencies-android-64
-. CI/android/before_install.sh

+ 0 - 7
CI/android/before_install.sh

@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-
-echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/25.2.9519653" >> $GITHUB_ENV
-
-brew install ninja
-
-. CI/install_conan_dependencies.sh "$DEPS_FILENAME"

+ 4 - 0
CI/before_install/android.sh

@@ -0,0 +1,4 @@
+#!/bin/sh
+
+sudo apt-get update
+sudo apt-get install ninja-build

+ 2 - 3
CI/linux/before_install.sh → CI/before_install/linux_qt5.sh

@@ -1,6 +1,5 @@
 #!/bin/sh
 
-sudo apt remove needrestart
 sudo apt-get update
 
 # Dependencies
@@ -9,6 +8,6 @@ sudo apt-get update
 # - debian build settings at debian/control
 sudo apt-get install libboost-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-locale-dev libboost-iostreams-dev \
 libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
-qtbase5-dev \
+qtbase5-dev qttools5-dev \
 ninja-build zlib1g-dev libavformat-dev libswscale-dev libtbb-dev libluajit-5.1-dev \
-libminizip-dev libfuzzylite-dev qttools5-dev libsqlite3-dev # Optional dependencies
+libminizip-dev libfuzzylite-dev libsqlite3-dev # Optional dependencies

+ 3 - 1
CI/linux-qt6/before_install.sh → CI/before_install/linux_qt6.sh

@@ -1,9 +1,11 @@
 #!/bin/sh
 
-sudo apt remove needrestart
 sudo apt-get update
 
 # Dependencies
+# In case of change in dependencies list please also update:
+# - developer docs at docs/developer/Building_Linux.md
+# - debian build settings at debian/control
 sudo apt-get install libboost-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-locale-dev libboost-iostreams-dev \
 libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev \
 qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools qt6-l10n-tools \

+ 0 - 2
CI/mac/before_install.sh → CI/before_install/macos.sh

@@ -3,5 +3,3 @@
 echo DEVELOPER_DIR=/Applications/Xcode_14.2.app >> $GITHUB_ENV
 
 brew install ninja
-
-. CI/install_conan_dependencies.sh "$DEPS_FILENAME"

+ 7 - 0
CI/before_install/mingw.sh

@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+sudo apt-get update
+sudo apt-get install ninja-build mingw-w64 nsis
+
+sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
+sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix

+ 0 - 0
CI/msvc/before_install.sh → CI/before_install/msvc.sh


+ 1 - 1
CI/conan/base/cross-macro.j2

@@ -10,7 +10,7 @@ STRIP={{ target_host }}-strip
 {%- endmacro -%}
 
 {% macro generate_env_win32(target_host) -%}
-CONAN_SYSTEM_LIBRARY_LOCATION=/usr/lib/gcc/{{ target_host }}/10-posix/
+CONAN_SYSTEM_LIBRARY_LOCATION=/usr/lib/gcc/{{ target_host }}/13-posix/
 RC={{ target_host }}-windres
 {%- endmacro -%}
 

+ 1 - 1
CI/install_conan_dependencies.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 
-RELEASE_TAG="1.2"
+RELEASE_TAG="1.3"
 FILENAME="$1"
 DOWNLOAD_URL="https://github.com/vcmi/vcmi-dependencies/releases/download/$RELEASE_TAG/$FILENAME.txz"
 

+ 0 - 5
CI/ios/before_install.sh

@@ -1,5 +0,0 @@
-#!/usr/bin/env bash
-
-echo DEVELOPER_DIR=/Applications/Xcode_14.2.app >> $GITHUB_ENV
-
-. CI/install_conan_dependencies.sh "dependencies-ios"

+ 0 - 1
CI/linux-qt6/upload_package.sh

@@ -1 +0,0 @@
-#!/bin/sh

+ 0 - 1
CI/linux/upload_package.sh

@@ -1 +0,0 @@
-#!/bin/sh

+ 0 - 4
CI/mac-arm/before_install.sh

@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-DEPS_FILENAME=dependencies-mac-arm
-. CI/mac/before_install.sh

+ 0 - 4
CI/mac-intel/before_install.sh

@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-DEPS_FILENAME=dependencies-mac-intel
-. CI/mac/before_install.sh

+ 0 - 14
CI/mingw-32/before_install.sh

@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-sudo apt-get update
-sudo apt-get install ninja-build mingw-w64 nsis
-sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
-
-# Workaround for getting new MinGW headers on Ubuntu 22.04.
-# Remove it once MinGW headers version in repository will be 10.0 at least
-curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-common_10.0.0-3_all.deb \
-  && sudo dpkg -i mingw-w64-common_10.0.0-3_all.deb;
-curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-i686-dev_10.0.0-3_all.deb \
-  && sudo dpkg -i mingw-w64-i686-dev_10.0.0-3_all.deb;
-
-. CI/install_conan_dependencies.sh "dependencies-mingw-32"

+ 0 - 14
CI/mingw/before_install.sh

@@ -1,14 +0,0 @@
-#!/usr/bin/env bash
-
-sudo apt-get update
-sudo apt-get install ninja-build mingw-w64 nsis
-sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
-
-# Workaround for getting new MinGW headers on Ubuntu 22.04.
-# Remove it once MinGW headers version in repository will be 10.0 at least
-curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-common_10.0.0-3_all.deb \
-  && sudo dpkg -i mingw-w64-common_10.0.0-3_all.deb;
-curl -O -L http://mirrors.kernel.org/ubuntu/pool/universe/m/mingw-w64/mingw-w64-x86-64-dev_10.0.0-3_all.deb \
-  && sudo dpkg -i mingw-w64-x86-64-dev_10.0.0-3_all.deb;
-
-. CI/install_conan_dependencies.sh "dependencies-mingw"

+ 0 - 6
CI/msvc/build_script.bat

@@ -1,6 +0,0 @@
-cd %APPVEYOR_BUILD_FOLDER%
-cd build_%VCMI_BUILD_PLATFORM%
-
-cmake --build . --config %VCMI_BUILD_CONFIGURATION% -- /maxcpucount:2
-
-cpack

+ 0 - 5
CI/msvc/coverity_build_script.bat

@@ -1,5 +0,0 @@
-cd %APPVEYOR_BUILD_FOLDER%
-cd build_%VCMI_BUILD_PLATFORM%
-
-echo Building with coverity...
-cov-build.exe --dir cov-int cmake --build . --config %VCMI_BUILD_CONFIGURATION% -- /maxcpucount:2

+ 0 - 17
CI/msvc/coverity_upload_script.ps

@@ -1,17 +0,0 @@
-7z a "$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" "$Env:APPVEYOR_BUILD_FOLDER\build_$Env:VCMI_BUILD_PLATFORM\cov-int\"
-
-# cf. http://stackoverflow.com/a/25045154/335418
-Remove-item alias:curl
-
-Write-Host "Uploading Coverity analysis result..." -ForegroundColor "Green"
-
-curl --silent --show-error `
-     --output curl-out.txt `
-     --form token="$Env:coverity_token" `
-     --form email="$Env:coverity_email" `
-     --form "file=@$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" `
-     --form version="$Env:APPVEYOR_REPO_COMMIT" `
-     --form description="CI server scheduled build." `
-     https://scan.coverity.com/builds?project=vcmi%2Fvcmi
-
-cat .\curl-out.txt

+ 0 - 0
CI/linux-qt6/validate_json.py → CI/validate_json.py


+ 13 - 8
CMakeLists.txt

@@ -180,11 +180,6 @@ else()
 	add_definitions(-DVCMI_NO_EXTRA_VERSION)
 endif(ENABLE_GITVERSION)
 
-# Precompiled header configuration
-if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0 )
-	set(ENABLE_PCH OFF) # broken
-endif()
-
 if(ENABLE_PCH)
 	macro(enable_pch name)
 		target_precompile_headers(${name} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:<StdInc.h$<ANGLE-R>>)
@@ -328,7 +323,6 @@ if(MINGW OR MSVC)
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244") # 4244: conversion from 'xxx' to 'yyy', possible loss of data
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") # 4267: conversion from 'xxx' to 'yyy', possible loss of data
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4275") # 4275: non dll-interface class 'xxx' used as base for dll-interface class
-		#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800") # 4800: implicit conversion from 'xxx' to bool. Possible information loss
 
 		if(ENABLE_STRICT_COMPILATION)
 			set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") # Treats all compiler warnings as errors
@@ -493,14 +487,23 @@ if (ENABLE_CLIENT)
 	if(TARGET SDL2_image::SDL2_image)
 		add_library(SDL2::Image ALIAS SDL2_image::SDL2_image)
 	endif()
+	if(TARGET SDL2_image::SDL2_image-static)
+		add_library(SDL2::Image ALIAS SDL2_image::SDL2_image-static)
+	endif()
 	find_package(SDL2_mixer REQUIRED)
 	if(TARGET SDL2_mixer::SDL2_mixer)
 		add_library(SDL2::Mixer ALIAS SDL2_mixer::SDL2_mixer)
 	endif()
+	if(TARGET SDL2_mixer::SDL2_mixer-static)
+		add_library(SDL2::Mixer ALIAS SDL2_mixer::SDL2_mixer-static)
+	endif()
 	find_package(SDL2_ttf REQUIRED)
 	if(TARGET SDL2_ttf::SDL2_ttf)
 		add_library(SDL2::TTF ALIAS SDL2_ttf::SDL2_ttf)
 	endif()
+	if(TARGET SDL2_ttf::SDL2_ttf-static)
+		add_library(SDL2::TTF ALIAS SDL2_ttf::SDL2_ttf-static)
+	endif()
 endif()
 
 if(ENABLE_LOBBY)
@@ -727,7 +730,7 @@ endif()
 
 if(WIN32)
 	if(TBB_FOUND AND MSVC)
-		   install_vcpkg_imported_tgt(TBB::tbb)
+		install_vcpkg_imported_tgt(TBB::tbb)
 	endif()
 
 	if(USING_CONAN)
@@ -737,7 +740,9 @@ if(WIN32)
 				${dep_files}
 				"${CMAKE_SYSROOT}/bin/*.dll" 
 				"${CMAKE_SYSROOT}/lib/*.dll" 
-				"${CONAN_SYSTEM_LIBRARY_LOCATION}/*.dll")
+				"${CONAN_SYSTEM_LIBRARY_LOCATION}/libgcc_s_dw2-1.dll" # for 32-bit only?
+				"${CONAN_SYSTEM_LIBRARY_LOCATION}/libgcc_s_seh-1.dll" # for 64-bit only?
+				"${CONAN_SYSTEM_LIBRARY_LOCATION}/libstdc++-6.dll")
 	else()
 		file(GLOB dep_files
 				${dep_files}

+ 45 - 14
conanfile.py

@@ -15,10 +15,11 @@ class VCMI(ConanFile):
         "minizip/[~1.2.12]",
     ]
     _clientRequires = [
-        "sdl/[~2.26.1 || >=2.0.20 <=2.22.0]", # versions in between have broken sound
-        "sdl_image/[~2.0.5]",
-        "sdl_mixer/[~2.0.4]",
-        "sdl_ttf/[~2.0.18]",
+        # 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
     ]
@@ -46,21 +47,41 @@ class VCMI(ConanFile):
         self.options["freetype"].shared = self.settings.os == "Android"
 
         # SDL_image and Qt depend on it, in iOS both are static
-        # Enable static libpng due to https://github.com/conan-io/conan-center-index/issues/15440,
-        # which leads to VCMI crashes of MinGW
-        self.options["libpng"].shared = not (self.settings.os == "Windows" and cross_building(self)) and self.settings.os != "iOS"
+        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"
 
-        if self.settings.os == "Android":
-            self.options["qt"].android_sdk = tools.get_env("ANDROID_HOME", default="")
-
         # 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
 
@@ -86,6 +107,7 @@ class VCMI(ConanFile):
         self.options["boost"].without_timer = True
         self.options["boost"].without_type_erasure = True
         self.options["boost"].without_wave = True
+        self.options["boost"].without_url = True
 
         self.options["ffmpeg"].disable_all_bitstream_filters = True
         self.options["ffmpeg"].disable_all_decoders = True
@@ -149,8 +171,13 @@ class VCMI(ConanFile):
         self.options["sdl"].sdl2main = self.settings.os != "iOS"
         self.options["sdl"].vulkan = False
 
+        # 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
+        self.options["sdl_image"].gif = False
         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"].svg = False
         self.options["sdl_image"].tga = False
         self.options["sdl_image"].with_libjpeg = False
@@ -162,13 +189,17 @@ 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
-        self.options["sdl_mixer"].mad = False
-        self.options["sdl_mixer"].mikmod = False
         self.options["sdl_mixer"].modplug = False
-        self.options["sdl_mixer"].nativemidi = False
         self.options["sdl_mixer"].opus = False
-        self.options["sdl_mixer"].wav = 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
 
         def _disableQtOptions(disableFlag, options):
             return " ".join([f"-{disableFlag}-{tool}" for tool in options])

+ 11 - 3
docs/modders/File_Formats.md

@@ -25,13 +25,21 @@ For animations VCMI supports .def format from Heroes III as well as alternative
 
 ### Sounds
 
-For sounds VCMI currently requires .wav format. Generally, VCMI will support any .wav parameters, however you might want to use high-bitrate versions, such as 44100 Hz or 48000 Hz, 32 bit, 1 or 2 channels
+For sounds VCMI currently supports:
+- .ogg/vorbis format - preferred for mods. Unlike wav, vorbis uses compression which may cause some data loss, however even 128kbit is generally undistinguishable from lossless formats
+- .wav format. This is format used by H3. It is supported by vcmi, but it may result in large file sizes (and as result - large mods)
 
-Support for additional formats, such as ogg/vorbis and ogg/opus is likely to be added in future
+Generally, VCMI will support any audio parameters, however you might want to use high-bitrate versions, such as 44100 Hz or 48000 Hz, 32 bit, 1 or 2 channels
+
+Support for additional formats, such as ogg/opus or flac may be added in future
 
 ### Music
 
-For sounds VCMI currently requires .mp3 format. Support for additional formats, such as ogg/vorbis and ogg/opus is likely to be added in future
+For music VCMI currently supports:
+- .ogg/vorbis format - preferred for mods. Generally offers better quality and lower sizes compared to mp3
+- .mp3 format. This is format used by H3
+
+Support for additional formats, such as ogg/opus may be added in future
 
 ### Video