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

Visual Studio Generator - packagePresets: Use multi-configuration builds #4096

Open
kuch3n opened this issue Sep 26, 2024 · 4 comments
Open
Labels
more info needed More info is needed from the community for us to properly triage and investigate.

Comments

@kuch3n
Copy link

kuch3n commented Sep 26, 2024

Brief Issue Summary

It is possible to pass multiple build configurations via a packagePresets. But CPack is run with the selected buildPresets and additionaly with the given configurations: [proc] Executing command: C:/msys64/ucrt64/bin/cpack.exe -C Release -C "Debug;Release" -B NuGet

The package preset:

"packagePresets": [
        {
            "name": "windows-x64-nuget",
            "displayName": "NuGet Package",
            "description": "Create a NuGet Package",
            "configurePreset": "default",
            "inheritConfigureEnvironment": true,
            "packageDirectory": "NuGet",
            "configurations": ["Debug", "Release"]
        }
    ],

CMake Tools should run a build with "Release" and "Debug", but it only runs for "Debug". Hence packaging fails, as "Release" build is missing.

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

@v-frankwang
Copy link
Collaborator

@kuch3n We are trying to reproduce this issue based on the code you provided, we ran into the problem in the screenshot below, when I try to install it on the NSIS website, it says that I can't access this page, is it mandatory to install NSIS in order to reproduce this issue? If not can you give me some more detailed steps and suggestions? Looking forward to receive your reply!

image

@v-frankwang v-frankwang added more info needed More info is needed from the community for us to properly triage and investigate. and removed triage labels Sep 27, 2024
@kuch3n
Copy link
Author

kuch3n commented Sep 27, 2024

@v-frankwang you could use the Visual Studio Generator, too.

CMakePresets.json
{
    "$schema": "https://cmake.org/cmake/help/latest/_downloads/3e2d73bff478d88a7de0de736ba5e361/schema.json",
    "version": 8,
    "configurePresets": [
        {
            "name": "default",
            "hidden": false,
            "displayName": "Default x64",
            "description": "Default build x64",
            "generator": "Visual Studio 17 2022",
            "binaryDir": "${sourceDir}/build/",
            "architecture": {
                "value": "x64"
            },
            "cacheVariables": {
                "CMAKE_VS_NUGET_PACKAGE_RESTORE": {
                    "type": "BOOL",
                    "value": "ON"
                }
            },
            "environment": {
                "PATH": "$penv{PATH};C:/nuget"
            },
            "vendor": {
                "microsoft.com/VisualStudioSettings/CMake/1.0": {
                    "hostOS": [ "Windows" ],
                    "intelliSenseMode": "windows-msvc-x64"
                }
            }
        }
    ],
    "packagePresets": [
        {
            "name": "windows-x64-nuget",
            "displayName": "NuGet Package",
            "description": "Create a NuGet Package",
            "configurePreset": "default",
            "inheritConfigureEnvironment": true,
            "packageDirectory": "NuGet",
            "configurations": [ "Debug", "Release", "RelWithDebInfo" ]
        }
    ]
}

@v-frankwang
Copy link
Collaborator

@kuch3n Thank you very much for your reply, we used the CMakePresets.json file you provided to solve the problem I ran into, but mine seems to be able to be packaged successfully, here are our results along with the details:

image

CMake Tools Diagnostics.txt

@kuch3n
Copy link
Author

kuch3n commented Sep 27, 2024

Isn't it just building for Debug? If i use "Run CPack" only the active build preset is build. With [[default]] Debug gets build.

"Run CPack" should run a build for each configuration, e.g. cmake --build . --config Debug and cmake --build . --config RelWithDebInfo. Instead only Debug or the configuration in the build preset is build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
more info needed More info is needed from the community for us to properly triage and investigate.
Projects
Status: Blocked
Development

No branches or pull requests

2 participants