ndabas / pico-setup-windows

Quickly get started with Raspberry Pi Pico/RP2040 on Windows
Apache License 2.0
298 stars 35 forks source link

set CMAKE_GENERATOR variable #1

Closed shreyask21 closed 3 years ago

shreyask21 commented 3 years ago

Set default CMake Generator to NMake Makefiles so the extra step can be avoided while building and using VS code CMake extension

ndabas commented 3 years ago

@aallan Yes, building with ninja will be a good long-term solution.

@shreyask21 Your changes do not do what you intend to do, for two reasons:

I believe this change will be useful nonetheless, so if you can fix the quotes (so it looks like set "CMAKE_GENERATOR=...", I'll merge it in. That way, at least for builds from the command line, the -G switch to cmake can be omitted.

[variant] Loaded new set of variants
[kit] Successfully loaded 5 kits from C:\Users\WDAGUtilityAccount\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: pico-examples 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-g++.exe" -Hc:/Users/WDAGUtilityAccount/Documents/Pico/pico-examples -Bc:/Users/WDAGUtilityAccount/Documents/Pico/pico-examples/build -G Ninja
[cmake] ...
aallan commented 3 years ago

@aallan Yes, building with ninja will be a good long-term solution.

Maybe, but we're unlikely to support it in the short to medium term. The recommended route will be to use nmake.

shreyask21 commented 3 years ago

@aallan Yes, building with ninja will be a good long-term solution.

@shreyask21 Your changes do not do what you intend to do, for two reasons:

  • The syntax for SET is incorrect. You either need to skip the quotes entirely or enclose the whole CMAKE_GENERATOR=... part in quotes. As written, the quotes become part of the environment variable and cmake does not recognize it.
  • Even with the environment variable set, VS Code still tries to build using ninja, explicitly specified on the command line that VS Code executes (see below.)

I believe this change will be useful nonetheless, so if you can fix the quotes (so it looks like set "CMAKE_GENERATOR=...", I'll merge it in. That way, at least for builds from the command line, the -G switch to cmake can be omitted.

[variant] Loaded new set of variants
[kit] Successfully loaded 5 kits from C:\Users\WDAGUtilityAccount\AppData\Local\CMakeTools\cmake-tools-kits.json
[main] Configuring folder: pico-examples 
[proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug "-DCMAKE_C_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-gcc.exe" "-DCMAKE_CXX_COMPILER:FILEPATH=C:\Program Files (x86)\GNU Arm Embedded Toolchain\10 2020-q4-major\bin\arm-none-eabi-g++.exe" -Hc:/Users/WDAGUtilityAccount/Documents/Pico/pico-examples -Bc:/Users/WDAGUtilityAccount/Documents/Pico/pico-examples/build -G Ninja
[cmake] ...

Yes you are right, I will make the changes.

ndabas commented 3 years ago

Closing as there has been no activity/response from the author.