diff --git a/CMakeOptions.md b/CMakeOptions.md index 8c28f1a10b..1ad90e6c9a 100644 --- a/CMakeOptions.md +++ b/CMakeOptions.md @@ -29,6 +29,7 @@ - AX_ENABLE_EXT_LIVE2D: the live2d extension, default: `FALSE` - AX_ENABLE_EXT_EFFEKSEER: the effekseer extension, default: `FALSE` - AX_WITH_XXX: usually user don't need care it +- AX_VS_DEPLOYMENT_TARGET: specify windows store deploy target, default: `10.0.17763.0` ## The options for axmol apps diff --git a/README.md b/README.md index 8c99c55c63..8f198c1dbc 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Examples: 6. Use Visual Studio to open the newly created solution file. For example, `./build/ProjectName.sln` #### Windows UWP (Visual Studio 2022), because microsoft limit, only support C++17 - ```cmake -B build_uwp -DCMAKE_SYSTEM_NAME=WindowsStore "-DCMAKE_SYSTEM_VERSION=10.0"``` + ```cmake -B build_uwp -DCMAKE_SYSTEM_NAME=WindowsStore "-DCMAKE_SYSTEM_VERSION=10.0" "-DAX_VS_DEPLOYMENT_TARGET=10.0.17763.0"``` ##### Creating the Visual Studio solution for all axmol test projects @@ -233,14 +233,7 @@ See [windows workflow guide](https://github.com/axmolengine/axmol/issues/564) 6. After cmake finishes generating, you can open the xcode project at ```build``` folder and run cpp-tests or other test targets. 7. Notes - **The code signing is required to run the ios/tvos app on your device, just change the bundle identifier until the auto manage signing is solved** - - **axmol only provides armv7, arm64, x86_64 prebuilt libraries for ios/tvos** - -### Notes - -- ThreadLocalStorage (TLS) - - ios x86 simulator ios>=10 and axmol no longer provide x86 libraries - - ios x64 or devices (armv7, arm64) ios sdk>=9.0 - - the 'OpenAL Soft' maintained by kcat uses TLS + - **axmol only provides aarm64, x86_64 prebuilt libraries for ios/tvos** ### Reference links diff --git a/README_CN.md b/README_CN.md index f15edfccc5..70439840ee 100644 --- a/README_CN.md +++ b/README_CN.md @@ -82,10 +82,9 @@ 1. 安装CMake,要求3.22以上 2. 确保 Visual Studio 2019/2022 已正确安装 3. 执行下面的命令 - ```bat - cd axmol - cmake -S . -B build -G "Visual Studio 16 2019" -A Win32 - ``` + - PC: ```cmake -S . -B build -G "Visual Studio 16 2019"``` + + - UWP: ```cmake -S . -B build -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_NAME=WindowsStore "-DCMAKE_SYSTEM_VERSION=10.0" "-DAX_VS_DEPLOYMENT_TARGET=10.0.17763.0"``` 4. 之后就可以用vs打开```axmol/build/axmol.sln```启动cpp-tests等测试工程了 #### Android diff --git a/cmake/Modules/AXBuildHelpers.cmake b/cmake/Modules/AXBuildHelpers.cmake index 2353e6ff35..f5e70fc174 100644 --- a/cmake/Modules/AXBuildHelpers.cmake +++ b/cmake/Modules/AXBuildHelpers.cmake @@ -432,17 +432,23 @@ endmacro() function (ax_uwp_set_all_targets_deploy_min_version) if (WINRT) - set(oneValueArgs TARGET_PLATFORM_MIN_VERSION) - cmake_parse_arguments(opt "" "${oneValueArgs}" "" ${ARGN}) - if (NOT opt_TARGET_PLATFORM_MIN_VERSION) - set(opt_TARGET_PLATFORM_MIN_VERSION "10.0.19041.0") - endif() - - get_all_targets(all_targets) + if (DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION) + message(STATUS "You are using a cmake version which is support CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION}, \nskip set VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION for targets one by one.") + else() + set(oneValueArgs TARGET_PLATFORM_MIN_VERSION) + cmake_parse_arguments(opt "" "${oneValueArgs}" "" ${ARGN}) + if (NOT opt_TARGET_PLATFORM_MIN_VERSION) + # The minmal deploy target version: Windows 10, version 1809 (Build 10.0.17763) for building msix package + # refer to: https://learn.microsoft.com/en-us/windows/msix/supported-platforms?source=recommendations + set(opt_TARGET_PLATFORM_MIN_VERSION ${AX_VS_DEPLOYMENT_TARGET}) + endif() + + get_all_targets(all_targets) - foreach(target ${all_targets}) - set_target_properties(${target} PROPERTIES VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "${opt_TARGET_PLATFORM_MIN_VERSION}") - endforeach() + foreach(target ${all_targets}) + set_target_properties(${target} PROPERTIES VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION "${opt_TARGET_PLATFORM_MIN_VERSION}") + endforeach() + endif() endif() endfunction() diff --git a/cmake/Modules/AXConfigDefine.cmake b/cmake/Modules/AXConfigDefine.cmake index de4a52aa33..8492329ef1 100644 --- a/cmake/Modules/AXConfigDefine.cmake +++ b/cmake/Modules/AXConfigDefine.cmake @@ -8,12 +8,33 @@ define_property(TARGET FULL_DOCS "use to save depend libs of axmol lua project" ) +# UWP min deploy target support, VS property: targetPlatformMinVersion +if (WINRT) + if (NOT DEFINED AX_VS_DEPLOYMENT_TARGET) + set(AX_VS_DEPLOYMENT_TARGET "10.0.17763.0") + endif() + if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER_EQUAL "3.27.0") + if (NOT DEFINED) + # The minmal deploy target version: Windows 10, version 1809 (Build 10.0.17763) for building msix package + # refer to: https://learn.microsoft.com/en-us/windows/msix/supported-platforms?source=recommendations + set(CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION ${AX_VS_DEPLOYMENT_TARGET}) + endif() + else() + if(DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION) + unset(CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION) + endif() + endif() +endif() + # config c standard if(NOT DEFINED CMAKE_C_STANDARD) if (WINDOWS) message(STATUS "CMAKE_HOST_SYSTEM_VERSION: ${CMAKE_HOST_SYSTEM_VERSION}") message(STATUS "CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}") message(STATUS "CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}") + if (DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION) + message(STATUS "CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION: ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION}") + endif() if (NOT CMAKE_SYSTEM_VERSION) set(CMAKE_SYSTEM_VERSION ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}) endif()