godotengine / godot-cpp

C++ bindings for the Godot script API
MIT License
1.75k stars 577 forks source link

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

Closed enetheru closed 1 month ago

enetheru commented 2 months 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 2 months 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 2 months ago

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

dsnopek commented 3 weeks ago

Cherry-picked for 4.2 in PR https://github.com/godotengine/godot-cpp/pull/1631

dsnopek commented 3 weeks ago

Cherry-picked for 4.3 in PR https://github.com/godotengine/godot-cpp/pull/1632