Re: [Kicad-developers] Plugin in C++

2018-12-31 Thread Mitja Nemec
Hi,

If you are going to implement replicate layout functonality I'd recommend going 
along the suggestions made in 
https://forum.kicad.info/t/replicate-layout-action-plugin/8539/13?u=mitjan
As for help implementing it in C++ take a look at 
https://archive.fosdem.org/2017/schedule/event/kicad_source/ it might give you 
an idea.
Regards, Mitja


  From: "mdoes...@xs4all.nl" 
 To: kicad-developers@lists.launchpad.net 
 Sent: Monday, 31 December 2018, 17:54
 Subject: [Kicad-developers] Plugin in C++
  
I've seen it is possible to write action plugins in python, I would
rather do this kind of stuff in C++. In the sources I've found only some
file loaders/savers  and 3D stuff. Is the kind of plugin like "replicate
layout" possible from C++? And if it is, is there some kind of example?

regards,

Mark

___
Mailing list: https://launchpad.net/~kicad-developers
Post to    : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help  : https://help.launchpad.net/ListHelp


   ___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Plugin in C++

2018-12-31 Thread Cirilo Bernardo
With regards to plugins, it also depends on how you define a plugin.
Within KiCad
it is only the 3D visualization which is implemented as a run-time
loadable library
(commonly called a "plugin") and its API is specifically for the
visualization of 3D
models. There is a generic layer which was intended to help the development of
other plugin APIs for different purposes and I was hoping to be able
to provide a
C scripting interface but the task proved too difficult since it would
have required
some major refactoring of PCB's internals. Maybe one day ...

Cirilo


On Tue, Jan 1, 2019 at 3:54 AM  wrote:
>
> I've seen it is possible to write action plugins in python, I would
> rather do this kind of stuff in C++. In the sources I've found only some
> file loaders/savers  and 3D stuff. Is the kind of plugin like "replicate
> layout" possible from C++? And if it is, is there some kind of example?
>
> regards,
>
> Mark
>
> ___
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Plugin in C++

2018-12-31 Thread John Beard
Hi,

There is also a description of how you would write a tool in the development 
documentation: 
http://docs.kicad-pcb.org/doxygen/md_Documentation_development_tool-framework.html

As Thomas said, there is no pluggable C++ interface for plugins. Part of the 
reason for this is that C++ does not provide a stable ABI for the plugin to 
communicate over. This means all plugins need to be compiled in the same way as 
kicad, which puts a damper on sharing plugins easily. This is essentially what 
the SWIG build process: use the ABI to the currently compiled kicad, wrap it 
and pass it on to Python. This is why it needs to be compiled in. An 
alternative is to pass info over a strict C interface (maybe using some kind of 
object serialisation or library) or some other method like Dbus or sockets, 
which are not very portable.

In principle, there could be a C++ plugin system too, but it would cause some 
heartache when ABIs don't match (you can't just download a plugin, you'll need 
to ensure it's compiled for your kicad).

Again in principle, a C++ plugin interface would possibly be a good idea for 
many tools anyway, even only internally, to encourage access to the internal 
data structures in a consistent and concurrent way. At that point, third party 
plugins could theoretically hook in too (if the ABI is ok).

Cheers, 

John



On 31 December 2018 17:17:06 GMT, Tomasz Wlostowski  
wrote:
>On 31/12/2018 17:54, mdoes...@xs4all.nl wrote:
>> I've seen it is possible to write action plugins in python, I would
>> rather do this kind of stuff in C++. In the sources I've found only
>some
>> file loaders/savers  and 3D stuff. Is the kind of plugin like
>"replicate
>> layout" possible from C++? And if it is, is there some kind of
>example?
>> 
>
>Hi,
>
>There is no possibility to write action plugins in C++, but you can
>just
>contribute a 'regular' KiCad tool. Have a look at
>EDIT_TOOL::CreateArray
>sources for a starting point.
>
>Regards,
>Tom
>
>___
>Mailing list: https://launchpad.net/~kicad-developers
>Post to : kicad-developers@lists.launchpad.net
>Unsubscribe : https://launchpad.net/~kicad-developers
>More help   : https://help.launchpad.net/ListHelp
___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Plugin in C++

