diff options
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | cmake/modules/FindFlatBuffers.cmake | 72 | ||||
-rw-r--r-- | docs/README.Fedora.md | 2 | ||||
-rw-r--r-- | docs/README.FreeBSD.md | 2 | ||||
-rw-r--r-- | docs/README.Linux.md | 9 | ||||
-rw-r--r-- | docs/README.openSUSE.md | 3 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/0_package.native-win32.list | 1 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/0_package.target-win10-arm.list | 1 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/0_package.target-win10-win32.list | 1 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/0_package.target-win10-x64.list | 1 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/0_package.target-win32.list | 1 | ||||
-rw-r--r-- | project/BuildDependencies/scripts/0_package.target-x64.list | 1 | ||||
-rw-r--r-- | tools/depends/.gitignore | 1 | ||||
-rw-r--r-- | tools/depends/native/Makefile | 4 | ||||
-rw-r--r-- | tools/depends/native/flatbuffers-native/0001-Fix-compiler-warning.patch | 18 | ||||
-rw-r--r-- | tools/depends/native/flatbuffers-native/Makefile | 61 | ||||
-rw-r--r-- | tools/depends/target/Makefile | 2 | ||||
-rw-r--r-- | tools/depends/target/flatbuffers/Makefile | 64 |
18 files changed, 243 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e35189a24..9cd6541bb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ if(UNIX) option(ENABLE_INTERNAL_RapidJSON "Enable internal rapidjson?" OFF) option(ENABLE_INTERNAL_FMT "Enable internal fmt?" OFF) option(ENABLE_INTERNAL_FSTRCMP "Enable internal fstrcmp?" OFF) + option(ENABLE_INTERNAL_FLATBUFFERS "Enable internal flatbuffers?" OFF) endif() # System options if(NOT WIN32) @@ -116,6 +117,7 @@ set(required_deps ASS CrossGUID Curl FFMPEG + FlatBuffers Fmt FreeType FriBidi @@ -241,6 +243,9 @@ if(WIN32) set(RESOURCES $<TARGET_OBJECTS:resources>) endif() +# Generate messages +core_add_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/messages/flatbuffers/*.txt) + include_directories(${INCLUDES} ${SYSTEM_INCLUDES}) add_compile_options(${ARCH_DEFINES} "${SYSTEM_DEFINES}" ${DEP_DEFINES} ${PATH_DEFINES}) @@ -286,7 +291,7 @@ endif() # main library (used for main binary and tests) add_library(lib${APP_NAME_LC} STATIC $<TARGET_OBJECTS:compileinfo>) -add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg dvdnav crossguid fmt fstrcmp ${PLATFORM_GLOBAL_TARGET_DEPS}) +add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg dvdnav crossguid fmt fstrcmp flatbuffers ${PLATFORM_GLOBAL_TARGET_DEPS}) set_target_properties(lib${APP_NAME_LC} PROPERTIES PREFIX "") # Other files (IDE) diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake new file mode 100644 index 0000000000..6f7e6a2f25 --- /dev/null +++ b/cmake/modules/FindFlatBuffers.cmake @@ -0,0 +1,72 @@ +# FindFlatBuffers +# -------- +# Find the FlatBuffers schema compiler and headers +# +# This will define the following variables: +# +# FLATBUFFERS_FOUND - system has FlatBuffers compiler and headers +# FLATBUFFERS_FLATC_EXECUTABLE - the flatc compiler executable +# FLATBUFFERS_INCLUDE_DIRS - the FlatFuffers include directory +# FLATBUFFERS_MESSAGES_INCLUDE_DIR - the directory for generated headers + +if(ENABLE_INTERNAL_FLATBUFFERS) + include(ExternalProject) + file(STRINGS ${CMAKE_SOURCE_DIR}/tools/depends/native/flatbuffers-native/Makefile VER REGEX "^[ ]*VERSION[ ]*=.+$") + string(REGEX REPLACE "^[ ]*VERSION[ ]*=[ ]*" "" FLATBUFFERS_VER "${VER}") + + # Allow user to override the download URL with a local tarball + # Needed for offline build envs + if(FLATBUFFERS_URL) + get_filename_component(FLATBUFFERS_URL "${FLATBUFFERS_URL}" ABSOLUTE) + else() + set(FLATBUFFERS_URL http://mirrors.kodi.tv/build-deps/sources/flatbuffers-${FLATBUFFERS_VER}.tar.gz) + endif() + if(VERBOSE) + message(STATUS "FLATBUFFERS_URL: ${FLATBUFFERS_URL}") + endif() + + set(FLATBUFFERS_FLATC_EXECUTABLE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin/flatc CACHE INTERNAL "FlatBuffer compiler") + set(FLATBUFFERS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include CACHE INTERNAL "FlatBuffer include dir") + + externalproject_add(flatbuffers + URL ${FLATBUFFERS_URL} + DOWNLOAD_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/download + PREFIX ${CORE_BUILD_DIR}/flatbuffers + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} + -DCMAKE_BUILD_TYPE=Release + -DFLATBUFFERS_CODE_COVERAGE=OFF + -DFLATBUFFERS_BUILD_TESTS=OFF + -DFLATBUFFERS_INSTALL=ON + -DFLATBUFFERS_BUILD_FLATLIB=OFF + -DFLATBUFFERS_BUILD_FLATC=ON + -DFLATBUFFERS_BUILD_FLATHASH=OFF + -DFLATBUFFERS_BUILD_GRPCTEST=OFF + -DFLATBUFFERS_BUILD_SHAREDLIB=OFF + "${EXTRA_ARGS}" + PATCH_COMMAND patch -p1 < ${CORE_SOURCE_DIR}/tools/depends/native/flatbuffers-native/0001-Fix-compiler-warning.patch + BUILD_BYPRODUCTS ${FLATBUFFERS_FLATC_EXECUTABLE}) + set_target_properties(flatbuffers PROPERTIES FOLDER "External Projects" + INTERFACE_INCLUDE_DIRECTORIES ${FLATBUFFERS_INCLUDE_DIR}) +else() + find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc) + find_path(FLATBUFFERS_INCLUDE_DIR NAMES flatbuffers/flatbuffers.h) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FlatBuffers + REQUIRED_VARS FLATBUFFERS_FLATC_EXECUTABLE FLATBUFFERS_INCLUDE_DIR + VERSION_VAR FLATBUFFERS_VER) + +if(FLATBUFFERS_FOUND) + set(FLATBUFFERS_MESSAGES_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/RetroPlayer/messages CACHE INTERNAL "Generated FlatBuffer headers") + set(FLATBUFFERS_INCLUDE_DIRS ${FLATBUFFERS_INCLUDE_DIR} ${FLATBUFFERS_MESSAGES_INCLUDE_DIR}) + + if(NOT TARGET flatbuffers) + add_library(flatbuffers UNKNOWN IMPORTED) + set_target_properties(flatbuffers PROPERTIES + FOLDER "External Projects" + INTERFACE_INCLUDE_DIRECTORIES ${FLATBUFFERS_INCLUDE_DIR}) + endif() +endif() + +mark_as_advanced(FLATBUFFERS_FLATC_EXECUTABLE FLATBUFFERS_INCLUDE_DIR) diff --git a/docs/README.Fedora.md b/docs/README.Fedora.md index 28c92d7440..5e607f06ef 100644 --- a/docs/README.Fedora.md +++ b/docs/README.Fedora.md @@ -63,7 +63,7 @@ If you get a `package not found` type of message with the below command, remove Install build dependencies: ``` -sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel avahi-devel bluez-libs-devel bzip2-devel cmake curl dbus-devel fmt-devel fontconfig-devel freetype-devel fribidi-devel fstrcmp-devel gawk gcc gcc-c++ gettext gettext-devel giflib-devel gperf java-9-openjdk-headless jre lcms2-devel libao-devel libass-devel libbluray-devel libcap-devel libcdio-devel libcec-devel libcurl-devel libidn2-devel libjpeg-turbo-devel libmicrohttpd-devel libmpc-devel libnfs-devel libplist-devel libpng12-devel libsmbclient-devel libtool libtool-ltdl-devel libudev-devel libusb-devel libuuid-devel libva-devel libvdpau-devel libxml2-devel libXmu-devel libXrandr-devel libxslt-devel libXt-devel lirc-devel lzo-devel mariadb-devel mesa-libEGL-devel mesa-libGL-devel mesa-libGLU-devel mesa-libGLw-devel mesa-libOSMesa-devel nasm openssl-devel openssl-libs patch pcre-devel pulseaudio-libs-devel python-devel python-pillow rapidjson-devel shairplay-devel sqlite-devel swig taglib-devel tinyxml-devel trousers-devel uuid-devel yasm zlib-devel +sudo dnf install alsa-lib-devel autoconf automake avahi-compat-libdns_sd-devel avahi-devel bluez-libs-devel bzip2-devel cmake curl dbus-devel flatbuffers fmt-devel fontconfig-devel freetype-devel fribidi-devel fstrcmp-devel gawk gcc gcc-c++ gettext gettext-devel giflib-devel gperf java-9-openjdk-headless jre lcms2-devel libao-devel libass-devel libbluray-devel libcap-devel libcdio-devel libcec-devel libcurl-devel libidn2-devel libjpeg-turbo-devel libmicrohttpd-devel libmpc-devel libnfs-devel libplist-devel libpng12-devel libsmbclient-devel libtool libtool-ltdl-devel libudev-devel libusb-devel libuuid-devel libva-devel libvdpau-devel libxml2-devel libXmu-devel libXrandr-devel libxslt-devel libXt-devel lirc-devel lzo-devel mariadb-devel mesa-libEGL-devel mesa-libGL-devel mesa-libGLU-devel mesa-libGLw-devel mesa-libOSMesa-devel nasm openssl-devel openssl-libs patch pcre-devel pulseaudio-libs-devel python-devel python-pillow rapidjson-devel shairplay-devel sqlite-devel swig taglib-devel tinyxml-devel trousers-devel uuid-devel yasm zlib-devel ``` **WARNING:** Make sure you copy paste the entire line or you might receive an error or miss a few dependencies. diff --git a/docs/README.FreeBSD.md b/docs/README.FreeBSD.md index 3ffda7e0b4..7574f23a31 100644 --- a/docs/README.FreeBSD.md +++ b/docs/README.FreeBSD.md @@ -74,7 +74,7 @@ If you get a `package not found` type of message with the below command, remove Install build dependencies: ``` -sudo pkg install autoconf automake avahi-app binutils cmake curl dbus doxygen dri2proto dri3proto e2fsprogs-libuuid enca encodings flac font-util fontconfig freetype2 fribidi gawk gettext-tools giflib git glew glproto gmake gmp gnutls gperf gstreamer1-vaapi hal inputproto jpeg-turbo libaacs libass libbdplus libbluray libcapn libcdio libcec libedit libfmt libgcrypt libgpg-error libidn libinotify libmicrohttpd libnfs libogg libplist librtmp libtool libudev-devd libva libvdpau libvorbis libxslt lirc lzo2 m4 mesa-libs mysql57-client nasm openjdk8 p8-platform pkgconf python2 rapidjson samba46 shairplay sndio sqlite3 swig30 taglib tiff tinyxml xf86-input-keyboard xf86-input-mouse xf86vidmodeproto xorg-server xrandr zip +sudo pkg install autoconf automake avahi-app binutils cmake curl dbus doxygen dri2proto dri3proto e2fsprogs-libuuid enca encodings flac flatbuffers font-util fontconfig freetype2 fribidi gawk gettext-tools giflib git glew glproto gmake gmp gnutls gperf gstreamer1-vaapi hal inputproto jpeg-turbo libaacs libass libbdplus libbluray libcapn libcdio libcec libedit libfmt libgcrypt libgpg-error libidn libinotify libmicrohttpd libnfs libogg libplist librtmp libtool libudev-devd libva libvdpau libvorbis libxslt lirc lzo2 m4 mesa-libs mysql57-client nasm openjdk8 p8-platform pkgconf python2 rapidjson samba46 shairplay sndio sqlite3 swig30 taglib tiff tinyxml xf86-input-keyboard xf86-input-mouse xf86vidmodeproto xorg-server xrandr zip ``` **WARNING:** Make sure you copy paste the entire line or you might receive an error or miss a few dependencies. diff --git a/docs/README.Linux.md b/docs/README.Linux.md index 5aaa48bc2a..7ccb333e62 100644 --- a/docs/README.Linux.md +++ b/docs/README.Linux.md @@ -70,7 +70,7 @@ git clone https://github.com/xbmc/xbmc kodi ## 3. Install the required packages The following is the list of packages that are used to build Kodi on Debian/Ubuntu (with all supported external libraries enabled). -* autoconf, automake, autopoint, gettext, autotools-dev, cmake, curl, default-jre | openjdk-6-jre | openjdk-7-jre, gawk, gcc (>= 4.9) | gcc-4.9, g++ (>= 4.9) | g++-4.9, cpp (>= 4.9) | cpp-4.9, gdc, gperf, libasound2-dev | libasound-dev, libass-dev (>= 0.9.8), libavahi-client-dev, libavahi-common-dev, libbluetooth-dev, libbluray-dev, libbz2-dev, libcdio-dev, libcec4-dev | libcec-dev, libp8-platform-dev, libcrossguid-dev, libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, libcwiid-dev, libdbus-1-dev, libegl1-mesa-dev, libenca-dev, libflac-dev, libfontconfig-dev, libfmt3-dev | libfmt-dev, libfreetype6-dev, libfribidi-dev, libfstrcmp-dev, libgcrypt-dev, libgif-dev (>= 5.0.5), libgles2-mesa-dev [armel] | libgl1-mesa-dev | libgl-dev, libglew-dev, libglu1-mesa-dev | libglu-dev, libgnutls-dev | libgnutls28-dev, libgpg-error-dev, libiso9660-dev, libjpeg-dev, liblcms2-dev, liblirc-dev, libltdl-dev, liblzo2-dev, libmicrohttpd-dev, libmysqlclient-dev, libnfs-dev, libogg-dev, libomxil-bellagio-dev [armel], libpcre3-dev, libplist-dev, libpng12-dev | libpng-dev, libpulse-dev, libshairplay-dev, libsmbclient-dev, libsqlite3-dev, libssl-dev, libtag1-dev (>= 1.8) | libtag1x8, libtiff5-dev | libtiff-dev | libtiff4-dev, libtinyxml-dev, libtool, libudev-dev, libva-dev, libvdpau-dev, libvorbis-dev, libxkbcommon-dev, libxmu-dev, libxrandr-dev, libxslt1-dev | libxslt-dev, libxt-dev, waylandpp-dev | netcat, wayland-protocols | wipe, lsb-release, nasm [!amd64], python-dev, python-pil | python-imaging, python-support | python-minimal, rapidjson-dev, swig, unzip, uuid-dev, yasm, zip, zlib1g-dev +* autoconf, automake, autopoint, gettext, autotools-dev, cmake, curl, default-jre | openjdk-6-jre | openjdk-7-jre, gawk, gcc (>= 4.9) | gcc-4.9, g++ (>= 4.9) | g++-4.9, cpp (>= 4.9) | cpp-4.9, flatbuffers, gdc, gperf, libasound2-dev | libasound-dev, libass-dev (>= 0.9.8), libavahi-client-dev, libavahi-common-dev, libbluetooth-dev, libbluray-dev, libbz2-dev, libcdio-dev, libcec4-dev | libcec-dev, libp8-platform-dev, libcrossguid-dev, libcurl4-openssl-dev | libcurl4-gnutls-dev | libcurl-dev, libcwiid-dev, libdbus-1-dev, libegl1-mesa-dev, libenca-dev, libflac-dev, libfontconfig-dev, libfmt3-dev | libfmt-dev, libfreetype6-dev, libfribidi-dev, libfstrcmp-dev, libgcrypt-dev, libgif-dev (>= 5.0.5), libgles2-mesa-dev [armel] | libgl1-mesa-dev | libgl-dev, libglew-dev, libglu1-mesa-dev | libglu-dev, libgnutls-dev | libgnutls28-dev, libgpg-error-dev, libiso9660-dev, libjpeg-dev, liblcms2-dev, liblirc-dev, libltdl-dev, liblzo2-dev, libmicrohttpd-dev, libmysqlclient-dev, libnfs-dev, libogg-dev, libomxil-bellagio-dev [armel], libpcre3-dev, libplist-dev, libpng12-dev | libpng-dev, libpulse-dev, libshairplay-dev, libsmbclient-dev, libsqlite3-dev, libssl-dev, libtag1-dev (>= 1.8) | libtag1x8, libtiff5-dev | libtiff-dev | libtiff4-dev, libtinyxml-dev, libtool, libudev-dev, libva-dev, libvdpau-dev, libvorbis-dev, libxkbcommon-dev, libxmu-dev, libxrandr-dev, libxslt1-dev | libxslt-dev, libxt-dev, waylandpp-dev | netcat, wayland-protocols | wipe, lsb-release, nasm [!amd64], python-dev, python-pil | python-imaging, python-support | python-minimal, rapidjson-dev, swig, unzip, uuid-dev, yasm, zip, zlib1g-dev ### 3.1. Build missing dependencies Some packages may be missing or outdated in older distributions. Notably `crossguid, libfmt, waylandpp, wayland-protocols, etc.` are known to be outdated or missing. Fortunately there is an easy way to build individual dependencies with **[Kodi's unified depends build system](../tools/depends/README.md)**. @@ -85,6 +85,11 @@ Build and install crossguid: sudo make -C tools/depends/target/crossguid PREFIX=/usr/local ``` +Build and install flatbuffers: +``` +sudo make -C tools/depends/target/flatbuffers PREFIX=/usr/local +``` + Build and install libfmt: ``` sudo make -C tools/depends/target/libfmt PREFIX=/usr/local @@ -105,7 +110,7 @@ sudo make -C tools/depends/target/waylandpp PREFIX=/usr/local **TIP:** Complete list of dependencies is available **[here](https://github.com/xbmc/xbmc/tree/master/tools/depends/target)**. ### 3.2. Enable internal dependencies -Some dependencies can be configured to build before Kodi. That's the case with `crossguid, libfmt and rapidjson`. To enable the internal build of a dependency, append `-DENABLE_INTERNAL_<DEPENDENCY_NAME>=ON` to the configure command below. For example, configuring an X11 build with internal `fmt` would become `cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_INTERNAL_FMT=ON` instead of `cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local`. +Some dependencies can be configured to build before Kodi. That's the case with `flatbuffers`, `crossguid, libfmt and rapidjson`. To enable the internal build of a dependency, append `-DENABLE_INTERNAL_<DEPENDENCY_NAME>=ON` to the configure command below. For example, configuring an X11 build with internal `fmt` would become `cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_INTERNAL_FMT=ON` instead of `cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local`. **[back to top](#table-of-contents)** | **[back to section top](#3-installing-the-required-packages)** diff --git a/docs/README.openSUSE.md b/docs/README.openSUSE.md index 637b0fda5c..3bb04426c1 100644 --- a/docs/README.openSUSE.md +++ b/docs/README.openSUSE.md @@ -118,8 +118,9 @@ Change to Kodi's source code directory: cd $HOME/kodi ``` -Build and install missing dependencies from repositories (*libfmt*, *rapidjson* and *waylandpp*): +Build and install missing dependencies from repositories (*flatbuffers*, *libfmt*, *rapidjson* and *waylandpp*): ``` +sudo make -C tools/depends/target/flatbuffers PREFIX=/usr/local sudo make -C tools/depends/target/libfmt PREFIX=/usr/local sudo make -C tools/depends/target/rapidjson PREFIX=/usr/local sudo make -C tools/depends/target/waylandpp PREFIX=/usr/local diff --git a/project/BuildDependencies/scripts/0_package.native-win32.list b/project/BuildDependencies/scripts/0_package.native-win32.list index 22ca6e1b8d..97ddd02630 100644 --- a/project/BuildDependencies/scripts/0_package.native-win32.list +++ b/project/BuildDependencies/scripts/0_package.native-win32.list @@ -7,6 +7,7 @@ ; -> ... ;PLEASE KEEP THIS LIST IN ALPHABETICAL ORDER! doxygen-1.8.2-win32.7z +flatc-1.9.0-Win32-v141.7z jsonschemabuilder-1.0.0-win32-3.7z swig-3.0.10-win32.7z texturepacker-1.1.1-win32.7z diff --git a/project/BuildDependencies/scripts/0_package.target-win10-arm.list b/project/BuildDependencies/scripts/0_package.target-win10-arm.list index 8b6a590edc..5dff2891da 100644 --- a/project/BuildDependencies/scripts/0_package.target-win10-arm.list +++ b/project/BuildDependencies/scripts/0_package.target-win10-arm.list @@ -10,6 +10,7 @@ cppwinrt-10.0.17134.0.7z crossguid-fef89a4-win10-ARM-v140.7z curl-7.59.0-win10-ARM-v141.7z expat-2.2.0-win10-ARM-v140.7z +flatbuffers-1.9.0.7z fmt-3.0.1-win10-ARM-v140.7z freetype-2.8-win10-ARM-v140.7z fstrcmp-0.7-win10-ARM-v141.7z diff --git a/project/BuildDependencies/scripts/0_package.target-win10-win32.list b/project/BuildDependencies/scripts/0_package.target-win10-win32.list index 8387897510..60b34ac594 100644 --- a/project/BuildDependencies/scripts/0_package.target-win10-win32.list +++ b/project/BuildDependencies/scripts/0_package.target-win10-win32.list @@ -10,6 +10,7 @@ cppwinrt-10.0.17134.0.7z crossguid-fef89a4-win10-Win32-v140.7z curl-7.59.0-win10-Win32-v141.7z expat-2.2.0-win10-Win32-v140.7z +flatbuffers-1.9.0.7z fmt-3.0.1-win10-Win32-v140.7z freetype-2.8-win10-Win32-v140.7z fstrcmp-0.7-win10-Win32-v141.7z diff --git a/project/BuildDependencies/scripts/0_package.target-win10-x64.list b/project/BuildDependencies/scripts/0_package.target-win10-x64.list index e3e1816e25..a73be23111 100644 --- a/project/BuildDependencies/scripts/0_package.target-win10-x64.list +++ b/project/BuildDependencies/scripts/0_package.target-win10-x64.list @@ -10,6 +10,7 @@ cppwinrt-10.0.17134.0.7z crossguid-fef89a4-win10-x64-v140.7z curl-7.59.0-win10-x64-v141.7z expat-2.2.0-win10-x64-v140.7z +flatbuffers-1.9.0.7z fmt-3.0.1-win10-x64-v140.7z freetype-2.8-win10-x64-v140.7z fstrcmp-0.7-win10-x64-v141.7z diff --git a/project/BuildDependencies/scripts/0_package.target-win32.list b/project/BuildDependencies/scripts/0_package.target-win32.list index 2638b8c6d4..f201d4ebe7 100644 --- a/project/BuildDependencies/scripts/0_package.target-win32.list +++ b/project/BuildDependencies/scripts/0_package.target-win32.list @@ -11,6 +11,7 @@ curl-7.59.0-Win32-v140.7z dnssd-765.50.9-win32-vc140-v2.7z easyhook-2.7.5870.0-win32-vc140-v2.7z expat-2.2.0-win32-vc140.7z +flatbuffers-1.9.0.7z fmt-3.0.1-win32-vc140.7z freetype-db5a22-win32-vc140.7z fstrcmp-0.7-Win32-v141.7z diff --git a/project/BuildDependencies/scripts/0_package.target-x64.list b/project/BuildDependencies/scripts/0_package.target-x64.list index 2858c05863..8e57512819 100644 --- a/project/BuildDependencies/scripts/0_package.target-x64.list +++ b/project/BuildDependencies/scripts/0_package.target-x64.list @@ -11,6 +11,7 @@ curl-7.59.0-x64-v140.7z dnssd-765.50.9-x64-vc140-v2.7z easyhook-2.7.6035.0-x64-vc140.7z expat-2.2.0-x64-vc140.7z +flatbuffers-1.9.0.7z fmt-3.0.1-x64-vc140.7z freetype-db5a224-x64-vc140.7z fstrcmp-0.7-x64-v141.7z diff --git a/tools/depends/.gitignore b/tools/depends/.gitignore index dfc92c84b6..6a23c8ada1 100644 --- a/tools/depends/.gitignore +++ b/tools/depends/.gitignore @@ -52,3 +52,4 @@ config.site.native /target/cross-file.meson /target/libfmt/fmt-*.tar.gz /target/rapidjson/rapidjson-*.tar.gz +/target/flatbuffers/*.tar.gz diff --git a/tools/depends/native/Makefile b/tools/depends/native/Makefile index 27460efe00..ba5b8eba8d 100644 --- a/tools/depends/native/Makefile +++ b/tools/depends/native/Makefile @@ -9,7 +9,8 @@ NATIVE= m4-native gettext-native autoconf-native automake-native \ gas-preprocessor-native python27-native zlib-native \ pcre-native swig-native \ libpng-native libjpeg-turbo-native liblzo2-native giflib-native \ - distribute-native distutilscross-native JsonSchemaBuilder TexturePacker + distribute-native distutilscross-native JsonSchemaBuilder TexturePacker \ + flatbuffers-native ifeq ($(OS),ios) @@ -39,6 +40,7 @@ all: native # Dependency layout for parallel builds autoconf-native: m4-native automake-native: autoconf-native +flatbuffers-native: cmake-native libtool-native: automake-native libpng-native: zlib-native meson-native: python3-native diff --git a/tools/depends/native/flatbuffers-native/0001-Fix-compiler-warning.patch b/tools/depends/native/flatbuffers-native/0001-Fix-compiler-warning.patch new file mode 100644 index 0000000000..c8f8b1414c --- /dev/null +++ b/tools/depends/native/flatbuffers-native/0001-Fix-compiler-warning.patch @@ -0,0 +1,18 @@ +--- + include/flatbuffers/util.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/flatbuffers/util.h b/include/flatbuffers/util.h +index e654010..7cadd0b 100644 +--- a/include/flatbuffers/util.h ++++ b/include/flatbuffers/util.h +@@ -321,7 +321,7 @@ inline int FromUTF8(const char **in) { + break; + } + } +- if ((static_cast<const unsigned char>(**in) << len) & 0x80) return -1; // Bit after leading 1's must be 0. ++ if ((static_cast<unsigned char>(**in) << len) & 0x80) return -1; // Bit after leading 1's must be 0. + if (!len) return *(*in)++; + // UTF-8 encoded values with a length are between 2 and 4 bytes. + if (len < 2 || len > 4) { return -1; } +-- diff --git a/tools/depends/native/flatbuffers-native/Makefile b/tools/depends/native/flatbuffers-native/Makefile new file mode 100644 index 0000000000..7c362e82cf --- /dev/null +++ b/tools/depends/native/flatbuffers-native/Makefile @@ -0,0 +1,61 @@ +include ../../Makefile.include +PREFIX=$(NATIVEPREFIX) +PLATFORM=$(NATIVEPLATFORM) +DEPS=../../Makefile.include Makefile + +# lib name, version +LIBNAME=flatbuffers +VERSION=1.9.0 +SOURCE=$(LIBNAME)-$(VERSION) +ARCHIVE=$(SOURCE).tar.gz +BASE_URL=http://mirrors.kodi.tv/build-deps/sources + +APP=$(PLATFORM)/flatc + +# Only this package uses CMake for build on native at the moment, +# so there is no separate toolchain file. Still we have to unset +# the CMAKE_TOOLCHAIN_FILE, which is part of $(CMAKE) and set to +# the target toolchain file. +CMAKE_OPTIONS := -DCMAKE_TOOLCHAIN_FILE= \ + -DCMAKE_BUILD_TYPE=Release \ + -DFLATBUFFERS_CODE_COVERAGE=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_INSTALL=ON \ + -DFLATBUFFERS_BUILD_FLATLIB=OFF \ + -DFLATBUFFERS_BUILD_FLATC=ON \ + -DFLATBUFFERS_BUILD_FLATHASH=OFF \ + -DFLATBUFFERS_BUILD_GRPCTEST=OFF \ + -DFLATBUFFERS_BUILD_SHAREDLIB=OFF \ + -DCMAKE_C_COMPILER="$(CC_BINARY_FOR_BUILD)" \ + -DCMAKE_CXX_COMPILER="$(CXX_BINARY_FOR_BUILD)" \ + -DCMAKE_C_FLAGS="$(NATIVE_CFLAGS)" \ + -DCMAKE_CXX_FLAGS="$(NATIVE_CXXFLAGS)" \ + -DCMAKE_EXE_LINKER_FLAGS="$(NATIVE_LDFLAGS)" \ + $(CMAKE_OPTIONS) +BUILDDIR = $(PLATFORM)/build-cmake # 'build' conflicts with file BUILD on case-insensitive FS + +all: .installed-$(PLATFORM) + +$(TARBALLS_LOCATION)/$(ARCHIVE): + cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) + +$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) + rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM) + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + cd $(PLATFORM); patch -p1 < ../0001-Fix-compiler-warning.patch + mkdir -p $(BUILDDIR) + cd $(BUILDDIR); $(CMAKE) $(CMAKE_OPTIONS) .. + +$(APP): $(PLATFORM) + $(MAKE) -C $(BUILDDIR) + +.installed-$(PLATFORM): $(APP) + $(MAKE) -C $(BUILDDIR) install + touch $@ + +clean: + $(MAKE) -C $(BUILDDIR) clean + rm -f .installed-$(PLATFORM) + +distclean: + rm -rf $(PLATFORM) .installed-$(PLATFORM) diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile index 682a4760dc..b5e91c1734 100644 --- a/tools/depends/target/Makefile +++ b/tools/depends/target/Makefile @@ -15,7 +15,7 @@ DEPENDS = \ taglib libusb libnfs \ pythonmodule-pil pythonmodule-pycryptodome pythonmodule-setuptools \ libxslt ffmpeg platform crossguid \ - libdvdread libdvdnav libdvdcss p8-platform + libdvdread libdvdnav libdvdcss p8-platform flatbuffers FFMPEG_DEPENDS = gnutls diff --git a/tools/depends/target/flatbuffers/Makefile b/tools/depends/target/flatbuffers/Makefile new file mode 100644 index 0000000000..106a423d01 --- /dev/null +++ b/tools/depends/target/flatbuffers/Makefile @@ -0,0 +1,64 @@ +-include ../../Makefile.include +DEPS=Makefile + +# lib name, version +LIBNAME=flatbuffers +VERSION=1.9.0 +SOURCE=$(LIBNAME)-$(VERSION) +ARCHIVE=$(SOURCE).tar.gz + +ifeq ($(PLATFORM),) + # Building stand-alone + ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) + PLATFORM = native + TARBALLS_LOCATION = $(ROOT_DIR) + BASE_URL := http://mirrors.kodi.tv/build-deps/sources + RETRIEVE_TOOL := curl -Ls --create-dirs -f -O + ARCHIVE_TOOL := tar --strip-components=1 -xf + CMAKE := cmake + CMAKE_OPTIONS := -DCMAKE_INSTALL_PREFIX=$(PREFIX) $(CMAKE_OPTIONS) + BUILD_FLATC=ON +else + # Building as part of depends + DEPS += ../../Makefile.include + BUILD_FLATC=OFF +endif + +CMAKE_OPTIONS := -DCMAKE_BUILD_TYPE=Release \ + -DFLATBUFFERS_CODE_COVERAGE=OFF \ + -DFLATBUFFERS_BUILD_TESTS=OFF \ + -DFLATBUFFERS_INSTALL=ON \ + -DFLATBUFFERS_BUILD_FLATLIB=OFF \ + -DFLATBUFFERS_BUILD_FLATC=$(BUILD_FLATC) \ + -DFLATBUFFERS_BUILD_FLATHASH=OFF \ + -DFLATBUFFERS_BUILD_GRPCTEST=OFF \ + -DFLATBUFFERS_BUILD_SHAREDLIB=OFF \ + $(CMAKE_OPTIONS) +BUILDDIR = $(PLATFORM)/build-cmake # 'build' conflicts with file BUILD on case-insensitive FS + +all: .installed-$(PLATFORM) + +$(TARBALLS_LOCATION)/$(ARCHIVE): + cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE) + +$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) +ifeq ($(PREFIX),) + @echo + @echo "ERROR: please set PREFIX to the kodi install path e.g. make PREFIX=/usr/local" + @exit 1 +endif + rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM) + cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) + mkdir -p $(BUILDDIR) + cd $(BUILDDIR); $(CMAKE) $(CMAKE_OPTIONS) .. + +.installed-$(PLATFORM): $(PLATFORM) + $(MAKE) -C $(BUILDDIR) install + touch $@ + +clean: + $(MAKE) -C $(BUILDDIR) clean + rm -f .installed-$(PLATFORM) + +distclean: + rm -rf $(PLATFORM) .installed-$(PLATFORM) |