Kodi Community Forum
Develop PVR addons with new cmake build system - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136)
+---- Thread: Develop PVR addons with new cmake build system (/showthread.php?tid=219166)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13


RE: Develop PVR addons with new cmake build system - garbear - 2015-03-20

Here is the readme from my libretro game add-on

Building out-of-tree (recommended)

Linux

Clone the repo and create a build directory

Code:
git clone https://github.com/kodi-game/game.libretro.git
cd game.libretro
mkdir build
cd build

Generate a build environment with config for debugging

Code:
cmake -DADDONS_TO_BUILD=game.libretro \
      -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_INSTALL_PREFIX=$HOME/workspace/xbmc/addons \
      $HOME/workspace/xbmc/project/cmake/addons

If you are developing in Eclipse, you can create a "makefile project with existing code" using game.libretro/ as the existing code location. To build, enter Properties -> "C/C++ Build" and change the build command to make -C build.

It is also possible to generate Eclipse project files with cmake

Code:
cmake -G"Eclipse CDT4 - Unix Makefiles" \
      -D_ECLIPSE_VERSION=4.4 \
      -DADDONS_TO_BUILD=game.libretro \
      -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_INSTALL_PREFIX=$HOME/workspace/xbmc/addons \
      $HOME/workspace/xbmc/project/cmake/addons

Building in-tree (cross-compiling)

Kodi's build system will fetch the add-on from the GitHub URL and git hash specified in game.libretro.txt.

Linux

Ensure that kodi has been built successfully. Then, from the root of the source tree, run

Code:
make install DESTDIR=$HOME/kodi

Build the add-on

Code:
make -C tools/depends/target/binary-addons PREFIX=$HOME/kodi ADDONS="game.libretro"

The compiled .so can be found at

Code:
$HOME/kodi/lib/kodi/addons/game.libretro/game.libretro.so

To rebuild the add-on or compile a different one, clean the build directory

Code:
make -C tools/depends/target/binary-addons clean

Windows

First, download and install CMake.

Run the script from PR6658 to create Visual Studio project files

Code:
tools\windows\prepare-binary-addons-dev.bat

The generated solution can be found at

Code:
project\cmake\addons\build\kodi-addons.sln

OSX

Per README.osx, enter the tools/depends directory and make the add-on:

Code:
cd tools/depends
make -C target/binary-addons ADDONS="game.libretro"

To rebuild the add-on or compile a different one, clean the build directory

Code:
make -C target/binary-addons clean




Devs: is this correct? how do you build out-of-tree on windows? Non-devs: feel free to adapt these instructions for your own project


RE: Develop PVR addons with new cmake build system - wsnipex - 2015-03-20

Note that for the linux out of tree build, there is no need to pass ADDON_SRC_PREFIX. The addons CMakelist doesn't recognize that option. PACKAGE_ZIP is not needed as well, unless you really want to create a zip package.


RE: Develop PVR addons with new cmake build system - garbear - 2015-03-20

(2015-03-20, 09:39)wsnipex Wrote: Note that for the linux out of tree build, there is no need to pass ADDON_SRC_PREFIX. The addons CMakelist doesn't recognize that option. PACKAGE_ZIP is not needed as well, unless you really want to create a zip package.

removed them from the readme, thanks


RE: Develop PVR addons with new cmake build system - wsnipex - 2015-03-20

doh, forgot to add, the same goes for ADDONS_TO_BUILD. In standalone mode, there is only 1 addon.


RE: Develop PVR addons with new cmake build system - FernetMenta - 2015-03-21

how has libretro managed to become a PVR addon? you know that this is the PVR dev section of the forum, don't you Smile


RE: Develop PVR addons with new cmake build system - garbear - 2015-03-21

game add-on

EDIT: or more technically, a game client extending "xbmc.gameclient" implementing the game API

EDIT: oh, no I didn't notice this was the PVR forum :p thought it was kodi-application dev. still, it's the same build system so the instructions should be identical


RE: Develop PVR addons with new cmake build system - scarecrow420 - 2015-03-21

