CMake和ARM64EC与GitHub操作

3lxsmp7m  于 2023-11-19  发布在  Git
关注(0)|答案(1)|浏览(148)

按照https://learn.microsoft.com/en-us/windows/arm/arm64ec-build中的说明,我可以使用VS2022构建一个简单的“hello world”CMake项目。
问题是,如果我尝试在GitHub上构建操作,我会得到:

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_C_COMPILER could be found.

CMake Error at CMakeLists.txt:3 (project):
  No CMAKE_CXX_COMPILER could be found.

字符串
我的yml很简单

name: build

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  BUILD_TYPE: Release

jobs:
    buildWindowsARM64EC:
      runs-on: windows-latest
      steps:
        - uses: actions/checkout@v3

        - name: Do stuff
          run: | 
            call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64
            cmake -B ${{github.workspace}}/build --preset arm64ec
            cmake --build ${{github.workspace}}/build --config Release
          shell: cmd


CMakePresets.json也很简单

{
  "version": 5,
  "configurePresets": [
    {
      "name": "base",
      "hidden": true,
      "generator": "Visual Studio 17 2022"
    },
    {
      "name": "arm64ec",
      "inherits": "base",
      "displayName": "arm64ec",
      "architecture": {
        "value": "arm64ec",
        "strategy": "set"
      }
    }
  ]
}


CMakeLists.txt:

cmake_minimum_required (VERSION 3.15)

project ("hello")

set(CMAKE_CXX_STANDARD 17)

set(Sources
    main.cpp)

add_executable (${PROJECT_NAME} ${Sources})


我猜我错过了一个PATH配置或类似的东西,但尽管多次迭代,我似乎不能得到任何接近它的工作。

zpqajqem

zpqajqem1#

最终,解决方案非常简单。
基本上我需要针对不同的SDK。
我添加了-DCMAKE_SYSTEM_VERSION=10,一切正常
YML现在只是:

name: build

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

env:
  BUILD_TYPE: Release

jobs:
    buildWindowsARM64EC:
      runs-on: windows-latest
      steps:
        - uses: actions/checkout@v3

        - name: Do stuff
          run: | 
            cmake -B ${{github.workspace}}/build --preset arm64ec -DCMAKE_SYSTEM_VERSION=10
            cmake --build ${{github.workspace}}/build --config Release

字符串
这样,它就像预期的那样工作了:

shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    BUILD_TYPE: Release
  
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.
-- The C compiler identification is MSVC 19.37.32825.0
-- The CXX compiler identification is MSVC 19.37.32825.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/bin/Hostx64/arm64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.37.32822/bin/Hostx64/arm64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (43.2s)
-- Generating done (0.0s)
-- Build files have been written to: D:/a/simpleConsoleToTestGHActions/simpleConsoleToTestGHActions/build
MSBuild version 17.7.2+d6990bcfa for .NET Framework

相关问题