From 9fc8b732737f139d3e466510d75668ab45578960 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 8 Mar 2016 21:02:53 +0100 Subject: sync with upstream --- project/cmake/CMakeLists.txt | 367 ++++++++++++++++++++ project/cmake/README.md | 166 +++++++++ project/cmake/addons/CMakeLists.txt | 156 +++++++-- project/cmake/addons/README | 28 +- .../addons/audioencoder.flac/audioencoder.flac.txt | 1 - .../addons/addons/audioencoder.flac/platforms.txt | 1 - .../addons/audioencoder.lame/audioencoder.lame.txt | 1 - .../addons/addons/audioencoder.lame/platforms.txt | 1 - .../audioencoder.vorbis/audioencoder.vorbis.txt | 1 - .../addons/audioencoder.vorbis/platforms.txt | 1 - .../addons/audioencoder.wav/audioencoder.wav.txt | 1 - .../addons/addons/audioencoder.wav/platforms.txt | 1 - .../cmake/addons/addons/pvr.argustv/platforms.txt | 1 - .../addons/addons/pvr.argustv/pvr.argustv.txt | 1 - project/cmake/addons/addons/pvr.demo/platforms.txt | 1 - project/cmake/addons/addons/pvr.demo/pvr.demo.txt | 1 - .../cmake/addons/addons/pvr.dvblink/platforms.txt | 1 - .../addons/addons/pvr.dvblink/pvr.dvblink.txt | 1 - .../addons/addons/pvr.dvbviewer/platforms.txt | 1 - .../addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt | 1 - .../cmake/addons/addons/pvr.filmon/platforms.txt | 1 - .../cmake/addons/addons/pvr.filmon/pvr.filmon.txt | 1 - project/cmake/addons/addons/pvr.hts/platforms.txt | 1 - project/cmake/addons/addons/pvr.hts/pvr.hts.txt | 1 - .../addons/addons/pvr.iptvsimple/platforms.txt | 1 - .../addons/pvr.iptvsimple/pvr.iptvsimple.txt | 1 - .../addons/pvr.mediaportal.tvserver/platforms.txt | 1 - .../pvr.mediaportal.tvserver.txt | 1 - .../cmake/addons/addons/pvr.mythtv/platforms.txt | 1 - .../cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt | 1 - .../cmake/addons/addons/pvr.nextpvr/platforms.txt | 1 - .../addons/addons/pvr.nextpvr/pvr.nextpvr.txt | 1 - project/cmake/addons/addons/pvr.njoy/platforms.txt | 1 - project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt | 1 - project/cmake/addons/addons/pvr.pctv/platforms.txt | 1 - project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt | 1 - .../cmake/addons/addons/pvr.vdr.vnsi/platforms.txt | 1 - .../addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt | 1 - .../cmake/addons/addons/pvr.vuplus/platforms.txt | 1 - .../cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt | 1 - project/cmake/addons/addons/pvr.wmc/platforms.txt | 1 - project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt | 1 - project/cmake/addons/bootstrap/CMakeLists.txt | 95 ++++++ project/cmake/addons/bootstrap/README.md | 48 +++ project/cmake/addons/bootstrap/bootstrap.cmake | 38 +++ .../bootstrap/repositories/binary-addons.txt | 1 + .../addons/depends/common/kodi-platform/deps.txt | 4 +- .../depends/common/kodi-platform/kodi-platform.txt | 2 +- .../depends/common/p8-platform/p8-platform.txt | 1 + .../addons/depends/common/tinyxml/tinyxml.txt | 2 +- project/cmake/installdata/addon-bindings.txt | 28 ++ project/cmake/installdata/common/addons.txt | 40 +++ project/cmake/installdata/common/common.txt | 13 + project/cmake/installdata/darwin/runtime.txt | 1 + project/cmake/installdata/linux/lirc.txt | 1 + project/cmake/installdata/test-reference-data.txt | 10 + project/cmake/installdata/windows/addons.txt | 1 + project/cmake/installdata/windows/dlls.txt | 6 + project/cmake/installdata/windows/irss.txt | 2 + project/cmake/kodi-config.cmake.in | 22 +- project/cmake/modules/FindAML.cmake | 35 ++ project/cmake/modules/FindASS.cmake | 18 + project/cmake/modules/FindAlsa.cmake | 20 ++ project/cmake/modules/FindAvahi.cmake | 26 ++ project/cmake/modules/FindBluray.cmake | 57 ++++ project/cmake/modules/FindCCache.cmake | 6 + project/cmake/modules/FindCEC.cmake | 58 ++++ project/cmake/modules/FindCXX11.cmake | 18 + project/cmake/modules/FindCdio.cmake | 20 ++ project/cmake/modules/FindCpluff.cmake | 46 +++ project/cmake/modules/FindCrossGUID.cmake | 56 ++++ project/cmake/modules/FindCurl.cmake | 37 ++ project/cmake/modules/FindD3DX11Effects.cmake | 49 +++ project/cmake/modules/FindDbus.cmake | 21 ++ project/cmake/modules/FindEGL.cmake | 48 +++ project/cmake/modules/FindEMBEDDED.cmake | 17 + project/cmake/modules/FindFFMPEG.cmake | 99 ++++++ project/cmake/modules/FindFreeType.cmake | 18 + project/cmake/modules/FindFribidi.cmake | 18 + project/cmake/modules/FindGIF.cmake | 46 +++ project/cmake/modules/FindJsonSchemaBuilder.cmake | 19 ++ project/cmake/modules/FindLibDvd.cmake | 116 +++++++ project/cmake/modules/FindLibSmbClient.cmake | 65 ++++ project/cmake/modules/FindLibUSB.cmake | 45 +++ project/cmake/modules/FindLzo2.cmake | 22 ++ project/cmake/modules/FindMMAL.cmake | 36 ++ project/cmake/modules/FindMicroHttpd.cmake | 106 ++++++ project/cmake/modules/FindMySqlClient.cmake | 53 +++ project/cmake/modules/FindNFS.cmake | 58 ++++ project/cmake/modules/FindOpenGLES.cmake | 48 +++ project/cmake/modules/FindOpenGl.cmake | 43 +++ project/cmake/modules/FindPCRE.cmake | 91 +++++ project/cmake/modules/FindPlist.cmake | 58 ++++ project/cmake/modules/FindPulseAudio.cmake | 72 ++++ project/cmake/modules/FindPython.cmake | 43 +++ project/cmake/modules/FindRTMP.cmake | 21 ++ project/cmake/modules/FindSSE.cmake | 105 ++++++ project/cmake/modules/FindSSH.cmake | 21 ++ project/cmake/modules/FindSWIG.cmake | 14 + project/cmake/modules/FindSdl.cmake | 46 +++ project/cmake/modules/FindShairplay.cmake | 63 ++++ project/cmake/modules/FindSqlite3.cmake | 19 ++ project/cmake/modules/FindTagLib.cmake | 62 ++++ project/cmake/modules/FindTexturePacker.cmake | 23 ++ project/cmake/modules/FindTinyXML.cmake | 68 ++++ project/cmake/modules/FindUDev.cmake | 22 ++ project/cmake/modules/FindUUID.cmake | 43 +++ project/cmake/modules/FindVAAPI.cmake | 47 +++ project/cmake/modules/FindVDPAU.cmake | 32 ++ project/cmake/modules/FindX.cmake | 21 ++ project/cmake/modules/FindXRandR.cmake | 22 ++ project/cmake/modules/FindXslt.cmake | 18 + project/cmake/modules/FindYajl.cmake | 27 ++ project/cmake/modules/FindZip.cmake | 46 +++ project/cmake/platform/darwin/defines.txt | 1 - project/cmake/platform/osx/defines.txt | 1 + project/cmake/scripts/android/archsetup.cmake | 30 ++ project/cmake/scripts/android/install.cmake | 0 project/cmake/scripts/android/macros.cmake | 1 + project/cmake/scripts/android/pathsetup.cmake | 1 + project/cmake/scripts/common/addon-helpers.cmake | 80 ++++- project/cmake/scripts/common/archsetup.cmake | 99 ++++++ project/cmake/scripts/common/checkcommits.cmake | 75 +++++ .../scripts/common/generateversionedfiles.cmake | 13 + project/cmake/scripts/common/generatorsetup.cmake | 24 ++ project/cmake/scripts/common/macros.cmake | 373 +++++++++++++++++++++ project/cmake/scripts/common/managestring.cmake | 235 +++++++++++++ project/cmake/scripts/common/pathsetup.cmake | 3 + project/cmake/scripts/common/prepare-env.cmake | 33 +- project/cmake/scripts/common/projectmacros.cmake | 84 +++++ project/cmake/scripts/darwin/archsetup.cmake | 34 ++ project/cmake/scripts/darwin/install.cmake | 0 project/cmake/scripts/darwin/macros.cmake | 108 ++++++ project/cmake/scripts/darwin/pathsetup.cmake | 32 ++ project/cmake/scripts/freebsd/archsetup.cmake | 19 ++ project/cmake/scripts/freebsd/install.cmake | 58 ++++ project/cmake/scripts/freebsd/macros.cmake | 1 + project/cmake/scripts/freebsd/pathsetup.cmake | 1 + project/cmake/scripts/ios/archsetup.cmake | 38 +++ project/cmake/scripts/ios/install.cmake | 1 + project/cmake/scripts/ios/macros.cmake | 1 + project/cmake/scripts/ios/pathsetup.cmake | 1 + project/cmake/scripts/linux/archsetup.cmake | 21 ++ project/cmake/scripts/linux/install.cmake | 93 +++++ project/cmake/scripts/linux/macros.cmake | 79 +++++ project/cmake/scripts/linux/pathsetup.cmake | 34 ++ project/cmake/scripts/rbpi/archsetup.cmake | 32 ++ project/cmake/scripts/rbpi/install.cmake | 1 + project/cmake/scripts/rbpi/macros.cmake | 1 + project/cmake/scripts/rbpi/pathsetup.cmake | 1 + project/cmake/scripts/windows/archsetup.cmake | 91 +++++ project/cmake/scripts/windows/install.cmake | 0 project/cmake/scripts/windows/macros.cmake | 143 ++++++++ project/cmake/scripts/windows/pathsetup.cmake | 34 ++ project/cmake/treedata/android/subdirs.txt | 16 + project/cmake/treedata/common/addons.txt | 7 + project/cmake/treedata/common/cores.txt | 8 + project/cmake/treedata/common/events.txt | 2 + project/cmake/treedata/common/externals.txt | 3 + project/cmake/treedata/common/filesystem.txt | 3 + project/cmake/treedata/common/interfaces.txt | 9 + project/cmake/treedata/common/music.txt | 5 + project/cmake/treedata/common/network.txt | 6 + project/cmake/treedata/common/peripherals.txt | 4 + project/cmake/treedata/common/profiles.txt | 3 + project/cmake/treedata/common/pvr.txt | 7 + project/cmake/treedata/common/settings.txt | 4 + project/cmake/treedata/common/subdirs.txt | 25 ++ project/cmake/treedata/common/tests.txt | 10 + project/cmake/treedata/common/video.txt | 5 + project/cmake/treedata/common/videoplayer.txt | 12 + project/cmake/treedata/darwin/subdirs.txt | 12 + project/cmake/treedata/freebsd/subdirs.txt | 4 + project/cmake/treedata/ios/subdirs.txt | 15 + project/cmake/treedata/linux/subdirs.txt | 12 + project/cmake/treedata/optional/common/X11.txt | 1 + project/cmake/treedata/optional/common/cec.txt | 1 + project/cmake/treedata/optional/common/nonfree.txt | 1 + project/cmake/treedata/optional/common/opengl.txt | 1 + .../cmake/treedata/optional/common/opengles.txt | 1 + project/cmake/treedata/rbpi/omxplayer.txt | 1 + project/cmake/treedata/rbpi/subdirs.txt | 12 + project/cmake/treedata/windows/subdirs.txt | 15 + 183 files changed, 5365 insertions(+), 95 deletions(-) create mode 100644 project/cmake/CMakeLists.txt create mode 100644 project/cmake/README.md delete mode 100644 project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt delete mode 100644 project/cmake/addons/addons/audioencoder.flac/platforms.txt delete mode 100644 project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt delete mode 100644 project/cmake/addons/addons/audioencoder.lame/platforms.txt delete mode 100644 project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt delete mode 100644 project/cmake/addons/addons/audioencoder.vorbis/platforms.txt delete mode 100644 project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt delete mode 100644 project/cmake/addons/addons/audioencoder.wav/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.argustv/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt delete mode 100644 project/cmake/addons/addons/pvr.demo/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.demo/pvr.demo.txt delete mode 100644 project/cmake/addons/addons/pvr.dvblink/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt delete mode 100644 project/cmake/addons/addons/pvr.dvbviewer/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt delete mode 100644 project/cmake/addons/addons/pvr.filmon/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt delete mode 100644 project/cmake/addons/addons/pvr.hts/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.hts/pvr.hts.txt delete mode 100644 project/cmake/addons/addons/pvr.iptvsimple/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt delete mode 100644 project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt delete mode 100644 project/cmake/addons/addons/pvr.mythtv/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt delete mode 100644 project/cmake/addons/addons/pvr.nextpvr/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt delete mode 100644 project/cmake/addons/addons/pvr.njoy/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt delete mode 100644 project/cmake/addons/addons/pvr.pctv/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt delete mode 100644 project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt delete mode 100644 project/cmake/addons/addons/pvr.vuplus/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt delete mode 100644 project/cmake/addons/addons/pvr.wmc/platforms.txt delete mode 100644 project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt create mode 100644 project/cmake/addons/bootstrap/CMakeLists.txt create mode 100644 project/cmake/addons/bootstrap/README.md create mode 100644 project/cmake/addons/bootstrap/bootstrap.cmake create mode 100644 project/cmake/addons/bootstrap/repositories/binary-addons.txt create mode 100644 project/cmake/addons/depends/common/p8-platform/p8-platform.txt create mode 100644 project/cmake/installdata/addon-bindings.txt create mode 100644 project/cmake/installdata/common/addons.txt create mode 100644 project/cmake/installdata/common/common.txt create mode 100644 project/cmake/installdata/darwin/runtime.txt create mode 100644 project/cmake/installdata/linux/lirc.txt create mode 100644 project/cmake/installdata/test-reference-data.txt create mode 100644 project/cmake/installdata/windows/addons.txt create mode 100644 project/cmake/installdata/windows/dlls.txt create mode 100644 project/cmake/installdata/windows/irss.txt create mode 100644 project/cmake/modules/FindAML.cmake create mode 100644 project/cmake/modules/FindASS.cmake create mode 100644 project/cmake/modules/FindAlsa.cmake create mode 100644 project/cmake/modules/FindAvahi.cmake create mode 100644 project/cmake/modules/FindBluray.cmake create mode 100644 project/cmake/modules/FindCCache.cmake create mode 100644 project/cmake/modules/FindCEC.cmake create mode 100644 project/cmake/modules/FindCXX11.cmake create mode 100644 project/cmake/modules/FindCdio.cmake create mode 100644 project/cmake/modules/FindCpluff.cmake create mode 100644 project/cmake/modules/FindCrossGUID.cmake create mode 100644 project/cmake/modules/FindCurl.cmake create mode 100644 project/cmake/modules/FindD3DX11Effects.cmake create mode 100644 project/cmake/modules/FindDbus.cmake create mode 100644 project/cmake/modules/FindEGL.cmake create mode 100644 project/cmake/modules/FindEMBEDDED.cmake create mode 100644 project/cmake/modules/FindFFMPEG.cmake create mode 100644 project/cmake/modules/FindFreeType.cmake create mode 100644 project/cmake/modules/FindFribidi.cmake create mode 100644 project/cmake/modules/FindGIF.cmake create mode 100644 project/cmake/modules/FindJsonSchemaBuilder.cmake create mode 100644 project/cmake/modules/FindLibDvd.cmake create mode 100644 project/cmake/modules/FindLibSmbClient.cmake create mode 100644 project/cmake/modules/FindLibUSB.cmake create mode 100644 project/cmake/modules/FindLzo2.cmake create mode 100644 project/cmake/modules/FindMMAL.cmake create mode 100644 project/cmake/modules/FindMicroHttpd.cmake create mode 100644 project/cmake/modules/FindMySqlClient.cmake create mode 100644 project/cmake/modules/FindNFS.cmake create mode 100644 project/cmake/modules/FindOpenGLES.cmake create mode 100644 project/cmake/modules/FindOpenGl.cmake create mode 100644 project/cmake/modules/FindPCRE.cmake create mode 100644 project/cmake/modules/FindPlist.cmake create mode 100644 project/cmake/modules/FindPulseAudio.cmake create mode 100644 project/cmake/modules/FindPython.cmake create mode 100644 project/cmake/modules/FindRTMP.cmake create mode 100644 project/cmake/modules/FindSSE.cmake create mode 100644 project/cmake/modules/FindSSH.cmake create mode 100644 project/cmake/modules/FindSWIG.cmake create mode 100644 project/cmake/modules/FindSdl.cmake create mode 100644 project/cmake/modules/FindShairplay.cmake create mode 100644 project/cmake/modules/FindSqlite3.cmake create mode 100644 project/cmake/modules/FindTagLib.cmake create mode 100644 project/cmake/modules/FindTexturePacker.cmake create mode 100644 project/cmake/modules/FindTinyXML.cmake create mode 100644 project/cmake/modules/FindUDev.cmake create mode 100644 project/cmake/modules/FindUUID.cmake create mode 100644 project/cmake/modules/FindVAAPI.cmake create mode 100644 project/cmake/modules/FindVDPAU.cmake create mode 100644 project/cmake/modules/FindX.cmake create mode 100644 project/cmake/modules/FindXRandR.cmake create mode 100644 project/cmake/modules/FindXslt.cmake create mode 100644 project/cmake/modules/FindYajl.cmake create mode 100644 project/cmake/modules/FindZip.cmake delete mode 100644 project/cmake/platform/darwin/defines.txt create mode 100644 project/cmake/platform/osx/defines.txt create mode 100644 project/cmake/scripts/android/archsetup.cmake create mode 100644 project/cmake/scripts/android/install.cmake create mode 120000 project/cmake/scripts/android/macros.cmake create mode 120000 project/cmake/scripts/android/pathsetup.cmake create mode 100644 project/cmake/scripts/common/archsetup.cmake create mode 100644 project/cmake/scripts/common/checkcommits.cmake create mode 100644 project/cmake/scripts/common/generateversionedfiles.cmake create mode 100644 project/cmake/scripts/common/generatorsetup.cmake create mode 100644 project/cmake/scripts/common/macros.cmake create mode 100644 project/cmake/scripts/common/managestring.cmake create mode 100644 project/cmake/scripts/common/pathsetup.cmake create mode 100644 project/cmake/scripts/common/projectmacros.cmake create mode 100644 project/cmake/scripts/darwin/archsetup.cmake create mode 100644 project/cmake/scripts/darwin/install.cmake create mode 100644 project/cmake/scripts/darwin/macros.cmake create mode 100644 project/cmake/scripts/darwin/pathsetup.cmake create mode 100644 project/cmake/scripts/freebsd/archsetup.cmake create mode 100644 project/cmake/scripts/freebsd/install.cmake create mode 100644 project/cmake/scripts/freebsd/macros.cmake create mode 100644 project/cmake/scripts/freebsd/pathsetup.cmake create mode 100644 project/cmake/scripts/ios/archsetup.cmake create mode 120000 project/cmake/scripts/ios/install.cmake create mode 120000 project/cmake/scripts/ios/macros.cmake create mode 120000 project/cmake/scripts/ios/pathsetup.cmake create mode 100644 project/cmake/scripts/linux/archsetup.cmake create mode 100644 project/cmake/scripts/linux/install.cmake create mode 100644 project/cmake/scripts/linux/macros.cmake create mode 100644 project/cmake/scripts/linux/pathsetup.cmake create mode 100644 project/cmake/scripts/rbpi/archsetup.cmake create mode 120000 project/cmake/scripts/rbpi/install.cmake create mode 120000 project/cmake/scripts/rbpi/macros.cmake create mode 120000 project/cmake/scripts/rbpi/pathsetup.cmake create mode 100644 project/cmake/scripts/windows/archsetup.cmake create mode 100644 project/cmake/scripts/windows/install.cmake create mode 100644 project/cmake/scripts/windows/macros.cmake create mode 100644 project/cmake/scripts/windows/pathsetup.cmake create mode 100644 project/cmake/treedata/android/subdirs.txt create mode 100644 project/cmake/treedata/common/addons.txt create mode 100644 project/cmake/treedata/common/cores.txt create mode 100644 project/cmake/treedata/common/events.txt create mode 100644 project/cmake/treedata/common/externals.txt create mode 100644 project/cmake/treedata/common/filesystem.txt create mode 100644 project/cmake/treedata/common/interfaces.txt create mode 100644 project/cmake/treedata/common/music.txt create mode 100644 project/cmake/treedata/common/network.txt create mode 100644 project/cmake/treedata/common/peripherals.txt create mode 100644 project/cmake/treedata/common/profiles.txt create mode 100644 project/cmake/treedata/common/pvr.txt create mode 100644 project/cmake/treedata/common/settings.txt create mode 100644 project/cmake/treedata/common/subdirs.txt create mode 100644 project/cmake/treedata/common/tests.txt create mode 100644 project/cmake/treedata/common/video.txt create mode 100644 project/cmake/treedata/common/videoplayer.txt create mode 100644 project/cmake/treedata/darwin/subdirs.txt create mode 100644 project/cmake/treedata/freebsd/subdirs.txt create mode 100644 project/cmake/treedata/ios/subdirs.txt create mode 100644 project/cmake/treedata/linux/subdirs.txt create mode 100644 project/cmake/treedata/optional/common/X11.txt create mode 100644 project/cmake/treedata/optional/common/cec.txt create mode 100644 project/cmake/treedata/optional/common/nonfree.txt create mode 100644 project/cmake/treedata/optional/common/opengl.txt create mode 100644 project/cmake/treedata/optional/common/opengles.txt create mode 100644 project/cmake/treedata/rbpi/omxplayer.txt create mode 100644 project/cmake/treedata/rbpi/subdirs.txt create mode 100644 project/cmake/treedata/windows/subdirs.txt (limited to 'project') diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt new file mode 100644 index 0000000..03b3752 --- /dev/null +++ b/project/cmake/CMakeLists.txt @@ -0,0 +1,367 @@ +cmake_minimum_required(VERSION 3.1) +project(kodi) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules) +if(DEPENDS_DIR) + list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR}) +endif() + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +# general +option(VERBOSE "Enable verbose output?" OFF) +option(ENABLE_DVDCSS "Enable libdvdcss support?" ON) +option(ENABLE_UPNP "Enable UPnP support?" ON) +option(ENABLE_NONFREE "Enable non-free components?" ON) +option(ENABLE_MICROHTTPD "Enable MicroHttpd webserver?" ON) +option(ENABLE_MYSQLCLIENT "Enable MySql support?" ON) +option(ENABLE_AVAHI "Enable Avahi support?" ON) +option(ENABLE_RTMP "Enable RTMP support?" ON) +option(ENABLE_BLURAY "Enable BluRay support?" ON) +option(ENABLE_PLIST "Enable AirPlay support?" ON) +option(ENABLE_NFS "Enable NFS support?" ON) +option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) +option(ENABLE_CEC "Enable CEC support?" ON) +if(UNIX) + if(NOT APPLE) + option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON) + else() + option(ENABLE_VTB "Enable VTB support?" OFF) + endif() + option(FFMPEG_PATH "Path to external ffmpeg?" "") + option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) + option(ENABLE_ALSA "Enable ALSA support?" ON) + option(ENABLE_PULSEAUDIO "Enable PulseAudio support?" ON) + option(ENABLE_DBUS "Enable dbus support?" ON) + option(ENABLE_LIBUSB "Enable libusb support?" ON) + option(ENABLE_UDEV "Enable UDev support?" ON) + option(ENABLE_OPENGL "Enable OpenGL?" ON) + option(ENABLE_OPENGLES "Enable OpenGLES?" ON) + option(ENABLE_OPENSSL "Enable OpenSSL?" ON) + option(ENABLE_SDL "Enable SDL?" OFF) + option(ENABLE_X11 "Enable X11 support?" ON) + option(ENABLE_EGL "Enable EGL?" OFF) + option(ENABLE_VAAPI "Enable VAAPI support?" ON) + option(ENABLE_VDPAU "Enable VDPAU support?" ON) + option(ENABLE_OPTICAL "Enable optical support?" ON) +endif() +# System options +if(NOT WIN32) + option(WITH_ARCH "build with given arch" OFF) + option(WITH_CPU "build with given cpu" OFF) + option(ENABLE_CCACHE "Enable Ccache support" ON) +endif() + +get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../.. ABSOLUTE) +set(CORE_BUILD_DIR build) + +include(scripts/common/generatorsetup.cmake) +include(scripts/common/addoptions.cmake) +include(scripts/common/archsetup.cmake) +include(scripts/common/macros.cmake) +include(scripts/common/managestring.cmake) +include(scripts/common/projectmacros.cmake) +include(scripts/common/pathsetup.cmake) +include(ExternalProject) + +core_find_git_rev() +core_find_versions() + +set(INCLUDES ${CORE_SOURCE_DIR} + ${CORE_SOURCE_DIR}/addons/library.xbmc.addon + ${CORE_SOURCE_DIR}/lib + ${CORE_SOURCE_DIR}/lib/gtest/include + ${CORE_SOURCE_DIR}/xbmc + ${CORE_SOURCE_DIR}/xbmc/${PLATFORM_DIR} + ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) + +find_package(PkgConfig) +if(CMAKE_CROSSCOMPILING) + if(PKG_CONFIG_EXECUTABLE) + message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}") + set(PKG_CONFIG_FOUND TRUE) + endif() +endif() + +find_package(Threads REQUIRED) +list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT}) + +# Required dependencies +set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd + TinyXML Python Yajl Xslt + JPEG Lzo2 Fribidi TagLib FFMPEG CrossGUID) +if(NOT WIN32) + list(APPEND required_deps LibSmbClient ZLIB) +else() + list(APPEND required_deps D3DX11Effects) +endif() +if(CORE_SYSTEM_NAME STREQUAL android) + list(APPEND required_deps Zip) +endif() + +# Optional dependencies +set(optional_deps MicroHttpd MySqlClient SSH + Alsa UDev Dbus Avahi + PulseAudio VDPAU VAAPI) + +# Required, dyloaded deps +set(required_dyload Curl ASS) + +# Optional, dyloaded deps +set(dyload_optional RTMP CEC Bluray Plist NFS) + +# Required by shared objects we link +set(required_dep_libs PNG EXPAT) + +# Required tools +find_package(TexturePacker REQUIRED) +find_package(JsonSchemaBuilder REQUIRED) + +foreach(dep ${required_dep_libs}) + find_package(${dep} REQUIRED) +endforeach() + +foreach(dep ${required_deps}) + core_require_dep(${dep}) +endforeach() + +foreach(dep ${optional_deps}) + core_optional_dep(${dep}) +endforeach() + +if(NOT UDEV_FOUND) + core_optional_dep(LibUSB) +endif() + +foreach(dep ${required_dyload}) + core_require_dyload_dep(${dep}) +endforeach() + +foreach(dep ${dyload_optional}) + core_optional_dyload_dep(${dep}) +endforeach() + +if(ENABLE_OPENSSL) + core_require_dep(OpenSSL) + list(APPEND DEP_DEFINES "-DHAVE_OPENSSL=1") +endif() + +if(ENABLE_UPNP) + list(APPEND DEP_DEFINES "-DUSE_UPNP=1") +endif() + +if(ENABLE_NONFREE) + list(APPEND DEP_DEFINES "-DHAVE_XBMC_NONFREE=1") +endif() + +if(ENABLE_OPTICAL) + list(APPEND DEP_DEFINES -DHAS_DVD_DRIVE) + core_require_dep(Cdio) +endif() + +if(ENABLE_AIRTUNES) + find_package(Shairplay) + if(SHAIRPLAY_FOUND) + core_require_dyload_dep(Shairplay) + endif() +endif() + +if(ENABLE_VTB) + list(APPEND DEP_DEFINES -DHAVE_VIDEOTOOLBOXDECODER=1) +endif() + +if(NOT WIN32) + core_optional_dep(OpenGl) + if(OPENGL_FOUND) + if(NOT APPLE) + core_optional_dep(Sdl) + else() + core_require_dep(Sdl) + endif() + core_optional_dep(X ENABLE_X11) + core_optional_dep(XRandR ENABLE_X11) + else() + core_optional_dep(OpenGLES ENABLE_OPENGLES) + if(OPENGLES_FOUND) + core_optional_dep(EGL ENABLE_EGL) + core_optional_dep(OMX ENABLE_OMX) + core_optional_dep(AML ENABLE_AML) + core_optional_dep(X ENABLE_X11) + core_optional_dep(Sdl) + endif() + endif() + + if(CORE_SYSTEM_NAME STREQUAL rbpi) + core_require_dep(MMAL) + endif() +endif() + +if(ENABLE_CCACHE) + core_optional_dep(CCache) +endif() + +# Compile Info +add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp + COMMAND ${CMAKE_COMMAND} -DCORE_SOURCE_DIR=${CORE_SOURCE_DIR} + -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + -DCORE_BUILD_DIR=${CORE_BUILD_DIR} + -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} + -DARCH_DEFINES="${ARCH_DEFINES}" + -DAPP_SCMID=${APP_SCMID} + -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -P ${PROJECT_SOURCE_DIR}/scripts/common/generateversionedfiles.cmake + DEPENDS ${CORE_SOURCE_DIR}/version.txt + ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in + ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in + ${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in) +list(APPEND install_data addons/xbmc.addon/addon.xml) +add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp) +target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}") + +# RC File +if(WIN32) + configure_file(${CORE_SOURCE_DIR}/xbmc/win32/XBMC_PC.rc.in + ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc @ONLY) + add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc) + target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media) + set(RESOURCES $) +endif() + +include_directories(${INCLUDES} ${SYSTEM_INCLUDES}) +add_compile_options(${ARCH_DEFINES} "${SYSTEM_DEFINES}" ${DEP_DEFINES} ${PATH_DEFINES}) + +set(core_DEPENDS "" CACHE STRING "" FORCE) +set(test_archives "" CACHE STRING "" FORCE) +set(test_sources "" CACHE STRING "" FORCE) +mark_as_advanced(core_DEPENDS) +mark_as_advanced(test_archives) +mark_as_advanced(test_sources) + +file(STRINGS ${PROJECT_SOURCE_DIR}/installdata/addon-bindings.txt bindings) +foreach(binding ${bindings}) + list(APPEND addon_bindings ${CORE_SOURCE_DIR}/${binding}) +endforeach() + +add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL) + +# Subdirs +core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt + ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt) +core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt + ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt) + +# copy files to build tree +copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt + ${PROJECT_SOURCE_DIR}/installdata/${CORE_SYSTEM_NAME}/*.txt) + +list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estuary\;${CORE_SOURCE_DIR}") +list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estouchy\;${CORE_SOURCE_DIR}") + +# These are skins that are copied into place from the source tree +foreach(skin ${SKINS}) + list(GET skin 0 dir) + list(GET skin 1 relative) + copy_skin_to_buildtree(${dir} ${relative}) +endforeach() + +add_custom_target(pack-skins ALL + DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES}) + +core_link_library(exif system/libexif) +if(CORE_SYSTEM_NAME STREQUAL linux) + core_link_library(sse4 system/libsse4) +endif() + +core_link_library(XBMC_addon addons/library.xbmc.addon/libXBMC_addon) +core_link_library(XBMC_codec addons/library.xbmc.codec/libXBMC_codec) +core_link_library(KODI_guilib addons/library.kodi.guilib/libKODI_guilib) +core_link_library(KODI_adsp addons/library.kodi.adsp/libKODI_adsp) +core_link_library(XBMC_pvr addons/library.xbmc.pvr/libXBMC_pvr) + +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer) +add_custom_target(wrap-libraries ALL DEPENDS ${WRAP_FILES}) + +set(LIBCEC_SONAME "${CEC_SONAME}") +if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android) + configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated.h.in + ${CORE_BUILD_DIR}/DllPaths_generated.h @ONLY) +elseif(CORE_SYSTEM_NAME STREQUAL android) + configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated_android.h.in + ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY) +endif() + +# Codegen +add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig) + +# Other files (IDE) +set(OTHER_FILES README.md) + +# main binary +add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} $ "${RESOURCES}" ${OTHER_FILES}) +whole_archive(_MAIN_LIBRARIES ${core_DEPENDS}) +target_link_libraries(${APP_NAME_LC} ${SYSTEM_LDFLAGS} ${_MAIN_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) +unset(_MAIN_LIBRARIES) +add_dependencies(${APP_NAME_LC} export-files) +if(NOT WIN32) + set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") +else() + set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) + copy_main_dlls_to_buildtree() +endif() + +# testing +copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt 1) +add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp $) +whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest ${test_archives}) +target_link_libraries(${APP_NAME_LC}-test ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) +unset(_TEST_LIBRARIES) +add_dependencies(${APP_NAME_LC}-test export-files) + +# make test and make check (cannot be executed when cross compiling) +if(NOT CMAKE_CROSSCOMPILING) + enable_testing() + gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources}) + add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) + add_dependencies(check ${APP_NAME_LC}-test) + + # For testing commit series + add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/checkcommits.cmake + -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}) +endif() + +# link wrapper +if(FFMPEG_LINK_EXECUTABLE) + set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}") +endif() + +# randr +if(ENABLE_X11 AND XRANDR_FOUND) + add_executable(kodi-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c) + target_link_libraries(kodi-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES}) +endif() + +# XBMCHelper +if(CORE_SYSTEM_TYPE STREQUAL darwin) + add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper) +endif() + +include(scripts/${CORE_SYSTEM_NAME}/install.cmake) + +# Status +message(STATUS "#---- CONFIGURATION ----#") +foreach(msg ${final_message}) + message(STATUS ${msg}) +endforeach() + +if(VERBOSE) + message(STATUS "\n#---- Internal Variables ----# ") + message(STATUS "DEPLIBS: ${DEPLIBS}") + message(STATUS "SYSTEM_LDFLAGS: ${SYSTEM_LDFLAGS}") + message(STATUS "core_DEPENDS: ${core_DEPENDS}") + message(STATUS "CMAKE_DL_LIBS: ${CMAKE_DL_LIBS}") +endif() +message(STATUS "#-----------------------#") + diff --git a/project/cmake/README.md b/project/cmake/README.md new file mode 100644 index 0000000..c0f94d8 --- /dev/null +++ b/project/cmake/README.md @@ -0,0 +1,166 @@ +# Kodi CMake based buildsystem + +This files describes Kodi's CMake based buildsystem. CMake is a cross-platform +tool for generating makefiles as well as project files used by IDEs. + +The current version of the buildsystem is capable of building the main Kodi +executable (but no packaging or dependency management yet) for the following +platforms: + +- Linux (GNU Makefiles) +- Windows (NMake Makefiles, Visual Studio 12 (2013)) +- OSX (GNU Makefiles, Xcode) +- Android (GNU Makefiles) + +Before building Kodi with CMake, please ensure that you have the platform +specific dependencies installed. + +While the legacy build systems typically used in-source builds it's recommended +to use out-of-source builds with CMake. The necessary runtime dependencies such +as dlls, skins and configuration files are copied over to the build directory +automatically. + +## Dependency installation + +### Linux + +The dependencies required to build on Linux can be found in +[docs/README.xxx](https://github.com/xbmc/xbmc/tree/master/docs). + +### Raspberry Pi + +The cross compilation environment for the Raspberry Pi as well as the +dependencies have to be installed as explained in +[docs/README.raspberrypi](https://github.com/xbmc/xbmc/tree/master/docs/README.raspberrypi). + +### Windows + +For Windows the dependencies can be found in the +[Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should +install the [Windows Software Development Kit (SDK)](https://dev.windows.com/en-us/downloads/sdk-archive) for your Windows version. This is required for HLSL shader offline compiling with the [Effect-Compiler Tool](https://msdn.microsoft.com/de-de/library/windows/desktop/bb232919(v=vs.85).aspx) (fxc.exe). + +On Windows, the CMake based buildsystem requires that the binary dependencies +are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat` +and that the mingw libs (ffmpeg, libdvd and others) are built using +`make-mingwlibs.bat`. + +### OSX + +For OSX the required dependencies can be found in +[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx). + +On OSX it is necessary to build the dependencies in `tools/depends` using +`./bootstrap && ./configure --host= && make`. The other steps such +as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed +as these steps are covered already by the CMake project. + +### Android + +The dependencies needed to compile for Android can be found in +[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.android) +. All described steps have to be executed (except 5.2 which is replaced by the +respective CMake command below). + +## Building Kodi + +This section lists the necessary commands for building Kodi with CMake. +CMake supports different generators that can be classified into two categories: +single- and multiconfiguration generators. + +A single configuration generator (GNU/NMake Makefiles) generates project files +for a single build type (e.g. Debug, Release) specified at configure time. +Multi configuration generators (Visual Studio, Xcode) allow to specify the +build type at compile time. + +All examples below are for out-of-source builds with Kodi checked out to +``: + +``` +mkdir kodi-build && cd kodi-build +``` + +### Linux with GNU Makefiles + +``` +cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) +./kodi.bin +``` + +`CMAKE_BUILD_TYPE` defaults to `Release`. + +### Raspberry Pi with GNU Makefiles + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) +``` + +### Windows with NMake Makefiles + +``` +cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release /project/cmake/ +cmake --build . # or: nmake +kodi.exe +``` + +### Windows with Visual Studio project files + +``` +cmake -G "Visual Studio 12" /project/cmake/ +cmake --build . --config "Debug" # or: Build solution with Visual Studio +set KODI_HOME="%CD%" && Debug\kodi.exe +``` + +### OSX with GNU Makefiles + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sysctl -n hw.ncpu) +./kodi.bin +``` + +### OSX with Xcode project files + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake -G "Xcode" /project/cmake/ +cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode +KODI_HOME=$(pwd) ./Release/kodi.bin +``` + +### Android with GNU Makefiles + +``` +cmake -DCMAKE_TOOLCHAIN_FILE=/tools/depends/target/Toolchain.cmake /project/cmake/ +cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc) +``` + +## Extra targets + +When using the makefile builds a few extra targets are defined: + +- `make check` builds and executes the test suite. + +## Debugging the build + +This section covers some tips that can be useful for debugging a CMake +based build. + +### Verbosity (show compiler and linker parameters) + +In order to see the exact compiler commands `make` and `nmake` can be +executed with a `VERBOSE=1` parameter. + +On Windows, this is unfortunately not enough because `nmake` uses +temporary files to workaround `nmake`'s command string length limitations. +In order to see verbose output the file +[Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40) +in the local CMake installation has to be adapted by uncommenting these +lines: + +``` +# uncomment these out to debug nmake and borland makefiles +#set(CMAKE_START_TEMP_FILE "") +#set(CMAKE_END_TEMP_FILE "") +#set(CMAKE_VERBOSE_MAKEFILE 1) +``` diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt index 0773713..8fc1a23 100644 --- a/project/cmake/addons/CMakeLists.txt +++ b/project/cmake/addons/CMakeLists.txt @@ -1,15 +1,31 @@ project(kodi-addons) -cmake_minimum_required(VERSION 2.8) +if(WIN32) + # there seems to be a bug in the CMake generator implementation in CMake 2.8.x releases for WIN32 + cmake_minimum_required(VERSION 3.0) +else() + cmake_minimum_required(VERSION 2.8) +endif() list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) +option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON) +if(ADDON_TARBALL_CACHING) + message(STATUS "Addon source tarball caching is enabled") +else() + message(STATUS "Addon source tarball caching is disabled") +endif() + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Release) endif() if(NOT CORE_SYSTEM_NAME) - string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CORE_SYSTEM_NAME "osx") + else() + string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) + endif() endif() include(ExternalProject) @@ -65,6 +81,7 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} -DCMAKE_INSTALL_PREFIX:PATH= -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig + -DDEPENDS_PATH=${DEPENDS_PATH} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE} -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} @@ -78,16 +95,26 @@ if(MSVC) set_property(GLOBAL PROPERTY USE_FOLDERS ON) endif() +option(PACKAGE_ZIP "Prepare built addons for packaging" OFF) if(PACKAGE_ZIP) # needed for project installing - list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1) - MESSAGE("package zip specified") + list(APPEND BUILD_ARGS -DPACKAGE_ZIP=ON) + + # figure out where to store the packaged ZIP archives + if(NOT PACKAGE_DIR) + set(PACKAGE_DIR "${BUILD_DIR}/zips") + else() + file(TO_CMAKE_PATH "${PACKAGE_DIR}" PACKAGE_DIR) + endif() + list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR}) + + MESSAGE(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})") endif() if(CMAKE_TOOLCHAIN_FILE) list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - MESSAGE("toolchain specified") - MESSAGE(${BUILD_ARGS}) + MESSAGE(STATUS "Toolchain specified") + MESSAGE(STATUS ${BUILD_ARGS}) endif() if(NOT ADDONS_TO_BUILD) @@ -97,16 +124,25 @@ else() separate_arguments(ADDONS_TO_BUILD) endif() +if(NOT ADDONS_DEFINITION_DIR) + set(ADDONS_DEFINITION_DIR ${PROJECT_SOURCE_DIR}/addons) +else() + file(TO_CMAKE_PATH "${ADDONS_DEFINITION_DIR}" ADDONS_DEFINITION_DIR) +endif() +get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE) + if(ADDON_SRC_PREFIX) message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") endif() -if(NOT KODI_LIB_DIR) - set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") +if(NOT APP_LIB_DIR) + set(APP_LIB_DIR "${DEPENDS_PATH}/lib/kodi") else() - file(TO_CMAKE_PATH "${KODI_LIB_DIR}" KODI_LIB_DIR) + file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR) endif() +set(APP_PREFIX "${CMAKE_INSTALL_PREFIX}") + # check for platform specific stuff if(EXISTS ${PLATFORM_DIR}/defines.txt) file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines) @@ -119,21 +155,23 @@ endif() # include check_target_platform() function include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake) -# check install permissions set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) -check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) -if(NOT ${can_write} AND NOT WIN32) - set(NEED_SUDO TRUE) - set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) - message(STATUS "NEED_SUDO: ${NEED_SUDO}") +if(NOT WIN32) + # check install permissions + check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) + if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(NEED_SUDO TRUE) + set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) + message(STATUS "NEED_SUDO: ${NEED_SUDO}") + endif() endif() ### prepare the build environment for the binary addons # copy the prepare-env.cmake script to the depends path so that we can include it -file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${KODI_LIB_DIR}) +file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${APP_LIB_DIR}) # add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found -list(APPEND CMAKE_MODULE_PATH ${KODI_LIB_DIR}) +list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR}) # include prepare-env.cmake which contains the logic to install the addon header bindings etc include(prepare-env) @@ -141,17 +179,61 @@ include(prepare-env) ### add the depends subdirectory for any general dependencies add_subdirectory(depends) +# add a custom target "package-addons" which will package and install all addons +add_custom_target(package-addons) + ### get and build all the binary addons # look for all the addons to be built -file(GLOB_RECURSE addons ${PROJECT_SOURCE_DIR}/addons/*.txt) +file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt) + +#if there are no addons assume that bootstrapping hasn't happened yet +if(NOT addons) + message(STATUS "Bootstrapping all default repositories as no addons were found...") + set(BOOTSTRAP_BUILD_DIR "${BUILD_DIR}/bootstrap") + + # make sure that the bootstraps build addon exists + if(NOT EXISTS ${BOOTSTRAP_BUILD_DIR}) + file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) + endif() + + # generate the bootstrap buildsystem + execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR} + -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR} + -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} + WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) + + # execute the generated bootstrap buildsystem + execute_process(COMMAND ${CMAKE_COMMAND} --build ${BOOTSTRAP_BUILD_DIR} + WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR}) + + # now look for all the addons to be built again + file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt) + + if(NOT addons) + message(FATAL_ERROR "No addons available to be built") + endif() +endif() + foreach(addon ${addons}) if(NOT (addon MATCHES platforms.txt)) file(STRINGS ${addon} def) separate_arguments(def) list(GET def 0 id) + set(ADDON_FOUND FALSE) + # try to find a perfect match list(FIND ADDONS_TO_BUILD ${id} idx) - if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all") + if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") + set(ADDON_FOUND TRUE) + # Maybe we have a regex + elseif(id MATCHES "${ADDONS_TO_BUILD}") + message(STATUS "Pattern ${ADDONS_TO_BUILD} matches ${id}, building addon") + set(ADDON_FOUND TRUE) + endif() + + if(ADDON_FOUND) get_filename_component(dir ${addon} PATH) # check if the addon has a platforms.txt @@ -180,6 +262,19 @@ foreach(addon ${addons}) if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "") list(GET def 2 revision) + # we need access to a git executable + find_package(Git REQUIRED) + + # resolve revision to git hash + execute_process(COMMAND ${GIT_EXECUTABLE} ls-remote ${url} ${revision} OUTPUT_VARIABLE revision_hash) + # git ls-remote only works on branches and tag names but not on revisions + if(NOT "${revision_hash}" STREQUAL "") + string(REPLACE "\t" ";" revision_list ${revision_hash}) + list(GET revision_list 0 revision_hash) + message(STATUS "${id}: git branch/tag ${revision} resolved to hash: ${revision_hash}") + set(revision ${revision_hash}) + endif() + # Note: downloading specific revisions via http in the format below is probably github specific # if we ever use other repositories, this might need adapting set(url ${url}/archive/${revision}.tar.gz) @@ -210,7 +305,7 @@ foreach(addon ${addons}) # download the addon if necessary if(NOT "${archive_name}" STREQUAL "") # download and extract the addon - if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) + if(NOT ADDON_TARBALL_CACHING OR NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) # cleanup any of the previously downloaded archives of this addon file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz") if(archives) @@ -275,6 +370,25 @@ foreach(addon ${addons}) add_dependencies(${id} ${${id}_DEPS}) endif() endif() + + if(CROSS_AUTOCONF AND AUTOCONF_FILES) + if(EXISTS ${SOURCE_DIR}/bootstrap/autoreconf.txt) + file(STRINGS ${SOURCE_DIR}/bootstrap/autoreconf.txt conf_dirs) + foreach(conf_dir ${conf_dirs}) + foreach(afile ${AUTOCONF_FILES}) + message(STATUS "copying ${afile} to ${SOURCE_DIR}/${conf_dir}") + file(COPY ${afile} DESTINATION ${SOURCE_DIR}/${conf_dir}) + endforeach() + endforeach() + endif() + endif() + + # create a forwarding target to the addon-package target + add_custom_target(package-${id} + COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build --target addon-package + DEPENDS ${id}) + add_dependencies(package-addons package-${id}) + else() message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}") endif() @@ -297,4 +411,4 @@ endif() # add custom target "supported_addons" that returns all addons that are supported on this platform string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}") -add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) +add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) \ No newline at end of file diff --git a/project/cmake/addons/README b/project/cmake/addons/README index b901bb7..a0f2c32 100644 --- a/project/cmake/addons/README +++ b/project/cmake/addons/README @@ -1,7 +1,8 @@ KODI ADDONS =========== This directory contains the cmake-based buildsystem for addons. It looks into -the "addons" sub-directory and parses all *.txt files recursively. Each addon +the directory pointed to by the ADDONS_DEFINITION_DIR option (which defaults to +the "addons" sub-directory) and parses all *.txt files recursively. Each addon must have its own .txt file in a separate sub-directory which must follow one of the defined format: @@ -22,13 +23,26 @@ are: * platforms.txt: List of platforms to build an addon for (or "all"). It is also supported to specify negated platforms with a leading exclamation mark (i), e.g. "!windows". - Available platforms are: linux, windows, darwin, ios, android, rbpi + Available platforms are: linux, windows, osx, ios, android, rbpi, freebsd + +ATTENTION: If no addon definitions could be found the buildsystem assumes that + the bootstrapping of the addon definition repositories hasn't been + performed yet and automatically executes the addon bootstrapping + buildsystem located in the "bootstrap" sub-directory with the default + settings (i.e. all addons from all pre-defined addon definition + repositories are bootstrapped into the directory pointed to by the + ADDONS_DEFINITION_DIR option). The buildsystem uses the following variables (which can be passed into it when executing cmake with the -D= option) to e.g. access specific paths: - * ADDONS_TO_BUILD is a quoted, space delimited list of s that - you want to build (default is "all"). + * ADDONS_TO_BUILD has two variations, which are tested in order: + - a quoted, space delimited list of s that + you want to build (default is "all"). + - a regular expression that every is matched against + e.g.: ADDONS_TO_BUILD=pvr.* to build all pvr addons + * ADDONS_DEFINITION_DIR points to the directory containing the definitions + for the addons to be built. * ADDON_SRC_PREFIX can be used to override the addon repository location. It must point to the locally available parent directory of the addon(s) to build will be appended to this path automatically @@ -45,11 +59,15 @@ specific paths: absolute representation of ../../.. starting from this directory). * BUILD_DIR points to the directory where the addons and their dependencies will be downloaded and built. - * PACKAGE_ZIP=1 will mean the add-ons will be 'packaged' into a common folder, + * PACKAGE_ZIP=ON means that the add-ons will be 'packaged' into a common folder, rather than being placed in /lib/kodi/addons and /share/kodi/addons. + * PACKAGE_DIR points to the directory where the ZIP archived addons will be + stored after they have been packaged (defaults to /zips) * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines (defaults to empty). + * ADDON_TARBALL_CACHING specifies whether downloaded addon source tarballs + should be cached or not (defaults to ON). The buildsystem makes some assumptions about the environment which must be met by whoever uses it: diff --git a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt deleted file mode 100644 index 5886cfa..0000000 --- a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt +++ /dev/null @@ -1 +0,0 @@ -audioencoder.flac https://github.com/xbmc/audioencoder.flac 84acb14 diff --git a/project/cmake/addons/addons/audioencoder.flac/platforms.txt b/project/cmake/addons/addons/audioencoder.flac/platforms.txt deleted file mode 100644 index 174a52e..0000000 --- a/project/cmake/addons/addons/audioencoder.flac/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -!ios \ No newline at end of file diff --git a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt deleted file mode 100644 index a55dc44..0000000 --- a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt +++ /dev/null @@ -1 +0,0 @@ -audioencoder.lame https://github.com/xbmc/audioencoder.lame 3eb59de diff --git a/project/cmake/addons/addons/audioencoder.lame/platforms.txt b/project/cmake/addons/addons/audioencoder.lame/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/audioencoder.lame/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt deleted file mode 100644 index 8decf52..0000000 --- a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt +++ /dev/null @@ -1 +0,0 @@ -audioencoder.vorbis https://github.com/xbmc/audioencoder.vorbis d556a68 diff --git a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt b/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt deleted file mode 100644 index b3209f6..0000000 --- a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt +++ /dev/null @@ -1 +0,0 @@ -audioencoder.wav https://github.com/xbmc/audioencoder.wav 40aaedf diff --git a/project/cmake/addons/addons/audioencoder.wav/platforms.txt b/project/cmake/addons/addons/audioencoder.wav/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/audioencoder.wav/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.argustv/platforms.txt b/project/cmake/addons/addons/pvr.argustv/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.argustv/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt b/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt deleted file mode 100644 index 88ccde4..0000000 --- a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.argustv https://github.com/kodi-pvr/pvr.argustv 96ee875 diff --git a/project/cmake/addons/addons/pvr.demo/platforms.txt b/project/cmake/addons/addons/pvr.demo/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.demo/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt b/project/cmake/addons/addons/pvr.demo/pvr.demo.txt deleted file mode 100644 index 1307381..0000000 --- a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.demo https://github.com/kodi-pvr/pvr.demo b4b7de1 diff --git a/project/cmake/addons/addons/pvr.dvblink/platforms.txt b/project/cmake/addons/addons/pvr.dvblink/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.dvblink/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt b/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt deleted file mode 100644 index 1aa96d8..0000000 --- a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.dvblink https://github.com/kodi-pvr/pvr.dvblink 5d505b8 diff --git a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt b/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt b/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt deleted file mode 100644 index db25aa2..0000000 --- a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer master \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.filmon/platforms.txt b/project/cmake/addons/addons/pvr.filmon/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.filmon/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt b/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt deleted file mode 100644 index 2e7142c..0000000 --- a/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.filmon https://github.com/kodi-pvr/pvr.filmon 413fe9e diff --git a/project/cmake/addons/addons/pvr.hts/platforms.txt b/project/cmake/addons/addons/pvr.hts/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.hts/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt b/project/cmake/addons/addons/pvr.hts/pvr.hts.txt deleted file mode 100644 index 5f913f8..0000000 --- a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.hts https://github.com/kodi-pvr/pvr.hts 4bf1a97 diff --git a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt b/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt b/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt deleted file mode 100644 index d1d4d3c..0000000 --- a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.iptvsimple https://github.com/kodi-pvr/pvr.iptvsimple a2e6c6f diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt deleted file mode 100644 index 665dfff..0000000 --- a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.mediaportal.tvserver https://github.com/kodi-pvr/pvr.mediaportal.tvserver 6f8ca82 diff --git a/project/cmake/addons/addons/pvr.mythtv/platforms.txt b/project/cmake/addons/addons/pvr.mythtv/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.mythtv/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt b/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt deleted file mode 100644 index de930ab..0000000 --- a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.mythtv https://github.com/kodi-pvr/pvr.mythtv ef9cf41 diff --git a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt b/project/cmake/addons/addons/pvr.nextpvr/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt b/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt deleted file mode 100644 index ecb73d2..0000000 --- a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.nextpvr https://github.com/kodi-pvr/pvr.nextpvr 1ecbf87 diff --git a/project/cmake/addons/addons/pvr.njoy/platforms.txt b/project/cmake/addons/addons/pvr.njoy/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.njoy/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt b/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt deleted file mode 100644 index fec1b59..0000000 --- a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.njoy https://github.com/kodi-pvr/pvr.njoy fcd6294 diff --git a/project/cmake/addons/addons/pvr.pctv/platforms.txt b/project/cmake/addons/addons/pvr.pctv/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.pctv/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt b/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt deleted file mode 100644 index b17bdc7..0000000 --- a/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.pctv https://github.com/kodi-pvr/pvr.pctv 0a0924e diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt deleted file mode 100644 index 72b4954..0000000 --- a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.vdr.vnsi https://github.com/kodi-pvr/pvr.vdr.vnsi 3a28e39 diff --git a/project/cmake/addons/addons/pvr.vuplus/platforms.txt b/project/cmake/addons/addons/pvr.vuplus/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.vuplus/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt b/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt deleted file mode 100644 index 36d60af..0000000 --- a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.vuplus https://github.com/kodi-pvr/pvr.vuplus d6abad3 diff --git a/project/cmake/addons/addons/pvr.wmc/platforms.txt b/project/cmake/addons/addons/pvr.wmc/platforms.txt deleted file mode 100644 index baa6044..0000000 --- a/project/cmake/addons/addons/pvr.wmc/platforms.txt +++ /dev/null @@ -1 +0,0 @@ -all \ No newline at end of file diff --git a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt b/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt deleted file mode 100644 index 1455925..0000000 --- a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt +++ /dev/null @@ -1 +0,0 @@ -pvr.wmc https://github.com/kodi-pvr/pvr.wmc cf28e4c diff --git a/project/cmake/addons/bootstrap/CMakeLists.txt b/project/cmake/addons/bootstrap/CMakeLists.txt new file mode 100644 index 0000000..86950b8 --- /dev/null +++ b/project/cmake/addons/bootstrap/CMakeLists.txt @@ -0,0 +1,95 @@ +project(kodi-addons-bootstrap) + +cmake_minimum_required(VERSION 2.8) + +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +# make sure CMAKE_INSTALL_PREFIX is properly set +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) + set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../addons") +endif() +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) + +# figure out where the build directory is located +if(NOT BUILD_DIR) + set(BUILD_DIR "${CMAKE_BINARY_DIR}/build") +else() + file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR) +endif() +get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE) + +# make sure that the repositories to build have been specified +if(NOT REPOSITORY_TO_BUILD) + set(REPOSITORY_TO_BUILD_DEFAULT ON) + set(REPOSITORY_TO_BUILD "all") + set(REPOSITORY_REVISION "") + message(STATUS "Bootstrapping all repositories") +else() + set(REPOSITORY_TO_BUILD_DEFAULT OFF) + message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}") +endif() + +# figure out which addons to bootstrap (defaults to all) +if(NOT ADDONS_TO_BUILD) + set(ADDONS_TO_BUILD "all") + message(STATUS "Bootstrapping all addons") +else() + message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}") +endif() + +include(ExternalProject) + +function(bootstrap_repo repo_id repo_url repo_revision) + message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...") + externalproject_add(${repo_id} + GIT_REPOSITORY ${repo_url} + GIT_TAG ${repo_revision} + PREFIX ${BUILD_DIR}/${repo_id} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND ${CMAKE_COMMAND} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} + -DPROJECT_SOURCE_DIR= + -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + -DADDONS_TO_BUILD=${ADDONS_TO_BUILD} + -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake + ) +endfunction() + +# look for all addons repository definitions +set(REPOSITORY_TO_BUILD_FOUND OFF) +file(GLOB repos repositories/*.txt) +foreach(repo ${repos}) + file(STRINGS ${repo} repo_definition) + separate_arguments(repo_definition) + list(GET repo_definition 0 repo_id) + + list(FIND REPOSITORY_TO_BUILD ${repo_id} idx) + if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all") + set(REPOSITORY_TO_BUILD_FOUND ON) + + # get the URL of the repository + list(GET repo_definition 1 repo_url) + + # get the revision of the repository if not provided as an argument + if(NOT REPOSITORY_REVISION) + list(GET repo_definition 2 repo_revision) + else() + set(repo_revision "${REPOSITORY_REVISION}") + endif() + + bootstrap_repo(${repo_id} ${repo_url} ${repo_revision}) + endif() +endforeach() + +# if we have been asked to bootstrap a specific repository (not the default one) and +# it couldn't be found in the predefined repository definitions we assume that it's a +# URL to a specific repository +if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND) + # default to the master branch if no revision has been provided + if(NOT REPOSITORY_REVISION) + set(REPOSITORY_REVISION "master") + endif() + + bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION}) +endif() diff --git a/project/cmake/addons/bootstrap/README.md b/project/cmake/addons/bootstrap/README.md new file mode 100644 index 0000000..b886b5b --- /dev/null +++ b/project/cmake/addons/bootstrap/README.md @@ -0,0 +1,48 @@ +# KODI ADDON DEFINITIONS BOOTSTRAPPING +This directory contains the cmake-based buildsystem for addon definitions +bootstrapping which downloads the addon definitions from one or more addon +definitions repositories. These addon definitions are then used by the addon +buildsystem to figure out which addons and which versions to build. It looks +into the "repositories" sub-directory and parses all *.txt files recursively. +Each addon definitions repository must have its own .txt file which +must follow the following defined format: +``` + +``` +where +* `` is the identification of the repository. +* `` must be the URL of the git repository containing the addon + definitions +* `` must be a valid git tag/branch/commit in the addon + definitions repository's git repository which will be used for the build + +The buildsystem uses the following variables (which can be passed into it when +executing cmake with the `-D=` option): +* `CMAKE_INSTALL_PREFIX` points to the directory where the downloaded addon +definitions will be installed to (defaults to `../addons`). +* `BUILD_DIR` points to the directory where the addon definitions repositories +will be downloaded to. +* `REPOSITORY_TO_BUILD` specifies a single addon definitions repository to be +downloaded and processed (defaults to `"all"`). +* `REPOSITORY_REVISION` specifies the git revision in the addon definitions +repository which will be used for the build. This option is only valid in +combination with the `REPOSITORY_TO_BUILD` option (defaults to the git +revision specified in the repository's definition file). +* `ADDONS_TO_BUILD` is a quoted, space delimited list of ``s that +should be bootstrapped (default is `"all"`). + +To trigger the cmake-based buildsystem the following command must be executed +with being the path to this directory (absolute or relative, allowing for +in-source and out-of-source builds). +``` +cmake -G +``` + +cmake supports multiple generators, see +http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list. + +In case of additional options the call might look like this +``` +cmake [-G ] \ + -DCMAKE_INSTALL_PREFIX="" +``` \ No newline at end of file diff --git a/project/cmake/addons/bootstrap/bootstrap.cmake b/project/cmake/addons/bootstrap/bootstrap.cmake new file mode 100644 index 0000000..c78910c --- /dev/null +++ b/project/cmake/addons/bootstrap/bootstrap.cmake @@ -0,0 +1,38 @@ +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) + +# make sure that the installation location has been specified +if(NOT CMAKE_INSTALL_PREFIX) + message(FATAL_ERROR "CMAKE_INSTALL_PREFIX has not been specified") +endif() + +# figure out which addons to bootstrap (defaults to all) +if(NOT ADDONS_TO_BUILD) + set(ADDONS_TO_BUILD "all") +else() + separate_arguments(ADDONS_TO_BUILD) +endif() + +# find all addon definitions and go through them +file(GLOB_RECURSE ADDON_DEFINITIONS ${PROJECT_SOURCE_DIR}/*.txt) +foreach(ADDON_DEFINITION_FILE ${ADDON_DEFINITIONS}) + # ignore platforms.txt + if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt)) + # read the addon definition file + file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION) + separate_arguments(ADDON_DEFINITION) + + # extract the addon definition's identifier + list(GET ADDON_DEFINITION 0 ADDON_ID) + + # check if the addon definition should be built + list(FIND ADDONS_TO_BUILD ${ADDON_ID} ADDONS_TO_BUILD_IDX) + if(ADDONS_TO_BUILD_IDX GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all") + # get the path to the addon definition directory + get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} PATH) + + # install the addon definition + message(STATUS "Bootstrapping ${ADDON_ID} addon...") + file(INSTALL ${ADDON_DEFINITION_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX}) + endif() + endif() +endforeach() diff --git a/project/cmake/addons/bootstrap/repositories/binary-addons.txt b/project/cmake/addons/bootstrap/repositories/binary-addons.txt new file mode 100644 index 0000000..8674f06 --- /dev/null +++ b/project/cmake/addons/bootstrap/repositories/binary-addons.txt @@ -0,0 +1 @@ +binary-addons https://github.com/xbmc/repo-binary-addons.git master \ No newline at end of file diff --git a/project/cmake/addons/depends/common/kodi-platform/deps.txt b/project/cmake/addons/depends/common/kodi-platform/deps.txt index f0e8246..b953815 100644 --- a/project/cmake/addons/depends/common/kodi-platform/deps.txt +++ b/project/cmake/addons/depends/common/kodi-platform/deps.txt @@ -1,2 +1,2 @@ -kodi -tinyxml \ No newline at end of file +tinyxml +p8-platform diff --git a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt index 009c72b..de42267 100644 --- a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt +++ b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt @@ -1 +1 @@ -kodi-platform https://github.com/xbmc/kodi-platform 48bdd985 +kodi-platform https://github.com/xbmc/kodi-platform fed924e764b4c9c722f7f5d825ce70d4b61ae54f diff --git a/project/cmake/addons/depends/common/p8-platform/p8-platform.txt b/project/cmake/addons/depends/common/p8-platform/p8-platform.txt new file mode 100644 index 0000000..7db4e36 --- /dev/null +++ b/project/cmake/addons/depends/common/p8-platform/p8-platform.txt @@ -0,0 +1 @@ +p8-platform https://github.com/Pulse-Eight/platform.git 38343e0acd6a636ac46139aa666aee4a8d1f13db diff --git a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt index 456b0c5..f8e05e8 100644 --- a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt +++ b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt @@ -1 +1 @@ -tinyxml http://mirrors.xbmc.org/build-deps/sources/tinyxml-2.6.2_2.tar.gz +tinyxml http://mirrors.kodi.tv/build-deps/sources/tinyxml-2.6.2_2.tar.gz diff --git a/project/cmake/installdata/addon-bindings.txt b/project/cmake/installdata/addon-bindings.txt new file mode 100644 index 0000000..fbcdf99 --- /dev/null +++ b/project/cmake/installdata/addon-bindings.txt @@ -0,0 +1,28 @@ +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h +xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h +xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h +xbmc/cores/AudioEngine/Utils/AEChannelData.h +xbmc/filesystem/IFileTypes.h diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt new file mode 100644 index 0000000..7d406ad --- /dev/null +++ b/project/cmake/installdata/common/addons.txt @@ -0,0 +1,40 @@ +addons/kodi.adsp/* +addons/kodi.audiodecoder/* +addons/kodi.resource/* +addons/kodi.vfs/* +addons/xbmc.audioencoder/* +addons/xbmc.codec/* +addons/xbmc.core/* +addons/xbmc.gui/* +addons/xbmc.metadata/* +addons/xbmc.pvr/* +addons/xbmc.python/* +addons/xbmc.webinterface/* +addons/library.xbmc.addon/* +addons/library.xbmc.codec/* +addons/library.xbmc.gui/* +addons/library.xbmc.pvr/* +addons/repository.xbmc.org/* +addons/webinterface.default/* +addons/screensaver.xbmc.builtin.dim/* +addons/screensaver.xbmc.builtin.black/* +addons/script.module.pil/* +addons/script.module.pysqlite/* +addons/audioencoder.xbmc.builtin.aac/* +addons/audioencoder.xbmc.builtin.wav/* +addons/audioencoder.xbmc.builtin.wma/* +addons/resource.language.en_gb/* +addons/resource.uisounds.confluence/* +addons/resource.images.weathericons.default/* +addons/metadata.local/* +addons/metadata.album.universal/* +addons/metadata.artists.universal/* +addons/metadata.common.allmusic.com/* +addons/metadata.common.fanart.tv/* +addons/metadata.common.htbackdrops.com/* +addons/metadata.common.imdb.com/* +addons/metadata.common.musicbrainz.org/* +addons/metadata.common.theaudiodb.com/* +addons/metadata.common.themoviedb.org/* +addons/metadata.themoviedb.org/* +addons/metadata.tvdb.com/* diff --git a/project/cmake/installdata/common/common.txt b/project/cmake/installdata/common/common.txt new file mode 100644 index 0000000..c1e52f0 --- /dev/null +++ b/project/cmake/installdata/common/common.txt @@ -0,0 +1,13 @@ +media/* +sounds/* +system/keymaps/* +system/library/* +system/players/VideoPlayer/etc/* +system/shaders/* +system/settings/* +userdata/* +system/addon-manifest.xml +system/colors.xml +system/peripherals.xml +system/playercorefactory.xml +system/keyboardlayouts/* diff --git a/project/cmake/installdata/darwin/runtime.txt b/project/cmake/installdata/darwin/runtime.txt new file mode 100644 index 0000000..e1bb711 --- /dev/null +++ b/project/cmake/installdata/darwin/runtime.txt @@ -0,0 +1 @@ +tools/darwin/runtime/preflight diff --git a/project/cmake/installdata/linux/lirc.txt b/project/cmake/installdata/linux/lirc.txt new file mode 100644 index 0000000..1b48478 --- /dev/null +++ b/project/cmake/installdata/linux/lirc.txt @@ -0,0 +1 @@ +system/Lircmap.xml diff --git a/project/cmake/installdata/test-reference-data.txt b/project/cmake/installdata/test-reference-data.txt new file mode 100644 index 0000000..895079a --- /dev/null +++ b/project/cmake/installdata/test-reference-data.txt @@ -0,0 +1,10 @@ +xbmc/utils/test/CXBMCTinyXML-test.xml +xbmc/utils/test/data/language/Spanish/strings.po +xbmc/filesystem/test/reffile.txt +xbmc/filesystem/test/reffile.txt.rar +xbmc/filesystem/test/reffile.txt.zip +xbmc/filesystem/test/refRARnormal.rar +xbmc/filesystem/test/refRARstored.rar +xbmc/network/test/data/test.html +xbmc/network/test/data/test.png +xbmc/network/test/data/test-ranges.txt diff --git a/project/cmake/installdata/windows/addons.txt b/project/cmake/installdata/windows/addons.txt new file mode 100644 index 0000000..92bf9b3 --- /dev/null +++ b/project/cmake/installdata/windows/addons.txt @@ -0,0 +1 @@ +addons/repository.pvr-win32.xbmc.org/* diff --git a/project/cmake/installdata/windows/dlls.txt b/project/cmake/installdata/windows/dlls.txt new file mode 100644 index 0000000..72cca7d --- /dev/null +++ b/project/cmake/installdata/windows/dlls.txt @@ -0,0 +1,6 @@ +system/*.dll +system/airplay/*.dll +system/cdrip/*.dll +system/players/dvdplayer/*.dll +system/players/paplayer/*.dll +system/players/VideoPlayer/*.dll diff --git a/project/cmake/installdata/windows/irss.txt b/project/cmake/installdata/windows/irss.txt new file mode 100644 index 0000000..6fd8d48 --- /dev/null +++ b/project/cmake/installdata/windows/irss.txt @@ -0,0 +1,2 @@ +system/IRSSmap.xml +system/X10-Lola-IRSSmap.xml diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in index 118d723..84b2563 100644 --- a/project/cmake/kodi-config.cmake.in +++ b/project/cmake/kodi-config.cmake.in @@ -1,11 +1,29 @@ -SET(KODI_INCLUDE_DIR @prefix@/include) SET(APP_NAME @APP_NAME@) +SET(APP_NAME_LC @APP_NAME_LC@) +SET(APP_NAME_UC @APP_NAME_UC@) SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@) SET(APP_VERSION_MINOR @APP_VERSION_MINOR@) +IF(NOT @APP_NAME_UC@_PREFIX) + SET(@APP_NAME_UC@_PREFIX @APP_PREFIX@) +ENDIF() +IF(NOT @APP_NAME_UC@_INCLUDE_DIR) + SET(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@) +ENDIF() +IF(NOT @APP_NAME_UC@_LIB_DIR) + SET(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@) +ENDIF() IF(NOT WIN32) SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") ENDIF() -LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi) +LIST(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@) ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON) +if(NOT CORE_SYSTEM_NAME) + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(CORE_SYSTEM_NAME "osx") + else() + string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) + endif() +endif() + include(addon-helpers) diff --git a/project/cmake/modules/FindAML.cmake b/project/cmake/modules/FindAML.cmake new file mode 100644 index 0000000..5b9a859 --- /dev/null +++ b/project/cmake/modules/FindAML.cmake @@ -0,0 +1,35 @@ +#.rst: +# FindAML +# ------- +# Finds the AML codec +# +# This will will define the following variables:: +# +# AML_FOUND - system has AML +# AML_INCLUDE_DIRS - the AML include directory +# AML_DEFINITIONS - the AML definitions +# +# and the following imported targets:: +# +# AML::AML - The AML codec + +find_path(AML_INCLUDE_DIR codec_error.h + PATH_SUFFIXES amcodec) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(AML + REQUIRED_VARS AML_INCLUDE_DIR) + +if(AML_FOUND) + set(AML_INCLUDE_DIRS ${AML_INCLUDE_DIR}) + set(AML_DEFINITIONS -DHAS_LIBAMCODEC=1) + + if(NOT TARGET AML::AML) + add_library(AML::AML UNKNOWN IMPORTED) + set_target_properties(AML::AML PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${AML_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAS_LIBAMCODEC=1) + endif() +endif() + +mark_as_advanced(AMLCODEC_INCLUDE_DIR) diff --git a/project/cmake/modules/FindASS.cmake b/project/cmake/modules/FindASS.cmake new file mode 100644 index 0000000..5f4b0c7 --- /dev/null +++ b/project/cmake/modules/FindASS.cmake @@ -0,0 +1,18 @@ +# - Try to find ASS +# Once done this will define +# +# ASS_FOUND - system has libass +# ASS_INCLUDE_DIRS - the libass include directory +# ASS_LIBRARIES - The libass libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (ASS libass) +else() + find_path(ASS_INCLUDE_DIRS ass/ass.h) + find_library(ASS_LIBRARIES NAMES ass libass) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ASS DEFAULT_MSG ASS_INCLUDE_DIRS ASS_LIBRARIES) + +mark_as_advanced(ASS_INCLUDE_DIRS ASS_LIBRARIES) diff --git a/project/cmake/modules/FindAlsa.cmake b/project/cmake/modules/FindAlsa.cmake new file mode 100644 index 0000000..b15a0cf --- /dev/null +++ b/project/cmake/modules/FindAlsa.cmake @@ -0,0 +1,20 @@ +# - Try to find ALSA +# Once done this will define +# +# ALSA_FOUND - system has libALSA +# ALSA_INCLUDE_DIRS - the libALSA include directory +# ALSA_LIBRARIES - The libALSA libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (ALSA alsa) +else() + find_path(ALSA_INCLUDE_DIRS asoundlib.h PATH_SUFFIXES alsa) + find_library(ALSA_LIBRARIES asound) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Alsa DEFAULT_MSG ALSA_INCLUDE_DIRS ALSA_LIBRARIES) + +set(ALSA_INCLUDE_DIRS "") # Dont want these added as 'timer.h' is a dangerous file +mark_as_advanced(ALSA_INCLUDE_DIRS ALSA_LIBRARIES) +list(APPEND ALSA_DEFINITIONS -DHAVE_ALSA=1 -DUSE_ALSA=1) diff --git a/project/cmake/modules/FindAvahi.cmake b/project/cmake/modules/FindAvahi.cmake new file mode 100644 index 0000000..24bf15c --- /dev/null +++ b/project/cmake/modules/FindAvahi.cmake @@ -0,0 +1,26 @@ +# - Try to find avahi +# Once done this will define +# +# AVAHI_FOUND - system has avahi +# AVAHI_INCLUDE_DIRS - the avahi include directory +# AVAHI_LIBRARIES - The avahi libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (AVAHI avahi-client) + list(APPEND AVAHI_INCLUDE_DIRS ${AVAHI_INCLUDEDIR}) +else() + find_path(AVAHI_CLIENT_INCLUDE_DIRS avahi-client/client.h) + find_path(AVAHI_COMMON_INCLUDE_DIRS avahi-common/defs.h) + find_library(AVAHI_COMMON_LIBRARIES avahi-common) + find_library(AVAHI_CLIENT_LIBRARIES avahi-common) + set(AVAHI_INCLUDE_DIRS ${AVAHI_CLIENT_INCLUDE_DIRS} + ${AVAHI_COMMON_INCLUDE_DIRS}) + set(AVAHI_LIBRARIES ${AVAHI_CLIENT_LIBRARIES} + ${AVAHI_COMMON_LIBRARIES}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Avahi DEFAULT_MSG AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES) + +mark_as_advanced(AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES) +list(APPEND AVAHI_DEFINITIONS -DHAVE_LIBAVAHI_COMMON=1 -DHAVE_LIBAVAHI_CLIENT=1) diff --git a/project/cmake/modules/FindBluray.cmake b/project/cmake/modules/FindBluray.cmake new file mode 100644 index 0000000..2b0a449 --- /dev/null +++ b/project/cmake/modules/FindBluray.cmake @@ -0,0 +1,57 @@ +#.rst: +# FindBluray +# ---------- +# Finds the libbluray library +# +# This will will define the following variables:: +# +# BLURAY_FOUND - system has libbluray +# BLURAY_INCLUDE_DIRS - the libbluray include directory +# BLURAY_LIBRARIES - the libbluray libraries +# BLURAY_DEFINITIONS - the libbluray compile definitions +# +# and the following imported targets:: +# +# Bluray::Bluray - The libblueray library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(BLURAY libbluray>=0.7.0) + set(BLURAY_VERSION ${PC_BLURAY_VERSION}) +else() + find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h + PATHS ${PC_BLURAY_INCLUDEDIR}) + + include(FindPackageHandleStandardArgs) + if(NOT WIN32) + find_library(BLURAY_LIBRARY NAMES bluray + PATHS ${PC_BLURAY_LIBDIR}) + + find_package_handle_standard_args(BLURAY + REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR + VERSION_VAR BLURAY_VERSION) + else() + # Dynamically loaded DLL + find_package_handle_standard_args(BLURAY + REQUIRED_VARS BLURAY_INCLUDE_DIR + VERSION_VAR BLURAY_VERSION) + endif() +endif() + +if(BLURAY_FOUND) + set(BLURAY_LIBRARIES ${BLURAY_LIBRARY}) + set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR}) + set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1) + + if(NOT TARGET Bluray::Bluray) + add_library(Bluray::Bluray UNKNOWN IMPORTED) + if(BLURAY_LIBRARY) + set_target_properties(Bluray::Bluray PROPERTIES + IMPORTED_LOCATION "${BLURAY_LIBRARY}") + endif() + set_target_properties(Bluray::Bluray PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1) + endif() +endif() + +mark_as_advanced(BLURAY_INCLUDE_DIR BLURAY_LIBRARY) diff --git a/project/cmake/modules/FindCCache.cmake b/project/cmake/modules/FindCCache.cmake new file mode 100644 index 0000000..4ad7d07 --- /dev/null +++ b/project/cmake/modules/FindCCache.cmake @@ -0,0 +1,6 @@ +find_program(CCACHE_FOUND ccache) +if(CCACHE_FOUND) + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) +endif(CCACHE_FOUND) + diff --git a/project/cmake/modules/FindCEC.cmake b/project/cmake/modules/FindCEC.cmake new file mode 100644 index 0000000..98e900d --- /dev/null +++ b/project/cmake/modules/FindCEC.cmake @@ -0,0 +1,58 @@ +#.rst: +# FindCEC +# ------- +# Finds the libCEC library +# +# This will will define the following variables:: +# +# CEC_FOUND - system has libCEC +# CEC_INCLUDE_DIRS - the libCEC include directory +# CEC_LIBRARIES - the libCEC libraries +# CEC_DEFINITIONS - the libCEC compile definitions +# +# and the following imported targets:: +# +# CEC::CEC - The libCEC library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_CEC libCEC>=3.0.0 QUIET) +endif() + +find_path(CEC_INCLUDE_DIR libCEC/CEC.h + PATHS ${PC_CEC_INCLUDEDIR}) + +set(CEC_VERSION ${PC_CEC_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(CEC_LIBRARY NAMES cec + PATHS ${PC_CEC_LIBDIR}) + + find_package_handle_standard_args(CEC + REQUIRED_VARS CEC_LIBRARY CEC_INCLUDE_DIR + VERSION_VAR CEC_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(CEC + REQUIRED_VARS CEC_INCLUDE_DIR + VERSION_VAR CEC_VERSION) +endif() + +if(CEC_FOUND) + set(CEC_LIBRARIES ${CEC_LIBRARY}) + set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIR}) + set(CEC_DEFINITIONS -DHAVE_LIBCEC=1) + + if(NOT TARGET CEC::CEC) + add_library(CEC::CEC UNKNOWN IMPORTED) + if(CEC_LIBRARY) + set_target_properties(CEC::CEC PROPERTIES + IMPORTED_LOCATION "${CEC_LIBRARY}") + endif() + set_target_properties(CEC::CEC PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${CEC_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBCEC=1) + endif() +endif() + +mark_as_advanced(CEC_INCLUDE_DIR CEC_LIBRARY) diff --git a/project/cmake/modules/FindCXX11.cmake b/project/cmake/modules/FindCXX11.cmake new file mode 100644 index 0000000..f1b7346 --- /dev/null +++ b/project/cmake/modules/FindCXX11.cmake @@ -0,0 +1,18 @@ +include(TestCXXAcceptsFlag) + +# try to use compiler flag -std=c++11 +check_cxx_accepts_flag("-std=c++11" CXX_FLAG_CXX11) +if(CXX_FLAG_CXX11) + add_options (CXX ALL_BUILDS "-std=c++11") + set(CXX_STD11_FLAGS "-std=c++11") +else() + # try to use compiler flag -std=c++0x for older compilers + check_cxx_accepts_flag("-std=c++0x" CXX_FLAG_CXX0X) + if(CXX_FLAG_CXX0X) + add_options (CXX ALL_BUILDS "-std=c++0x") + set(CXX_STD11_FLAGS "-std=c++0x") + endif(CXX_FLAG_CXX0X) +endif(CXX_FLAG_CXX11) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX_STD11_FLAGS) diff --git a/project/cmake/modules/FindCdio.cmake b/project/cmake/modules/FindCdio.cmake new file mode 100644 index 0000000..1b6b8cd --- /dev/null +++ b/project/cmake/modules/FindCdio.cmake @@ -0,0 +1,20 @@ +# - Try to find cdio +# Once done this will define +# +# CDIO_FOUND - system has libcdio +# CDIO_INCLUDE_DIRS - the libcdio include directory +# CDIO_LIBRARIES - The libcdio libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (CDIO libcdio libiso9660) + list(APPEND CDIO_INCLUDE_DIRS ${CDIO_libcdio_INCLUDEDIR} ${CDIO_libiso9660_INCLUDEDIR}) +endif() +if(NOT CDIO_FOUND) + find_path(CDIO_INCLUDE_DIRS cdio/cdio.h) + find_library(MODPLUG_LIBRARIES NAMES cdio) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Cdio DEFAULT_MSG CDIO_INCLUDE_DIRS CDIO_LIBRARIES) + +mark_as_advanced(CDIO_INCLUDE_DIRS CDIO_LIBRARIES) diff --git a/project/cmake/modules/FindCpluff.cmake b/project/cmake/modules/FindCpluff.cmake new file mode 100644 index 0000000..b8fa22d --- /dev/null +++ b/project/cmake/modules/FindCpluff.cmake @@ -0,0 +1,46 @@ +# - Builds Cpluff as external project +# Once done this will define +# +# CPLUFF_FOUND - system has cpluff +# CPLUFF_INCLUDE_DIRS - the cpluff include directories +# +# and link Kodi against the cpluff libraries. + +if(NOT WIN32) + string(REPLACE ";" " " defines "${CMAKE_C_FLAGS} ${SYSTEM_DEFINES} -I${EXPAT_INCLUDE_DIR}") + get_filename_component(expat_dir ${EXPAT_LIBRARY} PATH) + set(ldflags "-L${expat_dir}") + ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff + PREFIX ${CORE_BUILD_DIR}/cpluff + PATCH_COMMAND rm -f config.status + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} ${CORE_SOURCE_DIR}/lib/cpluff/configure + --disable-nls + --enable-static + --disable-shared + --with-pic + --prefix= + --host=${ARCH} + CFLAGS=${defines} + LDFLAGS=${ldflags} + BUILD_COMMAND make V=1) + set(ldflags "${ldflags};-lexpat") + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a + system/libcpluff libcpluff extras "${ldflags}") + set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +else() + ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff + PREFIX ${CORE_BUILD_DIR}/cpluff + CONFIGURE_COMMAND "" + # TODO: Building the project directly from lib/cpluff/libcpluff/win32/cpluff.vcxproj + # fails becaue it imports XBMC.defaults.props + BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG} + ${CORE_SOURCE_DIR}/project/VS2010Express/XBMC\ for\ Windows.sln + /project cpluff + INSTALL_COMMAND "") + # TODO: core_link_library +endif() + +set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include) +set(CPLUFF_FOUND 1) +mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND) diff --git a/project/cmake/modules/FindCrossGUID.cmake b/project/cmake/modules/FindCrossGUID.cmake new file mode 100644 index 0000000..0d4a915 --- /dev/null +++ b/project/cmake/modules/FindCrossGUID.cmake @@ -0,0 +1,56 @@ +if(ENABLE_INTERNAL_CROSSGUID) + include(ExternalProject) + file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/Makefile VER) + string(REGEX MATCH "VERSION=[^ ]*" CGUID_VER "${VER}") + list(GET CGUID_VER 0 CGUID_VER) + string(SUBSTRING "${CGUID_VER}" 8 -1 CGUID_VER) + + externalproject_add(crossguid + URL http://mirrors.kodi.tv/build-deps/sources/crossguid-${CGUID_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/crossguid + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/CMakeLists.txt + && + ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindUUID.cmake + && + ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindCXX11.cmake + ) + + set(CROSSGUID_FOUND 1) + set(CROSSGUID_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libcrossguid.a) + set(CROSSGUID_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(CROSSGUID DEFAULT_MSG CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES) + mark_as_advanced(CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES CROSSGUID_DEFINITIONS CROSSGUID_FOUND) +else() + find_path(CROSSGUID_INCLUDE_DIR guid.h) + + find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid + ${CONFIGURATION_LIBDIR_RELEASE}) + find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd + ${CONFIGURATION_LIBDIR_DEBUG}) + + include(SelectLibraryConfigurations) + select_library_configurations(CROSSGUID) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(CROSSGUID + REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR) + + if(CROSSGUID_FOUND) + set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY}) + set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR}) + endif() + mark_as_advanced(CROSSGUID_INCLUDE_DIR CROSSGUID_LIBRARY) +endif() + +if(NOT WIN32 AND NOT APPLE) + find_package(UUID REQUIRED) + list(APPEND CROSSGUID_INCLUDE_DIRS ${UUID_INCLUDE_DIRS}) + list(APPEND CROSSGUID_LIBRARIES ${UUID_LIBRARIES}) +endif() diff --git a/project/cmake/modules/FindCurl.cmake b/project/cmake/modules/FindCurl.cmake new file mode 100644 index 0000000..a2e8862 --- /dev/null +++ b/project/cmake/modules/FindCurl.cmake @@ -0,0 +1,37 @@ +# - Try to find CURL +# Once done this will define +# +# CURL_FOUND - system has libcurl +# CURL_INCLUDE_DIRS - the libcurl include directory +# CURL_LIBRARIES - The libcurl libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (CURL libcurl) + list(APPEND CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR}) +else() + find_path(CURL_INCLUDE_DIRS curl/curl.h) + find_library(CURL_LIBRARIES NAMES curl libcurl) +endif() +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Curl DEFAULT_MSG CURL_INCLUDE_DIRS CURL_LIBRARIES) + +mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES) + +if(CURL_FOUND) + if(NOT CURL_LIBRARY_DIRS AND CURL_LIBDIR) + set(CURL_LIBRARY_DIRS ${CURL_LIBDIR}) + endif() + + find_soname(CURL) + + if(EXISTS "${CURL_LIBRARY_DIRS}/${CURL_SONAME}") + execute_process(COMMAND readelf -s ${CURL_LIBRARY_DIRS}/${CURL_SONAME} COMMAND grep CRYPTO_set_locking_call OUTPUT_VARIABLE HAS_CURL_STATIC) + else() + message(FATAL_ERROR "curl library not found") + endif() +endif() + +if(HAS_CURL_STATIC) + mark_as_advanced(HAS_CURL_STATIC) + list(APPEND CURL_DEFINITIONS -DHAS_CURL_STATIC=1) +endif() diff --git a/project/cmake/modules/FindD3DX11Effects.cmake b/project/cmake/modules/FindD3DX11Effects.cmake new file mode 100644 index 0000000..2b2de85 --- /dev/null +++ b/project/cmake/modules/FindD3DX11Effects.cmake @@ -0,0 +1,49 @@ +# - Builds D3DX11Effects as external project +# Once done this will define +# +# D3DX11EFFECTS_FOUND - system has D3DX11Effects +# D3DX11EFFECTS_INCLUDE_DIRS - the D3DX11Effects include directories +# D3DCOMPILER_DLL - Path to the Direct3D Compiler + +include(ExternalProject) +ExternalProject_Add(d3dx11effects + SOURCE_DIR ${CORE_SOURCE_DIR}/lib/win32/Effects11 + PREFIX ${CORE_BUILD_DIR}/Effects11 + CONFIGURE_COMMAND "" + BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG} + ${CORE_SOURCE_DIR}/lib/win32/Effects11/Effects11_2013.sln + INSTALL_COMMAND "") + +set(D3DX11EFFECTS_FOUND 1) +set(D3DX11EFFECTS_INCLUDE_DIRS ${CORE_SOURCE_DIR}/lib/win32/Effects11/inc) + +set(D3DX11EFFECTS_LIBRARY_RELEASE ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Release/Effects11.lib) +set(D3DX11EFFECTS_LIBRARY_DEBUG ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Debug/Effects11.lib) +include(SelectLibraryConfigurations) +select_library_configurations(D3DX11EFFECTS) + +mark_as_advanced(D3DX11EFFECTS_FOUND) + +find_file(D3DCOMPILER_DLL + NAMES d3dcompiler_47.dll d3dcompiler_46.dll + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/x86" + "$ENV{WindowsSdkDir}Redist/d3d/x86" + NO_DEFAULT_PATH) +if(NOT D3DCOMPILER_DLL) + message(WARNING "Could NOT find Direct3D Compiler") +endif() +mark_as_advanced(D3DCOMPILER_DLL) + +find_program(FXC fxc + PATHS + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86" + "$ENV{WindowsSdkDir}bin/x86") +if(NOT FXC) + message(WARNING "Could NOT find DirectX Effects Compiler (FXC)") +endif() +mark_as_advanced(FXC) diff --git a/project/cmake/modules/FindDbus.cmake b/project/cmake/modules/FindDbus.cmake new file mode 100644 index 0000000..cdc3f52 --- /dev/null +++ b/project/cmake/modules/FindDbus.cmake @@ -0,0 +1,21 @@ +# - Try to find dbus +# Once done this will define +# +# DBUS_FOUND - system has libdbus +# DBUS_INCLUDE_DIRS - the libdbus include directory +# DBUS_LIBRARIES - The libdbus libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (DBUS dbus-1) +endif() + +if(DBUS_FOUND) + find_path(DBUS_INCLUDE_DIRS dbus/dbus.h PATH_SUFFIXES dbus-1.0) + find_library(DBUS_LIBRARIES dbus-1.0) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Dbus DEFAULT_MSG DBUS_INCLUDE_DIRS DBUS_LIBRARIES) + +list(APPEND DBUS_DEFINITIONS -DHAVE_DBUS=1) +mark_as_advanced(DBUS_INCLUDE_DIRS DBUS_LIBRARIES DBUS_DEFINITIONS) diff --git a/project/cmake/modules/FindEGL.cmake b/project/cmake/modules/FindEGL.cmake new file mode 100644 index 0000000..79bb176 --- /dev/null +++ b/project/cmake/modules/FindEGL.cmake @@ -0,0 +1,48 @@ +#.rst: +# FindEGL +# ------- +# Finds the EGL library +# +# This will will define the following variables:: +# +# EGL_FOUND - system has EGL +# EGL_INCLUDE_DIRS - the EGL include directory +# EGL_LIBRARIES - the EGL libraries +# EGL_DEFINITIONS - the EGL definitions +# +# and the following imported targets:: +# +# EGL::EGL - The EGL library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_EGL egl QUIET) +endif() + +find_path(EGL_INCLUDE_DIR EGL/egl.h + PATHS ${PC_EGL_INCLUDEDIR}) + +find_library(EGL_LIBRARY NAMES EGL egl + PATHS ${PC_EGL_LIBDIR}) + +set(EGL_VERSION ${PC_EGL_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(EGL + REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR + VERSION_VAR EGL_VERSION) + +if(EGL_FOUND) + set(EGL_LIBRARIES ${EGL_LIBRARY}) + set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR}) + set(EGL_DEFINITIONS -DHAVE_LIBEGL=1) + + if(NOT TARGET EGL::EGL) + add_library(EGL::EGL UNKNOWN IMPORTED) + set_target_properties(EGL::EGL PROPERTIES + IMPORTED_LOCATION "${EGL_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBEGL=1) + endif() +endif() + +mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY) diff --git a/project/cmake/modules/FindEMBEDDED.cmake b/project/cmake/modules/FindEMBEDDED.cmake new file mode 100644 index 0000000..bc1b456 --- /dev/null +++ b/project/cmake/modules/FindEMBEDDED.cmake @@ -0,0 +1,17 @@ +# - Try to find embedded platforms (RPI/IMX6) +# Once done this will define +# +# EMBEDDED_FOUND - system is RPI / IMX6 and we most probably want to compile for GLES2 support +# (don't configure for OpenGL) + +if(NOT CMAKE_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CPU}) +endif() + +string(REGEX MATCH "^arm" TARGET_ARCH_ARM "${CMAKE_SYSTEM_PROCESSOR}") +if(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM) + return() +endif(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM) + +find_path(EMBEDDED_FOUND NAMES include/linux/imxfb.h include/bcm_host.h PATHS /opt/vc) + diff --git a/project/cmake/modules/FindFFMPEG.cmake b/project/cmake/modules/FindFFMPEG.cmake new file mode 100644 index 0000000..711845a --- /dev/null +++ b/project/cmake/modules/FindFFMPEG.cmake @@ -0,0 +1,99 @@ +include(ExternalProject) +file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER) +string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}") +list(GET FFMPEG_VER 0 FFMPEG_VER) +string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER) +string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}") +list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL) +string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL) + + +if(ENABLE_INTERNAL_FFMPEG) + if(FFMPEG_PATH) + message(WARNING "Internal FFmpeg enabled, but FFMPEG_PATH given, ignoring") + endif() + if(CMAKE_CROSSCOMPILING) + set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH} + -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE} + -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING} + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} + -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + -DCPU=${WITH_CPU} + -DOS=${OS} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_AR=${CMAKE_AR} + -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} + -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}) + endif() + + externalproject_add(ffmpeg + URL ${FFMPEG_BASE_URL}/${FFMPEG_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/ffmpeg + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -DCMAKE_BUILD_TYPE=${DCMAKE_BUILD_TYPE} + -DFFMPEG_VER=${FFMPEG_VER} + -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} + ${CROSS_ARGS} + PATCH_COMMAND ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt + && + ${CMAKE_COMMAND} -E copy + ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake + ) + + file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper +"#!/bin/bash +if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}-test* ]] +then + avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec` + avcodec=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat` + avfilter=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter` + avutil=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil` + swscale=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale` + swresample=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample` + gnutls=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors gnutls` + vorbisenc=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors vorbisenc` + dcadec=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors dcadec` + $@ $avcodec $avformat $avcodec $avfilter $swscale $swresample -lpostproc $gnutls $vorbisenc $dcadec +else + $@ +fi") + file(COPY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper + DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE) + set(FFMPEG_LINK_EXECUTABLE "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg-link-wrapper -o " PARENT_SCOPE) + set(FFMPEG_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include) + list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\" + -DUSE_STATIC_FFMPEG=1) + set(FFMPEG_FOUND 1) +else() + if(FFMPEG_PATH) + set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig") + endif() + set(FFMPEG_PKGS libavcodec>=56.26.100 libavfilter>=5.11.100 libavformat>=56.25.101 + libavutil>=54.20.100 libswscale>=3.1.101 libswresample>=1.1.100 libpostproc>=53.3.100) + if(PKG_CONFIG_FOUND) + pkg_check_modules (FFMPEG ${FFMPEG_PKGS}) + string(REGEX REPLACE "framework;" "framework " FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}") + set(FFMPEG_LIBRARIES ${FFMPEG_LDFLAGS}) + else() + find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h PATH_SUFFIXES ffmpeg) + find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec) + find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter) + find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat) + find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil) + find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale) + find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER} ${FFMPEG_LIBAVFORMAT} + ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBPOSTPROC}) + add_custom_target(ffmpeg DEPENDS ${FFMPEG_LIBRARIES}) + endif() + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(FFMPEG DEFAULT_MSG FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES) + set(FFMPEG_FOUND 1) + list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\") +endif() + +mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS FFMPEG_FOUND) diff --git a/project/cmake/modules/FindFreeType.cmake b/project/cmake/modules/FindFreeType.cmake new file mode 100644 index 0000000..a1e69ab --- /dev/null +++ b/project/cmake/modules/FindFreeType.cmake @@ -0,0 +1,18 @@ +# - Try to find freetype +# Once done this will define +# +# FREETYPE_FOUND - system has freetype +# FREETYPE_INCLUDE_DIRS - the freetype include directory +# FREETYPE_LIBRARIES - The freetype libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (FREETYPE freetype2) +else() + find_path(FREETYPE_INCLUDE_DIRS freetype/freetype.h) + find_library(FREETYPE_LIBRARIES NAMES freetype freetype246MT) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FreeType DEFAULT_MSG FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) + +mark_as_advanced(FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES) diff --git a/project/cmake/modules/FindFribidi.cmake b/project/cmake/modules/FindFribidi.cmake new file mode 100644 index 0000000..65a8d8b --- /dev/null +++ b/project/cmake/modules/FindFribidi.cmake @@ -0,0 +1,18 @@ +# - Try to find Fribidi +# Once done this will define +# +# FRIBIDI_FOUND - system has fribidi +# FRIBIDI_INCLUDE_DIRS - the fribidi include directory +# FRIBIDI_LIBRARIES - The fribidi libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (FRIBIDI fribidi) +else() + find_path(FRIBIDI_INCLUDE_DIRS fribidi/fribidi.h) + find_library(FRIBIDI_LIBRARIES NAMES fribidi libfribidi) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Fribidi DEFAULT_MSG FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES) + +mark_as_advanced(FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES) diff --git a/project/cmake/modules/FindGIF.cmake b/project/cmake/modules/FindGIF.cmake new file mode 100644 index 0000000..8649bd4 --- /dev/null +++ b/project/cmake/modules/FindGIF.cmake @@ -0,0 +1,46 @@ +#.rst: +# FindGIF +# ------- +# Finds the libgif library +# +# This will will define the following variables:: +# +# GIF_FOUND - system has libgif +# GIF_INCLUDE_DIRS - the libgif include directory +# GIF_LIBRARIES - the libgif libraries +# +# and the following imported targets:: +# +# GIF::GIF - The libgif library + +find_path(GIF_INCLUDE_DIR gif_lib.h) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(GIF_LIBRARY NAMES gif) + find_package_handle_standard_args(GIF + REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(GIF + REQUIRED_VARS GIF_INCLUDE_DIR) +endif() + +if(GIF_FOUND) + set(GIF_LIBRARIES ${GIF_LIBRARY}) + set(GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR}) + set(GIF_DEFINITIONS -DHAVE_LIBGIF=1) + + if(NOT TARGET GIF::GIF) + add_library(GIF::GIF UNKNOWN IMPORTED) + if(GIF_LIBRARY) + set_target_properties(GIF::GIF PROPERTIES + IMPORTED_LOCATION "${GIF_LIBRARY}") + endif() + set_target_properties(GIF::GIF PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBGIF=1) + endif() +endif() + +mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY) diff --git a/project/cmake/modules/FindJsonSchemaBuilder.cmake b/project/cmake/modules/FindJsonSchemaBuilder.cmake new file mode 100644 index 0000000..78e8d0a --- /dev/null +++ b/project/cmake/modules/FindJsonSchemaBuilder.cmake @@ -0,0 +1,19 @@ +#.rst: +# FindJsonSchemaBuilder +# --------------------- +# Finds the JsonSchemaBuilder +# +# This will define the following (imported) targets:: +# +# JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable + +if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder) + if(CMAKE_CROSSCOMPILING) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL) + set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES + IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder") + else() + add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder) + add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder) + endif() +endif() diff --git a/project/cmake/modules/FindLibDvd.cmake b/project/cmake/modules/FindLibDvd.cmake new file mode 100644 index 0000000..f281773 --- /dev/null +++ b/project/cmake/modules/FindLibDvd.cmake @@ -0,0 +1,116 @@ +set(dvdlibs libdvdread libdvdnav) +if(ENABLE_DVDCSS) + list(APPEND dvdlibs libdvdcss) +endif() + +if(NOT WIN32) + foreach(dvdlib ${dvdlibs}) + file(GLOB VERSION_FILE ${CORE_SOURCE_DIR}/tools/depends/target/${dvdlib}/DVD*-VERSION) + file(STRINGS ${VERSION_FILE} VER) + string(REGEX MATCH "VERSION=[^ ]*$.*" ${dvdlib}_VER "${VER}") + list(GET ${dvdlib}_VER 0 ${dvdlib}_VER) + string(SUBSTRING "${${dvdlib}_VER}" 8 -1 ${dvdlib}_VER) + string(REGEX MATCH "BASE_URL=([^ ]*)" ${dvdlib}_BASE_URL "${VER}") + list(GET ${dvdlib}_BASE_URL 0 ${dvdlib}_BASE_URL) + string(SUBSTRING "${${dvdlib}_BASE_URL}" 9 -1 ${dvdlib}_BASE_URL) + endforeach() + + set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include") + if(CMAKE_CROSSCOMPILING) + set(EXTRA_FLAGS "CC=${CMAKE_C_COMPILER}") + endif() + + if(APPLE) + set(CMAKE_LD_FLAGS "-framework IOKit -framework CoreFoundation") + endif() + + if(ENABLE_DVDCSS) + ExternalProject_ADD(dvdcss URL ${libdvdcss_BASE_URL}/archive/${libdvdcss_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/libdvd + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND ac_cv_path_GIT= /configure + --target=${ARCH} + --host=${ARCH} + --disable-doc + --enable-static + --disable-shared + --with-pic + --prefix= + "${EXTRA_FLAGS}" + "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" + "LDFLAGS=${CMAKE_LD_FLAGS}") + + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a + system/players/VideoPlayer/libdvdcss dvdcss) + endif() + + set(DVDREAD_CFLAGS "-D_XBMC") + if(ENABLE_DVDCSS) + set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -DHAVE_DVDCSS_DVDCSS_H -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include") + endif(ENABLE_DVDCSS) + + ExternalProject_ADD(dvdread URL ${libdvdread_BASE_URL}/archive/${libdvdread_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/libdvd + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND ac_cv_path_GIT= /configure + --target=${ARCH} + --host=${ARCH} + --enable-static + --disable-shared + --with-pic + --prefix= + "${EXTRA_FLAGS}" + "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" + "LDFLAGS=${CMAKE_LD_FLAGS}") + if(ENABLE_DVDCSS) + add_dependencies(dvdread dvdcss) + endif() + + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a + system/players/VideoPlayer/libdvdread dvdread) + + if(ENABLE_DVDCSS) + set(DVDNAV_LIBS -ldvdcss) + endif(ENABLE_DVDCSS) + + ExternalProject_ADD(dvdnav URL ${libdvdnav_BASE_URL}/archive/${libdvdnav_VER}.tar.gz + PREFIX ${CORE_BUILD_DIR}/libdvd + UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif + CONFIGURE_COMMAND ac_cv_path_GIT= /configure + --target=${ARCH} + --host=${ARCH} + --enable-static + --disable-shared + --with-pic + --prefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd + "${EXTRA_FLAGS}" + "LDFLAGS=${CMAKE_LD_FLAGS} -L${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib" + "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}" + "DVDREAD_CFLAGS=${DVDREAD_CFLAGS}" + "DVDREAD_LIBS=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.la" + "LIBS=${DVDNAV_LIBS}") + add_dependencies(dvdnav dvdread) + core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a + system/players/VideoPlayer/libdvdnav dvdnav) + + set(LIBDVD_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include) + set(LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a) + if(ENABLE_DVDCSS) + list(APPEND LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a) + endif() + set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE) + set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE) +else() + # Dynamically loaded on Windows + find_path(LIBDVD_INCLUDE_DIR dvdcss/dvdcss.h PATHS ${CORE_SOURCE_DIR}/lib/libdvd/include) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(LIBDVD REQUIRED_VARS LIBDVD_INCLUDE_DIR) + + if(LIBDVD_FOUND) + set(LIBDVD_INCLUDE_DIRS ${LIBDVD_INCLUDE_DIR}) + endif() + + mark_as_advanced(LIBDVD_INCLUDE_DIR) +endif() diff --git a/project/cmake/modules/FindLibSmbClient.cmake b/project/cmake/modules/FindLibSmbClient.cmake new file mode 100644 index 0000000..897fa7b --- /dev/null +++ b/project/cmake/modules/FindLibSmbClient.cmake @@ -0,0 +1,65 @@ +# - Try to find Libsmbclient + +if(PKGCONFIG_FOUND) + pkg_check_modules(LIBSMBCLIENT smbclient) + set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) +endif() + +if (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) + # in cache already + set(LIBSMBCLIENT_FOUND TRUE) +else (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) + find_path(LIBSMBCLIENT_INCLUDE_DIR + NAMES + libsmbclient.h + PATHS + /usr/include + /usr/local/include + /opt/local/include + /sw/include + ) + + find_library(SMBCLIENT_LIBRARY + NAMES + smbclient + PATHS + /usr/lib + /usr/local/lib + /opt/local/lib + /sw/lib + ) + + if (SMBCLIENT_LIBRARY) + set(SMBCLIENT_FOUND TRUE) + endif (SMBCLIENT_LIBRARY) + + set(LIBSMBCLIENT_INCLUDE_DIRS + ${LIBSMBCLIENT_INCLUDE_DIR} + ) + + if (SMBCLIENT_FOUND) + set(LIBSMBCLIENT_LIBRARIES + ${LIBSMBCLIENT_LIBRARIES} + ${SMBCLIENT_LIBRARY} + ) + endif (SMBCLIENT_FOUND) + + if (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES) + set(LIBSMBCLIENT_FOUND TRUE) + endif (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES) + + if (LIBSMBCLIENT_FOUND) + if (NOT Libsmbclient_FIND_QUIETLY) + message(STATUS "Found Libsmbclient: ${LIBSMBCLIENT_LIBRARIES}") + endif (NOT Libsmbclient_FIND_QUIETLY) + else (LIBSMBCLIENT_FOUND) + if (Libsmbclient_FIND_REQUIRED) + message(FATAL_ERROR "Could not find Libsmbclient") + endif (Libsmbclient_FIND_REQUIRED) + endif (LIBSMBCLIENT_FOUND) + set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1) + + # show the LIBSMBCLIENT_INCLUDE_DIRS and LIBSMBCLIENT_LIBRARIES variables only in the advanced view + mark_as_advanced(LIBSMBCLIENT_INCLUDE_DIRS LIBSMBCLIENT_LIBRARIES LIBSMBCLIENT_DEFINITIONS) + +endif (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS) diff --git a/project/cmake/modules/FindLibUSB.cmake b/project/cmake/modules/FindLibUSB.cmake new file mode 100644 index 0000000..e976bf4 --- /dev/null +++ b/project/cmake/modules/FindLibUSB.cmake @@ -0,0 +1,45 @@ +#.rst: +# FindLibUSB +# ---------- +# Finds the USB library +# +# This will will define the following variables:: +# +# LIBUSB_FOUND - system has LibUSB +# LIBUSB_INCLUDE_DIRS - the USB include directory +# LIBUSB_LIBRARIES - the USB libraries +# +# and the following imported targets:: +# +# LibUSB::LibUSB - The USB library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_LIBUSB libusb QUIET) +endif() + +find_path(LIBUSB_INCLUDE_DIR usb.h + PATHS ${PC_LIBUSB_INCLUDEDIR}) +find_library(LIBUSB_LIBRARY NAMES usb + PATHS ${PC_LIBUSB_INCLUDEDIR}) +set(LIBUSB_VERSION ${PC_LIBUSB_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(LIBUSB + REQUIRED_VARS LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR + VERSION_VAR LIBUSB_VERSION) + +if(LIBUSB_FOUND) + set(LIBUSB_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIR}) + set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY}) + set(LIBUSB_DEFINITIONS -DUSE_LIBUSB=1) + + if(NOT TARGET LibUSB::LibUSB) + add_library(LibUSB::LibUSB UNKNOWN IMPORTED) + set_target_properties(LibUSB::LibUSB PROPERTIES + IMPORTED_LOCATION "${LIBUSB_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS USE_LIBUSB=1) + endif() +endif() + +mark_as_advanced(USB_INCLUDE_DIR USB_LIBRARY) diff --git a/project/cmake/modules/FindLzo2.cmake b/project/cmake/modules/FindLzo2.cmake new file mode 100644 index 0000000..33eee10 --- /dev/null +++ b/project/cmake/modules/FindLzo2.cmake @@ -0,0 +1,22 @@ +# - Try to find Lzo2 +# Once done this will define +# +# Lzo2_FOUND - system has Lzo2 +# Lzo2_INCLUDE_DIR - the Lzo2 include directory +# Lzo2_LIBRARIES - Link these to use Lzo2 +# Lzo2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_ + +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +FIND_PATH(LZO2_INCLUDE_DIRS lzo1x.h PATH_SUFFIXES lzo) + +FIND_LIBRARY(LZO2_LIBRARIES NAMES lzo2 liblzo2) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Lzo2 DEFAULT_MSG LZO2_INCLUDE_DIRS LZO2_LIBRARIES) + +MARK_AS_ADVANCED(LZO2_INCLUDE_DIRS LZO2_LIBRARIES) diff --git a/project/cmake/modules/FindMMAL.cmake b/project/cmake/modules/FindMMAL.cmake new file mode 100644 index 0000000..8843983 --- /dev/null +++ b/project/cmake/modules/FindMMAL.cmake @@ -0,0 +1,36 @@ +# - Try to find MMAL +# Once done this will define +# +# MMAL_FOUND - system has MMAL +# MMAL_INCLUDE_DIRS - the MMAL include directory +# MMAL_LIBRARIES - The MMAL libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules(MMAL mmal QUIET) +endif() + +if(NOT MMAL_FOUND) + find_path(MMAL_INCLUDE_DIRS interface/mmal/mmal.h) + find_library(MMAL_LIBRARY mmal) + find_library(MMALCORE_LIBRARY mmal_core) + find_library(MMALUTIL_LIBRARY mmal_util) + find_library(MMALCLIENT_LIBRARY mmal_vc_client) + find_library(MMALCOMPONENT_LIBRARY mmal_components) + find_library(BCM_LIBRARY bcm_host) + find_library(VCHIQ_LIBRARY vchiq_arm) + find_library(VCOS_LIBRARY vcos) + find_library(VCSM_LIBRARY vcsm) + find_library(CONTAINER_LIBRARY containers) + + set(MMAL_LIBRARIES ${MMAL_LIBRARY} ${MMALCORE_LIBRARY} ${MMALUTIL_LIBRARY} + ${MMALCLIENT_LIBRARY} ${MMALCOMPONENT_LIBRARY} + ${BCM_LIBRARY} ${VCHIQ_LIBRARY} ${VCOS_LIBRARY} ${VCSM_LIBRARY} ${CONTAINER_LIBRARY} + CACHE STRING "mmal libraries" FORCE) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MMAL DEFAULT_MSG MMAL_LIBRARIES MMAL_INCLUDE_DIRS) + +list(APPEND MMAL_DEFINITIONS -DHAVE_MMAL=1 -DHAS_MMAL=1) + +mark_as_advanced(MMAL_INCLUDE_DIRS MMAL_LIBRARIES MMAL_DEFINITIONS) diff --git a/project/cmake/modules/FindMicroHttpd.cmake b/project/cmake/modules/FindMicroHttpd.cmake new file mode 100644 index 0000000..f73dc77 --- /dev/null +++ b/project/cmake/modules/FindMicroHttpd.cmake @@ -0,0 +1,106 @@ +IF (NOT WIN32) + include(FindPkgConfig) + if ( PKG_CONFIG_FOUND ) + + pkg_check_modules (MICROHTTPD libmicrohttpd>=0.4) + + set(MICROHTTPD_DEFINITIONS ${MICROHTTPD_CFLAGS_OTHER}) + endif(PKG_CONFIG_FOUND) +endif (NOT WIN32) + +# +# set defaults +if(NOT MICROHTTPD_FOUND) + SET(_microhttpd_HOME "/usr/local") + SET(_microhttpd_INCLUDE_SEARCH_DIRS + ${CMAKE_INCLUDE_PATH} + /usr/local/include + /usr/include + ) + + SET(_microhttpd_LIBRARIES_SEARCH_DIRS + ${CMAKE_LIBRARY_PATH} + /usr/local/lib + /usr/lib + ) + + ## + if( "${MICROHTTPD_HOME}" STREQUAL "") + if("" MATCHES "$ENV{MICROHTTPD_HOME}") + message(STATUS "MICROHTTPD_HOME env is not set, setting it to /usr/local") + set (MICROHTTPD_HOME ${_microhttpd_HOME}) + else("" MATCHES "$ENV{MICROHTTPD_HOME}") + set (MICROHTTPD_HOME "$ENV{MICROHTTPD_HOME}") + endif("" MATCHES "$ENV{MICROHTTPD_HOME}") + else( "${MICROHTTPD_HOME}" STREQUAL "") + message(STATUS "MICROHTTPD_HOME is not empty: \"${MICROHTTPD_HOME}\"") + endif( "${MICROHTTPD_HOME}" STREQUAL "") + ## + + message(STATUS "Looking for microhttpd in ${MICROHTTPD_HOME}") + + IF( NOT ${MICROHTTPD_HOME} STREQUAL "" ) + SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS}) + SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS}) + SET(_microhttpd_HOME ${MICROHTTPD_HOME}) + ENDIF( NOT ${MICROHTTPD_HOME} STREQUAL "" ) + + IF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" ) + SET(_microhttpd_INCLUDE_SEARCH_DIRS $ENV{MICROHTTPD_INCLUDEDIR} ${_microhttpd_INCLUDE_SEARCH_DIRS}) + ENDIF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" ) + + IF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" ) + SET(_microhttpd_LIBRARIES_SEARCH_DIRS $ENV{MICROHTTPD_LIBRARYDIR} ${_microhttpd_LIBRARIES_SEARCH_DIRS}) + ENDIF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" ) + + IF( MICROHTTPD_HOME ) + SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS}) + SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS}) + SET(_microhttpd_HOME ${MICROHTTPD_HOME}) + ENDIF( MICROHTTPD_HOME ) + + # find the include files + FIND_PATH(MICROHTTPD_INCLUDE_DIRS microhttpd.h + HINTS + ${_microhttpd_INCLUDE_SEARCH_DIRS} + ${PC_MICROHTTPD_INCLUDEDIR} + ${PC_MICROHTTPD_INCLUDE_DIRS} + ${CMAKE_INCLUDE_PATH} + ) + + # locate the library + IF(WIN32) + SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.lib) + ELSE(WIN32) + SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.a) + ENDIF(WIN32) + FIND_LIBRARY(MICROHTTPD_LIBRARIES NAMES ${MICROHTTPD_LIBRARY_NAMES} + HINTS + ${_microhttpd_LIBRARIES_SEARCH_DIRS} + ${PC_MICROHTTPD_LIBDIR} + ${PC_MICROHTTPD_LIBRARY_DIRS} + ) + + # if the include and the program are found then we have it + IF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES) + SET(MICROHTTPD_FOUND "YES") + ENDIF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES) + + if( NOT WIN32) + find_library(GCRYPT_LIBRARY gcrypt) + find_library(GPGERROR_LIBRARY gpg-error) + list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY}) + if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android) + list(APPEND MICROHTTPD_LIBRARIES "-lrt") + endif() + endif( NOT WIN32) +endif() + +list(APPEND MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1) + +MARK_AS_ADVANCED( + MICROHTTPD_FOUND + MICROHTTPD_LIBRARIES + MICROHTTPD_DEFINITIONS + MICROHTTPD_INCLUDE_DIRS +) diff --git a/project/cmake/modules/FindMySqlClient.cmake b/project/cmake/modules/FindMySqlClient.cmake new file mode 100644 index 0000000..12fee5c --- /dev/null +++ b/project/cmake/modules/FindMySqlClient.cmake @@ -0,0 +1,53 @@ +#.rst: +# FindMySqlClient +# --------------- +# Finds the MySqlClient library +# +# This will will define the following variables:: +# +# MYSQLCLIENT_FOUND - system has MySqlClient +# MYSQLCLIENT_INCLUDE_DIRS - the MySqlClient include directory +# MYSQLCLIENT_LIBRARIES - the MySqlClient libraries +# MYSQLCLIENT_DEFINITIONS - the MySqlClient compile definitions +# +# and the following imported targets:: +# +# MySqlClient::MySqlClient - The MySqlClient library + +find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql_time.h) +find_library(MYSQLCLIENT_LIBRARY_RELEASE NAMES mysqlclient mysqlclient_r + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} mysql) +find_library(MYSQLCLIENT_LIBRARY_DEBUG NAMES mysqlclient + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} mysql) + +include(SelectLibraryConfigurations) +select_library_configurations(MYSQLCLIENT) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MYSQLCLIENT + REQUIRED_VARS MYSQLCLIENT_LIBRARY MYSQLCLIENT_INCLUDE_DIR) + +if(MYSQLCLIENT_FOUND) + set(MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARY}) + set(MYSQLCLIENT_INCLUDE_DIRS ${MYSQLCLIENT_INCLUDE_DIR}) + set(MYSQLCLIENT_DEFINITIONS -DHAVE_MYSQL=1) + + if(NOT TARGET MySqlClient::MySqlClient) + add_library(MySqlClient::MySqlClient UNKNOWN IMPORTED) + if(MYSQLCLIENT_LIBRARY_RELEASE) + set_target_properties(MySqlClient::MySqlClient PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_RELEASE}") + endif() + if(MYSQLCLIENT_LIBRARY_DEBUG) + set_target_properties(MySqlClient::MySqlClient PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_DEBUG}") + endif() + set_target_properties(MySqlClient::MySqlClient PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${MYSQLCLIENT_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_MYSQL=1) + endif() +endif() + +mark_as_advanced(MYSQLCLIENT_INCLUDE_DIR MYSQLCLIENT_LIBRARY) diff --git a/project/cmake/modules/FindNFS.cmake b/project/cmake/modules/FindNFS.cmake new file mode 100644 index 0000000..3fd9d61 --- /dev/null +++ b/project/cmake/modules/FindNFS.cmake @@ -0,0 +1,58 @@ +#.rst: +# FindNFS +# ------- +# Finds the libnfs library +# +# This will will define the following variables:: +# +# NFS_FOUND - system has libnfs +# NFS_INCLUDE_DIRS - the libnfs include directory +# NFS_LIBRARIES - the libnfs libraries +# NFS_DEFINITIONS - the libnfs compile definitions +# +# and the following imported targets:: +# +# NFS::NFS - The libnfs library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(NFS libnfs QUIET) +endif() + +find_path(NFS_INCLUDE_DIR nfsc/libnfs.h + PATHS ${PC_NFS_INCLUDEDIR}) + +set(NFS_VERSION ${PC_NFS_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(NFS_LIBRARY NAMES nfs + PATHS ${PC_NFS_LIBDIR}) + + find_package_handle_standard_args(NFS + REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR + VERSION_VAR NFS_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(NFS + REQUIRED_VARS NFS_INCLUDE_DIR + VERSION_VAR NFS_VERSION) +endif() + +if(NFS_FOUND) + set(NFS_LIBRARIES ${NFS_LIBRARY}) + set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR}) + set(NFS_DEFINITIONS -DHAVE_LIBNFS=1) + + if(NOT TARGET NFS::NFS) + add_library(NFS::NFS UNKNOWN IMPORTED) + if(NFS_LIBRARY) + set_target_properties(NFS::NFS PROPERTIES + IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}") + endif() + set_target_properties(NFS::NFS PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1) + endif() +endif() + +mark_as_advanced(NFS_INCLUDE_DIR NFS_LIBRARY) diff --git a/project/cmake/modules/FindOpenGLES.cmake b/project/cmake/modules/FindOpenGLES.cmake new file mode 100644 index 0000000..5d71dd4 --- /dev/null +++ b/project/cmake/modules/FindOpenGLES.cmake @@ -0,0 +1,48 @@ +#.rst: +# FindOpenGLES +# ------------ +# Finds the OpenGLES2 library +# +# This will will define the following variables:: +# +# OPENGLES_FOUND - system has OpenGLES +# OPENGLES_INCLUDE_DIRS - the OpenGLES include directory +# OPENGLES_LIBRARIES - the OpenGLES libraries +# OPENGLES_DEFINITIONS - the OpenGLES definitions + +find_package(EMBEDDED) + +if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi") + pkg_check_modules(PC_OPENGLES glesv2) + if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND) + set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH}) + endif() +endif() + +if(NOT CORE_SYSTEM_NAME STREQUAL ios) + find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h + PATHS ${PC_OPENGLES_INCLUDEDIR}) + find_library(OPENGLES_gl_LIBRARY NAMES GLESv2 + PATHS ${PC_OPENGLES_LIBDIR}) + find_library(OPENGLES_egl_LIBRARY NAMES EGL + PATHS ${PC_OPENGLES_LIBDIR}) +else() + find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES + PATHS ${CMAKE_OSX_SYSROOT}/System/Library + PATH_SUFFIXES Frameworks + NO_DEFAULT_PATH) + set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers) + set(OPENGLES_egl_LIBRARY ${OPENGLES_gl_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenGLES + REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY OPENGLES_INCLUDE_DIR) + +if(OPENGLES_FOUND) + set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR}) + set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_egl_LIBRARY}) + set(OPENGLES_DEFINITIONS -DHAVE_LIBGLESV2 -DHAVE_LIBEGL=1) +endif() + +mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY) diff --git a/project/cmake/modules/FindOpenGl.cmake b/project/cmake/modules/FindOpenGl.cmake new file mode 100644 index 0000000..9d6ec01 --- /dev/null +++ b/project/cmake/modules/FindOpenGl.cmake @@ -0,0 +1,43 @@ +#.rst: +# FindOpenGl +# ---------- +# Finds the FindOpenGl library +# +# This will will define the following variables:: +# +# OPENGL_FOUND - system has OpenGl +# OPENGL_INCLUDE_DIRS - the OpenGl include directory +# OPENGL_LIBRARIES - the OpenGl libraries +# OPENGL_DEFINITIONS - the OpenGl definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_OPENGL gl glu) +endif() + +if(NOT CORE_SYSTEM_NAME STREQUAL darwin) + find_path(OPENGL_INCLUDE_DIR GL/gl.h + PATHS ${PC_OPENGL_gl_INCLUDEDIR}) + find_library(OPENGL_gl_LIBRARY NAMES GL + PATHS ${PC_OPENGL_gl_LIBDIR}) + find_library(OPENGL_glu_LIBRARY NAMES GLU + PATHS ${PC_OPENGL_glu_LIBDIR}) +else() + find_library(OPENGL_gl_LIBRARY NAMES OpenGL + PATHS ${CMAKE_OSX_SYSROOT}/System/Library + PATH_SUFFIXES Frameworks + NO_DEFAULT_PATH) + set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers) + set(OPENGL_glu_LIBRARY ${OPENGL_gl_LIBRARY}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OpenGl + REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY OPENGL_INCLUDE_DIR) + +if(OPENGL_FOUND) + set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) + set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY}) + set(OPENGL_DEFINITIONS -DHAVE_LIBGL=1) +endif() + +mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY) diff --git a/project/cmake/modules/FindPCRE.cmake b/project/cmake/modules/FindPCRE.cmake new file mode 100644 index 0000000..54c4ab4 --- /dev/null +++ b/project/cmake/modules/FindPCRE.cmake @@ -0,0 +1,91 @@ +#.rst: +# FindPCRE +# -------- +# Finds the PCRECPP library +# +# This will will define the following variables:: +# +# PCRE_FOUND - system has libpcrecpp +# PCRE_INCLUDE_DIRS - the libpcrecpp include directory +# PCRE_LIBRARIES - the libpcrecpp libraries +# PCRE_DEFINITIONS - the libpcrecpp definitions +# +# and the following imported targets:: +# +# PCRE::PCRECPP - The PCRECPP library +# PCRE::PCRE - The PCRE library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_PCRE libpcrecpp QUIET) +endif() + +find_path(PCRE_INCLUDE_DIR pcrecpp.h + PATHS ${PC_PCRE_INCLUDEDIR}) +find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRE_LIBRARY_RELEASE NAMES pcre + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_PCRE_LIBDIR}) +find_library(PCRE_LIBRARY_DEBUG NAMES pcred + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_PCRE_LIBDIR}) +set(PCRE_VERSION ${PC_PCRE_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(PCRECPP) +select_library_configurations(PCRE) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(PCRE + REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR + VERSION_VAR PCRE_VERSION) + +if(PCRE_FOUND) + set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY}) + set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR}) + if(WIN32) + set(PCRE_DEFINITIONS -DPCRE_STATIC=1) + endif() + + if(NOT TARGET PCRE::PCRE) + add_library(PCRE::PCRE UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRE PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}") + if(WIN32) + set_target_properties(PCRE::PCRE PROPERTIES + INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1) + endif() + + endif() + if(NOT TARGET PCRE::PCRECPP) + add_library(PCRE::PCRECPP UNKNOWN IMPORTED) + if(PCRE_LIBRARY_RELEASE) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}") + endif() + if(PCRE_LIBRARY_DEBUG) + set_target_properties(PCRE::PCRECPP PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}") + endif() + set_target_properties(PCRE::PCRECPP PROPERTIES + INTERFACE_LINK_LIBRARIES PCRE::PCRE) + endif() +endif() + +mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY) diff --git a/project/cmake/modules/FindPlist.cmake b/project/cmake/modules/FindPlist.cmake new file mode 100644 index 0000000..d7a6c48 --- /dev/null +++ b/project/cmake/modules/FindPlist.cmake @@ -0,0 +1,58 @@ +#.rst: +# FindPlist +# --------- +# Finds the Plist library +# +# This will will define the following variables:: +# +# PLIST_FOUND - system has Plist library +# PLIST_INCLUDE_DIRS - the Plist library include directory +# PLIST_LIBRARIES - the Plist libraries +# PLIST_DEFINITIONS - the Plist compile definitions +# +# and the following imported targets:: +# +# Plist::Plist - The Plist library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_PLIST libplist QUIET) +endif() + +find_path(PLIST_INCLUDE_DIR plist/plist.h + PATHS ${PC_PLIST_INCLUDEDIR}) + +set(PLIST_VERSION ${PC_PLIST_VERSION}) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(PLIST_LIBRARY NAMES plist + PATHS ${PC_PLIST_LIBDIR}) + + find_package_handle_standard_args(PLIST + REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR + VERSION_VAR PLIST_VERSION) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(PLIST + REQUIRED_VARS PLIST_INCLUDE_DIR + VERSION_VAR PLIST_VERSION) +endif() + +if(PLIST_FOUND) + set(PLIST_LIBRARIES ${PLIST_LIBRARY}) + set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR}) + set(PLIST_DEFINITIONS -DHAVE_LIBPLIST=1) + + if(NOT TARGET Plist::Plist) + add_library(Plist::Plist UNKNOWN IMPORTED) + if(PLIST_LIBRARY) + set_target_properties(Plist::Plist PROPERTIES + IMPORTED_LOCATION "${PLIST_LIBRARY}") + endif() + set_target_properties(Plist::Plist PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPLIST=1) + endif() +endif() + +mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY) diff --git a/project/cmake/modules/FindPulseAudio.cmake b/project/cmake/modules/FindPulseAudio.cmake new file mode 100644 index 0000000..5b57364 --- /dev/null +++ b/project/cmake/modules/FindPulseAudio.cmake @@ -0,0 +1,72 @@ +# Try to find the PulseAudio library +# +# Once done this will define: +# +# PULSEAUDIO_FOUND - system has the PulseAudio library +# PULSEAUDIO_INCLUDE_DIR - the PulseAudio include directory +# PULSEAUDIO_LIBRARY - the libraries needed to use PulseAudio +# PULSEAUDIO_MAINLOOP_LIBRARY - the libraries needed to use PulsAudio Mailoop +# +# Copyright (c) 2008, Matthias Kretz, +# Copyright (c) 2009, Marcus Hufgard, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (NOT PULSEAUDIO_MINIMUM_VERSION) + set(PULSEAUDIO_MINIMUM_VERSION "1.0.0") +endif (NOT PULSEAUDIO_MINIMUM_VERSION) + +if (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) + # Already in cache, be silent + set(PULSEAUDIO_FIND_QUIETLY TRUE) +endif (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY) + +if (NOT WIN32) + include(FindPkgConfig) + pkg_check_modules(PC_PULSEAUDIO libpulse>=${PULSEAUDIO_MINIMUM_VERSION}) + pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib) +endif (NOT WIN32) + +FIND_PATH(PULSEAUDIO_INCLUDE_DIRS pulse/pulseaudio.h + HINTS + ${PC_PULSEAUDIO_INCLUDEDIR} + ${PC_PULSEAUDIO_INCLUDE_DIRS} + ) + +FIND_LIBRARY(PULSEAUDIO_LIBRARY NAMES pulse libpulse + HINTS + ${PC_PULSEAUDIO_LIBDIR} + ${PC_PULSEAUDIO_LIBRARY_DIRS} + ) + +FIND_LIBRARY(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib + HINTS + ${PC_PULSEAUDIO_LIBDIR} + ${PC_PULSEAUDIO_LIBRARY_DIRS} + ) + +if (NOT PULSEAUDIO_INCLUDE_DIRS OR NOT PULSEAUDIO_LIBRARY) + set(PULSEAUDIO_FOUND FALSE) +else() + set(PULSEAUDIO_FOUND TRUE) +endif() + +if (PULSEAUDIO_FOUND) + if (NOT PULSEAUDIO_FIND_QUIETLY) + message(STATUS "Found PulseAudio: ${PULSEAUDIO_LIBRARY}") + if (PULSEAUDIO_MAINLOOP_LIBRARY) + message(STATUS "Found PulseAudio Mainloop: ${PULSEAUDIO_MAINLOOP_LIBRARY}") + else (PULSAUDIO_MAINLOOP_LIBRARY) + message(STATUS "Could NOT find PulseAudio Mainloop Library") + endif (PULSEAUDIO_MAINLOOP_LIBRARY) + endif (NOT PULSEAUDIO_FIND_QUIETLY) +else (PULSEAUDIO_FOUND) + message(STATUS "Could NOT find PulseAudio") +endif (PULSEAUDIO_FOUND) + +set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY}) + +list(APPEND PULSEAUDIO_DEFINITIONS -DHAVE_LIBPULSE=1) + +mark_as_advanced(PULSEAUDIO_INCLUDE_DIRS PULSEAUDIO_LIBRARIES PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY) diff --git a/project/cmake/modules/FindPython.cmake b/project/cmake/modules/FindPython.cmake new file mode 100644 index 0000000..6f9f236 --- /dev/null +++ b/project/cmake/modules/FindPython.cmake @@ -0,0 +1,43 @@ +# - Try to find python +# Once done this will define +# +# PYTHON_FOUND - system has PYTHON +# PYTHON_INCLUDE_DIRS - the python include directory +# PYTHON_LIBRARIES - The python libraries + +if(PKG_CONFIG_FOUND AND NOT CMAKE_CROSSCOMPILING) + pkg_check_modules (PYTHON python) +endif() + +if(NOT PYTHON_FOUND) + if(CMAKE_CROSSCOMPILING) + find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH) + find_library(PYTHON_LIBRARY NAMES python2.6 python2.7) + find_path(PYTHON_INCLUDE_DIRS NAMES Python.h PATHS ${DEPENDS_PATH}/include/python2.6 ${DEPENDS_PATH}/include/python2.7) + set(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIRS} CACHE PATH "python include dir" FORCE) + + find_library(FFI_LIBRARY ffi) + find_library(EXPAT_LIBRARY expat) + find_library(INTL_LIBRARY intl) + + if(NOT CORE_SYSTEM_NAME STREQUAL android) + set(PYTHON_DEP_LIBRARIES -lpthread -ldl -lutil) + endif() + + set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${PYTHON_DEP_LIBRARIES} + CACHE INTERNAL "python libraries" FORCE) + else() + find_package(PythonLibs) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Python DEFAULT_MSG PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES) + +if(CMAKE_SYSTEM_NAME STREQUAL Darwin) + find_library(FFI_LIBRARY ffi REQUIRED) + find_library(INTL_LIBRARY intl) + list(APPEND PYTHON_LIBRARIES ${FFI_LIBRARY} ${INTL_LIBRARY}) +endif() + +mark_as_advanced(PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_LDFLAGS) diff --git a/project/cmake/modules/FindRTMP.cmake b/project/cmake/modules/FindRTMP.cmake new file mode 100644 index 0000000..432b77d --- /dev/null +++ b/project/cmake/modules/FindRTMP.cmake @@ -0,0 +1,21 @@ +# - Try to find rtmp +# Once done this will define +# +# RTMP_FOUND - system has librtmp +# RTMP_INCLUDE_DIRS - the librtmp include directory +# RTMP_LIBRARIES - The librtmp libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (RTMP librtmp) + list(APPEND RTMP_INCLUDE_DIRS ${RTMP_INCLUDEDIR}) +else() + find_path(RTMP_INCLUDE_DIRS librtmp/rtmp.h) + find_library(RTMP_LIBRARIES rtmp) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(RTMP DEFAULT_MSG RTMP_INCLUDE_DIRS RTMP_LIBRARIES) + +list(APPEND RTMP_DEFINITIONS -DHAS_LIBRTMP=1) + +mark_as_advanced(RTMP_INCLUDE_DIRS RTMP_LIBRARIES RTMP_DEFINITIONS) diff --git a/project/cmake/modules/FindSSE.cmake b/project/cmake/modules/FindSSE.cmake new file mode 100644 index 0000000..c76b811 --- /dev/null +++ b/project/cmake/modules/FindSSE.cmake @@ -0,0 +1,105 @@ +# Check if SSE instructions are available on the machine where +# the project is compiled. + +IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO) + + STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE) + IF (SSE2_TRUE) + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + ELSE (SSE2_TRUE) + set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") + ENDIF (SSE2_TRUE) + + # /proc/cpuinfo apparently omits sse3 :( + STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE) + IF (NOT SSE3_TRUE) + STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE) + ENDIF (NOT SSE3_TRUE) + + STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE) + IF (SSE3_TRUE OR SSSE3_TRUE) + set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") + ELSE (SSE3_TRUE OR SSSE3_TRUE) + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + ENDIF (SSE3_TRUE OR SSSE3_TRUE) + IF (SSSE3_TRUE) + set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") + ELSE (SSSE3_TRUE) + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + ENDIF (SSSE3_TRUE) + + STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE) + IF (SSE41_TRUE) + set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") + ELSE (SSE41_TRUE) + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") + ENDIF (SSE41_TRUE) +ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") + EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE + CPUINFO) + + STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE) + IF (SSE2_TRUE) + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + ELSE (SSE2_TRUE) + set(SSE2_FOUND false CACHE BOOL "SSE2 available on host") + ENDIF (SSE2_TRUE) + + STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE) + IF (SSE3_TRUE) + set(SSE3_FOUND true CACHE BOOL "SSE3 available on host") + ELSE (SSE3_TRUE) + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + ENDIF (SSE3_TRUE) + + STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE) + IF (SSSE3_TRUE) + set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host") + ELSE (SSSE3_TRUE) + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + ENDIF (SSSE3_TRUE) + + STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO}) + STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE) + IF (SSE41_TRUE) + set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host") + ELSE (SSE41_TRUE) + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") + ENDIF (SSE41_TRUE) +ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows") + # TODO + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") +ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") + set(SSE2_FOUND true CACHE BOOL "SSE2 available on host") + set(SSE3_FOUND false CACHE BOOL "SSE3 available on host") + set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host") + set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host") +ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + +if(NOT SSE2_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.") +endif(NOT SSE2_FOUND) +if(NOT SSE3_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.") +endif(NOT SSE3_FOUND) +if(NOT SSSE3_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.") +endif(NOT SSSE3_FOUND) +if(NOT SSE4_1_FOUND) + MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.") +endif(NOT SSE4_1_FOUND) + +mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND) + diff --git a/project/cmake/modules/FindSSH.cmake b/project/cmake/modules/FindSSH.cmake new file mode 100644 index 0000000..60c3537 --- /dev/null +++ b/project/cmake/modules/FindSSH.cmake @@ -0,0 +1,21 @@ +# - Try to find libssh +# Once done this will define +# +# SSH_FOUND - system has libssh +# SSH_INCLUDE_DIRS - the libssh include directory +# SSH_LIBRARIES - The libssh libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (SSH libssh) + list(APPEND SSH_INCLUDE_DIRS /usr/include) +else() + find_path(SSH_INCLUDE_DIRS libssh/libssh.h) + find_library(SSH_LIBRARIES ssh) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(SSH DEFAULT_MSG SSH_INCLUDE_DIRS SSH_LIBRARIES) + +list(APPEND SSH_DEFINITIONS -DHAVE_LIBSSH=1) + +mark_as_advanced(SSH_INCLUDE_DIRS SSH_LIBRARIES SSH_DEFINITIONS) diff --git a/project/cmake/modules/FindSWIG.cmake b/project/cmake/modules/FindSWIG.cmake new file mode 100644 index 0000000..84c7a51 --- /dev/null +++ b/project/cmake/modules/FindSWIG.cmake @@ -0,0 +1,14 @@ +if(NOT SWIG_EXECUTABLE) + find_program(SWIG_EXECUTABLE NAMES swig2.0 swig PATH_SUFFIXES swig) +endif() +if(SWIG_EXECUTABLE) + execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib + OUTPUT_VARIABLE SWIG_DIR + ERROR_VARIABLE SWIG_swiglib_error + RESULT_VARIABLE SWIG_swiglib_result) +endif() + + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR + VERSION_VAR SWIG_VERSION ) diff --git a/project/cmake/modules/FindSdl.cmake b/project/cmake/modules/FindSdl.cmake new file mode 100644 index 0000000..91bcac5 --- /dev/null +++ b/project/cmake/modules/FindSdl.cmake @@ -0,0 +1,46 @@ +#.rst: +# FindSDL +# ------- +# Finds the SDL library +# +# This will will define the following variables:: +# +# SDL_FOUND - system has SDL +# SDL_INCLUDE_DIRS - the SDL include directory +# SDL_LIBRARIES - the SDL libraries +# SDL_DEFINITIONS - the SDL compile definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_SDL2 sdl2 QUIET) + if(PC_SDL2_FOUND) + set(SDL_VERSION ${PC_SDL2_VERSION}) + else() + pkg_check_modules(PC_SDL1 sdl QUIET) + if(PC_SDL1_FOUND) + set(SDL_VERSION ${PC_SDL1_VERSION}) + endif() + endif() +endif() + +find_path(SDL_INCLUDE_DIR SDL/SDL.h + PATHS ${PC_SDL2_INCLUDE_DIR} ${PC_SDL1_INCLUDE_DIR}) +find_library(SDL_LIBRARY NAMES SDL2 SDL + PATHS ${PC_SDL2_LIBDIR} ${PC_SDL1_LIBDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sdl REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR + VERSION_VAR SDL_VERSION) + +if(SDL_FOUND) + set(SDL_LIBRARIES ${SDL_LIBRARY}) + set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR}) + set(SDL_DEFINITIONS -DHAVE_SDL=1) + + if(SDL_VERSION VERSION_GREATER 2) + list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=2) + elseif(SDL_VERSION VERSION_GREATER 1) + list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=1) + endif() +endif() + +mark_as_advanced(SDL_LIBRARY SDL_INCLUDE_DIR) diff --git a/project/cmake/modules/FindShairplay.cmake b/project/cmake/modules/FindShairplay.cmake new file mode 100644 index 0000000..4804686 --- /dev/null +++ b/project/cmake/modules/FindShairplay.cmake @@ -0,0 +1,63 @@ +#.rst: +# FindShairplay +# ------------- +# Finds the Shairplay library +# +# This will will define the following variables:: +# +# SHAIRPLAY_FOUND - system has Shairplay +# SHAIRPLAY_INCLUDE_DIRS - the Shairplay include directory +# SHAIRPLAY_LIBRARIES - the Shairplay libraries +# SHAIRPLAY_DEFINITIONS - the Shairplay compile definitions +# +# and the following imported targets:: +# +# Shairplay::Shairplay - The Shairplay library + +find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h) + +include(FindPackageHandleStandardArgs) +if(NOT WIN32) + find_library(SHAIRPLAY_LIBRARY NAMES shairplay) + + if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY) + include(CheckCSourceCompiles) + set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES}) + check_c_source_compiles("#include + + int main() + { + struct raop_callbacks_s foo; + foo.cls; + return 0; + } + " HAVE_SHAIRPLAY_CALLBACK_CLS) + endif() + + find_package_handle_standard_args(SHAIRPLAY + REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR HAVE_SHAIRPLAY_CALLBACK_CLS) +else() + # Dynamically loaded DLL + find_package_handle_standard_args(SHAIRPLAY + REQUIRED_VARS SHAIRPLAY_INCLUDE_DIR) +endif() + +if(SHAIRPLAY_FOUND) + set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY}) + set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR}) + set(SHAIRPLAY_DEFINITIONS -DHAVE_LIBSHAIRPLAY=1) + + if(NOT TARGET Shairplay::Shairplay) + add_library(Shairplay::Shairplay UNKNOWN IMPORTED) + if(SHAIRPLAY_LIBRARY) + set_target_properties(Shairplay::Shairplay PROPERTIES + IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}") + endif() + set_target_properties(Shairplay::Shairplay PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSHAIRPLAY=1) + endif() +endif() + +mark_as_advanced(SHAIRPLAY_INCLUDE_DIR SHAIRPLAY_LIBRARY) diff --git a/project/cmake/modules/FindSqlite3.cmake b/project/cmake/modules/FindSqlite3.cmake new file mode 100644 index 0000000..a47944e --- /dev/null +++ b/project/cmake/modules/FindSqlite3.cmake @@ -0,0 +1,19 @@ +# - Try to find SQLITE3 +# Once done this will define +# +# SQLITE3_FOUND - system has sqlite3 +# SQLITE3_INCLUDE_DIRS - the sqlite3 include directory +# SQLITE3_LIBRARIES - The sqlite3 libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (SQLITE3 sqlite3) + list(APPEND SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDEDIR}) +else() + find_path(SQLITE3_INCLUDE_DIRS sqlite3.h) + find_library(SQLITE3_LIBRARIES sqlite3) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sqlite3 DEFAULT_MSG SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) + +mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) diff --git a/project/cmake/modules/FindTagLib.cmake b/project/cmake/modules/FindTagLib.cmake new file mode 100644 index 0000000..b515e81 --- /dev/null +++ b/project/cmake/modules/FindTagLib.cmake @@ -0,0 +1,62 @@ +#.rst: +# FindTagLib +# ---------- +# Finds the TagLib library +# +# This will will define the following variables:: +# +# TAGLIB_FOUND - system has TagLib +# TAGLIB_INCLUDE_DIRS - the TagLib include directory +# TAGLIB_LIBRARIES - the TagLib libraries +# +# and the following imported targets:: +# +# TagLib::TagLib - The TagLib library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_TAGLIB taglib>=1.8.0 QUIET) +endif() + +find_path(TAGLIB_INCLUDE_DIR taglib/tag.h + PATHS ${PC_TAGLIB_INCLUDEDIR}) +find_library(TAGLIB_LIBRARY_RELEASE NAMES tag + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_TAGLIB_LIBDIR}) +find_library(TAGLIB_LIBRARY_DEBUG NAMES tag + PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_TAGLIB_LIBDIR}) +set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(TAGLIB) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TAGLIB + REQUIRED_VARS TAGLIB_LIBRARY TAGLIB_INCLUDE_DIR + VERSION_VAR TAGLIB_VERSION) + +if(TAGLIB_FOUND) + set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY}) + + # Workaround broken .pc file + list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES}) + + set(TAGLIB_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR}) + if(NOT TARGET TagLib::TagLib) + add_library(TagLib::TagLib UNKNOWN IMPORTED) + if(TAGLIB_LIBRARY_RELEASE) + set_target_properties(TagLib::TagLib PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${TAGLIB_LIBRARY_RELEASE}") + endif() + if(TAGLIB_LIBRARY_DEBUG) + set_target_properties(TagLib::TagLib PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${TAGLIB_LIBRARY_DEBUG}") + endif() + set_target_properties(TagLib::TagLib PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TAGLIB_INCLUDE_DIR}") + endif() +endif() + +mark_as_advanced(TAGLIB_INCLUDE_DIR TAGLIB_LIBRARY) diff --git a/project/cmake/modules/FindTexturePacker.cmake b/project/cmake/modules/FindTexturePacker.cmake new file mode 100644 index 0000000..2229ff7 --- /dev/null +++ b/project/cmake/modules/FindTexturePacker.cmake @@ -0,0 +1,23 @@ +#.rst: +# FindTexturePacker +# ----------------- +# Finds the TexturePacker +# +# This will define the following (imported) targets:: +# +# TexturePacker::TexturePacker - The TexturePacker executable + +if(NOT TARGET TexturePacker::TexturePacker) + if(CMAKE_CROSSCOMPILING) + add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) + set_target_properties(TexturePacker::TexturePacker PROPERTIES + IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker") + elseif(WIN32) + add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL) + set_target_properties(TexturePacker::TexturePacker PROPERTIES + IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe") + else() + add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker) + add_executable(TexturePacker::TexturePacker ALIAS TexturePacker) + endif() +endif() diff --git a/project/cmake/modules/FindTinyXML.cmake b/project/cmake/modules/FindTinyXML.cmake new file mode 100644 index 0000000..0168f40 --- /dev/null +++ b/project/cmake/modules/FindTinyXML.cmake @@ -0,0 +1,68 @@ +#.rst: +# FindTinyXML +# ----------- +# Finds the TinyXML library +# +# This will will define the following variables:: +# +# TINYXML_FOUND - system has TinyXML +# TINYXML_INCLUDE_DIRS - the TinyXML include directory +# TINYXML_LIBRARIES - the TinyXML libraries +# TINYXML_DEFINITIONS - the TinyXML definitions +# +# and the following imported targets:: +# +# TinyXML::TinyXML - The TinyXML library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_TINYXML tinyxml QUIET) +endif() + +find_path(TINYXML_INCLUDE_DIR tinyxml.h + PATH_SUFFIXES tinyxml + PATHS ${PC_TINYXML_INCLUDEDIR}) +find_library(TINYXML_LIBRARY_RELEASE NAMES tinyxml tinyxmlSTL + PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_RELEASE} + PATHS ${PC_TINYXML_LIBDIR}) +find_library(TINYXML_LIBRARY_DEBUG NAMES tinyxml tinyxmlSTL + PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_DEBUG} + PATHS ${PC_TINYXML_LIBDIR}) +set(TINYXML_VERSION ${PC_TINYXML_VERSION}) + +include(SelectLibraryConfigurations) +select_library_configurations(TINYXML) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TINYXML + REQUIRED_VARS TINYXML_LIBRARY TINYXML_INCLUDE_DIR + VERSION_VAR TINYXML_VERSION) + +if(TINYXML_FOUND) + set(TINYXML_LIBRARIES ${TINYXML_LIBRARY}) + set(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR}) + if(WIN32) + set(TINYXML_DEFINITIONS -DTIXML_USE_STL=1) + endif() + + if(NOT TARGET TinyXML::TinyXML) + add_library(TinyXML::TinyXML UNKNOWN IMPORTED) + if(TINYXML_LIBRARY_RELEASE) + set_target_properties(TinyXML::TinyXML PROPERTIES + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION "${TINYXML_LIBRARY_RELEASE}") + endif() + if(TINYXML_LIBRARY_DEBUG) + set_target_properties(TinyXML::TinyXML PROPERTIES + IMPORTED_CONFIGURATIONS DEBUG + IMPORTED_LOCATION "${TINYXML_LIBRARY_DEBUG}") + endif() + set_target_properties(TinyXML::TinyXML PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${TINYXML_INCLUDE_DIR}") + if(WIN32) + set_target_properties(TinyXML::TinyXML PROPERTIES + INTERFACE_COMPILE_DEFINITIONS TIXML_USE_STL=1) + endif() + endif() +endif() + +mark_as_advanced(TINYXML_INCLUDE_DIR TINYXML_LIBRARY) diff --git a/project/cmake/modules/FindUDev.cmake b/project/cmake/modules/FindUDev.cmake new file mode 100644 index 0000000..97fa956 --- /dev/null +++ b/project/cmake/modules/FindUDev.cmake @@ -0,0 +1,22 @@ +# - Try to find udev +# Once done this will define +# +# UDEV_FOUND - system has libudev +# UDEV_INCLUDE_DIRS - the libudev include directory +# UDEV_LIBRARIES - The libudev libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (UDEV libudev) + list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDEDIR}) +endif() + +if(NOT UDEV_FOUND) + find_path(UDEV_INCLUDE_DIRS libudev.h) + find_library(UDEV_LIBRARIES udev) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES) + +mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES) +list(APPEND UDEV_DEFINITIONS -DHAVE_LIBUDEV=1) diff --git a/project/cmake/modules/FindUUID.cmake b/project/cmake/modules/FindUUID.cmake new file mode 100644 index 0000000..173fac2 --- /dev/null +++ b/project/cmake/modules/FindUUID.cmake @@ -0,0 +1,43 @@ +#.rst: +# FindUUID +# -------- +# Finds the libuuid library +# +# This will will define the following variables:: +# +# UUID_FOUND - system has libuuid +# UUID_INCLUDE_DIRS - the libuuid include directory +# UUID_LIBRARIES - the libuuid libraries +# +# and the following imported targets:: +# +# UUID::UUID - The libuuid library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_UUID uuid QUIET) +endif() + +find_path(UUID_INCLUDE_DIR uuid/uuid.h + PATHS ${PC_UUID_INCLUDEDIR}) +find_library(UUID_LIBRARY uuid + PATHS ${PC_UUID_LIBRARY}) +set(UUID_VERSION ${PC_UUID_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(UUID + REQUIRED_VARS UUID_LIBRARY UUID_INCLUDE_DIR + VERSION_VAR UUID_VERSION) + +if(UUID_FOUND) + set(UUID_LIBRARIES ${UUID_LIBRARY}) + set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR}) + + if(NOT TARGET UUID::UUID) + add_library(UUID::UUID UNKNOWN IMPORTED) + set_target_properties(UUID::UUID PROPERTIES + IMPORTED_LOCATION "${UUID_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}") + endif() +endif() + +mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY) diff --git a/project/cmake/modules/FindVAAPI.cmake b/project/cmake/modules/FindVAAPI.cmake new file mode 100644 index 0000000..08e821f --- /dev/null +++ b/project/cmake/modules/FindVAAPI.cmake @@ -0,0 +1,47 @@ +#.rst: +# FindVAAPI +# --------- +# Finds the VAAPI library +# +# This will will define the following variables:: +# +# VAAPI_FOUND - system has VAAPI +# VAAPI_INCLUDE_DIRS - the VAAPI include directory +# VAAPI_LIBRARIES - the VAAPI libraries +# VAAPI_DEFINITIONS - the VAAPI definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_VAAPI libva libva-x11 QUIET) +endif() + +find_path(VAAPI_INCLUDE_DIR va/va.h + PATHS ${PC_VAAPI_libva_INCLUDEDIR}) +find_library(VAAPI_libva_LIBRARY NAMES va + PATHS ${PC_VAAPI_libva_LIBDIR}) +find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11 + PATHS ${PC_VAAPI_libva_LIBDIR}) + +if(PC_VAAPI_libva_VERSION) + set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION}) +elseif(VAAPI_INCLUDE_DIR AND EXISTS "${VAAPI_INCLUDE_DIR}/va/va_version.h") + file(STRINGS "${VAAPI_INCLUDE_DIR}/va/va_version.h" vaapi_version_str REGEX "^#define[\t ]+VA_VERSION_S[\t ]+\".*\".*") + string(REGEX REPLACE "^#define[\t ]+VA_VERSION_S[\t ]+\"([^\"]+)\".*" "\\1" VAAPI_VERSION_STRING "${vaapi_version_str}") + unset(vaapi_version_str) +endif() + +if(NOT VAAPI_FIND_VERSION) + set(VAAPI_FIND_VERSION 0.38.0) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VAAPI + REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_INCLUDE_DIR + VERSION_VAR VAAPI_VERSION_STRING) + +if(VAAPI_FOUND) + set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR}) + set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY}) + set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1) +endif() + +mark_as_advanced(VAAPI_INCLUDE_DIR VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY) diff --git a/project/cmake/modules/FindVDPAU.cmake b/project/cmake/modules/FindVDPAU.cmake new file mode 100644 index 0000000..680b45f --- /dev/null +++ b/project/cmake/modules/FindVDPAU.cmake @@ -0,0 +1,32 @@ +#.rst: +# FindVDPAU +# --------- +# Finds the VDPAU library +# +# This will will define the following variables:: +# +# VDPAU_FOUND - system has VDPAU +# VDPAU_INCLUDE_DIRS - the VDPAU include directory +# VDPAU_LIBRARIES - the VDPAU libraries +# VDPAU_DEFINITIONS - the VDPAU definitions + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_VDPAU vdpau QUIET) +endif() + +find_path(VDPAU_INCLUDE_DIR NAMES vdpau/vdpau.h vdpau/vdpau_x11.h + PATHS ${PC_VDPAU_INCLUDEDIR}) +find_library(VDPAU_LIBRARY NAMES vdpau + PATHS ${PC_VDPAU_LIBDIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(VDPAU + REQUIRED_VARS VDPAU_LIBRARY VDPAU_INCLUDE_DIR) + +if(VDPAU_FOUND) + set(VDPAU_INCLUDE_DIRS ${VDPAU_INCLUDE_DIR}) + set(VDPAU_LIBRARIES ${VDPAU_LIBRARY}) + set(VDPAU_DEFINITIONS -DHAVE_LIBVDPAU=1) +endif() + +mark_as_advanced(VDPAU_INCLUDE_DIR VDPAU_LIBRARY) diff --git a/project/cmake/modules/FindX.cmake b/project/cmake/modules/FindX.cmake new file mode 100644 index 0000000..d9ab5bc --- /dev/null +++ b/project/cmake/modules/FindX.cmake @@ -0,0 +1,21 @@ +# - Try to find X11 +# Once done this will define +# +# X11_FOUND - system has X11 +# X11_INCLUDE_DIRS - the X11 include directory +# X11_LIBRARIES - The X11 libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (X x11 xext libdrm egl) + list(APPEND X_INCLUDE_DIRS /usr/include) +else() + find_path(X_INCLUDE_DIRS X11/Xlib.h) + find_library(X_LIBRARIES X11) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(X DEFAULT_MSG X_INCLUDE_DIRS X_LIBRARIES) + +list(APPEND X_DEFINITIONS -DHAVE_X11=1) + +mark_as_advanced(X_INCLUDE_DIRS X_LIBRARIES X_DEFINITIONS) diff --git a/project/cmake/modules/FindXRandR.cmake b/project/cmake/modules/FindXRandR.cmake new file mode 100644 index 0000000..57ff750 --- /dev/null +++ b/project/cmake/modules/FindXRandR.cmake @@ -0,0 +1,22 @@ +# - Try to find xrandr +# Once done this will define +# +# XRANDR_FOUND - system has lixrandr +# XRANDR_INCLUDE_DIRS - the libxrandr include directory +# XRANDR_LIBRARIES - The libxrandr libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (XRANDR xrandr) + list(APPEND XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDEDIR}) +else() + find_library(XRANDR_LIBRARIES Xrandr) +endif() + +if(XRANDR_FOUND) +include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(XRandR DEFAULT_MSG XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES) + + list(APPEND XRANDR_DEFINITIONS -DHAVE_LIBXRANDR=1) + + mark_as_advanced(XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES XRANDR_DEFINITIONS) +endif() diff --git a/project/cmake/modules/FindXslt.cmake b/project/cmake/modules/FindXslt.cmake new file mode 100644 index 0000000..442ba43 --- /dev/null +++ b/project/cmake/modules/FindXslt.cmake @@ -0,0 +1,18 @@ +# - Try to find XSLT +# Once done this will define +# +# XSLT_FOUND - system has libxslt +# XSLT_INCLUDE_DIRS - the libxslt include directory +# XSLT_LIBRARIES - The libxslt libraries + +if(PKG_CONFIG_FOUND) + pkg_check_modules (XSLT libxslt) +else() + find_path(XSLT_INCLUDE_DIRS libxslt/xslt.h) + find_library(XSLT_LIBRARIES NAMES xslt libxslt) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Xslt DEFAULT_MSG XSLT_INCLUDE_DIRS XSLT_LIBRARIES) + +mark_as_advanced(XSLT_INCLUDE_DIRS XSLT_LIBRARIES) diff --git a/project/cmake/modules/FindYajl.cmake b/project/cmake/modules/FindYajl.cmake new file mode 100644 index 0000000..c27b03a --- /dev/null +++ b/project/cmake/modules/FindYajl.cmake @@ -0,0 +1,27 @@ +# Base Io build system +# Written by Jeremy Tregunna +# +# Find libyajl +pkg_check_modules(YAJL yajl>=2.0) +if(YAJL_FOUND) + list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=2) +endif() + +if(NOT YAJL_FOUND) + find_path(YAJL_INCLUDE_DIRS yajl/yajl_common.h) + find_library(YAJL_LIBRARIES NAMES yajl) + + file(STRINGS ${YAJL_INCLUDE_DIRS}/yajl/yajl_version.h version_header) + string(REGEX MATCH "YAJL_MAJOR ([0-9]+)" YAJL_VERSION_MAJOR ${version_header}) + string(REGEX REPLACE "YAJL_MAJOR ([0-9]+)" "\\1" YAJL_VERSION_MAJOR "${YAJL_VERSION_MAJOR}") + if (YAJL_VERSION_MINOR LESS 2) + set(YAJL_INCLUDE_DIRS) + set(YALJ_LIBRARIES) + endif() + list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=${YAJL_VERSION_MAJOR}) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Yajl DEFAULT_MSG YAJL_INCLUDE_DIRS YAJL_LIBRARIES) + +mark_as_advanced(YAJL_INCLUDE_DIRS YAJL_LIBRARIES YAJL_DEFINITIONS) diff --git a/project/cmake/modules/FindZip.cmake b/project/cmake/modules/FindZip.cmake new file mode 100644 index 0000000..e0a38c1 --- /dev/null +++ b/project/cmake/modules/FindZip.cmake @@ -0,0 +1,46 @@ +#.rst: +# FindZip +# ----------- +# Finds the Zip library +# +# This will will define the following variables:: +# +# ZIP_FOUND - system has Zip +# ZIP_INCLUDE_DIRS - the Zip include directory +# ZIP_LIBRARIES - the Zip libraries +# ZIP_DEFINITIONS - the Zip libraries +# +# and the following imported targets:: +# +# ZIP::ZIP - The Zip library + +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_ZIP libzip QUIET) +endif() + +find_path(ZIP_INCLUDE_DIR zip.h + PATHS ${PC_ZIP_INCLUDEDIR}) +find_library(ZIP_LIBRARY NAMES zip + PATHS ${PC_ZIP_LIBDIR}) +set(ZIP_VERSION ${PC_ZIP_VERSION}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ZIP + REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR + VERSION_VAR ZIP_VERSION) + +if(ZIP_FOUND) + set(ZIP_LIBRARIES ${ZIP_LIBRARY}) + set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR}) + set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}") + + if(NOT TARGET ZIP::ZIP) + add_library(ZIP::ZIP UNKNOWN IMPORTED) + set_target_properties(ZIP::ZIP PROPERTIES + IMPORTED_LOCATION "${ZIP_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}" + INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}") + endif() +endif() + +mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY) diff --git a/project/cmake/platform/darwin/defines.txt b/project/cmake/platform/darwin/defines.txt deleted file mode 100644 index 33b009e..0000000 --- a/project/cmake/platform/darwin/defines.txt +++ /dev/null @@ -1 +0,0 @@ --DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX diff --git a/project/cmake/platform/osx/defines.txt b/project/cmake/platform/osx/defines.txt new file mode 100644 index 0000000..33b009e --- /dev/null +++ b/project/cmake/platform/osx/defines.txt @@ -0,0 +1 @@ +-DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX -D_LINUX diff --git a/project/cmake/scripts/android/archsetup.cmake b/project/cmake/scripts/android/archsetup.cmake new file mode 100644 index 0000000..86c0f6a --- /dev/null +++ b/project/cmake/scripts/android/archsetup.cmake @@ -0,0 +1,30 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL armeabi-v7a) + set(ARCH arm-linux-androideabi) + elseif(CPU STREQUAL i686) + set(ARCH i686-linux-android) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +set(FFMPEG_OPTS --enable-cross-compile --cpu=cortex-a9 --arch=arm --target-os=linux --enable-neon + --disable-vdpau --cc=${CMAKE_C_COMPILER} --host-cc=${CMAKE_C_COMPILER} + --strip=${CMAKE_STRIP}) +set(ENABLE_SDL OFF) +set(ENABLE_X11 OFF) +set(ENABLE_EGL ON) +set(ENABLE_AML ON) +set(ENABLE_OPTICAL OFF) + +list(APPEND DEPLIBS android log jnigraphics) diff --git a/project/cmake/scripts/android/install.cmake b/project/cmake/scripts/android/install.cmake new file mode 100644 index 0000000..e69de29 diff --git a/project/cmake/scripts/android/macros.cmake b/project/cmake/scripts/android/macros.cmake new file mode 120000 index 0000000..28c77ca --- /dev/null +++ b/project/cmake/scripts/android/macros.cmake @@ -0,0 +1 @@ +../linux/macros.cmake \ No newline at end of file diff --git a/project/cmake/scripts/android/pathsetup.cmake b/project/cmake/scripts/android/pathsetup.cmake new file mode 120000 index 0000000..26d7f17 --- /dev/null +++ b/project/cmake/scripts/android/pathsetup.cmake @@ -0,0 +1 @@ +../linux/pathsetup.cmake \ No newline at end of file diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake index b94df2a..9541df4 100644 --- a/project/cmake/scripts/common/addon-helpers.cmake +++ b/project/cmake/scripts/common/addon-helpers.cmake @@ -10,13 +10,23 @@ add_custom_target(addon-package COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) macro(add_cpack_workaround target version ext) + if(NOT PACKAGE_DIR) + set(PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}/zips") + endif() + add_custom_command(TARGET addon-package PRE_BUILD - COMMAND ${CMAKE_COMMAND} -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext}) + COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext}) endmacro() # Grab the version from a given add-on's addon.xml macro (addon_version dir prefix) - FILE(READ ${dir}/addon.xml ADDONXML) + IF(EXISTS ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in) + FILE(READ ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in ADDONXML) + ELSE() + FILE(READ ${dir}/addon.xml ADDONXML) + ENDIF() + STRING(REGEX MATCH "]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) @@ -34,6 +44,25 @@ macro (build_addon target prefix libs) SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib") ENDIF(OS STREQUAL "android") + # get the library's location + SET(LIBRARY_LOCATION $) + # get the library's filename + if("${CORE_SYSTEM_NAME}" STREQUAL "android") + # for android we need the filename without any version numbers + set(LIBRARY_FILENAME $) + else() + SET(LIBRARY_FILENAME $) + endif() + + # if there's an addon.xml.in we need to generate the addon.xml + IF(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in) + SET(PLATFORM ${CORE_SYSTEM_NAME}) + + FILE(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file) + STRING(CONFIGURE "${addon_file}" addon_file_conf @ONLY) + FILE(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}") + ENDIF() + # set zip as default if addon-package is called without PACKAGE_XXX SET(CPACK_GENERATOR "ZIP") SET(ext "zip") @@ -51,33 +80,62 @@ macro (build_addon target prefix libs) set(CPACK_COMPONENTS_IGNORE_GROUPS 1) list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) # Pack files together to create an archive - INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION}) + INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "addon.xml.in" EXCLUDE) IF(WIN32) - # get the installation location for the addon's target - get_property(dll_location TARGET ${target} PROPERTY LOCATION) + if(NOT CPACK_PACKAGE_DIRECTORY) + # determine the temporary path + file(TO_CMAKE_PATH "$ENV{TEMP}" WIN32_TEMP_PATH) + string(LENGTH "${WIN32_TEMP_PATH}" WIN32_TEMP_PATH_LENGTH) + string(LENGTH "${PROJECT_BINARY_DIR}" PROJECT_BINARY_DIR_LENGTH) + + # check if the temporary path is shorter than the default packaging directory path + if(WIN32_TEMP_PATH_LENGTH GREATER 0 AND WIN32_TEMP_PATH_LENGTH LESS PROJECT_BINARY_DIR_LENGTH) + # set the directory used by CPack for packaging to the temp directory + set(CPACK_PACKAGE_DIRECTORY ${WIN32_TEMP_PATH}) + endif() + endif() + # in case of a VC++ project the installation location contains a $(Configuration) VS variable # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration # is changed within Visual Studio) - string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" dll_location "${dll_location}") + string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" LIBRARY_LOCATION "${LIBRARY_LOCATION}") # install the generated DLL file - INSTALL(PROGRAMS ${dll_location} DESTINATION ${target} + INSTALL(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) IF(CMAKE_BUILD_TYPE MATCHES Debug) # for debug builds also install the PDB file - get_filename_component(dll_directory ${dll_location} DIRECTORY) - INSTALL(FILES ${dll_directory}/${target}.pdb DESTINATION ${target} + get_filename_component(LIBRARY_DIR ${LIBRARY_LOCATION} DIRECTORY) + INSTALL(FILES ${LIBRARY_DIR}/${target}.pdb DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) ENDIF() ELSE(WIN32) + if(NOT CPACK_PACKAGE_DIRECTORY) + set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}) + endif() INSTALL(TARGETS ${target} DESTINATION ${target} COMPONENT ${target}-${${prefix}_VERSION}) ENDIF(WIN32) add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) ELSE(PACKAGE_ZIP OR PACKAGE_TGZ) - INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target}) - INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX) + message(STATUS "setting install paths to match ${APP_NAME}: CMAKE_INSTALL_PREFIX: ${${APP_NAME_UC}_PREFIX}") + set(CMAKE_INSTALL_PREFIX "${${APP_NAME_UC}_PREFIX}" CACHE PATH "${APP_NAME} install prefix" FORCE) + set(CMAKE_INSTALL_LIBDIR "${${APP_NAME_UC}_LIB_DIR}" CACHE PATH "${APP_NAME} install libdir" FORCE) + elseif(NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}" AND NOT OVERRIDE_PATHS) + message(FATAL_ERROR "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} differs from ${APP_NAME} prefix ${${APP_NAME_UC}_PREFIX}. Please pass -DOVERRIDE_PATHS=1 to skip this check") + else() + if(NOT CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/${APP_NAME_LC}") + endif() + endif() + else() + set(CMAKE_INSTALL_LIBDIR "lib/${APP_NAME_LC}") + endif() + INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) + INSTALL(DIRECTORY ${target} DESTINATION share/${APP_NAME_LC}/addons PATTERN "addon.xml.in" EXCLUDE) ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ) endmacro() diff --git a/project/cmake/scripts/common/archsetup.cmake b/project/cmake/scripts/common/archsetup.cmake new file mode 100644 index 0000000..dff5558 --- /dev/null +++ b/project/cmake/scripts/common/archsetup.cmake @@ -0,0 +1,99 @@ +# This script configures the build for a given architecture. +# Flags and stringified arch is set up. +# General compiler tests belongs here. +# +# On return, the following variables are set: +# CMAKE_SYSTEM_NAME - a lowercased system name +# CPU - the CPU on the target +# ARCH - the system architecture +# ARCH_DEFINES - list of compiler definitions for this architecture +# SYSTEM_DEFINES - list of compiler definitions for this system +# DEP_DEFINES - compiler definitions for system dependencies (e.g. LIRC) +# + the results of compiler tests etc. + +include(CheckCXXSourceCompiles) +include(CheckSymbolExists) +include(CheckFunctionExists) + +# Macro to check if a given type exists in a given header +# Arguments: +# header the header to check +# type the type to check for existence +# var the compiler definition to set if type exists +# On return: +# If type was found, the definition is added to SYSTEM_DEFINES +macro(check_type header type var) + check_cxx_source_compiles("#include <${header}> + int main() + { + ${type} s; + }" ${var}) + if(${var}) + list(APPEND SYSTEM_DEFINES -D${var}=1) + endif() +endmacro() + +# Macro to check if a given builtin function exists +# Arguments: +# func the function to check +# var the compiler definition to set if type exists +# On return: +# If type was found, the definition is added to SYSTEM_DEFINES +macro(check_builtin func var) + check_cxx_source_compiles(" + int main() + { + ${func}; + }" ${var}) + if(${var}) + list(APPEND SYSTEM_DEFINES -D${var}=1) + endif() +endmacro() + + +# -------- Main script --------- +message(STATUS "System type: ${CMAKE_SYSTEM_NAME}") +if(NOT CORE_SYSTEM_NAME) + string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) +endif() + +if(WITH_CPU) + set(CPU ${WITH_CPU}) +elseif(NOT CMAKE_TOOLCHAIN_FILE) + set(CPU ${CMAKE_SYSTEM_PROCESSOR}) +endif() + +if(CMAKE_TOOLCHAIN_FILE) + if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}") + message(FATAL_ERROR "Toolchain file ${CMAKE_TOOLCHAIN_FILE} does not exist.") + elseif(NOT DEPENDS_PATH OR NOT NATIVEPREFIX) + message(FATAL_ERROR "Toolchain did not define DEPENDS_PATH or NATIVEPREFIX. Possibly outdated depends.") + endif() +endif() + +# Main cpp +set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp) + +# system specific arch setup +include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/archsetup.cmake) + +message(STATUS "Core system type: ${CORE_SYSTEM_NAME}") +message(STATUS "Platform: ${PLATFORM}") +message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}") + +check_type(string std::u16string HAVE_STD__U16_STRING) +check_type(string std::u32string HAVE_STD__U32_STRING) +check_type(string char16_t HAVE_CHAR16_T) +check_type(string char32_t HAVE_CHAR32_T) +check_type(stdint.h uint_least16_t HAVE_STDINT_H) +check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE) +check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH) +check_builtin("long* temp=0; long ret=__sync_sub_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_SUB_AND_FETCH) +check_builtin("long* temp=0; long ret=__sync_val_compare_and_swap(temp, 1, 1)" HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP) +if(HAVE_POSIX_FADVISE) + list(APPEND SYSTEM_DEFINES -DHAVE_POSIX_FADVISE=1) +endif() +check_function_exists(localtime_r HAVE_LOCALTIME_R) +if(HAVE_LOCALTIME_R) + list(APPEND SYSTEM_DEFINES -DHAVE_LOCALTIME_R=1) +endif() diff --git a/project/cmake/scripts/common/checkcommits.cmake b/project/cmake/scripts/common/checkcommits.cmake new file mode 100644 index 0000000..304e623 --- /dev/null +++ b/project/cmake/scripts/common/checkcommits.cmake @@ -0,0 +1,75 @@ +find_package(Git REQUIRED) + +macro(sanity_check message) + if(status_code) + message(FATAL_ERROR "${message}") + endif() +endmacro() + +# Check that there are no changes in working-tree +execute_process(COMMAND ${GIT_EXECUTABLE} diff --quiet + RESULT_VARIABLE status_code) +sanity_check("Cannot run with working tree changes. Commit, stash or drop them.") + +# Setup base of tests +set(check_base $ENV{CHECK_BASE}) +if(NOT check_base) + set(check_base origin/master) +endif() + +# Setup end of tests +set(check_head $ENV{CHECK_HEAD}) +if(NOT check_head) + set(check_head HEAD) +endif() + +# Setup target to build +set(check_target $ENV{CHECK_TARGET}) +if(NOT check_target) + set(check_target check) +endif() + +# Build threads +set(build_threads $ENV{CHECK_THREADS}) +if(NOT build_threads) + if(UNIX) + execute_process(COMMAND nproc + OUTPUT_VARIABLE build_threads) + string(REGEX REPLACE "(\r?\n)+$" "" build_threads "${build_threads}") + endif() +endif() + +# Record current HEAD +execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE current_branch) + +string(REGEX REPLACE "(\r?\n)+$" "" current_branch "${current_branch}") + +# Grab revision list +execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${check_base}..${check_head} --reverse + OUTPUT_VARIABLE rev_list) + +string(REPLACE "\n" ";" rev_list ${rev_list}) +foreach(rev ${rev_list}) + # Checkout + message("Testing revision ${rev}") + execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${rev} + RESULT_VARIABLE status_code) + sanity_check("Failed to checkout ${rev}") + + # Build + if(build_threads GREATER 2) + execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" "--" "-j${build_threads}" + RESULT_VARIABLE status_code) + else() + execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" + RESULT_VARIABLE status_code) + endif() + if(status_code) + execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch}) + endif() + sanity_check("Failed to build target for revision ${rev}") +endforeach() + +message("Everything checks out fine") +execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch}) diff --git a/project/cmake/scripts/common/generateversionedfiles.cmake b/project/cmake/scripts/common/generateversionedfiles.cmake new file mode 100644 index 0000000..9a4080a --- /dev/null +++ b/project/cmake/scripts/common/generateversionedfiles.cmake @@ -0,0 +1,13 @@ +include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/macros.cmake) + +core_find_versions() +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/xbmc.addon) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/kodi.guilib) +configure_file(${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in + ${CMAKE_BINARY_DIR}/addons/xbmc.addon/addon.xml @ONLY) +configure_file(${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in + ${CMAKE_BINARY_DIR}/addons/kodi.guilib/addon.xml @ONLY) +configure_file(${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp @ONLY) +set(prefix ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) +set(APP_LIBDIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/kodi) diff --git a/project/cmake/scripts/common/generatorsetup.cmake b/project/cmake/scripts/common/generatorsetup.cmake new file mode 100644 index 0000000..75083ca --- /dev/null +++ b/project/cmake/scripts/common/generatorsetup.cmake @@ -0,0 +1,24 @@ +# Configure single-/multiconfiguration generators and variables +# +# CORE_BUILD_CONFIG that is set to +# - CMAKE_BUILD_TYPE for single configuration generators such as make, nmake +# - a variable that expands on build time to the current configuration for +# multi configuration generators such as VS or Xcode +if(CMAKE_CONFIGURATION_TYPES) + if(CMAKE_BUILD_TYPE) + message(FATAL_ERROR "CMAKE_BUILD_TYPE must not be defined for multi-configuration generators") + endif() + set(CORE_BUILD_CONFIG ${CMAKE_CFG_INTDIR}) + message(STATUS "Generator: Multi-configuration (${CMAKE_GENERATOR})") +else() + if(CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} + CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE) + else() + # Set default + set(CMAKE_BUILD_TYPE Release + CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE) + endif() + set(CORE_BUILD_CONFIG ${CMAKE_BUILD_TYPE}) + message(STATUS "Generator: Single-configuration: ${CMAKE_BUILD_TYPE} (${CMAKE_GENERATOR})") +endif() diff --git a/project/cmake/scripts/common/macros.cmake b/project/cmake/scripts/common/macros.cmake new file mode 100644 index 0000000..dd2233b --- /dev/null +++ b/project/cmake/scripts/common/macros.cmake @@ -0,0 +1,373 @@ +# This script holds the main functions used to construct the build system + +# include system specific macros +include(${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/macros.cmake) + +# Add a library, optionally as a dependency of the main application +# Arguments: +# name name of the library to add +# Optional Arguments: +# NO_MAIN_DEPENDS if specified, the library is not added to main depends +# Implicit arguments: +# SOURCES the sources of the library +# HEADERS the headers of the library (only for IDE support) +# OTHERS other library related files (only for IDE support) +# On return: +# Library will be built, optionally added to ${core_DEPENDS} +function(core_add_library name) + cmake_parse_arguments(arg "NO_MAIN_DEPENDS" "" "" ${ARGN}) + add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS}) + set_target_properties(${name} PROPERTIES PREFIX "") + if(NOT arg_NO_MAIN_DEPENDS) + set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE) + endif() + + # Add precompiled headers to Kodi main libraries + if(WIN32 AND "${CMAKE_CURRENT_LIST_DIR}" MATCHES "^${CORE_SOURCE_DIR}/xbmc") + add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/win32/pch.cpp + PCH_TARGET kodi) + endif() + + # IDE support + if(CMAKE_GENERATOR MATCHES "Xcode") + file(RELATIVE_PATH parentfolder ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) + set_target_properties(${name} PROPERTIES FOLDER "${parentfolder}") + elseif(CMAKE_GENERATOR MATCHES "Visual Studio") + file(RELATIVE_PATH foldername ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + set_target_properties(${name} PROPERTIES FOLDER "${foldername}") + source_group(" " REGULAR_EXPRESSION ".*") + endif() +endfunction() + +# Add a test library, and add sources to list for gtest integration macros +function(core_add_test_library name) + core_add_library(${name} NO_MAIN_DEPENDS) + set_target_properties(${name} PROPERTIES EXCLUDE_FROM_ALL 1) + foreach(src ${SOURCES}) + set(test_sources ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${test_sources} CACHE STRING "" FORCE) + endforeach() + set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE) +endfunction() + +# Add a data file to installation list with a mirror in build tree +# Arguments: +# file full path to file to mirror +# relative the relative base of file path in the build/install tree +# give another parameter to exclude from install target +# Implicit arguments: +# CORE_SOURCE_DIR - root of source tree +# On return: +# file is added to ${install_data} and mirrored in build tree +function(copy_file_to_buildtree file relative) + if(NOT WIN32) + string(REPLACE "\(" "\\(" file ${file}) + string(REPLACE "\)" "\\)" file ${file}) + endif() + string(REPLACE "${relative}/" "" outfile ${file}) + + if(NOT TARGET export-files) + add_custom_target(export-files ALL COMMENT "Copying files into build tree") + endif() + if(NOT ${CORE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR}) + if(VERBOSE) + message(STATUS "copy_file_to_buildtree - copying file: ${file} -> ${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() + add_custom_command(TARGET export-files COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}") + endif() + if(NOT ARGN) + list(APPEND install_data ${outfile}) + set(install_data ${install_data} PARENT_SCOPE) + endif() +endfunction() + +# add data files to installation list with a mirror in build tree. +# reads list of files to install from a given list of text files. +# Arguments: +# pattern globbing pattern for text files to read +# give another parameter to exclude from installation target +# Implicit arguments: +# CORE_SOURCE_DIR - root of source tree +# On return: +# files are added to ${install_data} and mirrored in build tree +function(copy_files_from_filelist_to_buildtree pattern) + foreach(arg ${ARGN}) + list(APPEND pattern ${arg}) + endforeach() + # copies files listed in text files to the buildtree + # Input: [glob pattern: filepattern] + list(SORT pattern) + if(VERBOSE) + message(STATUS "copy_files_from_filelist_to_buildtree - got pattern: ${pattern}") + endif() + foreach(pat ${pattern}) + file(GLOB filenames ${pat}) + foreach(filename ${filenames}) + string(STRIP ${filename} filename) + core_file_read_filtered(fstrings ${filename}) + foreach(dir ${fstrings}) + file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${dir}) + foreach(file ${files}) + if(ARGN) + copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR} 1) + else() + copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR}) + endif() + endforeach() + endforeach() + endforeach() + endforeach() + set(install_data ${install_data} PARENT_SCOPE) +endfunction() + +# helper macro to set modified variables in parent scope +macro(export_dep) + set(SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE) + set(DEPLIBS ${DEPLIBS} PARENT_SCOPE) + set(DEP_DEFINES ${DEP_DEFINES} PARENT_SCOPE) + set(${depup}_FOUND ${${depup}_FOUND} PARENT_SCOPE) + mark_as_advanced(${depup}_LIBRARIES) +endmacro() + +# add a required dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} +function(core_require_dep dep) + find_package(${dep} REQUIRED) + string(TOUPPER ${dep} depup) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + list(APPEND DEPLIBS ${${depup}_LIBRARIES}) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + export_dep() +endfunction() + +# add a required dyloaded dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up +function(core_require_dyload_dep dep) + find_package(${dep} REQUIRED) + string(TOUPPER ${dep} depup) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + find_soname(${depup} REQUIRED) + export_dep() + set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) +endfunction() + +# helper macro for optional deps +macro(setup_enable_switch) + string(TOUPPER ${dep} depup) + if (ARGV1) + set(enable_switch ${ARGV1}) + else() + set(enable_switch ENABLE_${depup}) + endif() +endmacro() + +# add an optional dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES} +function(core_optional_dep dep) + setup_enable_switch() + if(${enable_switch}) + find_package(${dep}) + if(${depup}_FOUND) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + list(APPEND DEPLIBS ${${depup}_LIBRARIES}) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) + export_dep() + else() + set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE) + endif() + endif() +endfunction() + +# add an optional dyloaded dependency of main application +# Arguments: +# dep name of find rule for dependency, used uppercased for variable prefix +# On return: +# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up +function(core_optional_dyload_dep dep) + setup_enable_switch() + if(${enable_switch}) + find_package(${dep}) + if(${depup}_FOUND) + list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) + find_soname(${depup} REQUIRED) + list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) + set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) + export_dep() + set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) + endif() + endif() +endfunction() + +function(core_file_read_filtered result filepattern) + # Reads STRINGS from text files + # with comments filtered out + # Result: [list: result] + # Input: [glob pattern: filepattern] + file(GLOB filenames ${filepattern}) + list(SORT filenames) + foreach(filename ${filenames}) + if(VERBOSE) + message(STATUS "core_file_read_filtered - filename: ${filename}") + endif() + file(STRINGS ${filename} fstrings REGEX "^[^#//]") + foreach(fstring ${fstrings}) + string(REGEX REPLACE "^(.*)#(.*)" "\\1" fstring ${fstring}) + string(REGEX REPLACE "//.*" "" fstring ${fstring}) + string(STRIP ${fstring} fstring) + list(APPEND filename_strings ${fstring}) + endforeach() + endforeach() + set(${result} ${filename_strings} PARENT_SCOPE) +endfunction() + +function(core_add_subdirs_from_filelist files) + # Adds subdirectories from a sorted list of files + # Input: [list: filenames] [bool: sort] + foreach(arg ${ARGN}) + list(APPEND files ${arg}) + endforeach() + list(SORT files) + if(VERBOSE) + message(STATUS "core_add_subdirs_from_filelist - got pattern: ${files}") + endif() + foreach(filename ${files}) + string(STRIP ${filename} filename) + core_file_read_filtered(fstrings ${filename}) + foreach(subdir ${fstrings}) + STRING_SPLIT(subdir " " ${subdir}) + list(GET subdir 0 subdir_src) + list(GET subdir -1 subdir_dest) + if(VERBOSE) + message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}") + endif() + add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest}) + endforeach() + endforeach() +endfunction() + +macro(core_add_optional_subdirs_from_filelist pattern) + # Adds subdirectories from text files + # if the option(s) in the 3rd field are enabled + # Input: [glob pattern: filepattern] + foreach(arg ${ARGN}) + list(APPEND pattern ${arg}) + endforeach() + foreach(elem ${pattern}) + string(STRIP ${elem} elem) + list(APPEND filepattern ${elem}) + endforeach() + + file(GLOB filenames ${filepattern}) + list(SORT filenames) + if(VERBOSE) + message(STATUS "core_add_optional_subdirs_from_filelist - got pattern: ${filenames}") + endif() + + foreach(filename ${filenames}) + if(VERBOSE) + message(STATUS "core_add_optional_subdirs_from_filelist - reading file: ${filename}") + endif() + file(STRINGS ${filename} fstrings REGEX "^[^#//]") + foreach(line ${fstrings}) + string(REPLACE " " ";" line "${line}") + list(GET line 0 subdir_src) + list(GET line 1 subdir_dest) + list(GET line 3 opts) + foreach(opt ${opts}) + if(ENABLE_${opt}) + if(VERBOSE) + message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}") + endif() + add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest}) + else() + if(VERBOSE) + message(STATUS " core_add_optional_subdirs_from_filelist: OPTION ${opt} not enabled for ${subdir_src}, skipping subdir") + endif() + endif() + endforeach() + endforeach() + endforeach() +endmacro() + +macro(today RESULT) + if (WIN32) + execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) + elseif(UNIX) + execute_process(COMMAND date -u +%F + OUTPUT_VARIABLE ${RESULT}) + string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}}) + else() + message(SEND_ERROR "date not implemented") + set(${RESULT} 000000) + endif() + string(REGEX REPLACE "(\r?\n)+$" "" ${RESULT} "${${RESULT}}") +endmacro() + +function(core_find_git_rev) + if(EXISTS ${CORE_SOURCE_DIR}/VERSION) + file(STRINGS ${CORE_SOURCE_DIR}/VERSION VERSION_FILE) + string(SUBSTRING "${VERSION_FILE}" 1 16 GIT_REV) + else() + find_package(Git) + if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git) + execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet -- + RESULT_VARIABLE status_code + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + if (NOT status_code) + execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --cached --ignore-submodules --quiet HEAD -- + RESULT_VARIABLE status_code + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + endif() + today(DATE) + execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1 + --pretty=format:"%h-dirty" HEAD + OUTPUT_VARIABLE LOG_UNFORMATTED + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH) + else() + execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1 + --pretty=format:"%h %cd" HEAD + OUTPUT_VARIABLE LOG_UNFORMATTED + WORKING_DIRECTORY ${CORE_SOURCE_DIR}) + string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH) + string(SUBSTRING ${LOG_UNFORMATTED} 9 10 DATE) + string(REPLACE "-" "" DATE ${DATE}) + endif() + set(GIT_REV "${DATE}-${HASH}") + endif() + if(GIT_REV) + set(APP_SCMID ${GIT_REV} PARENT_SCOPE) + endif() +endfunction() + +macro(core_find_versions) + include(CMakeParseArguments) + core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) + string(REPLACE " " ";" version_list "${version_list}") + cmake_parse_arguments(APP "" "VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API;APP_NAME;COMPANY_NAME" "" ${version_list}) + + set(APP_NAME ${APP_APP_NAME}) # inconsistency in upstream + string(TOLOWER ${APP_APP_NAME} APP_NAME_LC) + set(COMPANY_NAME ${APP_COMPANY_NAME}) + set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}) + if(APP_VERSION_TAG) + set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG}) + endif() + string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) + string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) + file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$") + string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version}) + file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$") + string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version_min ${guilib_version_min}) +endmacro() diff --git a/project/cmake/scripts/common/managestring.cmake b/project/cmake/scripts/common/managestring.cmake new file mode 100644 index 0000000..7321f4c --- /dev/null +++ b/project/cmake/scripts/common/managestring.cmake @@ -0,0 +1,235 @@ +# - Collection of String utility macros. +# Defines the following macros: +# STRING_TRIM(var str [NOUNQUOTE]) +# - Trim a string by removing the leading and trailing spaces, +# just like STRING(STRIP ...) in CMake 2.6 and later. +# This macro is needed as CMake 2.4 does not support STRING(STRIP ..) +# This macro also remove quote and double quote marks around the string, +# unless NOUNQUOTE is defined. +# * Parameters: +# + var: A variable that stores the result. +# + str: A string. +# + NOUNQUOTE: (Optional) do not remove the double quote mark around the string. +# +# STRING_UNQUOTE(var str) +# - Remove double quote marks and quote marks around a string. +# If the string is not quoted, then it returns an empty string. +# * Parameters: +# + var: A variable that stores the result. +# + str: A string. +# +# STRING_JOIN(var delimiter str_list [str...]) +# - Concatenate strings, with delimiter inserted between strings. +# * Parameters: +# + var: A variable that stores the result. +# + str_list: A list of string. +# + str: (Optional) more string to be join. +# +# STRING_SPLIT(var delimiter str [NOESCAPE_SEMICOLON]) +# - Split a string into a list using a delimiter, which can be in 1 or more +# characters long. +# * Parameters: +# + var: A variable that stores the result. +# + delimiter: To separate a string. +# + str: A string. +# + NOESCAPE_SEMICOLON: (Optional) Do not escape semicolons. +# + +IF(NOT DEFINED _MANAGE_STRING_CMAKE_) + SET(_MANAGE_STRING_CMAKE_ "DEFINED") + + MACRO(STRING_TRIM var str) + SET(${var} "") + IF (NOT "${ARGN}" STREQUAL "NOUNQUOTE") + # Need not trim a quoted string. + STRING_UNQUOTE(_var "${str}") + IF(NOT _var STREQUAL "") + # String is quoted + SET(${var} "${_var}") + ENDIF(NOT _var STREQUAL "") + ENDIF(NOT "${ARGN}" STREQUAL "NOUNQUOTE") + + IF(${var} STREQUAL "") + SET(_var_1 "${str}") + STRING(REGEX REPLACE "^[ \t\r\n]+" "" _var_2 "${str}" ) + STRING(REGEX REPLACE "[ \t\r\n]+$" "" _var_3 "${_var_2}" ) + SET(${var} "${_var_3}") + ENDIF(${var} STREQUAL "") + ENDMACRO(STRING_TRIM var str) + + # Internal macro + # Variable cannot be escaped here, as variable is already substituted + # at the time it passes to this macro. + MACRO(STRING_ESCAPE var str) + # ';' and '\' are tricky, need to be encoded. + # '#' => '#H' + # '\' => '#B' + # ';' => '#S' + SET(_NOESCAPE_SEMICOLON "") + SET(_NOESCAPE_HASH "") + + FOREACH(_arg ${ARGN}) + IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") + ELSEIF(${_arg} STREQUAL "NOESCAPE_HASH") + SET(_NOESCAPE_HASH "NOESCAPE_HASH") + ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + ENDFOREACH(_arg) + + IF(_NOESCAPE_HASH STREQUAL "") + STRING(REGEX REPLACE "#" "#H" _ret "${str}") + ELSE(_NOESCAPE_HASH STREQUAL "") + SET(_ret "${str}") + ENDIF(_NOESCAPE_HASH STREQUAL "") + + STRING(REGEX REPLACE "\\\\" "#B" _ret "${_ret}") + IF(_NOESCAPE_SEMICOLON STREQUAL "") + STRING(REGEX REPLACE ";" "#S" _ret "${_ret}") + ENDIF(_NOESCAPE_SEMICOLON STREQUAL "") + SET(${var} "${_ret}") + ENDMACRO(STRING_ESCAPE var str) + + MACRO(STRING_UNESCAPE var str) + # '#B' => '\' + # '#H' => '#' + # '#D' => '$' + # '#S' => ';' + SET(_ESCAPE_VARIABLE "") + SET(_NOESCAPE_SEMICOLON "") + SET(_ret "${str}") + FOREACH(_arg ${ARGN}) + IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") + ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE") + SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE") + STRING(REGEX REPLACE "#D" "$" _ret "${_ret}") + ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + ENDFOREACH(_arg) + + STRING(REGEX REPLACE "#B" "\\\\" _ret "${_ret}") + IF(_NOESCAPE_SEMICOLON STREQUAL "") + # ';' => '#S' + STRING(REGEX REPLACE "#S" "\\\\;" _ret "${_ret}") + ELSE(_NOESCAPE_SEMICOLON STREQUAL "") + STRING(REGEX REPLACE "#S" ";" _ret "${_ret}") + ENDIF(_NOESCAPE_SEMICOLON STREQUAL "") + + IF(NOT _ESCAPE_VARIABLE STREQUAL "") + # '#D' => '$' + STRING(REGEX REPLACE "#D" "$" _ret "${_ret}") + ENDIF(NOT _ESCAPE_VARIABLE STREQUAL "") + STRING(REGEX REPLACE "#H" "#" _ret "${_ret}") + SET(${var} "${_ret}") + ENDMACRO(STRING_UNESCAPE var str) + + + MACRO(STRING_UNQUOTE var str) + STRING_ESCAPE(_ret "${str}" ${ARGN}) + IF(_ret MATCHES "^[ \t\r\n]+") + STRING(REGEX REPLACE "^[ \t\r\n]+" "" _ret "${_ret}") + ENDIF(_ret MATCHES "^[ \t\r\n]+") + IF(_ret MATCHES "^\"") + # Double quote + STRING(REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1" _ret "${_ret}") + ELSEIF(_ret MATCHES "^'") + # Single quote + STRING(REGEX REPLACE "'\(.*\)'[ \t\r\n]*$" "\\1" _ret "${_ret}") + ELSE(_ret MATCHES "^\"") + SET(_ret "") + ENDIF(_ret MATCHES "^\"") + + # Unencoding + STRING_UNESCAPE(${var} "${_ret}" ${ARGN}) + ENDMACRO(STRING_UNQUOTE var str) + + MACRO(STRING_JOIN var delimiter str_list) + SET(_ret "") + FOREACH(_str ${str_list}) + IF(_ret STREQUAL "") + SET(_ret "${_str}") + ELSE(_ret STREQUAL "") + SET(_ret "${_ret}${delimiter}${_str}") + ENDIF(_ret STREQUAL "") + ENDFOREACH(_str ${str_list}) + + FOREACH(_str ${ARGN}) + IF(_ret STREQUAL "") + SET(_ret "${_str}") + ELSE(_ret STREQUAL "") + SET(_ret "${_ret}${delimiter}${_str}") + ENDIF(_ret STREQUAL "") + ENDFOREACH(_str ${str_list}) + SET(${var} "${_ret}") + ENDMACRO(STRING_JOIN var delimiter str_list) + + MACRO(STRING_SPLIT var delimiter str) + SET(_max_tokens "") + SET(_NOESCAPE_SEMICOLON "") + SET(_ESCAPE_VARIABLE "") + FOREACH(_arg ${ARGN}) + IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON") + ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE") + SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE") + ELSE(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + SET(_max_tokens ${_arg}) + ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON") + ENDFOREACH(_arg) + + IF(NOT _max_tokens) + SET(_max_tokens -1) + ENDIF(NOT _max_tokens) + + STRING_ESCAPE(_str "${str}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) + STRING_ESCAPE(_delimiter "${delimiter}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) + + SET(_str_list "") + SET(_token_count 0) + STRING(LENGTH "${_delimiter}" _de_len) + + WHILE(NOT _token_count EQUAL _max_tokens) + MATH(EXPR _token_count ${_token_count}+1) + IF(_token_count EQUAL _max_tokens) + # Last token, no need splitting + SET(_str_list ${_str_list} "${_str}") + ELSE(_token_count EQUAL _max_tokens) + # in case encoded characters are delimiters + STRING(LENGTH "${_str}" _str_len) + SET(_index 0) + SET(_token "") + SET(_str_remain "") + MATH(EXPR _str_end ${_str_len}-${_de_len}+1) + SET(_bound "k") + WHILE(_index LESS _str_end) + STRING(SUBSTRING "${_str}" ${_index} ${_de_len} _str_cursor) + IF(_str_cursor STREQUAL _delimiter) + # Get the token + STRING(SUBSTRING "${_str}" 0 ${_index} _token) + # Get the rest + MATH(EXPR _rest_index ${_index}+${_de_len}) + MATH(EXPR _rest_len ${_str_len}-${_index}-${_de_len}) + STRING(SUBSTRING "${_str}" ${_rest_index} ${_rest_len} _str_remain) + SET(_index ${_str_end}) + ELSE(_str_cursor STREQUAL _delimiter) + MATH(EXPR _index ${_index}+1) + ENDIF(_str_cursor STREQUAL _delimiter) + ENDWHILE(_index LESS _str_end) + + IF(_str_remain STREQUAL "") + # Meaning: end of string + LIST(APPEND _str_list "${_str}") + SET(_max_tokens ${_token_count}) + ELSE(_str_remain STREQUAL "") + LIST(APPEND _str_list "${_token}") + SET(_str "${_str_remain}") + ENDIF(_str_remain STREQUAL "") + ENDIF(_token_count EQUAL _max_tokens) + ENDWHILE(NOT _token_count EQUAL _max_tokens) + + + # Unencoding + STRING_UNESCAPE(${var} "${_str_list}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE}) + ENDMACRO(STRING_SPLIT var delimiter str) + +ENDIF(NOT DEFINED _MANAGE_STRING_CMAKE_) + diff --git a/project/cmake/scripts/common/pathsetup.cmake b/project/cmake/scripts/common/pathsetup.cmake new file mode 100644 index 0000000..54b352d --- /dev/null +++ b/project/cmake/scripts/common/pathsetup.cmake @@ -0,0 +1,3 @@ +# This script configures installation paths + +include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/pathsetup.cmake) diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake index 3413c45..b9a39e7 100644 --- a/project/cmake/scripts/common/prepare-env.cmake +++ b/project/cmake/scripts/common/prepare-env.cmake @@ -12,6 +12,8 @@ if(EXISTS "${APP_ROOT}/version.txt") set(${name} "${value}") endif() endforeach() + string(TOLOWER ${APP_NAME} APP_NAME_LC) + string(TOUPPER ${APP_NAME} APP_NAME_UC) endif() # bail if we can't parse versions @@ -19,16 +21,21 @@ if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR) message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists") endif() +# in case we need to download something, set KODI_MIRROR to the default if not alread set +if(NOT DEFINED KODI_MIRROR) + set(KODI_MIRROR "http://mirrors.kodi.tv") +endif() + ### copy all the addon binding header files to include/kodi # make sure include/kodi exists and is empty -set(KODI_LIB_DIR ${DEPENDS_PATH}/lib/kodi) -if(NOT EXISTS "${KODI_LIB_DIR}/") - file(MAKE_DIRECTORY ${KODI_LIB_DIR}) +set(APP_LIB_DIR ${DEPENDS_PATH}/lib/${APP_NAME_LC}) +if(NOT EXISTS "${APP_LIB_DIR}/") + file(MAKE_DIRECTORY ${APP_LIB_DIR}) endif() -set(KODI_INCLUDE_DIR ${DEPENDS_PATH}/include/kodi) -if(NOT EXISTS "${KODI_INCLUDE_DIR}/") - file(MAKE_DIRECTORY ${KODI_INCLUDE_DIR}) +set(APP_INCLUDE_DIR ${DEPENDS_PATH}/include/${APP_NAME_LC}) +if(NOT EXISTS "${APP_INCLUDE_DIR}/") + file(MAKE_DIRECTORY ${APP_INCLUDE_DIR}) endif() # we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc @@ -49,13 +56,13 @@ if(NOT WIN32) endif() endif() -# kodi-config.cmake.in (further down) expects a "prefix" variable -get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE) - # generate the proper kodi-config.cmake file -configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY) +configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${APP_LIB_DIR}/kodi-config.cmake @ONLY) + # copy cmake helpers to lib/kodi -file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${KODI_LIB_DIR}) +file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake + ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake + DESTINATION ${APP_LIB_DIR}) # generate xbmc-config.cmake for backwards compatibility to xbmc configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY) @@ -69,7 +76,7 @@ foreach(binding ${bindings}) string(REPLACE "+=" ";" binding "${binding}") list(GET binding 1 header) # copy the header file to include/kodi - file(COPY ${APP_ROOT}/${header} DESTINATION ${KODI_INCLUDE_DIR}) + file(COPY ${APP_ROOT}/${header} DESTINATION ${APP_INCLUDE_DIR}) # auto-generate header files for backwards compatibility to xbmc with deprecation warning # but only do it if the file doesn't already exist @@ -95,7 +102,7 @@ if(WIN32) else() set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1") set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") - set(PATCH_URL "http://mirrors.xbmc.org/build-deps/win32/${PATCH_ARCHIVE}") + set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) # download the archive containing patch.exe diff --git a/project/cmake/scripts/common/projectmacros.cmake b/project/cmake/scripts/common/projectmacros.cmake new file mode 100644 index 0000000..d0739c4 --- /dev/null +++ b/project/cmake/scripts/common/projectmacros.cmake @@ -0,0 +1,84 @@ +# This script holds macros which are project specific + +# Pack a skin xbt file +# Arguments: +# input input directory to pack +# output ouput xbt file +# On return: +# xbt is added to ${XBT_FILES} +function(pack_xbt input output) + file(GLOB_RECURSE MEDIA_FILES ${input}/*) + get_filename_component(dir ${output} PATH) + add_custom_command(OUTPUT ${output} + COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} + COMMAND TexturePacker::TexturePacker + ARGS -input ${input} + -output ${output} + -dupecheck + DEPENDS ${MEDIA_FILES}) + list(APPEND XBT_FILES ${output}) + set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) +endfunction() + +# Add a skin to installation list, mirroring it in build tree, packing textures +# Arguments: +# skin skin directory +# relative relative base path in build tree +# On return: +# xbt is added to ${XBT_FILES}, data added to ${install_data}, mirror in build tree +function(copy_skin_to_buildtree skin relative) + file(GLOB_RECURSE FILES ${skin}/*) + file(GLOB_RECURSE MEDIA_FILES ${skin}/media/*) + list(REMOVE_ITEM FILES ${MEDIA_FILES}) + foreach(file ${FILES}) + copy_file_to_buildtree(${file} ${relative}) + endforeach() + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dest}/media) + string(REPLACE "${relative}/" "" dest ${skin}) + pack_xbt(${skin}/media + ${CMAKE_BINARY_DIR}/${dest}/media/Textures.xbt + ${CMAKE_BINARY_DIR}) + + set(XBT_FILES ${XBT_FILES} PARENT_SCOPE) + set(install_data ${install_data} PARENT_SCOPE) +endfunction() + +# Get GTest tests as CMake tests. +# Copied from FindGTest.cmake +# Thanks to Daniel Blezek for the GTEST_ADD_TESTS code +function(GTEST_ADD_TESTS executable extra_args) + if(NOT ARGN) + message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS") + endif() + foreach(source ${ARGN}) + file(READ "${source}" contents) + string(REGEX MATCHALL "TEST_?[F]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents}) + foreach(hit ${found_tests}) + string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit}) + add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args}) + endforeach() + # Groups parametrized tests under a single ctest entry + string(REGEX MATCHALL "INSTANTIATE_TEST_CASE_P\\(([^,]+), *([^,]+)" found_tests2 ${contents}) + foreach(hit ${found_tests2}) + string(SUBSTRING ${hit} 24 -1 test_name) + string(REPLACE "," ";" test_name "${test_name}") + list(GET test_name 0 filter_name) + list(GET test_name 1 test_prefix) + string(STRIP ${test_prefix} test_prefix) + add_test(${test_prefix}.${filter_name} ${executable} --gtest_filter=${filter_name}* ${extra_args}) + endforeach() + endforeach() +endfunction() + +function(whole_archive output) + if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) + set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) + foreach(library ${ARGN}) + list(APPEND ${output} -Wl,-force_load ${library}) + set(${output} ${${output}} PARENT_SCOPE) + endforeach() + else() + set(${output} ${ARGN} PARENT_SCOPE) + endif() +endfunction() diff --git a/project/cmake/scripts/darwin/archsetup.cmake b/project/cmake/scripts/darwin/archsetup.cmake new file mode 100644 index 0000000..accb8ab --- /dev/null +++ b/project/cmake/scripts/darwin/archsetup.cmake @@ -0,0 +1,34 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for darwin. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.mm + ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.h) + +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX) +set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + -D__STDC_CONSTANT_MACROS) +set(PLATFORM_DIR linux) +set(CMAKE_SYSTEM_NAME Darwin) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL x86_64) + set(ARCH x86_64-apple-darwin) + elseif(CPU STREQUAL i386) + set(ARCH i386-apple-darwin) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX}) + +list(APPEND DEPLIBS "-framework DiskArbitration" "-framework IOKit" + "-framework IOSurface" "-framework SystemConfiguration" + "-framework ApplicationServices" "-framework AppKit" + "-framework CoreAudio" "-framework AudioToolbox" + "-framework CoreGraphics") diff --git a/project/cmake/scripts/darwin/install.cmake b/project/cmake/scripts/darwin/install.cmake new file mode 100644 index 0000000..e69de29 diff --git a/project/cmake/scripts/darwin/macros.cmake b/project/cmake/scripts/darwin/macros.cmake new file mode 100644 index 0000000..4ee17c2 --- /dev/null +++ b/project/cmake/scripts/darwin/macros.cmake @@ -0,0 +1,108 @@ +function(core_link_library lib wraplib) + if(CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(wrapper_obj cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) + elseif(CMAKE_GENERATOR MATCHES "Xcode") + set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o) + else() + message(FATAL_ERROR "Unsupported generator in core_link_library") + endif() + + set(export -bundle -undefined dynamic_lookup -read_only_relocs suppress + -Wl,-alias_list,${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def + ${CORE_BUILD_DIR}/${wrapper_obj}) + set(check_arg "") + if(TARGET ${lib}) + set(target ${lib}) + set(link_lib $) + set(check_arg ${ARGV2}) + set(data_arg ${ARGV3}) + else() + set(target ${ARGV2}) + set(link_lib ${lib}) + set(check_arg ${ARGV3}) + set(data_arg ${ARGV4}) + endif() + if(check_arg STREQUAL export) + set(export ${export} + -Wl,--version-script=${ARGV3}) + elseif(check_arg STREQUAL nowrap) + set(export ${data_arg}) + elseif(check_arg STREQUAL extras) + foreach(arg ${data_arg}) + list(APPEND export ${arg}) + endforeach() + endif() + get_filename_component(dir ${wraplib} PATH) + + # We can't simply pass the linker flags to the args section of the custom command + # because cmake will add quotes around it (and the linker will fail due to those). + # We need to do this handstand first ... + separate_arguments(CUSTOM_COMMAND_ARGS_LDFLAGS UNIX_COMMAND "${CMAKE_SHARED_LINKER_FLAGS}") + + add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} + COMMAND ${CMAKE_C_COMPILER} + ARGS ${CUSTOM_COMMAND_ARGS_LDFLAGS} ${export} -Wl,-force_load ${link_lib} + -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + DEPENDS ${target} wrapper.def wrapper + VERBATIM) + + # Uncomment to create wrap_ targets for debugging + #get_filename_component(libname ${wraplib} NAME_WE) + #add_custom_target(wrap_${libname} ALL DEPENDS ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) + + list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) + set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +endfunction() + +function(find_soname lib) + cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) + + string(TOLOWER ${lib} liblow) + if(${lib}_LDFLAGS) + set(link_lib "${${lib}_LDFLAGS}") + else() + set(link_lib "${${lib}_LIBRARIES}") + endif() + + execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs + COMMAND fgrep libraries: + COMMAND sed "s/[^=]*=\\(.*\\)/\\1/" + COMMAND sed "s/:/ /g" + ERROR_QUIET + OUTPUT_VARIABLE cc_lib_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND echo ${link_lib} + COMMAND sed "s/-L[ ]*//g" + COMMAND sed "s/-l[^ ]*//g" + ERROR_QUIET + OUTPUT_VARIABLE env_lib_path + OUTPUT_STRIP_TRAILING_WHITESPACE) + + foreach(path ${cc_lib_path} ${env_lib_path}) + if(IS_DIRECTORY ${path}) + execute_process(COMMAND ls -- ${path}/lib${liblow}.dylib + ERROR_QUIET + OUTPUT_VARIABLE lib_file + OUTPUT_STRIP_TRAILING_WHITESPACE) + else() + set(lib_file ${path}) + endif() + if(lib_file) + # we want the path/name that is embedded in the dylib + execute_process(COMMAND otool -L ${lib_file} + COMMAND grep -v lib${liblow}.dylib + COMMAND grep ${liblow} + COMMAND awk "{V=1; print $V}" + ERROR_QUIET + OUTPUT_VARIABLE filename + OUTPUT_STRIP_TRAILING_WHITESPACE) + get_filename_component(${lib}_SONAME "${filename}" NAME) + message(STATUS "${lib} soname: ${${lib}_SONAME}") + endif() + endforeach() + if(arg_REQUIRED AND NOT ${lib}_SONAME) + message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") + endif() + set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) +endfunction() diff --git a/project/cmake/scripts/darwin/pathsetup.cmake b/project/cmake/scripts/darwin/pathsetup.cmake new file mode 100644 index 0000000..e31f66e --- /dev/null +++ b/project/cmake/scripts/darwin/pathsetup.cmake @@ -0,0 +1,32 @@ +if(NOT prefix) + set(prefix ${DEPENDS_PATH}) +endif() +if(NOT exec_prefix) + set(exec_prefix \${prefix}) +endif() +if(NOT libdir) + set(libdir ${prefix}/lib) +endif() +if(NOT bindir) + set(bindir ${prefix}/bin) +endif() +if(NOT includedir) + set(includedir ${prefix}/include) +endif() +if(NOT datarootdir) + set(datarootdir ${prefix}/share) +endif() +if(NOT datadir) + set(datadir \${datarootdir}) +endif() + +list(APPEND final_message "-- PATH config --") +list(APPEND final_message "Prefix: ${prefix}") +list(APPEND final_message "Libdir: ${libdir}") +list(APPEND final_message "Bindir: ${bindir}") +list(APPEND final_message "Includedir: ${includedir}") +list(APPEND final_message "Datarootdir: ${datarootdir}") +list(APPEND final_message "Datadir: ${datadir}") + +set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" + -DINSTALL_PATH=\"${datarootdir}/xbmc\") diff --git a/project/cmake/scripts/freebsd/archsetup.cmake b/project/cmake/scripts/freebsd/archsetup.cmake new file mode 100644 index 0000000..edc77f1 --- /dev/null +++ b/project/cmake/scripts/freebsd/archsetup.cmake @@ -0,0 +1,19 @@ +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_FREEBSD) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) +set(SYSTEM_LDFLAGS -L/usr/local/lib) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CMAKE_SYSTEM_PROCESSOR STREQUAL amd64) + set(ARCH x86_64-freebsd) + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86") + set(ARCH x86-freebsd) + else() + message(WARNING "unknown CPU: ${CPU}") + endif() +endif() + +set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") +set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) diff --git a/project/cmake/scripts/freebsd/install.cmake b/project/cmake/scripts/freebsd/install.cmake new file mode 100644 index 0000000..0c8939e --- /dev/null +++ b/project/cmake/scripts/freebsd/install.cmake @@ -0,0 +1,58 @@ +set(libdir ${CMAKE_INSTALL_PREFIX}/lib) +set(bindir ${CMAKE_INSTALL_PREFIX}/bin) + +configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc.sh.in + ${CORE_BUILD_DIR}/scripts/xbmc @ONLY) +configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc-standalone.sh.in + ${CORE_BUILD_DIR}/scripts/xbmc-standalone @ONLY) + +install(TARGETS xbmc-xrandr DESTINATION lib/xbmc) +install(FILES ${addon_bindings} DESTINATION include/xbmc) +install(FILES ${cmake_files} ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/modules/xbmc-config.cmake + DESTINATION lib/xbmc) +install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc-standalone + DESTINATION bin) +install(FILES ${CORE_SOURCE_DIR}/tools/Linux/FEH.py + DESTINATION share/xbmc) + +install(FILES ${CORE_SOURCE_DIR}/tools/Linux/xbmc-xsession.desktop + RENAME XBMC.desktop + DESTINATION share/xsessions) + +install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL + ${CORE_SOURCE_DIR}/docs/README.freebsd + DESTINATION share/doc/xbmc) + +foreach(texture ${XBT_FILES}) + string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) + get_filename_component(dir ${dir} PATH) + install(FILES ${texture} + DESTINATION share/xbmc/${dir}) +endforeach() + +foreach(wraplib ${WRAP_FILES}) + get_filename_component(dir ${wraplib} PATH) + install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib} + DESTINATION lib/xbmc/${dir}) +endforeach() + +foreach(file ${install_data}) + get_filename_component(dir ${file} PATH) + install(FILES ${CMAKE_BINARY_DIR}/${file} + DESTINATION share/xbmc/${dir}) +endforeach() + +install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs) + foreach(dir \${dirs}) + file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*) + foreach(file \${FILES}) + get_filename_component(dir \${file} PATH) + file(INSTALL \${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xbmc/\${dir}) + endforeach() + endforeach()") +foreach(subdir ${build_dirs}) + string(REPLACE " " ";" subdir ${subdir}) + list(GET subdir 0 id) + install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install)") +endforeach() diff --git a/project/cmake/scripts/freebsd/macros.cmake b/project/cmake/scripts/freebsd/macros.cmake new file mode 100644 index 0000000..f0bf7ba --- /dev/null +++ b/project/cmake/scripts/freebsd/macros.cmake @@ -0,0 +1 @@ +include(../linux/macros.cmake) diff --git a/project/cmake/scripts/freebsd/pathsetup.cmake b/project/cmake/scripts/freebsd/pathsetup.cmake new file mode 100644 index 0000000..1fb45b6 --- /dev/null +++ b/project/cmake/scripts/freebsd/pathsetup.cmake @@ -0,0 +1 @@ +include(${PROJECT_SOURCE_DIR}/scripts/linux/pathsetup.cmake) diff --git a/project/cmake/scripts/ios/archsetup.cmake b/project/cmake/scripts/ios/archsetup.cmake new file mode 100644 index 0000000..e6639f7 --- /dev/null +++ b/project/cmake/scripts/ios/archsetup.cmake @@ -0,0 +1,38 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/XBMCApplication.m) + +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS) +set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + -D__STDC_CONSTANT_MACROS) +set(PLATFORM_DIR linux) +set(CMAKE_SYSTEM_NAME Darwin) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL armv7) + set(ARCH arm-apple-darwin) + elseif(CPU STREQUAL arm64) + set(ARCH arm-apple-darwin) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX}) + +list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo" + "-framework CoreAudio" "-framework AudioToolbox" + "-framework QuartzCore" "-framework MediaPlayer" + "-framework CFNetwork" "-framework CoreGraphics" + "-framework Foundation" "-framework UIKit" + "-framework CoreMedia" "-framework AVFoundation") + +set(ENABLE_DVDCSS OFF) +set(ENABLE_OPTICAL OFF) +set(ENABLE_VTB ON) +set(VTB_FOUND 1 CACHE INTERNAL "VTB") diff --git a/project/cmake/scripts/ios/install.cmake b/project/cmake/scripts/ios/install.cmake new file mode 120000 index 0000000..0ea6586 --- /dev/null +++ b/project/cmake/scripts/ios/install.cmake @@ -0,0 +1 @@ +../darwin/install.cmake \ No newline at end of file diff --git a/project/cmake/scripts/ios/macros.cmake b/project/cmake/scripts/ios/macros.cmake new file mode 120000 index 0000000..45c7ad1 --- /dev/null +++ b/project/cmake/scripts/ios/macros.cmake @@ -0,0 +1 @@ +../darwin/macros.cmake \ No newline at end of file diff --git a/project/cmake/scripts/ios/pathsetup.cmake b/project/cmake/scripts/ios/pathsetup.cmake new file mode 120000 index 0000000..f8e1248 --- /dev/null +++ b/project/cmake/scripts/ios/pathsetup.cmake @@ -0,0 +1 @@ +../darwin/pathsetup.cmake \ No newline at end of file diff --git a/project/cmake/scripts/linux/archsetup.cmake b/project/cmake/scripts/linux/archsetup.cmake new file mode 100644 index 0000000..d0e149e --- /dev/null +++ b/project/cmake/scripts/linux/archsetup.cmake @@ -0,0 +1,21 @@ +set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) +set(CMAKE_SYSTEM_NAME Linux) +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL x86_64) + set(ARCH x86_64-linux) + elseif(CPU MATCHES "i.86") + set(ARCH i486-linux) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") +set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) diff --git a/project/cmake/scripts/linux/install.cmake b/project/cmake/scripts/linux/install.cmake new file mode 100644 index 0000000..b887610 --- /dev/null +++ b/project/cmake/scripts/linux/install.cmake @@ -0,0 +1,93 @@ +if(X_FOUND) + set(USE_X11 1) +else() + set(USE_X11 0) +endif() +if(OPENGL_FOUND) + set(USE_OPENGL 1) +else() + set(USE_OPENGL 0) +endif() +if(OPENGLES_FOUND) + set(USE_OPENGLES 1) +else() + set(USE_OPENGLES 0) +endif() + +configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.sh.in + ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY) +configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in + ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY) + +install(TARGETS ${APP_NAME_LC} DESTINATION ${libdir}/kodi) +if(ENABLE_X11 AND XRANDR_FOUND) + install(TARGETS ${APP_NAME_LC}-xrandr DESTINATION ${libdir}/${APP_NAME_LC}) +endif() +install(FILES ${addon_bindings} DESTINATION ${includedir}/kodi) +install(FILES ${cmake-files} + DESTINATION ${libdir}/kodi) +install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone + DESTINATION ${bindir}) + +configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in + ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop) +install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop + DESTINATION ${datarootdir}/xsessions) + +install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL + ${CORE_SOURCE_DIR}/docs/README.linux + DESTINATION ${datarootdir}/doc/kodi) + +install(FILES ${CORE_SOURCE_DIR}/tools/Linux/kodi.desktop + DESTINATION ${datarootdir}/applications) + +foreach(texture ${XBT_FILES}) + string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture}) + get_filename_component(dir ${dir} PATH) + install(FILES ${texture} + DESTINATION ${datarootdir}/kodi/${dir}) +endforeach() + +foreach(wraplib ${WRAP_FILES}) + get_filename_component(dir ${wraplib} PATH) + install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib} + DESTINATION ${libdir}/kodi/${dir}) +endforeach() + +foreach(file ${install_data}) + get_filename_component(dir ${file} PATH) + install(FILES ${CMAKE_BINARY_DIR}/${file} + DESTINATION ${datarootdir}/kodi/${dir}) +endforeach() + +if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs) + install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs) + foreach(dir \${dirs}) + file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*) + foreach(file \${FILES}) + get_filename_component(dir \${file} PATH) + file(INSTALL \${file} DESTINATION ${datarootdir}/kodi/\${dir}) + endforeach() + endforeach()") +endif() + +if(NOT "$ENV{DESTDIR}" STREQUAL "") + set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR}) +endif() +foreach(subdir ${build_dirs}) + if(NOT subdir MATCHES kodi-platform) + string(REPLACE " " ";" subdir ${subdir}) + list(GET subdir 0 id) + install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})") + endif() +endforeach() + +install(FILES ${CORE_SOURCE_DIR}/media/icon48x48.png + RENAME ${APP_NAME_LC}.png + DESTINATION ${datarootdir}/icons/hicolor/48x48/apps) +install(FILES ${CORE_SOURCE_DIR}/media/icon256x256.png + RENAME ${APP_NAME_LC}.png + DESTINATION ${datarootdir}/icons/hicolor/256x256/apps) + +install(CODE "execute_process(COMMAND gtk-update-icon-cache -f -q -t $ENV{DESTDIR}${datarootdir}/icons/hicolor ERROR_QUIET)") diff --git a/project/cmake/scripts/linux/macros.cmake b/project/cmake/scripts/linux/macros.cmake new file mode 100644 index 0000000..7453a1c --- /dev/null +++ b/project/cmake/scripts/linux/macros.cmake @@ -0,0 +1,79 @@ +function(core_link_library lib wraplib) + set(export -Wl,--unresolved-symbols=ignore-all + `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def` + ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) + set(check_arg "") + if(TARGET ${lib}) + set(target ${lib}) + set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a) + set(check_arg ${ARGV2}) + set(data_arg ${ARGV3}) + else() + set(target ${ARGV2}) + set(link_lib ${lib}) + set(check_arg ${ARGV3}) + set(data_arg ${ARGV4}) + endif() + if(check_arg STREQUAL export) + set(export ${export} + -Wl,--version-script=${ARGV3}) + elseif(check_arg STREQUAL nowrap) + set(export ${data_arg}) + elseif(check_arg STREQUAL extras) + foreach(arg ${data_arg}) + list(APPEND export ${arg}) + endforeach() + endif() + get_filename_component(dir ${wraplib} PATH) + add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + COMMAND cmake -E make_directory ${dir} + COMMAND ${CMAKE_C_COMPILER} + ARGS -Wl,--whole-archive + ${link_lib} + -Wl,--no-whole-archive -lm + -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} + ${export} + DEPENDS ${target} wrapper.def wrapper) + list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) + set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +endfunction() + +function(find_soname lib) + cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) + + string(TOLOWER ${lib} liblow) + if(${lib}_LDFLAGS) + set(link_lib "${${lib}_LDFLAGS}") + else() + if(IS_ABSOLUTE "${${lib}_LIBRARIES}") + set(link_lib "${${lib}_LIBRARIES}") + else() + set(link_lib -l${${lib}_LIBRARIES}) + endif() + endif() + execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib} + COMMAND grep LOAD.*${liblow} + ERROR_QUIET + OUTPUT_VARIABLE ${lib}_FILENAME) + string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}") + string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME) + if(NOT ${lib}_FILENAME) + execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib} + OUTPUT_QUIET + ERROR_VARIABLE _TMP_FILENAME) + string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME}) + endif() + if(${lib}_FILENAME) + execute_process(COMMAND objdump -p ${${lib}_FILENAME} + COMMAND grep SONAME.*${liblow} + ERROR_QUIET + OUTPUT_VARIABLE ${lib}_SONAME) + string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME}) + string(STRIP ${${lib}_SONAME} ${lib}_SONAME) + message(STATUS "${lib} soname: ${${lib}_SONAME}") + set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) + endif() + if(arg_REQUIRED AND NOT ${lib}_SONAME) + message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") + endif() +endfunction() diff --git a/project/cmake/scripts/linux/pathsetup.cmake b/project/cmake/scripts/linux/pathsetup.cmake new file mode 100644 index 0000000..940fb62 --- /dev/null +++ b/project/cmake/scripts/linux/pathsetup.cmake @@ -0,0 +1,34 @@ +if(NOT prefix) + set(prefix ${CMAKE_INSTALL_PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX ${prefix}) +endif() +if(NOT exec_prefix) + set(exec_prefix \${prefix}) +endif() +if(NOT libdir) + set(libdir ${prefix}/lib) +endif() +if(NOT bindir) + set(bindir ${prefix}/bin) +endif() +if(NOT includedir) + set(includedir ${prefix}/include) +endif() +if(NOT datarootdir) + set(datarootdir ${prefix}/share) +endif() +if(NOT datadir) + set(datadir \${datarootdir}) +endif() + +list(APPEND final_message "-- PATH config --") +list(APPEND final_message "Prefix: ${prefix}") +list(APPEND final_message "Libdir: ${libdir}") +list(APPEND final_message "Bindir: ${bindir}") +list(APPEND final_message "Includedir: ${includedir}") +list(APPEND final_message "Datarootdir: ${datarootdir}") +list(APPEND final_message "Datadir: ${datadir}") + +set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" + -DINSTALL_PATH=\"${datarootdir}/xbmc\") diff --git a/project/cmake/scripts/rbpi/archsetup.cmake b/project/cmake/scripts/rbpi/archsetup.cmake new file mode 100644 index 0000000..84f1dad --- /dev/null +++ b/project/cmake/scripts/rbpi/archsetup.cmake @@ -0,0 +1,32 @@ +if(NOT CMAKE_TOOLCHAIN_FILE) + message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for rbpi. See ${PROJECT_SOURCE_DIR}/README.md") +endif() + +set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI + -DHAS_OMXPLAYER -DHAVE_OMXLIB) +set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED + -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64) +set(PLATFORM_DIR linux) + +string(REGEX REPLACE "[ ]+" ";" SYSTEM_LDFLAGS $ENV{LDFLAGS}) +set(CMAKE_SYSTEM_NAME Linux) + +if(WITH_ARCH) + set(ARCH ${WITH_ARCH}) +else() + if(CPU STREQUAL arm1176jzf-s) + set(ARCH arm-linux-gnueabihf) + elseif(CPU MATCHES "cortex-a7") + set(ARCH arm-linux-gnueabihf) + else() + message(SEND_ERROR "Unknown CPU: ${CPU}") + endif() +endif() + +find_package(CXX11 REQUIRED) + +set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use") +set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE}) +set(MMAL_FOUND 1 CACHE INTERNAL "MMAL") +set(OMX_FOUND 1 CACHE INTERNAL "OMX") +set(OMXLIB_FOUND 1 CACHE INTERNAL "OMX") diff --git a/project/cmake/scripts/rbpi/install.cmake b/project/cmake/scripts/rbpi/install.cmake new file mode 120000 index 0000000..0409981 --- /dev/null +++ b/project/cmake/scripts/rbpi/install.cmake @@ -0,0 +1 @@ +../linux/install.cmake \ No newline at end of file diff --git a/project/cmake/scripts/rbpi/macros.cmake b/project/cmake/scripts/rbpi/macros.cmake new file mode 120000 index 0000000..28c77ca --- /dev/null +++ b/project/cmake/scripts/rbpi/macros.cmake @@ -0,0 +1 @@ +../linux/macros.cmake \ No newline at end of file diff --git a/project/cmake/scripts/rbpi/pathsetup.cmake b/project/cmake/scripts/rbpi/pathsetup.cmake new file mode 120000 index 0000000..26d7f17 --- /dev/null +++ b/project/cmake/scripts/rbpi/pathsetup.cmake @@ -0,0 +1 @@ +../linux/pathsetup.cmake \ No newline at end of file diff --git a/project/cmake/scripts/windows/archsetup.cmake b/project/cmake/scripts/windows/archsetup.cmake new file mode 100644 index 0000000..baa3624 --- /dev/null +++ b/project/cmake/scripts/windows/archsetup.cmake @@ -0,0 +1,91 @@ +# -------- Architecture settings --------- + +set(ARCH win32) + + +# -------- Paths (mainly for find_package) --------- + +set(PLATFORM_DIR win32) + +# Precompiled headers fail with per target output directory. (needs CMake 3.1) +set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs) + +set(CMAKE_SYSTEM_NAME Windows) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg) +list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin) +list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../BuildDependencies) +set(CONFIGURATION_LIBDIR lib/${CORE_BUILD_CONFIG}-vc120) +set(CONFIGURATION_LIBDIR_RELEASE lib/Release-vc120) +set(CONFIGURATION_LIBDIR_DEBUG lib/Debug-vc120) + +set(JPEG_NAMES ${JPEG_NAMES} jpeg-static) +set(PYTHON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../BuildDependencies/include/python) + + +# -------- Compiler options --------- + +add_options(CXX ALL_BUILDS "/wd\"4996\"") +set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS) +set(SYSTEM_DEFINES -DNOMINMAX -D_USE_32BIT_TIME_T -DHAS_DX -D__STDC_CONSTANT_MACROS + -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING + -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi" + -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi" + -DBUILDING_WITH_CMAKE + $<$:-DD3D_DEBUG_INFO -D_SECURE_SCL=0 -D_HAS_ITERATOR_DEBUGGING=0>) + +# Compile with /MT (to be compatible with the dependent libraries) +foreach(CompilerFlag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") +endforeach() + +# Make sure /FS is set for Visual Studio in order to prevent simultanious access to pdb files. +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(CMAKE_CXX_FLAGS "/MP /FS ${CMAKE_CXX_FLAGS}") +endif() + + +# -------- Linker options --------- + +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") + +# For #pragma comment(lib X) +# TODO: It would certainly be better to handle these libraries via CMake modules. +link_directories(${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin + ${PROJECT_SOURCE_DIR}/../BuildDependencies/lib + ${PROJECT_SOURCE_DIR}/../BuildDependencies/${CONFIGURATION_LIBDIR}) + +# Additional libraries +list(APPEND DEPLIBS d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib + PowrProf.lib setupapi.lib dwmapi.lib yajl.lib dxguid.lib DelayImp.lib) + +# NODEFAULTLIB option +set(_nodefaultlibs_RELEASE libc msvcrt libci msvcprt) +set(_nodefaultlibs_DEBUG libcpmt libc msvcrt libcmt msvcrtd msvcprtd) +foreach(_lib ${_nodefaultlibs_RELEASE}) + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"") +endforeach() +foreach(_lib ${_nodefaultlibs_DEBUG}) + set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"") +endforeach() + +# DELAYLOAD option +set(_delayloadlibs libxslt.dll dnssd.dll dwmapi.dll ssh.dll sqlite3.dll + avcodec-56.dll avfilter-5.dll avformat-56.dll avutil-54.dll + postproc-53.dll swresample-1.dll swscale-3.dll d3dcompiler_47.dll) +foreach(_lib ${_delayloadlibs}) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:\"${_lib}\"") +endforeach() + +# Make the Release version create a PDB +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") +# Minimize the size or the resulting DLLs +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF") + + +# -------- Visual Studio options --------- + +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +endif() diff --git a/project/cmake/scripts/windows/install.cmake b/project/cmake/scripts/windows/install.cmake new file mode 100644 index 0000000..e69de29 diff --git a/project/cmake/scripts/windows/macros.cmake b/project/cmake/scripts/windows/macros.cmake new file mode 100644 index 0000000..6aabf7d --- /dev/null +++ b/project/cmake/scripts/windows/macros.cmake @@ -0,0 +1,143 @@ +function(core_link_library lib wraplib) +# set(export -Wl,--unresolved-symbols=ignore-all +# `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def` +# ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o) +# set(check_arg "") +# if(TARGET ${lib}) +# set(target ${lib}) +# set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a) +# set(check_arg ${ARGV2}) +# set(data_arg ${ARGV3}) +# else() +# set(target ${ARGV2}) +# set(link_lib ${lib}) +# set(check_arg ${ARGV3}) +# set(data_arg ${ARGV4}) +# endif() +# if(check_arg STREQUAL "export") +# set(export ${export} +# -Wl,--version-script=${ARGV3}) +# elseif(check_arg STREQUAL "nowrap") +# set(export ${data_arg}) +# elseif(check_arg STREQUAL "extras") +# foreach(arg ${data_arg}) +# list(APPEND export ${arg}) +# endforeach() +# endif() +# get_filename_component(dir ${wraplib} PATH) +# add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} +# COMMAND cmake -E make_directory ${dir} +# COMMAND ${CMAKE_C_COMPILER} +# ARGS -Wl,--whole-archive +# ${link_lib} +# -Wl,--no-whole-archive -lm +# -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} +# ${export} +# DEPENDS ${target} wrapper.def wrapper) +# list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) +# set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE) +endfunction() + +function(find_soname lib) + # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h. + # Therefore the output of this function is unused. +endfunction() + +# Add precompiled header to target +# Arguments: +# target existing target that will be set up to compile with a precompiled header +# pch_header the precompiled header file +# pch_source the precompiled header source file +# Optional Arguments: +# PCH_TARGET build precompiled header as separate target with the given name +# so that the same precompiled header can be used for multiple libraries +# EXCLUDE_SOURCES if not all target sources shall use the precompiled header, +# the relevant files can be listed here +# On return: +# Compiles the pch_source into a precompiled header and adds the header to +# the given target +function(add_precompiled_header target pch_header pch_source) + cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN}) + + if(PCH_PCH_TARGET) + set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch) + else() + set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch) + endif() + + # Set compile options and dependency for sources + get_target_property(sources ${target} SOURCES) + list(REMOVE_ITEM sources ${pch_source}) + foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES) + list(REMOVE_ITEM sources ${exclude_source}) + endforeach() + set_source_files_properties(${sources} + PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\"" + OBJECT_DEPENDS "${pch_binary}") + + # Set compile options for precompiled header + if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch) + set_source_files_properties(${pch_source} + PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\"" + OBJECT_OUTPUTS "${pch_binary}") + endif() + + # Compile precompiled header + if(PCH_PCH_TARGET) + # As own target for usage in multiple libraries + if(NOT TARGET ${PCH_PCH_TARGET}_pch) + add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source}) + set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) + endif() + # From VS2012 onwards, precompiled headers have to be linked against (LNK2011). + target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch) + set_target_properties(${target} PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) + else() + # As part of the target + target_sources(${target} PRIVATE ${pch_source}) + endif() +endfunction() + +# Adds an FX-compiled shader to a target +# Creates a custom command that FX-compiles the given shader and adds the +# generated header file to the given target. +# Arguments: +# target Target to add the FX-compiled shader to +# hlsl HLSL shader input file +# profile HLSL profile that specifies the shader model +# entrypoint Shader entry point +# On return: +# FXC_FILE is set to the name of the generated header file. +function(add_shader_dx target hlsl profile entrypoint) + get_filename_component(file ${hlsl} NAME_WE) + add_custom_command(OUTPUT ${file}.h + COMMAND ${FXC} /Fh ${file}.h + /E ${entrypoint} + /T ${profile} + /Vn ${file} + /Qstrip_reflect + ${hlsl} + DEPENDS ${hlsl} + COMMENT "FX compile ${hlsl}" + VERBATIM) + target_sources(${target} PRIVATE ${file}.h) + target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) +endfunction() + +# Copies the main dlls to the root of the buildtree +# On return: +# files added to ${install_data}, mirror in build tree +function(copy_main_dlls_to_buildtree) + set(dir ${PROJECT_SOURCE_DIR}/../Win32BuildSetup/dependencies) + file(GLOB_RECURSE files ${dir}/*) + foreach(file ${files}) + copy_file_to_buildtree(${file} ${dir}) + endforeach() + + if(D3DCOMPILER_DLL) + get_filename_component(d3dcompiler_dir ${D3DCOMPILER_DLL} DIRECTORY) + copy_file_to_buildtree(${D3DCOMPILER_DLL} ${d3dcompiler_dir}) + endif() + + set(install_data ${install_data} PARENT_SCOPE) +endfunction() diff --git a/project/cmake/scripts/windows/pathsetup.cmake b/project/cmake/scripts/windows/pathsetup.cmake new file mode 100644 index 0000000..940fb62 --- /dev/null +++ b/project/cmake/scripts/windows/pathsetup.cmake @@ -0,0 +1,34 @@ +if(NOT prefix) + set(prefix ${CMAKE_INSTALL_PREFIX}) +else() + set(CMAKE_INSTALL_PREFIX ${prefix}) +endif() +if(NOT exec_prefix) + set(exec_prefix \${prefix}) +endif() +if(NOT libdir) + set(libdir ${prefix}/lib) +endif() +if(NOT bindir) + set(bindir ${prefix}/bin) +endif() +if(NOT includedir) + set(includedir ${prefix}/include) +endif() +if(NOT datarootdir) + set(datarootdir ${prefix}/share) +endif() +if(NOT datadir) + set(datadir \${datarootdir}) +endif() + +list(APPEND final_message "-- PATH config --") +list(APPEND final_message "Prefix: ${prefix}") +list(APPEND final_message "Libdir: ${libdir}") +list(APPEND final_message "Bindir: ${bindir}") +list(APPEND final_message "Includedir: ${includedir}") +list(APPEND final_message "Datarootdir: ${datarootdir}") +list(APPEND final_message "Datadir: ${datadir}") + +set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\" + -DINSTALL_PATH=\"${datarootdir}/xbmc\") diff --git a/project/cmake/treedata/android/subdirs.txt b/project/cmake/treedata/android/subdirs.txt new file mode 100644 index 0000000..1c75fa6 --- /dev/null +++ b/project/cmake/treedata/android/subdirs.txt @@ -0,0 +1,16 @@ +xbmc/linux linuxsupport +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/peripherals/bus/linux peripherals/bus/linux +xbmc/powermanagement/android powermanagement/android +xbmc/storage/android storage/android +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/windowing/android windowing/android +xbmc/windowing/egl windowing/egl +xbmc/platform/posix posix +xbmc/platform/android/activity android_activity +xbmc/platform/android/bionic_supplement android_bionicsupplement +xbmc/platform/android/jni android_jni +xbmc/platform/android/loader android_loader diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt new file mode 100644 index 0000000..29b7990 --- /dev/null +++ b/project/cmake/treedata/common/addons.txt @@ -0,0 +1,7 @@ +lib/addons/library.kodi.adsp KODI_adsp +lib/addons/library.kodi.audioengine KODI_audioengine +lib/addons/library.kodi.guilib KODI_guilib +lib/addons/library.kodi.inputstream KODI_inputstream +lib/addons/library.xbmc.addon XBMC_addon +lib/addons/library.xbmc.codec XBMC_codec +lib/addons/library.xbmc.pvr XBMC_pvr diff --git a/project/cmake/treedata/common/cores.txt b/project/cmake/treedata/common/cores.txt new file mode 100644 index 0000000..d23939d --- /dev/null +++ b/project/cmake/treedata/common/cores.txt @@ -0,0 +1,8 @@ +xbmc/cores cores +xbmc/cores/AudioEngine cores/audioengine +xbmc/cores/DllLoader cores/dll-loader +xbmc/cores/DllLoader/exports cores/dll-loader/exports +xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util +xbmc/cores/ExternalPlayer cores/externalplayer +xbmc/cores/paplayer cores/paplayer +xbmc/cores/playercorefactory cores/playercorefactory diff --git a/project/cmake/treedata/common/events.txt b/project/cmake/treedata/common/events.txt new file mode 100644 index 0000000..0adeb08 --- /dev/null +++ b/project/cmake/treedata/common/events.txt @@ -0,0 +1,2 @@ +xbmc/events events +xbmc/events/windows events/windows diff --git a/project/cmake/treedata/common/externals.txt b/project/cmake/treedata/common/externals.txt new file mode 100644 index 0000000..632b354 --- /dev/null +++ b/project/cmake/treedata/common/externals.txt @@ -0,0 +1,3 @@ +xbmc/contrib/kissfft kissfft +lib/libUPnP upnp +lib/libexif exif diff --git a/project/cmake/treedata/common/filesystem.txt b/project/cmake/treedata/common/filesystem.txt new file mode 100644 index 0000000..1c49a74 --- /dev/null +++ b/project/cmake/treedata/common/filesystem.txt @@ -0,0 +1,3 @@ +xbmc/filesystem filesystem +xbmc/filesystem/VideoDatabaseDirectory filesystem/videodatabase +xbmc/filesystem/MusicDatabaseDirectory filesystem/musicdatabase diff --git a/project/cmake/treedata/common/interfaces.txt b/project/cmake/treedata/common/interfaces.txt new file mode 100644 index 0000000..ffd3570 --- /dev/null +++ b/project/cmake/treedata/common/interfaces.txt @@ -0,0 +1,9 @@ +xbmc/interfaces interfaces +xbmc/interfaces/builtins interfaces/builtins +xbmc/interfaces/generic interfaces/generic +xbmc/interfaces/info interfaces/info +xbmc/interfaces/json-rpc interfaces/json-rpc +xbmc/interfaces/json-rpc/schema interfaces/json-rpc/schema +xbmc/interfaces/legacy interfaces/legacy +xbmc/interfaces/legacy/wsgi interfaces/legacy/wsgi +xbmc/interfaces/python interfaces/python diff --git a/project/cmake/treedata/common/music.txt b/project/cmake/treedata/common/music.txt new file mode 100644 index 0000000..71f30e1 --- /dev/null +++ b/project/cmake/treedata/common/music.txt @@ -0,0 +1,5 @@ +xbmc/music music +xbmc/music/dialogs music/dialogs +xbmc/music/infoscanner music/infoscanner +xbmc/music/tags music/tags +xbmc/music/windows music/windows diff --git a/project/cmake/treedata/common/network.txt b/project/cmake/treedata/common/network.txt new file mode 100644 index 0000000..c0ec4a3 --- /dev/null +++ b/project/cmake/treedata/common/network.txt @@ -0,0 +1,6 @@ +xbmc/network network +xbmc/network/dacp network/dacp +xbmc/network/httprequesthandler network/httprequesthandler +xbmc/network/httprequesthandler/python network/httprequesthandler/python +xbmc/network/upnp network/upnp +xbmc/network/websocket network/websocket diff --git a/project/cmake/treedata/common/peripherals.txt b/project/cmake/treedata/common/peripherals.txt new file mode 100644 index 0000000..e6d9283 --- /dev/null +++ b/project/cmake/treedata/common/peripherals.txt @@ -0,0 +1,4 @@ +xbmc/peripherals peripherals +xbmc/peripherals/bus peripherals/bus +xbmc/peripherals/devices peripherals/devices +xbmc/peripherals/dialogs peripherals/dialogs diff --git a/project/cmake/treedata/common/profiles.txt b/project/cmake/treedata/common/profiles.txt new file mode 100644 index 0000000..fae570b --- /dev/null +++ b/project/cmake/treedata/common/profiles.txt @@ -0,0 +1,3 @@ +xbmc/profiles profiles +xbmc/profiles/dialogs profiles/dialogs +xbmc/profiles/windows profiles/windows diff --git a/project/cmake/treedata/common/pvr.txt b/project/cmake/treedata/common/pvr.txt new file mode 100644 index 0000000..6797677 --- /dev/null +++ b/project/cmake/treedata/common/pvr.txt @@ -0,0 +1,7 @@ +xbmc/pvr pvr +xbmc/pvr/addons pvr/addons +xbmc/pvr/channels pvr/channels +xbmc/pvr/dialogs pvr/dialogs +xbmc/pvr/recordings pvr/recordings +xbmc/pvr/timers pvr/timers +xbmc/pvr/windows pvr/windows diff --git a/project/cmake/treedata/common/settings.txt b/project/cmake/treedata/common/settings.txt new file mode 100644 index 0000000..c5aa2ae --- /dev/null +++ b/project/cmake/treedata/common/settings.txt @@ -0,0 +1,4 @@ +xbmc/settings settings +xbmc/settings/dialogs settings/dialogs +xbmc/settings/lib settings/lib +xbmc/settings/windows settings/windows diff --git a/project/cmake/treedata/common/subdirs.txt b/project/cmake/treedata/common/subdirs.txt new file mode 100644 index 0000000..762547e --- /dev/null +++ b/project/cmake/treedata/common/subdirs.txt @@ -0,0 +1,25 @@ +xbmc xbmc +xbmc/addons addons +xbmc/commons commons +xbmc/cdrip cdrip +xbmc/dbwrappers dbwrappers +xbmc/dialogs dialogs +xbmc/epg epg +xbmc/guilib guilib +xbmc/input input +xbmc/listproviders listproviders +xbmc/media media +xbmc/messaging messaging +xbmc/messaging/helpers messagingHelpers +xbmc/pictures pictures +xbmc/platform platform +xbmc/playlists playlists +xbmc/powermanagement powermanagement +xbmc/programs programs +xbmc/rendering rendering +xbmc/storage storage +xbmc/threads threads +xbmc/utils utils +xbmc/view view +xbmc/windowing windowing +xbmc/windows windows diff --git a/project/cmake/treedata/common/tests.txt b/project/cmake/treedata/common/tests.txt new file mode 100644 index 0000000..358bc4d --- /dev/null +++ b/project/cmake/treedata/common/tests.txt @@ -0,0 +1,10 @@ +xbmc/test test +xbmc/addons/test test/addons +xbmc/filesystem/test test/filesystem +xbmc/interfaces/python/test test/python +xbmc/music/tags/test test/music_tags +xbmc/network/test test/network +xbmc/threads/test test/threads +xbmc/utils/test test/utils +xbmc/video/test test/video +xbmc/cores/AudioEngine/Sinks/test test/audioengine_sinks diff --git a/project/cmake/treedata/common/video.txt b/project/cmake/treedata/common/video.txt new file mode 100644 index 0000000..e7855a0 --- /dev/null +++ b/project/cmake/treedata/common/video.txt @@ -0,0 +1,5 @@ +xbmc/video video +xbmc/video/dialogs video/dialogs +xbmc/video/jobs video/jobs +xbmc/video/videosync video/sync +xbmc/video/windows video/windows diff --git a/project/cmake/treedata/common/videoplayer.txt b/project/cmake/treedata/common/videoplayer.txt new file mode 100644 index 0000000..8c8d45d --- /dev/null +++ b/project/cmake/treedata/common/videoplayer.txt @@ -0,0 +1,12 @@ +xbmc/cores/VideoPlayer cores/VideoPlayer +xbmc/cores/VideoPlayer/DVDCodecs cores/VideoPlayer/codecs +xbmc/cores/VideoPlayer/DVDCodecs/Audio cores/VideoPlayer/codecs/audio +xbmc/cores/VideoPlayer/DVDCodecs/Overlay cores/VideoPlayer/codecs/overlay +xbmc/cores/VideoPlayer/DVDCodecs/Video cores/VideoPlayer/codecs/video +xbmc/cores/VideoPlayer/DVDDemuxers cores/VideoPlayer/demuxers +xbmc/cores/VideoPlayer/DVDInputStreams cores/VideoPlayer/inputstreams +xbmc/cores/VideoPlayer/DVDSubtitles cores/VideoPlayer/subtitles +xbmc/cores/VideoPlayer/Process cores/VideoPlayer/process +xbmc/cores/VideoPlayer/VideoRenderers cores/VideoPlayer/videorenderers +xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders cores/VideoPlayer/videorenderers/shaders +xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender cores/VideoPlayer/videorenderers/hwdec diff --git a/project/cmake/treedata/darwin/subdirs.txt b/project/cmake/treedata/darwin/subdirs.txt new file mode 100644 index 0000000..f0fc5c5 --- /dev/null +++ b/project/cmake/treedata/darwin/subdirs.txt @@ -0,0 +1,12 @@ +xbmc/linux linuxsupport +xbmc/network/linux network/linux +xbmc/network/osx network/osx +xbmc/peripherals/bus/osx peripherals/bus/osx +xbmc/powermanagement/osx powermanagement/osx +xbmc/storage/osx storage/osx +xbmc/platform/posix posix +xbmc/platform/darwin platform_darwin +xbmc/platform/darwin/osx platform_osx +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/windowing/osx windowing/osx diff --git a/project/cmake/treedata/freebsd/subdirs.txt b/project/cmake/treedata/freebsd/subdirs.txt new file mode 100644 index 0000000..faff03c --- /dev/null +++ b/project/cmake/treedata/freebsd/subdirs.txt @@ -0,0 +1,4 @@ +xbmc/linux linuxsupport +xbmc/input/linux input/linux +xbmc/network/linux network/linux +xbmc/freebsd freebsdsupport diff --git a/project/cmake/treedata/ios/subdirs.txt b/project/cmake/treedata/ios/subdirs.txt new file mode 100644 index 0000000..b681ed5 --- /dev/null +++ b/project/cmake/treedata/ios/subdirs.txt @@ -0,0 +1,15 @@ +xbmc/linux linuxsupport +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/network/osx network/osx +xbmc/peripherals/bus/osx peripherals/bus/osx +xbmc/powermanagement/osx powermanagement/osx +xbmc/storage/osx storage/osx +xbmc/platform/posix posix +xbmc/platform/darwin platform_darwin +xbmc/platform/darwin/ios platform_ios +xbmc/platform/darwin/ios-common platform_ios-common +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/windowing/osx windowing/osx diff --git a/project/cmake/treedata/linux/subdirs.txt b/project/cmake/treedata/linux/subdirs.txt new file mode 100644 index 0000000..81a48e3 --- /dev/null +++ b/project/cmake/treedata/linux/subdirs.txt @@ -0,0 +1,12 @@ +xbmc/linux linuxsupport +xbmc/linux/sse4 sse4 +xbmc/input/linux input/linux +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/peripherals/bus/linux peripherals/bus/linux +xbmc/powermanagement/linux powermanagement/linux +xbmc/storage/linux storage/linux +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/platform/posix posix diff --git a/project/cmake/treedata/optional/common/X11.txt b/project/cmake/treedata/optional/common/X11.txt new file mode 100644 index 0000000..f4afa57 --- /dev/null +++ b/project/cmake/treedata/optional/common/X11.txt @@ -0,0 +1 @@ +xbmc/windowing/X11 windowing/X11 # X11 diff --git a/project/cmake/treedata/optional/common/cec.txt b/project/cmake/treedata/optional/common/cec.txt new file mode 100644 index 0000000..19cd7f7 --- /dev/null +++ b/project/cmake/treedata/optional/common/cec.txt @@ -0,0 +1 @@ +xbmc/peripherals/bus/virtual peripherals/bus/virtual # CEC diff --git a/project/cmake/treedata/optional/common/nonfree.txt b/project/cmake/treedata/optional/common/nonfree.txt new file mode 100644 index 0000000..470ed59 --- /dev/null +++ b/project/cmake/treedata/optional/common/nonfree.txt @@ -0,0 +1 @@ +lib/UnrarXLib unrarxlib # NONFREE diff --git a/project/cmake/treedata/optional/common/opengl.txt b/project/cmake/treedata/optional/common/opengl.txt new file mode 100644 index 0000000..b88ad7a --- /dev/null +++ b/project/cmake/treedata/optional/common/opengl.txt @@ -0,0 +1 @@ +xbmc/rendering/gl rendering/gl # OPENGL diff --git a/project/cmake/treedata/optional/common/opengles.txt b/project/cmake/treedata/optional/common/opengles.txt new file mode 100644 index 0000000..6a223a1 --- /dev/null +++ b/project/cmake/treedata/optional/common/opengles.txt @@ -0,0 +1 @@ +xbmc/rendering/gles rendering/gles # OPENGLES diff --git a/project/cmake/treedata/rbpi/omxplayer.txt b/project/cmake/treedata/rbpi/omxplayer.txt new file mode 100644 index 0000000..d56f1df --- /dev/null +++ b/project/cmake/treedata/rbpi/omxplayer.txt @@ -0,0 +1 @@ +xbmc/cores/omxplayer cores/omxplayer diff --git a/project/cmake/treedata/rbpi/subdirs.txt b/project/cmake/treedata/rbpi/subdirs.txt new file mode 100644 index 0000000..866ec00 --- /dev/null +++ b/project/cmake/treedata/rbpi/subdirs.txt @@ -0,0 +1,12 @@ +xbmc/linux linuxsupport +xbmc/input/linux input/linux +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/linux network/linux +xbmc/peripherals/bus/linux peripherals/bus/linux +xbmc/powermanagement/linux powermanagement/linux +xbmc/storage/linux storage/linux +xbmc/filesystem/posix filesystem/posix +xbmc/utils/posix utils_posix +xbmc/platform/posix posix +xbmc/windowing/egl windowing/egl # EGL diff --git a/project/cmake/treedata/windows/subdirs.txt b/project/cmake/treedata/windows/subdirs.txt new file mode 100644 index 0000000..60c0095 --- /dev/null +++ b/project/cmake/treedata/windows/subdirs.txt @@ -0,0 +1,15 @@ +xbmc/win32 win32support +xbmc/input/windows input/windows +xbmc/input/touch input/touch +xbmc/input/touch/generic input/touch/generic +xbmc/network/windows network/windows +xbmc/network/mdns network/mdns +xbmc/peripherals/bus/win32 peripherals/bus/win32 +xbmc/powermanagement/windows powermanagement/windows +xbmc/storage/windows storage/windows +xbmc/filesystem/win32 filesystem/win32 +xbmc/utils/win32 utils_win32 +xbmc/platform/win32 platform_win32 +xbmc/rendering/dx rendering_dx +xbmc/threads/platform/win threads_win +xbmc/windowing/windows windowing/windows -- cgit v1.2.3