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

support for windows 7/10 and latest version of clang added #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

lukicmarko91
Copy link

Signed-off-by: Marko [email protected]

@rprichard
Copy link
Owner

Thanks for sharing this, but I don't think I'm going to merge it as-is.

@lukicmarko91
Copy link
Author

lukicmarko91 commented Jul 2, 2017

If its because of mixed up .pro file, i just fixed that. Sorry didn't see it last night, that was just there for testing reasons. Only thing i changed is FileExplorer class. Now it will add all available drives to external directory, and only populate those containing files, it maybe is not elegant, but it's kind of a workaround for program putting all files which paths are not starting with for example "C:\" inside special category. Btw that option is not tested on linux since i don't have it installed atm.

PS. On windows, only ninja generates proper compile_commands.json, CMake generated one will result in emtpy index file for some reason

PSS If you see something else you dont like, let me know, so i can try to fix it

@samogot
Copy link
Contributor

samogot commented Jul 24, 2017

@lukicmarko91 have you an instruction how to build/install it on windows? it would be very useful for me.

@lukicmarko91
Copy link
Author

Lets start:
In order to build this by yourself, you need latest version of Qt Creator, latest Clang source, and a lot of nerves and time.

  1. In order to link your app to clang libraries, clang needs to be built with minGW 5.3.0 (one that comes with Qt creator). Easiest way is to open clang project inside qt creator, and build it from there , just exclude tests, set install dir, and target to install, and then pass -Wa,-mbig-obj -j4 as build argument so you don't get linker error because of too big object file, note that -j is optional

  2. Download sourceweb from repository, open it in Qt creator, and set qmake argument CLANG_DIR=path_to_root_dir_where_you_installed_clang_libs (that should be the dir you set as install dir when you built clang)

  3. Build your sourceweb

  4. Add folders where sw-clang-indexer.exe and navigator.exe are located into system PATH variable

  5. Open cmd, navigate to folder where your compile_commands.json are, run "sw-clang-indexer --index-project"

  6. finally run navigator GUI by runing "sourceweb index"

Note that in order for this to work, you will need to generate compile_commands.json with ninja, which is a bit tricky:

  1. Download ninja for windows, and add it to windows PATH

  2. Generate ninja build files for desired project, using CMake

  3. Open rules.ninja and find all the lines that goes like this: "rule CXX_COMPILER__some text", and copy that somewhere so it forms a string like this: "CXX_COMPILER__sometext1 CXX_COMPILER__sometext2 CXX__ ...."

  4. Open cmd, navigate to folder where you generated ninja build files, and type ninja -t compdb CXX_COMPILER__sometext1 CXX_COMPILER__sometext2 > compile_commands.json

  5. Voila, you have your compile_commands.json file, but in the wrong place :), so copy that where source code of application you want to index is located, and you are ready to go :D

As an untested alternative, there is this repository :

https://github.com/lukicmarko91/sourcewebWindowsDeploy.git,

where i built and deployed sourceweb application, since its static linking, i think it should work out of the box (not sure tho.. ) Needs to be tested by someone who doesn't have clang libs and qt libs installed. But you need to generate compile_commands.json by yourself

If you get stuck somewhere, im glad to help if i can,

Best regards, Marko

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