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

Add PICOTOOL_OVERRIDE_DIR #1820

Closed
wants to merge 1 commit into from
Closed

Conversation

shabaz123
Copy link

Submitting against 'develop'
Fixes #1818

When using Windows 11 and SDK 2.0.0, when trying to do a cmake -G "NMake Makefiles" .. or cmake -G "Ninja" .. then picotool executable is not found, and it gets built within the project. The Findpicotool.cmake file does not seem to find the picotool executable at least with Windows, I have not checked Linux/Mac.

I have a solution which should be benign, since it only kicks in if the user creates a system environment variable in Windows, called PICOTOOL_OVERRIDE_DIR. If that is set, then the picotool.exe file there is used (and the version command is executed to confirm it is the correct version).

The submitted change is in a single file (Findpicotool.cmake), placed near the top of the file, after the cmake_minimum_required(VERSION 3.17) line.

I have tested by performing a build, and I can see that the picotool executable was used, and that the .uf2 file was successfully created.

The attached files evidence that, and at the end there is a dir listing that shows that the .uf2 file was created.

nmake_output.txt
cmake_g_nmake_makefile_output.txt

@kilograham kilograham requested a review from will-v-pi August 14, 2024 18:54
@will-v-pi
Copy link
Contributor

I don't want to add this, as there are already better ways to do this native to CMake. See the Usage by the SDK section of the picotool README for more details.

In short, you can run the following CMake commands from your picotool build directory to install the required files to $MY_INSTALL_DIR (replacing $MY_INSTALL_DIR with the path you want to use)

cmake -DCMAKE_INSTALL_PREFIX=$MY_INSTALL_DIR -DPICOTOOL_FLAT_INSTALL=1 ..
cmake --build .
cmake --install .

then set the picotool_DIR environment variable to $MY_INSTALL_DIR/picotool - so no need to add an additional PICOTOOL_OVERRIDE_DIR variable.

@bhass1
Copy link

bhass1 commented Aug 15, 2024

Can confirm, after running cmake --install . from my cmake build folder of the picotool project, the Findpicotool.cmake finds my precompiled picotool. More details in Issue #1818

@shabaz123
Copy link
Author

Thanks for the response!

@will-v-pi does the mixed-case env var picotool_DIR function with Windows? Traditionally env vars are case-insensitive with Windows, and I don't know if Windows CMake would match that with the mixed case (I don't know either way, I've not tried it yet).

I'll close this PR for now, since it's been confirmed working with Linux.

@shabaz123 shabaz123 closed this Aug 15, 2024
@will-v-pi
Copy link
Contributor

I've confirmed it works in Windows too, by running

$env:picotool_DIR = '~\.pico-sdk\picotool\2.0.0\picotool'
$env:pioasm_DIR = '~\.pico-sdk\tools\2.0.0\pioasm'
$env:PICO_SDK_PATH = '~\.pico-sdk\sdk\2.0.0'
$env:PICO_TOOLCHAIN_PATH = '~\.pico-sdk\toolchain\13_2_Rel1'
cmake .. -G "NMake Makefiles"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants