sy6sy2 / xbmc

Kodi is an award-winning free and open source home theater/media center software and entertainment hub for digital media. With its beautiful interface and powerful skinning engine, it's available for Android, BSD, Linux, macOS, iOS and Windows.
https://kodi.tv/
Other
6 stars 1 forks source link

Move common code out of platform/darwin/ios #52

Open fuzzard opened 5 years ago

fuzzard commented 5 years ago

Extract common code to platform/darwin/ios-common. The below has very similar code with only minor changes, and possibly some legacy code that may not be required anymore. At this point in time i've just ifdeffed any differences between our current MAINKeyboard. and IOSKeyboard.*

IOSScreenManager looks to be only used in IOS. IOSExternalTouchController only IOS

Working branch

https://github.com/fuzzard/xbmc/commits/atv_combine

fuzzard commented 5 years ago

This can all be staged prior to ATV, so all the IOS work is done, and then a followup PR for the atv stuff

fuzzard commented 5 years ago

Fairly large differences for EAGLView. between the platforms, so leave them separate. Have renamed MAINEAGLView. to TVOSEAGLView. inline with the ios counterpart

fuzzard commented 5 years ago

XBMCDebugHelpers.h has been removed. Identical to the NSDebugHelpers.h in platform/darwin

sy6sy2 commented 5 years ago

Good idea to use the ios-common folder for common code between iOS and tvOS.

So what's the plan?

  1. Wait for https://github.com/xbmc/xbmc/pull/16015 to be merged
  2. Wait for https://github.com/xbmc/xbmc/pull/16017 to be merged
  3. Wait for your PR (https://github.com/xbmc/xbmc/pull/16018) to be merged
  4. Open a PR to move from TARGET_DARWIN_IOS to TARGET_DARWIN_EMBEDED
  5. Open a PR to add tvOS support

Is it the right way? Maibe 5. can be split in multiple PR?

fuzzard commented 5 years ago

Yeah, i think all the existing ios PR's would be preferred to get in, then we can rebase after. Theres no real rush to get the ATV stuff in, as its only start of v19 build window, so probably best to just polish everything up and rock solid before going into master

with 4. i think thatd be best. As IOS is an existing platform, anything changing that is probably best in unrelated pr's than tvos for easy git blame/history

  1. just keep your existing one open. I know its a pain in the ass to keep rebasing, but it keeps it visible and in peoples mind, and we are able to get reviews from team kodi members easier than from our branches.
sy6sy2 commented 5 years ago

Ok ;-) So I keep my PR open, and normally, each time a PR will be merged (16015, 16017, 16018, ...) the diff between my existing PR and master should reduce.

For the PR at point 4. it's better to wait until 1., 2. and 3. to be merged isn't it?

fuzzard commented 5 years ago

Ive got a branch that has commits for build system and darwin_embedded, and a commit for the xbmc codebase ifdeffery https://github.com/fuzzard/xbmc/commits/ATV-darwin_embedded

the build works without any issues, but running kodi on the ATV crashes, and i havent had time to look at it. Feel free to look over the commits, and comment on anything you think should be changed.

sy6sy2 commented 5 years ago

Di you mean for PR number 4? For PR 4. I was thinking of something without any trace of tvOS stuff no?

fuzzard commented 5 years ago

yeah, i can adopt what i have to not include the tvos stuff. The outline is there which makes it pretty quick and easy

fuzzard commented 5 years ago

merged: https://github.com/xbmc/xbmc/pull/16018

I believe that covers all of the platform/darwin/ios code. Now just need to ifdef and add the ATV stuff into the ios-common code

kambala-decapitator commented 5 years ago

nice work!

I also agree with the outlined plan.

sy6sy2 commented 5 years ago

@fuzzard, My test for iOS with https://github.com/fuzzard/xbmc/tree/master_darwin-embedded

Tools and dependencies OK. But I failed to generate Xcode project:

