← Back to team overview

kicad-developers team mailing list archive

Re: RFC: out-of-tree plugin builds

 

1) Header files should be installed in
$CMAKE_INSTALL_PREFIX/include/kicad/plugins or possibly
$CMAKE_INSTALL_PREFIX/include/kicad/3d-plugins.  A some point we may
want to expose the APIs of the kicad libraries (kifaces) so I would
prefer the plugin headers be in a descriptive path for clarity.  I'm not
sure what the correct header install path is on OSX should be.  Any of
our OSX devs know where they should be installed.

2) The lib link files should be installed in $CMAKE_INSTALL_PREFIX/lib.
 Again, OSX may have it's own preferred path.

3) There is a good example in the "Mastering CMake" book on how to
generate <Package>Config.cmake files.  There is an example on the CMake
wiki as well:
https://cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file.
 These are built automatically when you compile the KiCad 3D plugin and
includes all of the necessary information for compiling and linking
against the plugin library.  I'm sure there are some examples on how to
do this out there.  The other alternative is to write a generic
Find<Package>.cmake file however this is not as powerful as the first
option.  I've never used the first option but it appears to be CMake
specific way to support building against custom libraries.  It's more
like pc-config than the typical Find<Package>.cmake stuff in that it
includes compiler and link flags used to build the library and other
useful settings.  There are also default locations where CMake will look
for the <Package>Config.cmake files so you will need to figure out where
they are and install the config files there.

On 4/5/2016 10:17 PM, Cirilo Bernardo wrote:
> With the recent merge of the 3D plugin work we must now address
> some new issues which have come about due to the introduction
> of plugins and a shared library (kicad_3dsg). In particular, users
> who wish to create out-of-tree plugins will now need to find the vital
> kicad headers and necessary shared libraries (at the moment only
> kicad_3dsg).
> 
> For the 3D plugins and kicad_3dsg all of the necessary header files
> have been placed in the include/plugins directory. At the moment
> there are no CMake instructions to install header files since I wanted
> some feedback on the options and their effects of in-tree source code.
> 
> I think the best place to install the headers would be within
> ${SOME_SYSTEM_PATH}/include/kicad and subdirectories
> within (at the moment only plugins/ and its subdirs). We will need to
> provide a FindKicad.cmake file or an appropriate CMake package
> file to discover these headers and the associated libraries.
> 
> What I am not so certain of is the expected behavior of the
> find script:
> 
> Option1: Kicad_INCLUDE_DIR is set to:
> ${SOME_SYSTEM_PATH}/include/kicad
> This would require no changes to the kicad source since
> the kicad headers use the form "plugins/whatever" to include
> headers related to the plugin system. However, some people
> might argue that it's not clear that we're thinking of kicad
> plugins and might prefer:
> 
> Option2: Kicad_INCLUDE_DIR is set to:
> ${SOME_SYSTEM_PATH}/include
> This would require the following changes to headers and
> directory structure:
> a. headers change from using #include "plugins/whatever" to
> #include "kicad/plugins/whatever"
> b. move the directory include/plugins to include/kicad/plugins
> -- however I'm not so comfortable having a 'kicad' directory
> within the main branch's "include" dir.
> 
> Some thought has to go into what KiCad may be like in the
> future - will we have more shared libraries, will we have only
> plugin-related shared libs and headers or is it possible we
> will have others. For example if we were certain that we
> will only have plugin headers then we can install headers to
> ${SOME_SYSTEM_PATH}/include/kicad-plugins and
> the include/plugins directory can simply be changed to
> include/kicad-plugins and appropriate changes made to
> existing headers and in-tree code.
> 
> Any comments/suggestions?
> 
> PS: Some tutorial code is largely written but is awkward
> because of this situation where kicad does not (yet) install
> headers. I plan to clean it up and push to the documentation
> repository as soon as these last issues are addressed.
> 
> - Cirilo
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp
> 



Follow ups

References