You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Its incredibly complicated and cumbersome to get all the correct information needed for vscode-cmake-tools to actually invoke cmake commands to produce a working configuration / build for my scenario. I still haven't actually figured out how to do it.
I have python codebase with a cmake built cpp extension using nanobind. I'm trying to keep things as simple and uniform as possible so that developers who are primarily python dev's have a chance to get into the c++ side of things when required. To that effect everything must be streamlined.
check out the repo
setup the python venv and install deps
edit a .cpp file
run the python program
need everything to work and reflect the changes made to that .cpp file
I've got this workflow working. Based on an ENV var, the python codebase will invoke a script to rebuild the c++ extension prior to importing it.
What I can't get to work is a correct ide tooling experience in vscode for those editing the cpp files.
I would VERY much like to be able to use vscode-cmake-tools for this. My extension is built with cmake -- all the data that is needed for intellisense is there in the cmake configuration directory ... Why can't I just point cmake-tools at the cmake directory that I generated and use that as a configuration provider for the c++ extension and get intellisense?
Instead I have to jump through insane hoops to try and get the required information (which is not guaranteed to be the same from machine to machine) into the extension context such that this can 'just work' -- and in fact I don't think its even possible to make this work.
I need to somehow induce cmake-tools to accomplish the equivalent of this script
#!/bin/bash -x
set -eo pipefail
if [[ -z "$CMAKE_BUILD_TYPE" ]]; then
DEFAULT_CMAKE_BUILD_TYPE="Release"
echo "CMAKE_BUILD_TYPE environment variable not set using $DEFAULT_CMAKE_BUILD_TYPE " 1>&2
CMAKE_BUILD_TYPE=$DEFAULT_CMAKE_BUILD_TYPE
fi
CMAKE=cmake
if [[ -z "$PYTHON_EXECUTABLE" ]]; then
PYTHON_EXECUTABLE=$(which python)
echo "setting PYTHON_EXECUTABLE to $PYTHON_EXECUTABLE from binary path (via command 'which python')"
else
echo "setting PYTHON_EXECUTABLE via env var to $PYTHON_EXECUTABLE"
fi
# configure the build with explicit PYTHON_EXECUTABLE
$CMAKE -S ./ -B ./001-configure/zephyrus_native_ext -DPython_Executable=$PYTHON_EXECUTABLE -DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE
# build and install native extension module
$CMAKE --build ./001-configure/zephyrus_native_ext --target install -j 8 --config $CMAKE_BUILD_TYPE
The cmake configuration I want is not complicated -- all I should need is to make sure that the path to the correct python is visible and everything else happens in cmake. But in addition to that, I also have a bunch of song and dance to try and configure cmake tools to use the correct generator and something about cmake presets and a bunch of json file jujitsu that I don't understand and that doesn't map in any way I can discern onto the generated cli commands ...
Even if there is a json file song and dance that would be able to replicate the above -- its insane that I have to have all this configuration happening twice and try to keep them in sync -- when I already have a script that does what I need. Why can't I just point cmake-tools at the cmake directory generated above (001-configure/zephyrus_native_ext) and get intellisense from it? That's all I want or need ...
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Its incredibly complicated and cumbersome to get all the correct information needed for
vscode-cmake-tools
to actually invokecmake
commands to produce a working configuration / build for my scenario. I still haven't actually figured out how to do it.I have python codebase with a cmake built cpp extension using nanobind. I'm trying to keep things as simple and uniform as possible so that developers who are primarily python dev's have a chance to get into the c++ side of things when required. To that effect everything must be streamlined.
I've got this workflow working. Based on an ENV var, the python codebase will invoke a script to rebuild the c++ extension prior to importing it.
What I can't get to work is a correct ide tooling experience in vscode for those editing the cpp files.
I would VERY much like to be able to use vscode-cmake-tools for this. My extension is built with cmake -- all the data that is needed for intellisense is there in the cmake configuration directory ... Why can't I just point cmake-tools at the cmake directory that I generated and use that as a configuration provider for the c++ extension and get intellisense?
Instead I have to jump through insane hoops to try and get the required information (which is not guaranteed to be the same from machine to machine) into the extension context such that this can 'just work' -- and in fact I don't think its even possible to make this work.
I need to somehow induce cmake-tools to accomplish the equivalent of this script
The cmake configuration I want is not complicated -- all I should need is to make sure that the path to the correct python is visible and everything else happens in cmake. But in addition to that, I also have a bunch of song and dance to try and configure cmake tools to use the correct generator and something about cmake presets and a bunch of json file jujitsu that I don't understand and that doesn't map in any way I can discern onto the generated cli commands ...
Even if there is a json file song and dance that would be able to replicate the above -- its insane that I have to have all this configuration happening twice and try to keep them in sync -- when I already have a script that does what I need. Why can't I just point cmake-tools at the cmake directory generated above (
001-configure/zephyrus_native_ext
) and get intellisense from it? That's all I want or need ...Beta Was this translation helpful? Give feedback.
All reactions