puzzlepaint / cide

A fast, lightweight C/C++ IDE for Linux and Windows
BSD 3-Clause "New" or "Revised" License
50 stars 12 forks source link
ide libclang

CIDE - A C/C++ IDE

CIDE aims to be a lightweight and fast IDE for C/C++, focusing on:

  1. Making writing code as easy as possible
    • Fast code completion, partly automatic
    • Robustness to mistyping
  2. Offering good code browsing capabilities
    • Hovering a variable/function call/etc. gives extensive information
    • On-the-fly member list for classes / structs

CIDE contains extensive support for C/C++ thanks to using libclang. CUDA is supported to varying degrees depending on how well the libclang and CUDA versions on the system work together. There is also initial, very basic support for GLSL shaders.

See the more comprehensive overview of features below.

Screenshots

CIDE on Linux Screenshot on Linux

CIDE on Windows Screenshot on Windows

Overview of main features

Since CIDE is still a new project, at the moment some features may be missing that you may expect. In particular, be aware of the following:

Precompiled binaries

Binary releases are available on GitHub releases. Before using them, please also read the recommended setup steps below:

  1. Windows-specific setup
  2. Initial setup

Building

Before building, make sure to check out the git submodules in the repository. To do so, either clone the repository with the --recurse-submodules option:

git clone --recurse-submodules <path>

Or, if the repository was already cloned, run:

git submodule update --init --recursive

The following build dependencies must be present:

Dependency Version(s) known to work
libclang 9.0.1, 10.0.0, 11.0.1
Qt5 5.12.3, 5.14.2, 5.15.0
libgit2 0.28.4, 1.0.1, 1.1.0

The following runtime dependencies should be present:

Dependency Necessity Purpose
CMake Required Getting the parse settings. Version 3.14 or later is required
clang Required Getting the default include and resource paths for configuring libclang
make or ninja Required for building applications Build integration
gdb Required for debugging applications Debugger
konsole Required for debugging applications Terminal I/O for debugged applications

The application can be built via CMake, generating ninja build files (make does not work).

Building on Linux

Building on Linux was tested with gcc.

mkdir build
cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
ninja

Building on Windows

Building on Windows was tested with clang. Since clang alone does not come with all required components, the "Build Tools for Visual Studio" must also be installed (or Visual Studio itself). With clang, cmake, and ninja all in the PATH environment variable, one can then create a build directory as in the Linux case and run the following in a Command Prompt window in this directory:

REM Adjust this path to where you installed Visual Studio or its build tools.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

REM Adjust the paths and LLVM version to your installation.
REM The LLVM paths and version are given manually here since the LLVM installer seems to come without llvm-config.
cmake ^
  -G Ninja ^
  -DCMAKE_BUILD_TYPE=Release ^
  -DCMAKE_C_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" ^
  -DCMAKE_CXX_COMPILER:PATH="C:\Program Files\LLVM\bin\clang-cl.exe" ^
  -DLLVM_ROOT="C:\Program Files\LLVM" ^
  -DLLVM_INCLUDE_DIRS="C:\Program Files\LLVM\include" ^
  -DLLVM_LIBRARY_DIRS="C:\Program Files\LLVM\lib" ^
  -DLLVM_VERSION="9.0.1" ^
  -DQt5_DIR=C:\...\Qt\5.12.3\msvc2017_64\lib\cmake\Qt5 ^
  -DLIBGIT2_INCLUDE_DIR="C:\...\libgit2-0.28.4\include" ^
  -DLIBGIT2_LIBRARIES="C:\...\libgit2-0.28.4\build\git2.lib" ^
  -DYAML_CPP_BUILD_TESTS=FALSE ^
  -DYAML_CPP_BUILD_TOOLS=FALSE ^
  ..

REM Before running ninja, copy git2.dll into the build directory. Otherwise, building will fail.

ninja

After building, copy all remaining required DLLs into the build directory, including yaml-cpp.dll from within the third_party subfolder (trying to execute CIDE.exe should display which DLLs are missing). Once all DLLs are present, the application should run.

Building with Visual Studio instead of ninja/clang should also work with a little manual effort.

Windows-specific setup

On Windows, please ensure that the environment is set up for building when starting CIDE. This likely means:

  1. To run the batch script which sets the Visual Studio environment (see "Building on Windows" above) prior to running CIDE, and
  2. Ensuring that the cmake, ninja, and clang binaries are in the PATH environment variable (in case you did not do this while installing them).

It might be easiest to write a .bat file to do the necessary setup and then start CIDE, for example like this (if the PATH is already set correctly):

call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
start C:/Users/Thomas/Projects/cide/build/CIDE.exe

On Linux, the environment is likely already set up, so probably nothing similar needs to be done.

Initial setup

On the first start, CIDE should ask for the program to be configured. Here, in particular the path to a clang binary should be set that will be used for locating default include paths and clang's resource path. Ideally, this path should be to a binary with the same version as the libclang that CIDE runs with. This libclang version is printed to the terminal on startup. On Windows, choose the clang++.exe binary variant.

Another useful optional setup step is to configure QtHelp files. CIDE normally uses documentation comments in header files (e.g., comments starting with ///) for documentation display in code info tooltips. However, if such comments are not available, QtHelp files can be used as an alternative. This is for example useful to get documentation for standard C/C++ functionality or for the Qt5 library.

To set up these help files, go to Program settings -> Documentation files. Add any downloaded .pch files to this list. For example, you may want to add:

Note: It appears that adding such a file can take a long time on Windows. The application will not react during this time.

Default shortcuts reference

The list below only shows non-standard shortcuts. Standard editor shortcuts (for example, Ctrl-C, Ctrl-V, ...) should work as usual. Note that the shortcuts are configurable in the program settings.

 

 

 

 

 

 

 

Tips and tricks

Contributing

Contributions to the project are welcome. Please try to follow the existing coding style when adding code. Also, suggestions for new features, and ideas for how the IDE could make the process of writing correct code even easier, are very much welcome (although one should generally not expect them to get implemented). Feel free to open GitHub issues for discussion.