Enhance Windows build configuration and architecture detection
- Added architecture detection in CMakeLists.txt for Windows, defining appropriate compile flags for ARM64, x64, and x86 platforms. - Updated yaze.vcxproj to include Debug and Release configurations for ARM64, ensuring proper setup for ARM64 builds. - Modified GitHub Actions workflow to support packaging for Windows ARM64, creating artifacts for both x64 and ARM64 builds.
This commit is contained in:
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@@ -136,6 +136,21 @@ jobs:
|
|||||||
copy README.md package\
|
copy README.md package\
|
||||||
cd package && 7z a ..\yaze-windows-x86.zip *
|
cd package && 7z a ..\yaze-windows-x86.zip *
|
||||||
|
|
||||||
|
- name: "Windows ARM64"
|
||||||
|
os: windows-2022
|
||||||
|
vcpkg_triplet: arm64-windows
|
||||||
|
cmake_generator: "Visual Studio 17 2022"
|
||||||
|
cmake_generator_platform: ARM64
|
||||||
|
artifact_name: "yaze-windows-arm64"
|
||||||
|
artifact_path: "build/bin/Release/"
|
||||||
|
package_cmd: |
|
||||||
|
mkdir package
|
||||||
|
xcopy /E /I build\bin\Release\* package\
|
||||||
|
xcopy /E /I assets package\assets
|
||||||
|
copy LICENSE package\
|
||||||
|
copy README.md package\
|
||||||
|
cd package && 7z a ..\yaze-windows-arm64.zip *
|
||||||
|
|
||||||
- name: "macOS Universal"
|
- name: "macOS Universal"
|
||||||
os: macos-14
|
os: macos-14
|
||||||
vcpkg_triplet: arm64-osx
|
vcpkg_triplet: arm64-osx
|
||||||
|
|||||||
@@ -98,6 +98,20 @@ elseif(YAZE_PLATFORM_MACOS)
|
|||||||
elseif(YAZE_PLATFORM_WINDOWS)
|
elseif(YAZE_PLATFORM_WINDOWS)
|
||||||
include(cmake/vcpkg.cmake)
|
include(cmake/vcpkg.cmake)
|
||||||
target_compile_definitions(yaze_common INTERFACE WINDOWS)
|
target_compile_definitions(yaze_common INTERFACE WINDOWS)
|
||||||
|
|
||||||
|
# Windows-specific architecture detection and configuration
|
||||||
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|aarch64")
|
||||||
|
target_compile_definitions(yaze_common INTERFACE YAZE_ARCH_ARM64)
|
||||||
|
message(STATUS "Building for Windows ARM64")
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|x86_64")
|
||||||
|
target_compile_definitions(yaze_common INTERFACE YAZE_ARCH_X64)
|
||||||
|
message(STATUS "Building for Windows x64")
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86")
|
||||||
|
target_compile_definitions(yaze_common INTERFACE YAZE_ARCH_X86)
|
||||||
|
message(STATUS "Building for Windows x86")
|
||||||
|
else()
|
||||||
|
message(WARNING "Unknown Windows architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compiler-specific settings
|
# Compiler-specific settings
|
||||||
|
|||||||
@@ -3,16 +3,29 @@
|
|||||||
add_definitions("-DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0")
|
add_definitions("-DMICROSOFT_WINDOWS_WINBASE_H_DEFINE_INTERLOCKED_CPLUSPLUS_OVERLOADS=0")
|
||||||
|
|
||||||
# vcpkg settings
|
# vcpkg settings
|
||||||
set(VCPKG_TARGET_ARCHITECTURE x64)
|
|
||||||
set(VCPKG_CRT_LINKAGE dynamic)
|
set(VCPKG_CRT_LINKAGE dynamic)
|
||||||
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
set(VCPKG_LIBRARY_LINKAGE dynamic)
|
||||||
|
|
||||||
# Enable vcpkg manifest mode for automatic dependency management
|
# Enable vcpkg manifest mode for automatic dependency management
|
||||||
set(VCPKG_MANIFEST_MODE ON)
|
set(VCPKG_MANIFEST_MODE ON)
|
||||||
|
|
||||||
# Configure vcpkg triplet (defaults to x64-windows)
|
# Auto-detect target architecture and set vcpkg triplet
|
||||||
if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
||||||
set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet")
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|aarch64")
|
||||||
|
set(VCPKG_TARGET_TRIPLET "arm64-windows" CACHE STRING "vcpkg target triplet")
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE arm64)
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|x86_64")
|
||||||
|
set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet")
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||||
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i386|i686|x86")
|
||||||
|
set(VCPKG_TARGET_TRIPLET "x86-windows" CACHE STRING "vcpkg target triplet")
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x86)
|
||||||
|
else()
|
||||||
|
# Fallback to x64 if architecture detection fails
|
||||||
|
set(VCPKG_TARGET_TRIPLET "x64-windows" CACHE STRING "vcpkg target triplet")
|
||||||
|
set(VCPKG_TARGET_ARCHITECTURE x64)
|
||||||
|
message(WARNING "Could not detect target architecture, defaulting to x64")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set vcpkg installation directory if not already set
|
# Set vcpkg installation directory if not already set
|
||||||
@@ -21,6 +34,7 @@ if(NOT DEFINED VCPKG_INSTALLED_DIR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
message(STATUS "vcpkg configuration:")
|
message(STATUS "vcpkg configuration:")
|
||||||
|
message(STATUS " Target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
|
||||||
message(STATUS " Target triplet: ${VCPKG_TARGET_TRIPLET}")
|
message(STATUS " Target triplet: ${VCPKG_TARGET_TRIPLET}")
|
||||||
message(STATUS " Installed directory: ${VCPKG_INSTALLED_DIR}")
|
message(STATUS " Installed directory: ${VCPKG_INSTALLED_DIR}")
|
||||||
message(STATUS " Manifest mode: ${VCPKG_MANIFEST_MODE}")
|
message(STATUS " Manifest mode: ${VCPKG_MANIFEST_MODE}")
|
||||||
|
|||||||
44
yaze.vcxproj
44
yaze.vcxproj
@@ -17,6 +17,14 @@
|
|||||||
<Configuration>Release</Configuration>
|
<Configuration>Release</Configuration>
|
||||||
<Platform>x86</Platform>
|
<Platform>x86</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|ARM64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|ARM64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>ARM64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
@@ -30,6 +38,7 @@
|
|||||||
<VcpkgManifestInstall>true</VcpkgManifestInstall>
|
<VcpkgManifestInstall>true</VcpkgManifestInstall>
|
||||||
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows</VcpkgTriplet>
|
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows</VcpkgTriplet>
|
||||||
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows</VcpkgTriplet>
|
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows</VcpkgTriplet>
|
||||||
|
<VcpkgTriplet Condition="'$(Platform)'=='ARM64'">arm64-windows</VcpkgTriplet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
@@ -76,6 +85,27 @@
|
|||||||
<VcpkgTriplet>x86-windows</VcpkgTriplet>
|
<VcpkgTriplet>x86-windows</VcpkgTriplet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<VcpkgEnabled>true</VcpkgEnabled>
|
||||||
|
<VcpkgManifestInstall>true</VcpkgManifestInstall>
|
||||||
|
<VcpkgTriplet>arm64-windows</VcpkgTriplet>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v143</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<VcpkgEnabled>true</VcpkgEnabled>
|
||||||
|
<VcpkgManifestInstall>true</VcpkgManifestInstall>
|
||||||
|
<VcpkgTriplet>arm64-windows</VcpkgTriplet>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@@ -130,6 +160,20 @@
|
|||||||
<TargetName>yaze</TargetName>
|
<TargetName>yaze</TargetName>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||||
|
<TargetName>yaze</TargetName>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<OutDir>$(SolutionDir)build\bin\$(Configuration)\</OutDir>
|
||||||
|
<IntDir>$(SolutionDir)build\obj\$(ProjectName)\$(Configuration)\</IntDir>
|
||||||
|
<TargetName>yaze</TargetName>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
|||||||
Reference in New Issue
Block a user