SaschaWillems / Vulkan

C++ examples for the Vulkan graphics API
MIT License
10.36k stars 2.04k forks source link

Windwos 11 Visual Studio 22 Cmake Build Problem #952

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hello.

At root of fresh master branch git clone I've executed a command

cmake -G "Visual Studio 17 2022" -A Win64

I've got an error

CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.

CMake Deprecation Warning at CMakeLists.txt:2 (cmake_policy):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
CMake Error at CMakeLists.txt:7 (project):
  Failed to run MSBuild command:

    C:/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/amd64/MSBuild.exe

  to get the value of VCTargetsPath:

    Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

    Build started 6/2/2022 6:49:39 PM.
    Project "C:\Users\User\Desktop\Vulkan\CMakeFiles\3.23.2\VCTargetsPath.vcxproj" on node 1 (default targets).
    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(824,5): error : The BaseOutputPath/OutputPath property is not set for project 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='Win64'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\Users\User\Desktop\Vulkan\CMakeFiles\3.23.2\VCTargetsPath.vcxproj]
    Done Building Project "C:\Users\User\Desktop\Vulkan\CMakeFiles\3.23.2\VCTargetsPath.vcxproj" (default targets) -- FAILED.

    Build FAILED.

    "C:\Users\User\Desktop\Vulkan\CMakeFiles\3.23.2\VCTargetsPath.vcxproj" (default target) (1) ->
    (_CheckForInvalidConfigurationAndPlatform target) ->
      C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(824,5): error : The BaseOutputPath/OutputPath property is not set for project 'VCTargetsPath.vcxproj'.  Please check to make sure that you have specified a valid combination of Configuration and Platform for this project.  Configuration='Debug'  Platform='Win64'.  You may be seeing this message because you are trying to build a project without a solution file, and have specified a non-default Configuration or Platform that doesn't exist for this project. [C:\Users\User\Desktop\Vulkan\CMakeFiles\3.23.2\VCTargetsPath.vcxproj]

        0 Warning(s)
        1 Error(s)

    Time Elapsed 00:00:00.92

  Exit code: 1

-- Configuring incomplete, errors occurred!
See also "C:/Users/User/Desktop/Vulkan/CMakeFiles/CMakeOutput.log".

How to fix it?

And, generally writing, I want just compile example and run one of them.

How to get this without IDE? Cmake must be enough.

SaschaWillems commented 2 years ago

I'm still on VS2019, where CMake works out of the box without an IDE. The error states something about a missing config, so did you try explicitly selecting e.g. a debug config? nd what CMake version are you using?

ghost commented 2 years ago

Thanks for reply,

latest just downloaded cmake, latest visual studion and the last commit from the current repo.

Can please suggest what you mean by debug config?

On Thu, Jun 2, 2022, 21:01 Sascha Willems @.***> wrote:

I'm still on VS2019, where CMake works out of the box without an IDE. The error states something about a missing config, so did you try explicitly selecting e.g. a debug config? nd what CMake version are you using?

— Reply to this email directly, view it on GitHub https://github.com/SaschaWillems/Vulkan/issues/952#issuecomment-1145156105, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARNHLCXXFI466VI66CNN6DDVNDZHHANCNFSM5XVNQWGA . You are receiving this because you authored the thread.Message ID: @.***>

MattGuerrette commented 2 years ago

You should use "-A x64" if you are trying to target 64bit. Win64 means nothing to CMake afaik

SaschaWillems commented 2 years ago

As @MattGuerrette noticed, the syntax for newer VS versions is slightly different. I have updated the build instructions accordingly.