Hi guys, am I missing something here? I'm a windows developer working on ServerWMC Backend and pvr.wmc addon. I used the batch file mentioned and generated a visual studio solution for pvr.wmc but none of the source files (cpp and header files) seem to be in the visual studio project?


RE: Develop PVR addons with new cmake build system - FernetMenta - 2015-03-21

building kodi-addon.sln will create the solution with the source files. see post #1


RE: Develop PVR addons with new cmake build system - scarecrow420 - 2015-03-22

(2015-03-21, 18:06)FernetMenta Wrote: building kodi-addon.sln will create the solution with the source files. see post #1

Ah right I get it now. Can i make a suggestion that an explanatory sentence be included at the top of the "For Windows" section in post #1 that briefly outlines at a high level what we are achieving, for those not familiar with cmake? For example something like "We will use cmake to generate a kodi-addons.sln Visual Studio solution, which will then be built to generate the actual addon's Visual Studio solution" Yes i realise the steps do walk through the required actions, but since there is no sort of "this is what we are doing at a high level" statement, I had opened the solution and built it, but somehow missed that there was then ANOTHER generated solution that actually contained the source code etc, and perhaps others may too


Also a question on paths - post #1 mentions that the kodi-addons.sln and actual addon sln are at paths

Code:
\project\cmake\addons\kodi-addons.sln
\project\cmake\addons\pvr.demo-prefix\src\pvr.demo-build\pvr.demo.sln

However at least on my system the paths are (note the \build\ folder)
Code:
\project\cmake\addons\build\kodi-addons.sln
\project\cmake\addons\build\pvr.demo-prefix\src\pvr.demo-build

Note that I used the referenced batch file to do the cmake stuff and didnt strictly follow your commands in post #1 so perhaps that is why mine are in a \build\ folder?


Thanks for the help!


RE: Develop PVR addons with new cmake build system - Montellese - 2015-03-22

(2015-03-22, 05:10)scarecrow420 Wrote: Also a question on paths - post #1 mentions that the kodi-addons.sln and actual addon sln are at paths

Code:
\project\cmake\addons\kodi-addons.sln
\project\cmake\addons\pvr.demo-prefix\src\pvr.demo-build\pvr.demo.sln

However at least on my system the paths are (note the \build\ folder)
Code:
\project\cmake\addons\build\kodi-addons.sln
\project\cmake\addons\build\pvr.demo-prefix\src\pvr.demo-build

Note that I used the referenced batch file to do the cmake stuff and didnt strictly follow your commands in post #1 so perhaps that is why mine are in a \build\ folder?


Thanks for the help!

Yup the paths you see in your build system are correct.


RE: Develop PVR addons with new cmake build system - scarecrow420 - 2015-03-22

Cool, perhaps fernetmenta can update the paths in post #1


RE: Develop PVR addons with new cmake build system - FernetMenta - 2015-03-22

(2015-03-22, 12:41)scarecrow420 Wrote: Cool, perhaps fernetmenta can update the paths in post #1

post #1 is correct. Montellese sets a build folder in his script which results in this different path.

EDIT: i will set this folder too and update post #1


RE: Develop PVR addons with new cmake build system - garbear - 2015-03-23

(2015-03-20, 16:22)wsnipex Wrote: doh, forgot to add, the same goes for ADDONS_TO_BUILD. In standalone mode, there is only 1 addon.

this doesn't seem to be correct. if I omit ADDONS_TO_BUILD, *all* add-ons are fetched (not sure if they're built tho, didn't wait that long)


RE: Develop PVR addons with new cmake build system - ironic_monkey - 2015-03-23

*standalone build*


RE: Develop PVR addons with new cmake build system - garbear - 2015-03-23

right,

Code:
git clone ...game.libretro.git
cd game.libretro
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug \
      -DCMAKE_INSTALL_PREFIX=$HOME/workspace/xbmc/addons \
      $HOME/workspace/xbmc/project/cmake/addons

without adding -DADDONS_TO_BUILD=game.libretro it downloads all add-ons