Skip to content

Set up Build on Eclipse

Dmytro Maslenko edited this page Jan 3, 2023 · 1 revision

Description

Here you will find step-by-step instructions to use the Eclipse IDE for building the KeePassXC application.
The below steps are tested on the Linux machine but the same is applicable for another ones.

Prerequisite

Your environment is prepared properly:

and the sources are downloaded as described here.

Install the Eclipse C++ IDE

  • Select the latest Eclipse release.
  • Find the Eclipse IDE for C/C++ Developers section and download needed platform specific package.
  • Complete the installation according to your platform.

Create an Eclipse project

  • Open the File > Imports... > C/C++ > Existing Code as Makefile Project, click Next>.
  • Specify a Project Name as keepassxc, specify Existing Code Location using Browse... button, select Linux GCC as a toolchain, click Finish.
  • In the Project Explorer you will get new project.

Setup the Eclipse Build target

Release configuration

  • Open the Build Target window using the Window > Show View > Build Target menu. It should appear on the right, with the Outline window.
  • Make sure you have the build folder or create it. CMake will run with this folder as its working directory.
  • Right click on the build folder and select New... command. The Create Build Target dialog will appear:
    • Provide Target name as Release.
    • In Build Target deselect Same as the target name and make sure that the Build target field is empty.
    • In Build Command deselect Use builder settings and set the Build command to
      cmake -DWITH_XC_ALL=ON -DCMAKE_BUILD_TYPE=Release ..
      Note, you can specify any build option(s) supported by this project.
    • Keep the rest fields by default as is and press OK.

Setup the Eclipse builder

Next, setup the builder to run the Makefiles that CMake builds.

  • Right click on the keepassxc project and select Properties.
  • Select C/C++ Build.
    • Open the Manage Configurations... and set the Release as active, click OK.
    • Select the Configuration to Release [Active].
      • On the Builder Settings tab:
        • Deselect Use default build command and specify the Build command: make.

        • Deselect Generate Makefiles automatically.

        • Specify the Build directory field: ${workspace_loc:/keepassxc/build}. You can use the Workspace... button to select it manually.

        • The form should appear as shown below:

      • On the Behavior tab:
        • Select Use custom build arguments and specify the Build arguments as -j4 or -j8 (it depends how many available CPU cores you have).

        • Select Build (Incremental build) and specify the target name all.

        • Select Clean and specify the target name clean.

        • Click Apply and Close.

  • Set the Release configuration to build as active by the Project > Build Configurations > Set Active command.

Build the project

  • In the Build Targets window double click on Release to generate the GNU Make build system.
    Expected execution time is couple seconds. Do it every time when you got the latest code or changed the CMakeLists.txt.
  • Build is possible by different ways:
    • From main menu: Project > Build Project.
    • From toolbar: Hammer icon
    • From project context menu: Build Configurations > Build All.

Run the application

  • Run is possible by different ways:
    • From main menu: Run > Run.
    • From toolbar: Run icon
    • From project context menu: Run as > Local C/C++ Application > keepassxc > OK.