-
Notifications
You must be signed in to change notification settings - Fork 21
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
CLion IDE support #54
Comments
Hmm... (Note: I've never used CLion.) What you're proposing is "old-style" CMake which is generally not used anymore and just ignores the targets in the rest of the CMake files. "Modern" CMake uses BTW: Your Offhand I can't think of why CLion would have problems with targets as that is what most CMake files use now.
I think we need to figure out why it's not respecting the targets rather than work around them. |
That looks like it's set to the correct target. The fact that it compiles tells me there's a disconnect between the compiler and the thing that's handling what I think CLion calls code insight. I have had similar disconnects with Qt Creator in the past and I think it had to do with the version of clang that Qt Creator included as a language server vs. the compiler I was actually compiling with. According to this article from CLion:
Not sure if that's the same thing since I don't know their terminology. Are there any "code insight"/code completion/language server settings that might affect this? |
I had the problem when setting up GDExtensions by myself (before finding your awesome template) and searched for a solution for an hour. I didn't find anything regarding any code insight/completion settings, I only got it working with my workaround above. For visual studio code a way is to use the |
Maybe it's caching the symbol information and compiling forces it to re-index? I know that Qt Creator sometimes takes a long time to index these larger projects. @svdragster If it's still a problem, I would suggest asking on the CLion forums. It looks to me like godot-cpp and GDExtensionTemplate are following CMake's recommended target style. @kiririn39 That warning you're getting is unusual - what OS are you compiling on? |
@asmaloney I didnt pass any explicitly, i used an ide's compile button since it was available. I'm on arm mac so that is why |
I wonder where set( CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "" ) |
I'v looked in to it a bit more. Seems like godot-cpp generates or however it gets these actual nodes api binding files, but they went in cmake-build-debug folder. Which is probably not expected? i tried moving them in appropriate locations. On this sccreen red file names mean the are not listed in git because i copy-pasted them. This is a place i would expect them to be and i guess Clion does so, because after this i could use Cion's intellisense even without prior mentioned actions. Are they supposed to be here? My guess would be that Clion messes up with some paths? and insted of pasting generated files in extern/godot-cpp they went to export folder? Excuse me if i'm writing strange sentences, i'm not a cmake enjoyer and making a wild guess here) |
Those files are in the right place - all generated files belong in the build directory. (You can see them in my IDE project structure in my comment above.) If you look at godot-cpp's CMakeLists.txt, they are clearly added to the library.: add_library(${PROJECT_NAME} STATIC
${SOURCES}
${HEADERS}
${GENERATED_FILES_LIST}
) and later on they are added to the include directories: target_include_directories(${PROJECT_NAME} ${GODOT_CPP_SYSTEM_HEADERS_ATTRIBUTE} PUBLIC
include
${CMAKE_CURRENT_BINARY_DIR}/gen/include
${GODOT_GDEXTENSION_DIR}
) So I don't know why CLion can't find them for code completion, but can for building. I think the best bet is to ask on the CLion forums. |
I'm working on a project, based on this repo here: https://github.com/Sythelux/godot_tree_generator_plugin/tree/feature/godot-4.1-gdextension i'm coding with CLion and except for CLion not being able to do the includes on its own. it works rather well. Maybe other CLion users can track down what I might've different from this repo. (I had to set the build dir to "." in the settings, because CLion is usually putting stuff in its own cmake build directory. |
Thanks @Sythelux.
That's what it is supposed to do. With CMake you generally don't build in your project's directory (i.e. the build process doesn't add or modify any files in your project's directory at all). You would have build directories for debug and release outside your project directory.
Aside: You also shouldn't check in any generated files that are supposed to be in the build directory - e.g. gen/Version.h, addons/zylann.treegen/zylann.treegen.gdextension. These are generated when you run the build. Generated files may be different between builds (debug & release) like the .gdextension file, or between different runs of the build (in the Version.h case, the git hash will be changing all the time). This is one of the reasons the build directories are outside the project directory. |
Thank you for helping me with my project structure. I didn't want to open up another thing here in the issue tracker though. Just telling, that CLion can work with that project setup. |
Without making the following adjustments, CLion can't find the headers for godot, resulting in unavailable IDE suggestions and annoying red squiggly lines.
I added the following at the bottom of
CMakeLists.txt
, now the IDE suggestions work correctly. It's not ideal since you have to add all your files to SOURCE_FILES. I hope there is a better way that I'm not aware of.I'm not sure if and how this should be included in the template. Maybe using a patch?
The text was updated successfully, but these errors were encountered: