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

Execute CMake on Bash on Ubuntu on Windows? #111

Closed
devnoname120 opened this issue Feb 9, 2017 · 12 comments
Closed

Execute CMake on Bash on Ubuntu on Windows? #111

devnoname120 opened this issue Feb 9, 2017 · 12 comments
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature help wanted we currently are not planning work on this and would like help from the open source community
Milestone

Comments

@devnoname120
Copy link

I'm willing to compile a project with the vitasdk, which is available on Linux but not Windows.
For this, I usually open a Bash on Ubuntu on Windows instance, run cmake and make.

How can I integrate this build workflow in Visual Studio Code with this extension?

@vector-of-bool
Copy link
Contributor

It's an interesting question... Perhaps a cmake-launcher option which prefixes the CMake command? Then, when CMake executes, it runs the CMake inside of Ubuntu on Windows. This is not a use case I've ever thought of but would be excellent in terms of usability for those who want to dev for Linux on Windows.

@vector-of-bool vector-of-bool added enhancement an enhancement to the product that is either not present or an improvement to an existing feature help wanted we currently are not planning work on this and would like help from the open source community labels Feb 9, 2017
@devnoname120
Copy link
Author

I can confirm that there are two ways to execute commands in bash from outside of it:

  • bash myscript.sh which will execute myscript.sh and stop.
  • bash -c "mycommand" which will execute the command and stop.

@MathiasMagnus
Copy link
Contributor

However, you will also need path translation for the working directory when invoking cmake from WSL (Windows Subsystem for Linux, generally more Google friendly than referring to the marketing name, Ubuntu on Win...).

Indeed, would be a very nice addition. Big brother VS is actually very close to reaching the cross-platform nirvana. They solved multi-configuration by having multiple directories of CMake configurations, thus one can click-click to select an Architecture which corresponds to certain CMake configuration parametrizations.

ps.: plus, they got proper IntelliSense hooked up by extracting the required compiler flags from the CMake invocations via cmake-server mode, and generating a hidden vcxproj accordingly, which the editor can hook into.

@vector-of-bool
Copy link
Contributor

As @MathiasMagnus says, there's a bit more than just simply prefixing the CMake commands. Still, I think the addition would be useful and is something I may want to have myself, although for different use cases. For example, I'd like to be able to build and configure over SSH, in a Docker container, or in a Vagrant VM with a shared folder. Such a thing would be useful as some kind of "CMake Launcher" that lets you invoke and work on a project in interesting and useful ways. Another big question is how this will play into cmake-server, which communicates using a named pipe (it is possible to communicate using stdin/stdout, but that has proven to be problematic and buggy compared to using a pipe, and may require some changes to CMake upstream).

@devnoname120
Copy link
Author

devnoname120 commented Mar 26, 2017

Code seems to now properly support the execution of a task in a shell: microsoft/vscode#6579 (comment)

How to make it work with cmake-tools?

@vector-of-bool
Copy link
Contributor

I don't believe that will work as it currently stands, since the way the extension executes CMake is unrelated to VSCode's task execution.

@vector-of-bool vector-of-bool added this to the Backlog milestone Jun 4, 2017
@cenit
Copy link

cenit commented Nov 30, 2017

hi!
Any news on this front? It would be a terrific addition!

@vector-of-bool
Copy link
Contributor

Haven't looked at it yet, and I'm still unsure of just how to make it work. Still in the backlog.

@jitbasemartin
Copy link

+1 It wil be great to have that for docker
For now I use a tasks with harcoded values, but I need to change manually my settings instead of use the power of the GUI

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "0.1.0",
    "showOutput": "always",
    "runner": "terminal",
    "command": "bash",
    "args": [
        "-c"
    ],
    "isShellCommand": true,
    "tasks": [
        {
            "taskName": "docker-cmake-configure",
            "suppressTaskName": true,
            "args": [
                "docker exec -it ${config:custom.docker.defaultName} cmake --no-warn-unused-cli -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/arm-linux-gnueabihf-gcc-4.8 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/arm-linux-gnueabihf-g++-4.8 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -H/home/developer/project -B/home/developer/project/build"
            ]
        },
        {
            "taskName": "docker-cmake-build",
            "suppressTaskName": true,
            "isBuildCommand": true,
            "args": [
                "docker exec -it ${config:custom.docker.defaultName} cmake --build /home/developer/project/build --config Debug -- -j 6"
            ]
        }
    ]
}

@bobbrow
Copy link
Member

bobbrow commented Jul 16, 2019

Does the new WSL Remote extension address this issue?

@cenit
Copy link

cenit commented Jul 16, 2019

yes, at least for me

@MathiasMagnus
Copy link
Contributor

@bobbrow yes it does. As far as I'm concerned, this issue can be closed.

@bobbrow bobbrow closed this as completed Jul 17, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement an enhancement to the product that is either not present or an improvement to an existing feature help wanted we currently are not planning work on this and would like help from the open source community
Projects
None yet
Development

No branches or pull requests

6 participants