2018-12-31 Thread Tomasz Wlostowski
On 31/12/2018 17:54, mdoes...@xs4all.nl wrote:
> I've seen it is possible to write action plugins in python, I would
> rather do this kind of stuff in C++. In the sources I've found only some
> file loaders/savers  and 3D stuff. Is the kind of plugin like "replicate
> layout" possible from C++? And if it is, is there some kind of example?
> 

Hi,

There is no possibility to write action plugins in C++, but you can just
contribute a 'regular' KiCad tool. Have a look at EDIT_TOOL::CreateArray
sources for a starting point.

Regards,
Tom

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Plugin in C++

2018-12-31 Thread mdoesbur
I've seen it is possible to write action plugins in python, I would
rather do this kind of stuff in C++. In the sources I've found only some
file loaders/savers  and 3D stuff. Is the kind of plugin like "replicate
layout" possible from C++? And if it is, is there some kind of example?

regards,

Mark

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Debugging Kicad, can this be done with Qt creator?

2018-12-31 Thread Clemens Koller
Hi, Cedric,

I've just tested your instructions. It looks quite good. Some comments are 
below:

On my main Arch Linux (regularly maintained rolling release since 2011), your 
instructions don't work out of the box yet.

Qt Creator chokes a bit on the qmake versions because I am using qt4 and qt5 on 
my system:
"Cannot update Qt version information: /usr/lib/qt/bin/qmake cannot be run."
This can easily be fixed by going to Tools -> Options - Kits -> Qt Versions:
Use Qt 5.12.0 (System) /usr/bin/qmake
xor Qt 5.12.0 (System) /usr/bin/qmake-qt5
not Qt 4.8.7 (System) /usr/bin/qmake-qt4