/Users/Shared/xbmc-depends/x86_64-darwin18.5.0-native/bin/cmake -G Xcode -DCMAKE_TOOLCHAIN_FILE=/Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/share/Toolchain.cmake ../kodi|tee /tmp/toto.txt
-- Toolchain enabled IOS bundle for project kodi
-- Toolchain enabled IOS bundle for project kodi
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The ASM compiler identification is AppleClang
-- Found assembler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Source directory: /Users/sylvain/Kodi_dev/kodi
-- Build directory: /Users/sylvain/Kodi_dev/kodi-ios-build
-- Generator: Multi-configuration (Xcode)
-- CMake Version: 3.12.2
-- System type: Darwin
-- Core system type: darwin_embedded
-- Platform: iphoneos
-- CPU: arm64, ARCH: aarch64
-- Cross-Compiling: TRUE
-- Execute build artefacts on host: FALSE
-- Depends based build: 1
-- Could not find hardware support for SSE (missing: _SSE_TRUE _SSE_OK)
-- Could not find hardware support for SSE2 (missing: _SSE2_TRUE _SSE2_OK)
-- Could not find hardware support for SSE3 (missing: _SSE3_TRUE _SSE3_OK)
-- Could not find hardware support for SSSE3 (missing: _SSSE3_TRUE _SSSE3_OK)
-- Could not find hardware support for SSE4.1 (missing: _SSE41_TRUE _SSE41_OK)
-- Could not find hardware support for SSE4.2 (missing: _SSE42_TRUE _SSE42_OK)
-- Could not find hardware support for AVX (missing: _AVX_TRUE _AVX_OK)
-- Could not find hardware support for AVX2 (missing: _AVX2_TRUE _AVX2_OK)
-- NEON optimization enabled
-- Found Git: /usr/local/bin/git (found version "2.21.0")
-- Found PkgConfig: /usr/local/bin/pkg-config (found version "0.29.2")
-- Could NOT find Alsa (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR)
-- Could NOT find Avahi (missing: AVAHI_CLIENT_LIBRARY AVAHI_COMMON_LIBRARY AVAHI_CLIENT_INCLUDE_DIR AVAHI_COMMON_INCLUDE_DIR)
-- Could NOT find Bluetooth (missing: BLUETOOTH_LIBRARY BLUETOOTH_INCLUDE_DIR)
-- Found Bluray: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libbluray.dylib (found suitable version "1.0.2", minimum required is "0.9.3")
-- Could NOT find CAP (missing: CAP_LIBRARY CAP_INCLUDE_DIR)
-- Could NOT find CCache (missing: CCACHE_PROGRAM)
-- Could NOT find CEC (missing: CEC_LIBRARY CEC_INCLUDE_DIR) (Required is at least version "4.0.0")
-- Could NOT find DBus (missing: DBUS_LIBRARY DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR)
-- Could NOT find LCMS2 (missing: LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
-- Could NOT find LircClient (missing: LIRCCLIENT_LIBRARY LIRCCLIENT_INCLUDE_DIR)
-- Could NOT find MDNS (missing: MDNS_LIBRARY)
-- Found MicroHttpd: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libmicrohttpd.a (found version "0.9.55")
-- Found NFS: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libnfs.a (found version "2.0.0")
-- Could NOT find PulseAudio (missing: PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY PULSEAUDIO_SIMPLE_LIBRARY PULSEAUDIO_INCLUDE_DIR) (Required is at least version "2.0.0")
-- Found Python: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/include/python2.7
-- Found SmbClient: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libsmbclient.dylib
-- Could NOT find Sndio (missing: SNDIO_LIBRARY SNDIO_INCLUDE_DIR)
-- Could NOT find UDEV (missing: UDEV_LIBRARY UDEV_INCLUDE_DIR)
-- Found LibXml2: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libxml2.a;-L/Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib;-lxml2;-lpthread;-lz;-lm (found version "2.9.4")
-- Found XSLT: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libxslt.a (found version "1.1.29")
-- Found Plist: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libplist.dylib (found version "2.0.0")
-- Found ASS: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libass.dylib (found version "0.13.4")
-- Found Cdio: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libcdio.a (found version "0.94")
-- Found EXPAT: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libexpat.a (found version "2.2.5")
-- Found CrossGUID: /Users/sylvain/Kodi_dev/kodi-ios-build/build/lib/libcrossguid.a (found version "8f399e8bd4")
-- Found Curl: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libcurl.a (found version "7.61.1")
-- Found FFMPEG: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/include (found version "4.0")
-- Found FlatBuffers: /Users/Shared/xbmc-depends/x86_64-darwin18.5.0-native/bin/flatc
-- Found Fmt: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libfmt.a (found version "5.1.0")
-- Found FreeType: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libfreetype.a (found version "20.0.14")
-- Found FriBidi: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libfribidi.a (found version "0.19.7")
-- Found fstrcmp: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libfstrcmp.a (found version "0.7.D001")
-- Found Iconv: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/lib/libiconv.tbd
-- Found LibDvd: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/include
-- Found Lzo2: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/liblzo2.a
-- Found OpenSSL: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libcrypto.a (found version "1.1.0h")
-- Found PCRE: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libpcrecpp.a (found version "8.42")
-- Found RapidJSON: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/include (found version "1.1.0")
-- Found Sqlite3: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libsqlite3.a (found version "3.26.0")
-- Found TagLib: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libtag.a (found version "1.11.1")
-- Found TinyXML: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libtinyxml.a (found version "2.6.2")
-- Found ZLIB: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found OpenGLES: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/OpenGLES.framework
-- Found MariaDBClient: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/mariadb/libmariadbclient.a (found version "10.2.9")
-- Could NOT find LIBUSB (missing: LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR)
-- Found Shairplay: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib/libshairplay.dylib
-- Found PythonInterp: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/bin/python (found version "1.4")
-- Found Threads: TRUE
-- Found Java: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java (found version "11.0.2") found components:  Runtime
-- Found SWIG: /usr/local/bin/swig (found version "3.0.12")
-- #---- CONFIGURATION ----#
-- Platform: ios
-- -- PATH config --
-- Prefix: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug
-- Libdir: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/lib
-- Bindir: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/bin
-- Includedir: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/include
-- Datarootdir: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/share
-- Datadir: /Users/Shared/xbmc-depends/iphoneos12.2_arm64-target-debug/share
-- ALSA enabled: No
-- AVAHI enabled: No
-- BLUETOOTH enabled: No
-- BLURAY enabled: Yes
-- CAP enabled: No
-- CCACHE enabled: No
-- CEC enabled: No
-- DBUS enabled: No
-- LCMS2 enabled: No
-- LIRCCLIENT enabled: No
-- MDNS enabled: No
-- MICROHTTPD enabled: Yes
-- NFS enabled: Yes
-- PULSEAUDIO enabled: No
-- PYTHON enabled: Yes
-- SMBCLIENT enabled: Yes
-- SNDIO enabled: No
-- UDEV enabled: No
-- XSLT enabled: Yes
-- PLIST enabled: Yes
-- MARIADBCLIENT enabled: Yes
-- LIBUSB enabled: No
-- Configuring done
CMake Error at CMakeLists.txt:316 (add_executable):
  Cannot find source file:

    /Users/sylvain/Kodi_dev/kodi/xbmc/platform/darwin/darwin_embedded/XBMCApplication.mm

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm
  .hpp .hxx .in .txx

CMake Error at CMakeLists.txt:316 (add_executable):
  No SOURCES given to target: kodi

-- Build files have been written to: /Users/sylvain/Kodi_dev/kodi-ios-build
fuzzard commented 5 years ago

Cheers , I'll look at it this afternoon. I think I know what may be causing it

sy6sy2 commented 5 years ago

Yes I think I know too. For me you need to modify ArchSetup.cmake:5 from

set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/${CORE_SYSTEM_NAME}/XBMCApplication.mm)

