go2sh / cmake-integration-vscode

CMake Server Interface for VSCode.
https://go2sh.github.io/cmake-integration-vscode/
Other
19 stars 11 forks source link

Feature Request: Select Toolchain and Output Directory #2

Closed atar-axis closed 5 years ago

atar-axis commented 5 years ago

Hey there,

I am often cross-compiling projects by the cmake option
-DCMAKE_TOOLCHAIN_FILE=../../somefolder/toolchain_raspberry.cmake.

I am therefore building my project into a directory called ./build/arm_cross instead of ./build.

It would be great if you could offer a fourth option in the status-bar, to select the toolchain file (which you could define in the settings.json in beforehand), somehow like that:

"cmake": {
    "generator" : "Unix Makefiles",
    "toolchains" : {
        "auto": {
            "build_dir": "${workspaceRoot}/build/x86_64"
        },
        "arm": {
            "file": "${workspaceRoot}/toolchain_raspberry.cmake"
            "build_dir": "${workspaceRoot}/build/arm_cross"
        }
    }
}

Again: Thank you for your hard work! I really enjoy the easiness of your extension :grin:

go2sh commented 5 years ago

I just had a quick thought about it. I definitely plan to add some sort of toolchain selection, but the cmake server doesn't allow to change the build directory. So I have to run multiple server instances. Would it be enough to build only one toolchain at a time?

BTW: I'm also creating some packages to write VHDL in vscode. ;-)

atar-axis commented 5 years ago

So by "one toolchain at a time" you mean that the other build is overwritten because both are compiled into the same detination directory, right?

That's not what I thought about but I take what I can get :grin:

I'm also creating some packages to write VHDL in vscode. ;-)

I'm not sure if vscode would be my first choice for for VHDL (I like Sigasi in compination with whatever IDE fits the FPGA) :) Anyway, I am glad that ppl. like you invest so much time for OpenSource projects.

go2sh commented 5 years ago

So by "one toolchain at a time" you mean that the other build is overwritten because both are compiled into the same detination directory, right?

Not exactly. There will be two directories, but only one directory can be configured and build at a time.

Offtopic: Meine Kollegen nutzen auch alle Sigasi. Ist schon schick, aber Eclipse basiert und Eclipse ist nicht mein Favorite.^^

atar-axis commented 5 years ago

Not exactly. There will be two directories, but only one directory can be configured and build at a time.

Sounds good to me - I think that's exactly what I need :) Thank you very very much!

Meine Kollegen nutzen auch alle Sigasi. Ist schon schick, aber Eclipse basiert und Eclipse ist nicht mein Favorite.^^

Ich hab es schon ne ganze Weile nicht mehr benutzt, und auch nur integriert z.B. in Quartus. Ich vermeide Eclipse auch wo möglich - aber tatsächlich finde ich auch Javascript-basierte Editoren nicht unbedingt toll - trotzdem liebe ich vscode. :grin:

go2sh commented 5 years ago

Hi there, it's bin a while. I did work rewritting the configuration. The extension is close to supporting toolchain files and custom build directories per configuration. :-) See #10 Are you still interested in testing?

atar-axis commented 5 years ago

Hey there, for sure! :)

go2sh commented 5 years ago

Hi there, I finished the implementation. :battery: Toolchain and output directory settings should work. Download the v0.4.0-beta1 release from github and install it. The only thing is the lack of docs.^^

Open the command pallet and search for Edit CMake Configurations and there you go. VSCode has a schema that guide you through the settings.

atar-axis commented 5 years ago

Hey there! I am testing it right now: What do you mean by "schema"? Some kind of auto completion? If yes, I fear it does not work - at least Vscode does not tell me anything :)

atar-axis commented 5 years ago

I fear I don't get it. Whenever I try to add sth like

    {
      "name": "raspi cross",
      "buildType": "Release",
      "toolchainFile": "../ff1_dev_tools/toolchain_raspberry.cmake"
    }

then VScode returns Failed to validate CMake Configurations for ff1_selfcheck: .configurations[0]: should NOT have additional properties

go2sh commented 5 years ago

Hm, the vix file didn't contain the schema. :see_no_evil: Fixed that in beta2. The option is also called just toolchain, as it can be both an object or a file. If its an object, the toolchain file will be generated. I'll also plan to add some kind of inheritance or defaults, so that there are less duplicate text.

atar-axis commented 5 years ago

Unfortunately beta2 has no vsix yet, right? :grin:

go2sh commented 5 years ago

yeah, its tricky with the schema. But if you change toolchainFile into toolchain, it should work for you.

go2sh commented 5 years ago

Now there is a version -beta3 with another toolchain file fix. :+1:

Feel free to open any kind of issue with the beta. I changed quite a lot.^^

atar-axis commented 5 years ago

Perfect, the schema does work now! So does the toolchain and output directory! I really love it, like a dream. You are awesome!