Side note: Otherwise, if no proper qmake is accessible, Qt Creator asks for the 
ninja build system.
This could optionally be installed with:
# pacman -S ninja
(currently, it's ninja-1.8.2-1)


When I tell Qt Creator to use CMakeLists.txt according to your suggestions:

> file => open file or project => /home/username/kicad/CMakeList.txt => open
> configure project

but first, it gets a bit noisy:

-8<-
Failed to set up kit for Qbs: Could not determine whether Qt is a static build.
Running "/usr/bin/cmake -E server --pipe=/tmp/cmake-.IhGzVk/socket 
--experimental" in /tmp/QtCreator-wuKvat/qtc-cmake-tBiqfBkX.
Starting to parse CMake project, using: 
"-DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++", 
"-DCMAKE_C_COMPILER:STRING=/usr/bin/gcc", "-DCMAKE_PREFIX_PATH:STRING=", 
"-DQT_QMAKE_EXECUTABLE:STRING=".
The C compiler identification is GNU 8.2.1
The CXX compiler identification is GNU 8.2.1
Check for working C compiler: /usr/bin/gcc
Check for working C compiler: /usr/bin/gcc -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /usr/bin/g++
Check for working CXX compiler: /usr/bin/g++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at CMakeLists.txt:89 (install):
  install TARGETS given no RUNTIME DESTINATION for executable target "kicad".


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

cmake_minimum_required(VERSION 3.13)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP".
This warning is for project developers.  Use -Wno-dev to suppress it.

Configuring incomplete, errors occurred!
See also "/tmp/QtCreator-wuKvat/qtc-cmake-tBiqfBkX/CMakeFiles/CMakeOutput.log".
CMake Project parsing failed.
-8<-

Interestingly, CMakeLists.txt contains the line:
cmake_minimum_required( VERSION 2.8.12 FATAL_ERROR )

So, urgh?
The fun part is, that this issue simply vanished on the next try - after 
closing & opening qtcreator.
I then get a quite promising log of:

-8<-
Running "/usr/bin/cmake -E server --pipe=/tmp/cmake-.eYPdxT/socket 
--experimental" in /tmp/QtCreator-XUOcgJ/qtc-cmake-FzUufvWY.
Starting to parse CMake project, using: 
"-DCMAKE_CXX_COMPILER:STRING=/usr/bin/g++", 
"-DCMAKE_C_COMPILER:STRING=/usr/bin/gcc", "-DCMAKE_PREFIX_PATH:STRING=", 
"-DQT_QMAKE_EXECUTABLE:STRING=".
The C compiler identification is GNU 8.2.1
The CXX compiler identification is GNU 8.2.1
Check for working C compiler: /usr/bin/gcc
Check for working C compiler: /usr/bin/gcc -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: /usr/bin/g++
Check for working CXX compiler: /usr/bin/g++ -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
KiCad install dir: 
Looking for malloc.h
Looking for malloc.h - found
Looking for iso646.h
Looking for iso646.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for strcasecmp
Looking for strcasecmp - found
Looking for strncasecmp
Looking for strncasecmp - found
Looking for strtok_r
Looking for strtok_r - found
Looking for malloc
Looking for malloc - found
Looking for math.h
Looking for math.h - found
Looking for C++ include cmath
Looking for C++ include cmath - found
Looking for asinh
Looking for asinh - found
Looking for acosh
Looking for acosh - found
Looking for atanh
Looking for atanh - found
Performing Test HAVE_CMATH_ISINF
Performing Test HAVE_CMATH_ISINF - Success
Looking for clock_gettime in rt
Looking for clock_gettime in rt - found
Looking for gettimeofday
Looking for gettimeofday - found
Looking for getc_unlocked
Looking for getc_unlocked - found
Performing Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE
Performing Test COMPILER_SUPPORTS_WSUGGEST_OVERRIDE - Success
Performing Test COMPILER_SUPPORTS_WVLA
Performing Test COMPILER_SUPPORTS_WVLA - Success
Performing Test COMPILER_SUPPORTS_WSHADOW
Performing Test COMPILER_SUPPORTS_WSHADOW - 

Re: [Kicad-developers] Debugging Kicad, can this be done with Qt creator?

2018-12-31 Thread cedric.dew...@telfort.nl
Hey, Mario,

Arch has not every needed package in their repo, but the aur is easy enough in 
my opinion. (Also, I find the arch people to be more willing to indulge my 
crazy idea's (like installing packages as a non-root user) than the Debian 
people)
Kicad already has debug, release, minimum size release and release with debug 
symbols options, so there's no need to create them again :-)

You are completely correct that release links faster, but I accept the slower 
linking to be able to use breakpoints and the like.
Also I think new code should always be stepped through, so little ahem.. "side 
effects" can be caught as well.

PS, I forgot to mention that the procedure starts from a fresh install of 
Manjaro, not a fresh install of Arch.

Cheers, and happy new year,
Cedric

>Origineel Bericht
>Van : mrluze...@ua.pt
>Datum : 31/12/2018 14:13
>Aan : kicad-developers@lists.launchpad.net, cedric.dew...@telfort.nl
>Onderwerp : Re: [Kicad-developers]   Debugging Kicad, can this be done with Qt 
>creator?
>
>Nice, this should be placed somewhere online for other people interested on 
>build on Arch Linux.
>It looks Arch require a bit more work to setup kicad. On debian is similar but 
>you can use directly the packages from repository.
>
>Also a tip note on the QT, you may would like to create two build targets: 
>debug and release.
>debug is useful for step-by-step debug but it will take ages to build (linker)
>release is faster to linker and test small changes on the code..
>
>Mario Luzeiro
>
>From: Kicad-developers 
> on behalf of 
>cedric.dew...@telfort.nl 
>Sent: 31 December 2018 12:58
>To: kicad-developers@lists.launchpad.net
>Subject: [Kicad-developers]   Debugging Kicad, can this be done with Qt 
>creator?
>
>Hi Mario, I've just tested the procedure from an empty harddrive.
>Cheers,
>Cedric
>
># pacman -Suy
># mv /usr/lib/xfce4/thunar-archive-plugin/engrampa.tap 
>/usr/lib/xfce4/thunar-archive-plugin/engrampa.tap-mv
># pacman -Suy
># reboot
>
># nano /etc/makepkg.conf #uncommand the line, and set the number of jobs  
>MAKEFLAGS="-j9"
>
># pacman -S base-devel \
> git \
> cmake \
> doxygen \
> gcc \
> python2 \
> pkg-config \
> swig \
> boost \
> cairo \
> glew \
> curl \
> python-wxpython \
> python2-wxpython3 \
> opencascade \
> ngspice \
> lib32-wxgtk2 \
> qtcreator \
> gdb
>
>$ wget 
>https://archive.archlinux.org/packages/g/glm/glm-0.9.9.2-1-any.pkg.tar.xz
># pacman -U glm-0.9.9.2-1-any.pkg.tar.xz
>
>$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/oce.tar.gz
>$ tar -xf oce.tar.gz
>$ cd oce
>$ makepkg
># pacman -U oce-0.18.3-1-x86_64.pkg.tar.xz
>$ git clone -b master https://git.launchpad.net/kicad
>$ qtcreator
>
>file => open file or project => /home/username/kicad/CMakeList.txt => open
>configure project
>set a breakpoint somewhere
>projects => Build & run => Desktop => build => Build Steps => tool arguments: 
>-j9 # number of cores + 1
>bottom-left => Build-debug
>Debug => start debugging => start debugging
>
>>Origineel Bericht
>>Van : mrluze...@ua.pt
>>Datum : 30/12/2018 18:38
>>Aan : kicad-developers@lists.launchpad.net, cedric.dew...@telfort.nl
>>Onderwerp : Re: [Kicad-developers]  Debugging Kicad, can this be done with Qt 
>>creator?
>>
>>Hi Cedric,
>>I've heard good things about arch linux but didn't get a chance to try it yet.
>>My guess is that this kind of development steps are not so documented because 
>>people are using different ways and flavors for build and debugging KiCad.
>>Nevertheless, it would be good to have it documented somewhere..
>>
>>Have a good new year too!
>>Mario
>
>___
>Mailing list: https://launchpad.net/~kicad-developers
>Post to : kicad-developers@lists.launchpad.net
>Unsubscribe : https://launchpad.net/~kicad-developers
>More help   : https://help.launchpad.net/ListHelp
>

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


Re: [Kicad-developers] Debugging Kicad, can this be done with Qt creator?

2018-12-31 Thread Mário Luzeiro
Nice, this should be placed somewhere online for other people interested on 
build on Arch Linux.
It looks Arch require a bit more work to setup kicad. On debian is similar but 
you can use directly the packages from repository.

Also a tip note on the QT, you may would like to create two build targets: 
debug and release.
debug is useful for step-by-step debug but it will take ages to build (linker)
release is faster to linker and test small changes on the code..

Mario Luzeiro

From: Kicad-developers 
 on behalf of 
cedric.dew...@telfort.nl 
Sent: 31 December 2018 12:58
To: kicad-developers@lists.launchpad.net
Subject: [Kicad-developers]   Debugging Kicad, can this be done with Qt creator?

Hi Mario, I've just tested the procedure from an empty harddrive.
Cheers,
Cedric

# pacman -Suy
# mv /usr/lib/xfce4/thunar-archive-plugin/engrampa.tap 
/usr/lib/xfce4/thunar-archive-plugin/engrampa.tap-mv
# pacman -Suy
# reboot

# nano /etc/makepkg.conf #uncommand the line, and set the number of jobs  
MAKEFLAGS="-j9"

# pacman -S base-devel \
 git \
 cmake \
 doxygen \
 gcc \
 python2 \
 pkg-config \
 swig \
 boost \
 cairo \
 glew \
 curl \
 python-wxpython \
 python2-wxpython3 \
 opencascade \
 ngspice \
 lib32-wxgtk2 \
 qtcreator \
 gdb

$ wget https://archive.archlinux.org/packages/g/glm/glm-0.9.9.2-1-any.pkg.tar.xz
# pacman -U glm-0.9.9.2-1-any.pkg.tar.xz

$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/oce.tar.gz
$ tar -xf oce.tar.gz
$ cd oce
$ makepkg
# pacman -U oce-0.18.3-1-x86_64.pkg.tar.xz
$ git clone -b master https://git.launchpad.net/kicad
$ qtcreator

file => open file or project => /home/username/kicad/CMakeList.txt => open
configure project
set a breakpoint somewhere
projects => Build & run => Desktop => build => Build Steps => tool arguments: 
-j9 # number of cores + 1
bottom-left => Build-debug
Debug => start debugging => start debugging

>Origineel Bericht
>Van : mrluze...@ua.pt
>Datum : 30/12/2018 18:38
>Aan : kicad-developers@lists.launchpad.net, cedric.dew...@telfort.nl
>Onderwerp : Re: [Kicad-developers]  Debugging Kicad, can this be done with Qt 
>creator?
>
>Hi Cedric,
>I've heard good things about arch linux but didn't get a chance to try it yet.
>My guess is that this kind of development steps are not so documented because 
>people are using different ways and flavors for build and debugging KiCad.
>Nevertheless, it would be good to have it documented somewhere..
>
>Have a good new year too!
>Mario

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp


[Kicad-developers] Debugging Kicad, can this be done with Qt creator?

2018-12-31 Thread cedric.dew...@telfort.nl
Hi Mario, I've just tested the procedure from an empty harddrive.
Cheers,
Cedric

# pacman -Suy
# mv /usr/lib/xfce4/thunar-archive-plugin/engrampa.tap 
/usr/lib/xfce4/thunar-archive-plugin/engrampa.tap-mv
# pacman -Suy
# reboot

# nano /etc/makepkg.conf #uncommand the line, and set the number of jobs  
MAKEFLAGS="-j9"

# pacman -S base-devel \
 git \
 cmake \
 doxygen \
 gcc \
 python2 \
 pkg-config \
 swig \
 boost \
 cairo \
 glew \
 curl \
 python-wxpython \
 python2-wxpython3 \
 opencascade \
 ngspice \
 lib32-wxgtk2 \
 qtcreator \
 gdb

$ wget https://archive.archlinux.org/packages/g/glm/glm-0.9.9.2-1-any.pkg.tar.xz
# pacman -U glm-0.9.9.2-1-any.pkg.tar.xz

$ wget https://aur.archlinux.org/cgit/aur.git/snapshot/oce.tar.gz
$ tar -xf oce.tar.gz
$ cd oce
$ makepkg
# pacman -U oce-0.18.3-1-x86_64.pkg.tar.xz
$ git clone -b master https://git.launchpad.net/kicad
$ qtcreator

file => open file or project => /home/username/kicad/CMakeList.txt => open
configure project
set a breakpoint somewhere
projects => Build & run => Desktop => build => Build Steps => tool arguments: 
-j9 # number of cores + 1
bottom-left => Build-debug
Debug => start debugging => start debugging

>Origineel Bericht
>Van : mrluze...@ua.pt
>Datum : 30/12/2018 18:38
>Aan : kicad-developers@lists.launchpad.net, cedric.dew...@telfort.nl
>Onderwerp : Re: [Kicad-developers]  Debugging Kicad, can this be done with Qt 
>creator?
>
>Hi Cedric,
>I've heard good things about arch linux but didn't get a chance to try it yet.
>My guess is that this kind of development steps are not so documented because 
>people are using different ways and flavors for build and debugging KiCad.
>Nevertheless, it would be good to have it documented somewhere..
>
>Have a good new year too!
>Mario

___
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp