![]() |
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) |
Develop PVR addons with new cmake build system - FernetMenta - 2015-02-21 We have changed the build system for PVR addons. Now they are built with cmake and every addon has its own repository. CMake (http://www.cmake.org/Wiki/CMake) generates the build environment required for a particular platform. Team-Kodi provides the infrastructure to build PVR addons for the supported plattforms. The addons are maintained in their own repositories from where the build process loads them. The repository is specified in a .txt file in the Kodi source tree. For the pvr.demo addon this is in home/xbmc/progs/src/xbmc/project/cmake/addons/addons/pvr.demo/pvr.demo.txt. You can clone this repository to any location of your system. You also need to clone the Kodi repository which contains common files, libs, and API for the addons. For setup of an development environment follow these steps. The examples are with absolute paths. You can substitute the path to match your systems. Linux: Although in-tree buildings works well, it is recommended to build an addon outside Kodi's tree. I have created a folder "build" in the source tree of the addon. Change to addon's build folder: Code: cd /home/xbmc/progs/src/pvr.demo/build generate build environment with config for debugging Code: 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 Setup Development Environment. Setup your IDE. I use Eclipse and just need to load the sources into my Kodi workspace. This is done by creating a new project form an existing makefile project. Now the addon can be built by this command. I have added it to the project settings of my Eclipse project Code: make -C /home/xbmc/progs/src/pvr.demo/build Windows: Change to addons folder: Code: cd D:\Projects\xbmx\xbmc\project\cmake\addons\build Generate build environment with config for debugging. This command generates a Visual Studio 2013 solution. Code: cmake -DADDONS_TO_BUILD="pvr.demo" -DADDON_SRC_PREFIX="D:\Projects" -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 12" -DCMAKE_USER_MAKE_RULES_OVERRIDE="D:\Projects\xbmx\xbmc\project\cmake\scripts\windows\c-flag-overrides.cmake" -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX="D:\Projects\xbmx\xbmc\project\cmake\scripts\windows\cxx-flag-overrides.cmake" -DCMAKE_INSTALL_PREFIX="D:\Projects\xbmx\xbmc\addons" -DBUILD_DIR="D:\Projects\xbmx\xbmc\project\cmake\addons\build" -DPACKAGE_ZIP=1 "D:\Projects\xbmx\xbmc\project\cmake\addons" Open Visual Studio, load and build this solution: Code: D:\Projects\xbmx\xbmc\project\cmake\addons\build\kodi-addons.sln Setup Development Environment. Open Visual Studio, load Kodi solution. Then add existing solution: Code: D:\Projects\xbmx\xbmc\project\cmake\addons\build\pvr.demo-prefix\src\pvr.demo-build\pvr.demo.sln Create post-build step. Required to copy files for debugging Create Post-Build Event in Visual Studio Code: tbd For a more convenient method see post #9, credits to Montellese who provided this script. RE: Develop PVR addons with new cmake build system - manül - 2015-02-21 Thanks for the instructions! Much appreciated! Imho they're missing the generation of Toolchain.cmake which, among other things, includes compiler flags (e.g. enable C++11) and should be passed to the initial cmake call. Code: cd ./xbmc/tools/depends && ./bootstrap && ./configure --prefix=/opt/xbmc-depends This file should then be passed to cmake using -DCMAKE_TOOLCHAIN_FILE=/opt/xbmc-depends/<arch>/share/Toolchain.cmake You shouldn't generate the build environment inside your source folder. Usually cmake complains if you do this. Best practice is something like this: Code: mkdir /home/xbmc-build RE: Develop PVR addons with new cmake build system - FernetMenta - 2015-02-21 As long as you are not cross compiling you won't need those steps, right? The steps in post #1 worked for native builds on Linux and Windows. C++11 flag does not need depends: https://github.com/Montellese/xbmc/commit/d01c500eb799a6cf3d394a2c837b41e10f6ad04d RE: Develop PVR addons with new cmake build system - garbear - 2015-02-22 Thanks for all your hard work on this FernetMenta, montellese, spiff, wsnipex et. al. When I've gotten game and peripheral add-ons fully in sync I'll post here how everything works. RE: Develop PVR addons with new cmake build system - wsnipex - 2015-02-22 (2015-02-21, 23:36)FernetMenta Wrote: As long as you are not cross compiling you won't need those steps, right? The steps in post #1 worked for native builds on Linux and Windows. Correct. You only need Toolchain and config.site when cross compiling. Not needed for linux and windows. For all other platforms, you must configure unified depends and build native tools first. RE: Develop PVR addons with new cmake build system - wsnipex - 2015-02-22 (2015-02-21, 23:18)manül Wrote: Thanks for the instructions! Much appreciated! binary addons now have their own Toolchain and config.site files: https://github.com/Montellese/xbmc/commit/aece7c44313e53032cf4162b6456698b09b2d88b they also need to be mangled a little before build, which is done when doing make -C depends/target/xbmc-pvr-addons https://github.com/Montellese/xbmc/commit/029359d2f7de84488a7b2d37c6907a8e6895d5d3#diff-4331f22e2921896dd680ed39048db0beR60 RE: Develop PVR addons with new cmake build system - Montellese - 2015-02-22 (2015-02-21, 22:58)FernetMenta Wrote: Generate build environment with config for debugging. This command generates a Visual Studio 2013 solution.You're missing some important cmake flags here, see tools/buildsteps/win32/make-addons.bat. Most important are CMAKE_USER_MAKE_RULES_OVERRIDE and CMAKE_USER_MAKE_RULES_OVERRIDE_CXX because otherwise you build with the wrong compiler flags. Maybe we can put together a batch script for developers. (2015-02-21, 22:58)FernetMenta Wrote: Create post-build step. After the addon has been built we want it to be copied to theJust try setting a different ADDON_INSTALL_PATH when calling cmake i.e. set it to D:\Projects\xbmx\xbmc\addons in your case (see make-addons.bat for that as well). RE: Develop PVR addons with new cmake build system - FernetMenta - 2015-02-22 Thanks! I have updated post #1 RE: Develop PVR addons with new cmake build system - Montellese - 2015-02-22 I've adjusted the existing make-addons.bat used to build binary addons on win32 during the whole build process to a version that can be used to create the build environment for Visual Studio with debug building. Copy https://gist.github.com/Montellese/149ecbd5ca20941d2be4 into tools/buildsteps/win32 and execute it from there. If you want to execute it from somewhere else you need to adjust the default value of WORKDIR in the batch file. Available options are
RE: Develop PVR addons with new cmake build system - dhead - 2015-03-03 Regarding Linux, correct me if I'm wrong, the guide is for compiling with Kodi's tree (outside of it but still using it as a source). What about building without Kodi's tree ? I failed compiling both pvr.hts and pvr.vdr.vnsi with kodi-platfrom and Kodi 15.0a1 installed on my system. I've got no experiecnce with cmake but I expected from the cmake script to auto locate Kodi's headers but it failed to find libXBMC_codec.h even when I manually set KODI_INCLUDE_DIR. Code: cmake -DCMAKE_BUILD_TYPE=Release -DKODI_INCLUDE_DIR="/usr/share/kodi/addons/library.xbmc.codec" so I had to manually set the paths in CMAKE_CXX_FLAGS Code: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-I/usr/share/kodi/addons/library.xbmc.codec -I/usr/include/kodi" but then I get build error about class redefinition (only now I'm starting to learn about cpp) Code: [ 84%] Building CXX object CMakeFiles/pvr.hts.dir/src/HTSPDemuxer.cpp.o RE: Develop PVR addons with new cmake build system - emveepee - 2015-03-03 When building in Windows is something needed to set the prefix? I followed the steps in post #1 and it creates a .dll but the folder layout is cmake\addons\pvr.nextpvr-prefix I assume that should be the commit reference from pvr.nextpvr.txt Martin RE: Develop PVR addons with new cmake build system - Montellese - 2015-03-03 The buildsystem currently doesn't really work standalone and needs to be used as it is integrated in the Kodi codebase. The goal is to get it completely separated (apart from the header files) but right now it isn't. RE: Develop PVR addons with new cmake build system - wsnipex - 2015-03-03 (2015-03-03, 09:01)Montellese Wrote: The buildsystem currently doesn't really work standalone and needs to be used as it is integrated in the Kodi codebase. The goal is to get it completely separated (apart from the header files) but right now it isn't. just to clarify: This is only valid for windows and cross compiled platforms. Linux does work standalone. @dhead: please pastebin the full output. If you have kodi installed in a standard prefix (/usr, /usr/local), it should just work. RE: Develop PVR addons with new cmake build system - dhead - 2015-03-03 @wsnipex http://pastebin.com/hGTDMNRw RE: Develop PVR addons with new cmake build system - ironic_monkey - 2015-03-03 1) don't set any include paths (i get that it's a test) 2) pvr.hts master is broken - it shall include kodi/libXBMC_codec.h not libXBMC_codec.h - naughty hudo ![]() |