to

set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/${CORE_PLATFORM_NAME}/XBMCApplication.mm)

It seems working on my side. I will try to build the code project now ;-)

sy6sy2 commented 5 years ago

Issue: In Xcode, Display name, Bundle Identifier, Version and Build are empty. This was not the case before I believe

Edit: Fixed

Edit2: I opened a little PR if you want to check the fix that I found https://github.com/fuzzard/xbmc/pull/2

fuzzard commented 5 years ago

have had a quick look at my code. Pushed out a fix that should solve it i believe. It could be dependant on a current PR from rechi https://github.com/xbmc/xbmc/pull/16020 around how its laid out, so will just monitor rechi's and adapt when it gets merged.

Ill have a look at those fixes this afternoon Sylvain. Already got one of them when i just looked at my code.

sy6sy2 commented 5 years ago

So, with the current PR branch (https://github.com/fuzzard/xbmc/pull/2):

fuzzard commented 5 years ago

Sounds like a similar issue to my ATV branch. Something is missing, so I'll have to spend a bit of time trawling through it.

sy6sy2 commented 5 years ago

I don't have my iPhone USB cable ATM to directly run Kodi from Xcode (this why I installed the deb remotely from SSH in Wi-Fi). I will try tomorrow to see if I can see something in log. Time to sleep here ;-)

sy6sy2 commented 5 years ago

I just tried directly to run Kodi from Xcode:

My log: https://hastebin.com/qivujihiji.php

fuzzard commented 5 years ago

doesnt even look like a crash. It literally just shuts down. odd. Wont get time to look into it tonight.

kambala-decapitator commented 5 years ago

I think this is the reason, based on the log:

CFileCache::Open - opening <addons/matrix/addons.xml.gz> using cache CFileCache::Process - Source read didn't return any data! Hit eof(?) Quitting due to POSIX signal

sy6sy2 commented 5 years ago

Yes! But why :-/

sy6sy2 commented 5 years ago

This is the log with master branch to compare: https://hastebin.com/ogeguxahel.php Everything works with master

Edit: Source read didn't return any data! Hit eof(?) is still present but not Quitting due to POSIX signal ...

sy6sy2 commented 5 years ago

@fuzzard Just fixed the crash issue with this commit https://github.com/fuzzard/xbmc/pull/2/commits/12214fdcb473847e85a2be2df545d584fe7b324f What is still needed before create the PR?

fuzzard commented 5 years ago

ive put in the fixes, just going to get Pogar to do a build/test to confirm, and if it works as hoped, ill submit PR

fuzzard commented 5 years ago

Submitted PR. will wait for the feedback for changes. Have done myself a full build and deploy to an unjailbroken ipad air. https://github.com/xbmc/xbmc/pull/16039

As mentioned, will need updates to the build system of most, if not all addons. If we get the go ahead on that PR, ill start the grunt work this weekend. Should only be build related changes, as we still have/support the code define TARGET_DARWIN_IOS. When tvos comes in however, may need to convert any over to TARGET_DARWIN_EMBEDDED if possible.

An exampled change. https://github.com/xbmc/visualization.shadertoy/blob/a395124bd9a7dbda27e269e5284136697bbaac66/FindOpenGLES2.cmake#L14

Ill make a list of all the addons kodi ships with and tick them off as i go.

fuzzard commented 5 years ago

Addons checked/updated.

fuzzard commented 5 years ago

another note for myself

xbmc/Application.cpp Line 423-425

ifdef TARGET_DARWIN_EMBEDDED

CopyUserDataIfNeeded("special://masterprofile/", "iOS/sources.xml", "sources.xml");

endif

Will need to change that come tvos

kambala-decapitator commented 5 years ago

@fuzzard this is correct. Or you want to rename the iOS folder?

fuzzard commented 5 years ago

Yes, rename, or add a tvos ifdef. As far as I remember, this part hasnt been touched in the ATV code as yet, so it will currently be iOS on the ATV builds.