Develop PVR addons with new cmake build system

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
negge Offline
yo guysv7may bd latr tomorroe
Posts: 3,719
Joined: Dec 2010
Reputation: 53
Location: Finland
Post: #31
Awesome, thanks, I got it set up just the way I wanted now.
find quote
tent_icle Offline
Junior Member
Posts: 1
Joined: Mar 2015
Reputation: 0
Post: #32
Sorry to ask such a basic question, but I'm new to cmake: would someone be able to give me a hint on how to setup a cmake toolchain file to cross-compile these addons?

I'm just trying to figure out what I need to add to h.duo's instructions for native compiliation. I guess I need a .cmake file to pass to cmake with -DCMAKE_TOOLCHAIN_FILE ? Anything else?
find quote
ironic_monkey Offline
Posting Freak
Posts: 1,457
Joined: Nov 2013
Reputation: 69
Post: #33
have a look at the in-tree build system. it's doing precisely that... a cmake toolchain is generated as part of the tools/depends configure.
find quote
scarecrow420 Offline
Moderator
Posts: 1,377
Joined: Oct 2004
Reputation: 36
Post: #34
this may be the place to ask my question too. in pvr.wmc we have a clientversion.h file that we were previously updating the version in (as well as the addon.xml.in file) and constantly having issues when other people did changes and bumped the xml file without realising there was a header file as well. Is it possible to have the new build system generate our clientversion.h file (or similar) or replace a token in it or whatever, based on the version in the addon.xml file?

pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
find quote
ironic_monkey Offline
Posting Freak
Posts: 1,457
Joined: Nov 2013
Reputation: 69
Post: #35
of course, want me to prepare it ? i did in any case. pull https://github.com/notspiff/pvr.wmc/comm...entversion

i cannot send a pr as my repo aint a fork and i cba to refork right now. but it's based on kodi-pvr/pvr.wmc master so it should pull clean (git pull https://github.com/notspiff/pvr.wmc generate_clientversion).

general cluestick: configure_file(infile outfile @ONLY). placeholders are replaced with the value of the equivalent *cmake variable*. the build_addon macro makes the version available as <PREFIX>_VERSION where PREFIX is given as a parameter (WMC in this case).
(This post was last modified: 2015-03-10 15:01 by ironic_monkey.)
find quote
scarecrow420 Offline
Moderator
Posts: 1,377
Joined: Oct 2004
Reputation: 36
Post: #36
im hpapy to give it a try but would appreciate a bit more of a clue Big Grin the configure_file command seems OK, assumedly i cdreate a template file somewhere (eg clientversion.h.in), containing @[email protected] parameter, and then add a call to configure_file to copy the template file to the right header file and do the parameter replacement, effectively generating the clentversion.h header file. However what im not sure of is if there is already a @[email protected] parameter in existence within cmake that somehow magically knows our pvr.wmc version, or do we have to read it in from the addon.xml file? if so, how to do that?

Also I guess the other thing Im not quite understanding is that if we are using visual studio (as we are windows devs) which I take it we now generate a VS solution/project via running cmake, and if we had this custom cmake command to generate out c++ file that contains the version and is compiled into our addon, would cmake then turn that into a Visual Studio post build event in the VS sln/csproj that it generates, or does it only work when executing cmake on the build servers (and thus our windows IDE/development would infact fail to compile because the header file would be missing, since nothing had generated it?)

pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
(This post was last modified: 2015-03-10 15:10 by scarecrow420.)
find quote
ironic_monkey Offline
Posting Freak
Posts: 1,457
Joined: Nov 2013
Reputation: 69
Post: #37
read my updated post and commit. it's the full thing. the build_addon() macro reads from addon.xml for you and makes it available.

the outlined solution happens at configure time (i.e. when you call cmake) and won't pick up a change to addon.xml on build time. it you want it done on build time, i can do that as well, easily doable, just some slightly more annoying syntax involved.
find quote
ironic_monkey Offline
Posting Freak
Posts: 1,457
Joined: Nov 2013
Reputation: 69
Post: #38
top commit in the branch now does the generation as a build step. touch clientversion.h.in or addon.xml and it's regenerated.
find quote
scarecrow420 Offline
Moderator
Posts: 1,377
Joined: Oct 2004
Reputation: 36
Post: #39
Cool thanks! I'll try and test it tomorrow

pvr.wmc TV addon and ServerWMC Backend Development Team
http://bit.ly/ServerWMC
find quote
garbear Offline
Team-Kodi Developer
Posts: 1,853
Joined: Dec 2010
Reputation: 115
Location: city of angels
Post: #40
I have a quick question about -DADDON_SRC_PREFIX.

