Developing KiCad: Configure an IDE

Hmm, I didn’t know that DNF provided a way to install all the dependent packages.

BTW, if you didn’t notice a relevant thread about dependencies is going on:

Current directory is ~/Kicad
$ cmake -DCMAKE_INSTALL_PREFIX=build/debug/bin/ -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

– Configuring done
– Generating done
– Build files have been written to: /home/user/Kicad
$ ls build/debug/bin
$ ls
build cmake_install.cmake hello_world Makefile my_2020_cmake_log.txt.bk1
CMakeCache.txt CMakeLists.txt helloworld.cpp Makefile.bk1 my_kcb_log.txt
CMakeFiles cmake_URLs.txt kicad my_2020_cmake_log.txt qtcreator
$ ls build/
debug release
$ ls build/debug/
bin
$ ls build/debug/bin/

-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/Kicad

$ ls build/debug/bin
$ ls build/
debug release
$ ls build/debug/
bin
$ ls build/debug/bin/

Well, it said the build files were written, but obviously they were not.
Where did I go wrong?

Thank you, herostat. You just defined me. Before writing this post, I installed cmake version 3.13.4, watched a youtube video on how to use cmake, and then successfully ran cmake with the {hello world} code given in the video.

Run cmake from build directory otherwise you will contaminate source tree and run into problems.
By build directory I mean Kicad/build/release or Kicad/build/debug or wherever you want your build to actually happen.

[code]user@solydk1:~/Kicad/build/debug$ cmake -DCMAKE_INSTALL_PREFIX=build/debug/bin/ -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

CMake Error: The source directory “/home/user/Kicad/build/debug” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
user@solydk1:~/Kicad/build/debug$ cmake -DCMAKE_INSTALL_PREFIX=…/ -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

CMake Error: The source directory “/home/user/Kicad/build/debug” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
user@solydk1:~/Kicad/build/debug$ cmake -DCMAKE_INSTALL_PREFIX=/home/user/Kicad/build/debug/bin/ -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

CMake Error: The source directory “/home/user/Kicad/build/debug” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
user@solydk1:~/Kicad/build/debug$ cmake -DCMAKE_INSTALL_PREFIX=./ -DCMAKE_BUILD_TYPE=DebugCMake Warning:
No source or binary directory provided. Both will be assumed to be the
same as the current working directory, but note that this warning will
become a fatal error in future CMake releases.

CMake Error: The source directory “/home/user/Kicad/build/debug” does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.[/code]
I must be doing something stupid, but I don’t see what it is.

From /home/user/Kicad,

user@solydk1:~/Kicad$ find ./ -name "CMakelists.txt" 

From where I expect the build to be created, ~/Kicad/build/debug,

user@solydk1:~/Kicad/build/debug$ pwd
/home/user/Kicad/build/debug
user@solydk1:~/Kicad/build/debug$ cmake -DCMAKE_INSTALL_PREFIX=../../ -DCMAKE_BUILD_TYPE=Debug
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


CMake Error: The source directory "/home/user/Kicad/build/debug" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

I thought -DCMAKE_INSTALL_PREFIX specified a relative path to CMakelists.txt. Am I wrong?

That specifies where make install should put the program after it’s compiled. To point cmake to root source dir just pass ../../ as last parameter.
cmake -Dsomething -Dsomeotherthing ../../

vim+ctags or equivalent setups running in pure terminal can be quite powerful when configured with all kinds of plugins and shortcuts but they have very steep learning curve. Even today it’s a very viable way to work on code and many do just that.
However even when you master these tools they are still bound by limitations of pure text interface and simply cannot provide the level of comfort and ergonomics of a well designed GUI app. What I like about VSCode is that everything there is configurable and you can add your own actions running arbitrary parametrized shell commands, making that the best of both GUI/terminal worlds imho.

Well, I tried what you said from inside /home/user/Kicad and this is what happened:

user@solydk1:~/Kicad$ cmake -DCMAKE_INSTALL_PREFIX=../../ -DCMAKE_BUILD_TYPE=Debug ./build/release/bin/ 
CMake Error: The source directory "/home/user/Kicad/build/release/bin" does not appear to contain CMakeLists.txt.

I don’t know enough about cmake to know what I’m doing wrong.

I think I wasn’t clear enough.
From /home/user/Kicad/build/debug do this:

cmake -DCMAKE_BUILD_TYPE=Debug ../../

The working directory of where you run cmake from is where cmake will generate build files. Last parameter in the command above is the relative path to where cmake will look for CMakeLists.txt. So when you are in Kicad/build/debug this ../../ will point to Kicad. Makes sense?
After you’ve run cmake like this (assuming it didn’t throw a bunch of errors at you) you will run make to actually build kicad using the build files that cmake generated. To speed up build you can run it with multiple threads like make -j16. Put the number of cores/threads of your CPU instead of 16 there.

Awesome! this is a very good and helpful step by step tutorial.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.