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

CREATE_PROJECT: export compile_commands.json via cmake #2525

Merged
merged 2 commits into from Oct 19, 2020

Conversation

@mgerhardy
Copy link
Contributor

@mgerhardy mgerhardy commented Oct 14, 2020

This is useful for e.g. clangd or other clang based tools like the analyser.

https://cmake.org/cmake/help/v3.5/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html

I'm using the generated compile_commands.json with clangd and vscode (the file must be located in the project root to be found automatically by clangd)

Install the clangd plugin for vscode, execute cmake, copy the your_build_dir/compile_commands.json to scummvmcheckout/compile_commands.json and execute Restart clangd in vscode.

cd devtools/create_project/cmake
cmake .
cmake --build .
cd ../../..
./devtools/create_project/cmake/create_project . --cmake
mkdir build
cd build
cmake ..
cd ..
ln -sf build/compile_commands.json compile_commands.json

Bildschirmfoto von 2020-10-14 16-49-11

Now install clangd and open the project. It might be problematic if you have the project already configured with intellisense. So doing a fresh vscode workspace might be better and answering the intellisense questions with no

Another nice option is now to add a .clang-tidy and .clang-format - they are automatically picked up for static code analysis and code formatting in the ide.

Bildschirmfoto von 2020-10-14 16-57-24

@deepcode-ci-bot
Copy link

@deepcode-ci-bot deepcode-ci-bot bot commented Oct 14, 2020

DeepCode's analysis on #a7654b found:

  • ⚠️ 1 warning 👇

Top issues

Description Example fixes
Missing check is_open on std::ofstream before writing to it. Occurrences: 🔧 Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot

mgerhardy added 2 commits Oct 14, 2020
this is useful for e.g. clangd or other clang based tools like the analyser
@mgerhardy mgerhardy force-pushed the mgerhardy:pr/cmake-compile-commands branch from 2af3060 to a7654b4 Oct 19, 2020
@sev-
Copy link
Member

@sev- sev- commented Oct 19, 2020

Thanks!

@sev- sev- merged commit 813b497 into scummvm:master Oct 19, 2020
1 of 2 checks passed
1 of 2 checks passed
deepcode-ci-bot Found 1 warning issue.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.