I'm trying to piece together a readme for compiling game add-ons with the new cmake build system (https://github.com/kodi-game/game.libret.../Readme.md ) and it looks like I need to set -DADDON_SRC_PREFIX=$HOME/workspace, where $HOME/workspace is the dir I cloned the add-on to, i.e.

Code:
cd $HOME/workspace
git clone https://github.com/kodi-game/game.libretro.git

Is this right, or should it be -DADDON_SRC_PREFIX=$HOME/workspace/game.libretro? Is -DADDON_SRC_PREFIX even used? I get cmake warnings that this var is unused.
find quote
wsnipex Offline
Team-Kodi
Posts: 6,438
Joined: Jun 2011
Reputation: 166
Post: #41
ADDON_SRC_PREFIX must point to the parent dir, so if you do:
Code:
cd $HOME/workspace
git clone https://github.com/kodi-game/game.libretro.git

then -DADDON_SRC_PREFIX=$HOME/workspace
Note that the git dir (game.libretro) must match the addon definition in project/cmake/addons/addons/game.libretro/game.libretro.txt

edit:
you probably also want to pass the list of addons you want to build with -DADDONS_TO_BUILD="game.libretro game.whatever some.other.addon"
(This post was last modified: 2015-03-16 10:03 by wsnipex.)
find quote
garbear Offline
Team-Kodi Developer
Posts: 1,853
Joined: Dec 2010
Reputation: 115
Location: city of angels
Post: #42
thanks, so my readme is correct (at least for that one detail Wink )

my game.libretro.txt file is:

Code:
game.libretro https://github.com/kodi-game/game.libretro 88bf57c

the add-on compiles and runs so I think I'm doing this right
find quote
wsnipex Offline
Team-Kodi
Posts: 6,438
Joined: Jun 2011
Reputation: 166
Post: #43
great. If you want to proof that your local copy is used, just add this line to your adons CMakeLists.txt
Code:
message(FATAL_ERROR "test, bailing out")

and run make. It should then throw this error.
find quote
EricV Offline
Member
Posts: 99
Joined: Aug 2009
Reputation: 1
Post: #44
I tried to compile using the new receipe and its quite unobvious for an non dev:

[quote]
cmake -DADDONS_TO_BUILD=pvr.demo -DADDON_SRC_PREFIX=/home/xbmc/progs/src -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/home/xbmc/progs/src/xbmc/addons -DPACKAGE_ZIP=1 /home/xbmc/progs/src/xbmc/project/cmake/addons
[\quote]

-DCMAKE_INSTALL_PREFIX install the binary addon in the xbmc source tree, why not in the installed tree? So you must redo an install to have it really installed on the target directory. So please document the full procedure

In addition, the current kodi docs/README.linux fails at make -C tools/depends/target/binary-addons PREFIX=/usr/local)
In addition, the current kodi docs/README.pvr still reference the old tree
In addition, pvr.hts reference non existing fields in epg (iYears) and channel_group(iPosition)

diff --git a/src/Tvheadend.cpp b/src/Tvheadend.cpp
index 7cb1047..3d0fd13 100644
--- a/src/Tvheadend.cpp
+++ b/src/Tvheadend.cpp
@@ -130,7 +130,7 @@ PVR_ERROR CTvheadend::GetTags ( ADDON_HANDLE handle )
tag.bIsRadio = false; // TODO: support for radio channel groups.
strncpy(tag.strGroupName, it->second.name.c_str(),
sizeof(tag.strGroupName));
- tag.iPosition = it->second.index;
+ // tag.iPosition = it->second.index;
tags.push_back(tag);
}
}
@@ -684,7 +684,7 @@ void CTvheadend::TransferEvent
epg.strCast = NULL; /* not supported by tvh */
epg.strDirector = NULL; /* not supported by tvh */
epg.strWriter = NULL; /* not supported by tvh */
- epg.iYear = 0; /* not supported by tvh */
+// epg.iYear = 0; /* not supported by tvh */
epg.strIMDBNumber = NULL; /* not supported by tvh */
epg.strIconPath = event.image.c_str();
epg.iGenreType = event.content & 0xF0;
(This post was last modified: 2015-03-19 16:50 by EricV.)
find quote
ironic_monkey Offline
Posting Freak
Posts: 1,457
Joined: Nov 2013
Reputation: 69
Post: #45
good thing non-devs is not a concern then ! ;>

really, forget about the in-tree build unless you are crossing. just build it as normal software

1) execute make install for kodi to install bindings and cmake helpers.
2) build and install kodi-platform from https://github.com/xbmc/kodi-platform

you then build them addons completely like other software. and install them wherever you want, however you want.
find quote
Post Reply