diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e7ee82e..ca4027d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -46,6 +46,18 @@ jobs: - os: windows-2022 build_type: x86-Release arch: amd64_x86 + - os: windows-2022 + build_type: arm64-Debug + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64-Release + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Debug + arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Release + arch: amd64_arm64 - os: windows-2022 build_type: x64-Debug-Clang arch: amd64 @@ -59,16 +71,10 @@ jobs: build_type: x86-Release-Clang arch: amd64_x86 - os: windows-2022 - build_type: arm64-Debug + build_type: arm64-Debug-Clang arch: amd64_arm64 - os: windows-2022 - build_type: arm64-Release - arch: amd64_arm64 - - os: windows-2022 - build_type: arm64ec-Debug - arch: amd64_arm64 - - os: windows-2022 - build_type: arm64ec-Release + build_type: arm64-Release-Clang arch: amd64_arm64 steps: diff --git a/.github/workflows/uwp.yml b/.github/workflows/uwp.yml new file mode 100644 index 0000000..e951eb2 --- /dev/null +++ b/.github/workflows/uwp.yml @@ -0,0 +1,70 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# +# http://go.microsoft.com/fwlink/?LinkID=512686 + +name: 'CMake (UWP)' + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + paths-ignore: + - '*.md' + - LICENSE + - '.nuget/*' + - build/*.mdb + - build/*.props + - build/*.ps1 + - build/*.yml + +permissions: + contents: read + +jobs: + build: + runs-on: windows-2022 + + strategy: + fail-fast: false + + matrix: + build_type: [x64-Debug-UWP, x64-Release-UWP, x64-Debug-UWP-Clang, x64-Release-UWP-Clang] + arch: [amd64] + include: + - build_type: x86-Debug-UWP + arch: amd64_x86 + - build_type: x86-Release-UWP + arch: amd64_x86 + - build_type: x86-Debug-UWP-Clang + arch: amd64_x86 + - build_type: x86-Release-UWP-Clang + arch: amd64_x86 + - build_type: arm64-Debug-UWP + arch: amd64_arm64 + - build_type: arm64-Release-UWP + arch: amd64_arm64 + - build_type: arm64-Debug-UWP-Clang + arch: amd64_arm64 + - build_type: arm64-Release-UWP-Clang + arch: amd64_arm64 + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: 'Install Ninja' + run: choco install ninja + + - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0 + with: + arch: ${{ matrix.arch }} + uwp: true + + - name: 'Configure CMake' + working-directory: ${{ github.workspace }} + run: cmake --preset=${{ matrix.build_type }} + + - name: 'Build' + working-directory: ${{ github.workspace }} + run: cmake --build out\build\${{ matrix.build_type }} diff --git a/.github/workflows/vcpkg.yml b/.github/workflows/vcpkg.yml index 7fd1548..4c3cd27 100644 --- a/.github/workflows/vcpkg.yml +++ b/.github/workflows/vcpkg.yml @@ -36,6 +36,15 @@ jobs: - os: windows-2022 build_type: arm64-Debug-VCPKG arch: amd64_arm64 + - os: windows-2022 + build_type: arm64ec-Debug-VCPKG + arch: amd64_arm64 + - os: windows-2022 + build_type: x64-Debug-MinGW + arch: amd64 + - os: windows-2022 + build_type: x64-Release-MinGW + arch: amd64 exclude: # Exclude failing case due to linker issue. - os: windows-2022 @@ -57,7 +66,14 @@ jobs: run: | if ("${{ matrix.arch }}" -eq "amd64") { - echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV + if ("${{ matrix.build_type }}" -match "MinGW") + { + echo "VCPKG_DEFAULT_TRIPLET=x64-mingw-static" >> $env:GITHUB_ENV + } + else + { + echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV + } } elseif ("${{ matrix.arch }}" -eq "amd64_x86") { diff --git a/CMakePresets.json b/CMakePresets.json index af639a6..b3cc8a0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -45,6 +45,10 @@ "strategy": "external" }, "cacheVariables": { "DIRECTX_ARCH": "arm64ec" }, + "environment": { + "CFLAGS": "/arm64EC", + "CXXFLAGS": "/arm64EC" + }, "hidden": true }, @@ -126,6 +130,22 @@ "strategy": "external" } }, + { + "name": "Clang-X86", + "environment": { + "CFLAGS": "-m32", + "CXXFLAGS": "-m32" + }, + "hidden": true + }, + { + "name": "Clang-AArch64", + "environment": { + "CFLAGS": "--target=arm64-pc-windows-msvc", + "CXXFLAGS": "--target=arm64-pc-windows-msvc" + }, + "hidden": true + }, { "name": "GNUC", "hidden": true, @@ -145,7 +165,7 @@ }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x86-mingw-static", - "VCPKG_HOST_TRIPLET": "x86-mingw-static" + "VCPKG_HOST_TRIPLET": "x64-windows" } }, { @@ -156,7 +176,7 @@ }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "x64-mingw-static", - "VCPKG_HOST_TRIPLET": "x64-mingw-static" + "VCPKG_HOST_TRIPLET": "x64-windows" } }, { @@ -189,8 +209,8 @@ { "name": "x86-Release" , "description": "MSVC for x86 (Release) Library only", "inherits": [ "base", "x86", "Release", "MSVC" ] }, { "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug) Library only", "inherits": [ "base", "ARM64", "Debug", "MSVC" ] }, { "name": "arm64-Release" , "description": "MSVC for ARM64 (Release) Library only", "inherits": [ "base", "ARM64", "Release", "MSVC" ] }, - { "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) Library only", "inherits": [ "base", "ARM64EC", "Debug", "MSVC" ], "environment": { "CXXFLAGS": "/arm64EC" } }, - { "name": "arm64ec-Release", "description": "MSVC for ARM64EC (Release) Library only", "inherits": [ "base", "ARM64EC", "Release", "MSVC" ], "environment": { "CXXFLAGS": "/arm64EC" } }, + { "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) Library only", "inherits": [ "base", "ARM64EC", "Debug", "MSVC" ] }, + { "name": "arm64ec-Release", "description": "MSVC for ARM64EC (Release) Library only", "inherits": [ "base", "ARM64EC", "Release", "MSVC" ] }, { "name": "x64-Debug-UWP" , "description": "MSVC for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "MSVC", "UWP" ] }, { "name": "x64-Release-UWP" , "description": "MSVC for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "MSVC", "UWP" ] }, @@ -211,29 +231,29 @@ { "name": "x86-Release-VCPKG" , "description": "MSVC for x86 (Release) uvatlastool", "inherits": [ "base", "x86", "Release", "VCPKG", "MSVC", "Tools" ] }, { "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug) uvatlastool", "inherits": [ "base", "ARM64", "Debug", "VCPKG", "MSVC", "Tools" ] }, { "name": "arm64-Release-VCPKG" , "description": "MSVC for ARM64 (Release) uvatlastool", "inherits": [ "base", "ARM64", "Release", "VCPKG", "MSVC", "Tools" ] }, - { "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) uvatlastool", "inherits": [ "base", "ARM64EC", "Debug", "VCPKG", "MSVC", "Tools" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, - { "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) uvatlastool", "inherits": [ "base", "ARM64EC", "Release", "VCPKG", "MSVC", "Tools" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, + { "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) uvatlastool", "inherits": [ "base", "ARM64EC", "Debug", "VCPKG", "MSVC", "Tools" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, + { "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) uvatlastool", "inherits": [ "base", "ARM64EC", "Release", "VCPKG", "MSVC", "Tools" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } }, { "name": "x64-Debug-Clang" , "description": "Clang/LLVM for x64 (Debug) Library only", "inherits": [ "base", "x64", "Debug", "Clang" ] }, { "name": "x64-Release-Clang" , "description": "Clang/LLVM for x64 (Release) Library only", "inherits": [ "base", "x64", "Release", "Clang" ] }, - { "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) Library only", "inherits": [ "base", "x86", "Debug", "Clang" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) Library only", "inherits": [ "base", "x86", "Release", "Clang" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) Library only", "inherits": [ "base", "ARM64", "Debug", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, - { "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) Library only", "inherits": [ "base", "ARM64", "Release", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) Library only", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86" ] }, + { "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) Library only", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86" ] }, + { "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) Library only", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64" ] }, + { "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) Library only", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64" ] }, { "name": "x64-Debug-UWP-Clang" , "description": "Clang/LLVM for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "Clang", "UWP" ] }, { "name": "x64-Release-UWP-Clang" , "description": "Clang/LLVM for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "Clang", "UWP" ] }, - { "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, - { "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "UWP" ] }, + { "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "UWP" ] }, + { "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64", "UWP" ] }, + { "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64", "UWP" ] }, { "name": "x64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Debug) uvatlastool", "inherits": [ "base", "x64", "Debug", "VCPKG", "Clang", "Tools" ] }, { "name": "x64-Release-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Release) uvatlastool", "inherits": [ "base", "x64", "Release", "VCPKG", "Clang", "Tools" ] }, - { "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) uvatlastool", "inherits": [ "base", "x86", "Debug", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) uvatlastool", "inherits": [ "base", "x86", "Release", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "-m32" } }, - { "name": "arm64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for AArch64 (Debug) uvatlastool", "inherits": [ "base", "ARM64", "Debug", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, - { "name": "arm64-Release-Clang-VCPKG", "description": "Clang/LLVM for AArch64 (Release) uvatlastool", "inherits": [ "base", "ARM64", "Release", "VCPKG", "Clang", "Tools" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } }, + { "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) uvatlastool", "inherits": [ "base", "x86", "Debug", "VCPKG", "Clang", "Clang-X86", "Tools" ] }, + { "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) uvatlastool", "inherits": [ "base", "x86", "Release", "VCPKG", "Clang", "Clang-X86", "Tools" ] }, + { "name": "arm64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for AArch64 (Debug) uvatlastool", "inherits": [ "base", "ARM64", "Debug", "VCPKG", "Clang", "Clang-AArch64", "Tools" ] }, + { "name": "arm64-Release-Clang-VCPKG", "description": "Clang/LLVM for AArch64 (Release) uvatlastool", "inherits": [ "base", "ARM64", "Release", "VCPKG", "Clang", "Clang-AArch64", "Tools" ] }, { "name": "x64-Debug-Scarlett-Clang" , "description": "Clang/LLVM for x64 (Debug) for Xbox Series X|S", "inherits": [ "base", "x64", "Debug", "Clang", "Scarlett" ] }, { "name": "x64-Release-Scarlett-Clang", "description": "Clang/LLVM for x64 (Release) for Xbox Series X|S", "inherits": [ "base", "x64", "Release", "Clang", "Scarlett" ] }, diff --git a/build/CompilerAndLinker.cmake b/build/CompilerAndLinker.cmake index 6fb5447..b93ddf9 100644 --- a/build/CompilerAndLinker.cmake +++ b/build/CompilerAndLinker.cmake @@ -30,6 +30,12 @@ elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$") set(DIRECTX_ARCH arm64) elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64EC$") set(DIRECTX_ARCH arm64ec) +elseif((NOT (DEFINED DIRECTX_ARCH)) AND (CMAKE_SYSTEM_NAME STREQUAL "Linux")) + if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + set(DIRECTX_ARCH x64) + elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + set(DIRECTX_ARCH arm64) + endif() endif() #--- Determines host architecture @@ -49,7 +55,7 @@ if(MSVC) list(APPEND COMPILER_SWITCHES "$<$>:/guard:cf>") list(APPEND LINKER_SWITCHES /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO) - if((${DIRECTX_ARCH} MATCHES "x86") + if((${DIRECTX_ARCH} STREQUAL "x86") OR ((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))) list(APPEND LINKER_SWITCHES /SAFESEH) endif() @@ -71,7 +77,7 @@ if(XBOX_CONSOLE_TARGET STREQUAL "scarlett") elseif(XBOX_CONSOLE_TARGET MATCHES "xboxone|durango") list(APPEND COMPILER_SWITCHES $,/favor:AMD64 /arch:AVX,-march=btver2>) elseif(NOT (${DIRECTX_ARCH} MATCHES "^arm")) - if((${DIRECTX_ARCH} MATCHES "x86") OR (CMAKE_SIZEOF_VOID_P EQUAL 4)) + if((${DIRECTX_ARCH} STREQUAL "x86") OR (CMAKE_SIZEOF_VOID_P EQUAL 4)) set(ARCH_SSE2 $<$:/arch:SSE2> $<$>:-msse2>) else() set(ARCH_SSE2 $<$>:-msse2>)