Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake uses wrong windows sdk version #4477

Closed
perrylets opened this issue May 19, 2024 · 2 comments
Closed

Cmake uses wrong windows sdk version #4477

perrylets opened this issue May 19, 2024 · 2 comments

Comments

@perrylets
Copy link

perrylets commented May 19, 2024

When I try to build with this script

$required = @{ "git" = "git"; "cmake" = "cmake"; "ninja" = "ninja"; "7zip" = "7z" } 
$missing = @()
foreach ($app in $required.GetEnumerator()) {
  if (!(Get-Command -Name $app.Value -ErrorAction SilentlyContinue)) {
    $missing += $app.Key
  }
}
if ($missing.count -gt 0) {
  Write-Output "`e[31mRequired apps `e[33m$($missing -join "`e[31m, `e[33m") `e[31mare missing.`e[0m"
  if (!(Get-Command scoop)) {
    $installScoop = Read-Host "`e[33mScoop is not installed. Do you want to install it? `e[34m(`e[32my`e[34m/`e[31mN`e[34m)`e[0m"
    if ($installScoop -like "y*") {
      Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
      Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
    }
    else {
      Write-Output "Install $missing manually and run the script again."
      exit
    }
  }
  foreach ($app in $missing) {
    Write-Output "`e[32mInstalling `e[34m$app`e[32m...`e[0m" 
    scoop install $app 1> $null
  }
}

$deps = "D:/deps"
$aseprite = "D:/Apps/aseprite" 
$skia = "$deps/skia"
$skiazip = "$deps/skia.zip"
$visualstudio = "D:/Apps/Microsoft Visual Studio/2022/Community"

& "$visualstudio/Common7/Tools/Launch-VsDevShell.ps1" -Arch amd64 -HostArch amd64 -SkipAutomaticLocation  

if (Test-Path $skia) {
  Remove-Item -Recurse $skia
}

Invoke-WebRequest -Uri "https://github.com/aseprite/skia/releases/download/m102-861e4743af/Skia-Windows-Release-x64.zip" -OutFile $skiazip
Expand-Archive -Path $skiazip -Force -DestinationPath $skia

if (!(Test-Path $aseprite)) {
  git clone --recursive https://github.com/aseprite/aseprite.git $aseprite
  Set-Location $aseprite
}
else {
  Set-Location $aseprite
  git pull
  git submodule update --init --recursive
}

if (Test-Path $aseprite/build) {
  Remove-Item -Recurse -Force $aseprite/build
}
New-Item -ItemType Directory -Path $aseprite/build
Set-Location build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DLAF_BACKEND=skia -DSKIA_DIR=$skia -DSKIA_LIBRARY_DIR=$skia\out\Release-x64 -DSKIA_LIBRARY=$skia\out\Release-x64\skia.lib -G Ninja .. 
ninja aseprite

if (Test-Path $aseprite\build\bin\aseprite.exe) {
  Write-Output "`e[32;1mBuild completed successfully.`e[0m"
  Write-Output "`e[33mFinished build is located in the $aseprite/build/bin directory.`e[0m"
  Write-Output "The aseprite executable and data folder listed above can be moved to a location of your choosing."
}

I get this message

CMake Warning:
  Ignoring extra path from command line:

   ".lib"


-- The C compiler identification is MSVC 19.34.31948.0
-- The CXX compiler identification is MSVC 19.34.31948.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: D:/Apps/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: D:/Apps/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - broken
CMake Error at D:/Users/Perry/scoop/apps/cmake/3.29.3/share/cmake-3.29/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "D:/Apps/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: 'D:/Apps/aseprite/build/CMakeFiles/CMakeScratch/TryCompile-6hwgtz'

From this, I can tell it's picking the wrong sdk version and I can't change it, be it with -DCMAKE_SYSTEM_VERSION=10.0.18362.0 or not.

I know the paths aren't usual but they're not the problem, because they were like this when I built a prior version.

Aseprite and System version

  • Aseprite version: 3ea0437
  • System: Windows 11 version 24H2 (OS build 26120.470)
@dacap
Copy link
Member

dacap commented May 20, 2024

Hi @perrylets, sorry but we don't know this script you're sharing. We recommend you to follow our instructions from the INSTALL file.

@dacap dacap closed this as completed May 20, 2024
@perrylets
Copy link
Author

perrylets commented May 20, 2024

I made it myself it just downloads the skia zip and extracts it and follow the instructions besides adding -DCMAKE_SYSTEM_VERSION to try to fix the problem. It will have the same issue even without the flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants