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

Possible bug with CMake and visual studio release type #1582

Closed
enetheru opened this issue Sep 12, 2024 · 5 comments · Fixed by #1600
Closed

Possible bug with CMake and visual studio release type #1582

enetheru opened this issue Sep 12, 2024 · 5 comments · Fixed by #1600
Labels
bug This has been identified as a bug cmake topic:buildsystem Related to the buildsystem or CI setup

Comments

@enetheru
Copy link
Contributor

Godot version

godot-cpp version

master

System information

github ci

Issue description

I pulled the build logs from the github ci, 🏁 Build (Windows, MSVC, CMake)
cmake command is 'cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" .' but the visual studio build command has this in it: '/p:Configuration=Debug' is this a bug? I'm unfamilar with msvc
I'm submitting this so that it doesnt get lost, and can be reviewed by someone familiar with msvc

Steps to reproduce

review the ci logs

Minimal reproduction project

Release build of godot-cpp using CMake and Visual Studio

@dsnopek dsnopek added bug This has been identified as a bug cmake topic:buildsystem Related to the buildsystem or CI setup labels Sep 18, 2024
@enetheru
Copy link
Contributor Author

I found the answer

Visual Studio projects are multi-config projects like Ninja-MultiConfig which means you can't set the configuration at configure time as there are multiple, it always chooses the first one by default when not specified in the build command.

# Instead of this:
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
cmake --build . --verbose
# It should be this
cmake -G"Visual Studio 17 2022" .
cmake --build . --verbose --config Release

enetheru added a commit to enetheru/godot-cpp that referenced this issue Sep 21, 2024
Visual Studio projects are multi-config projects like Ninja-MultiConfig which means you can't set the configuration at configure time as there are multiple, it always chooses the first one by default when not specified in the build command.

Instead of this:
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
cmake --build . --verbose

It should be this
cmake -G"Visual Studio 17 2022" .
cmake --build . --verbose --config Release
enetheru added a commit to enetheru/godot-cpp that referenced this issue Sep 21, 2024
Visual Studio projects are multi-config projects like Ninja-MultiConfig which means you can't set the configuration at configure time as there are multiple, it always chooses the first one by default when not specified in the build command.

Instead of this:
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
cmake --build . --verbose

It should be this
cmake -G"Visual Studio 17 2022" .
cmake --build . --verbose --config Release

Update ci.yml

Because the current build system doesnt use generator expressions for multi config builds, both the CMAKE_BUILD_TYPE and the build --config options need to be set
@dsnopek
Copy link
Collaborator

dsnopek commented Sep 26, 2024

Now that you've figured out what's going on with this, do we still need this issue? Or, is this something you think we should document somewhere?

EDIT: Oh, nevermind, it looks like you have you have PR #1600 to fix this. I'll update the description on that one so these are linked.

dsnopek added a commit that referenced this issue Sep 26, 2024
VSProj Configure type on build command - to resolve #1582
@enetheru
Copy link
Contributor Author

enetheru commented Sep 27, 2024 via email

@dsnopek
Copy link
Collaborator

dsnopek commented Sep 27, 2024

I guess there's your build instructions in PR #1595?

@enetheru
Copy link
Contributor Author

enetheru commented Sep 28, 2024 via email

dsnopek pushed a commit to dsnopek/godot-cpp that referenced this issue Oct 28, 2024
Visual Studio projects are multi-config projects like Ninja-MultiConfig which means you can't set the configuration at configure time as there are multiple, it always chooses the first one by default when not specified in the build command.

Instead of this:
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
cmake --build . --verbose

It should be this
cmake -G"Visual Studio 17 2022" .
cmake --build . --verbose --config Release

Update ci.yml

Because the current build system doesnt use generator expressions for multi config builds, both the CMAKE_BUILD_TYPE and the build --config options need to be set

(cherry picked from commit 07704f8)
dsnopek pushed a commit to dsnopek/godot-cpp that referenced this issue Oct 28, 2024
Visual Studio projects are multi-config projects like Ninja-MultiConfig which means you can't set the configuration at configure time as there are multiple, it always chooses the first one by default when not specified in the build command.

Instead of this:
cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" .
cmake --build . --verbose

It should be this
cmake -G"Visual Studio 17 2022" .
cmake --build . --verbose --config Release

Update ci.yml

Because the current build system doesnt use generator expressions for multi config builds, both the CMAKE_BUILD_TYPE and the build --config options need to be set

(cherry picked from commit 07704f8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug cmake topic:buildsystem Related to the buildsystem or CI setup
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants