godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.7k stars 525 forks source link

VSProj Configure type on build command - to resolve #1582 #1600

Closed enetheru closed 3 days ago

enetheru commented 1 week ago

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

Because the existing cmake solution does not use generator expressions for its per config configuration, we actually have to specify it in both commands :(

cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 17 2022" . cmake --build . --verbose --config Release

Fixes https://github.com/godotengine/godot-cpp/issues/1582

enetheru commented 1 week ago

I know why its failing.

# Default build type is Debug in the SConstruct
if("${CMAKE_BUILD_TYPE}" STREQUAL "")
    set(CMAKE_BUILD_TYPE Debug)
endif()

I'll fix the commit so it adds only the --config to the build command so its correct in both places.

enetheru commented 1 week ago

I'm in the middle of compiling right now or i would squash these two commits.