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

ATV-cmake-generation branch: next PR #42

Closed sy6sy2 closed 4 years ago

sy6sy2 commented 5 years ago

ATV-cmake-generation branch

Description

Branch to use for the next PR to upstream/master.

This branch must be kept up to date with upstream/master by using:

git fetch upstream
git rebase upstream/master
git push --force

The only purpose of the modifications made by this branch is to be able to generate without error the project Xcode with Cmake for the Apple TV. Here we do not care if we can compile or not this project with Xcode

Commits

  1. [tvOS] Toolchain: Only tools/depends/target/Toolchain.cmake.in file changes
  2. [tvOS] cmake/platform
  3. [tvOS] cmake/scripts
  4. [tvOS] cmake/modules/FindOpenGLES.cmake
  5. [tvOS] tools/darwin/packaging
  6. [tvOS] xbmc/platform/darwin
  7. At this point I am able to generate Xcode project for tvOS without error
kambala-decapitator commented 5 years ago

you have old version. grab the latest from ATV branch: https://github.com/SylvainCecchetto/xbmc/blob/ATV/xbmc/cores/AudioEngine/Sinks/AESinkDARWINIOS.mm

sy6sy2 commented 5 years ago

In CMakeLists.txt we have:

core_add_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/common/*.txt
                               ${CMAKE_SOURCE_DIR}/cmake/treedata/${CORE_SYSTEM_NAME}/*.txt)

It worked when CORE_SYSTEM_NAME was equal to tvos but now that we use CORE_SYSTEM_NAME =ios with CORE_PLATFORM_NAME=tvos then Cmake used cmake/treedata/ios/subdirs.txt instead of cmake/treedata/tvos/subdirs.txt.

Any idea on how to fix it without modifying CMakeLists.txt?

phunkyfish commented 5 years ago

How does it work for rbpi?

sy6sy2 commented 5 years ago

It seems that it uses the same subdirs.txt file as linux

phunkyfish commented 5 years ago

I assume those files are different between iOS and tvOS.

I think CMakeLists.txt would need to be changed. Temp var with CORE_SYSTEM_NAME and then update it if CORE_PLATFORM_NAME is tvos.

I see CORE_PLATFORM_NAME has changed from appletvos to tvos. Will this cause any issues with the build? There are many things named with appletvos but not sure if they are created by us or are Xcode specific.

sy6sy2 commented 5 years ago

This is my current dirty hack :-/

# Subdirs
# Tempo hack
if(CORE_PLATFORM_NAME STREQUAL "tvos")
core_add_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/common/*.txt
                               ${CMAKE_SOURCE_DIR}/cmake/treedata/${CORE_PLATFORM_NAME}/*.txt)
core_add_optional_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/optional/common/*.txt
                                        ${CMAKE_SOURCE_DIR}/cmake/treedata/optional/${CORE_PLATFORM_NAME}/*.txt)
else()
core_add_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/common/*.txt
                               ${CMAKE_SOURCE_DIR}/cmake/treedata/${CORE_SYSTEM_NAME}/*.txt)
core_add_optional_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/optional/common/*.txt
                                        ${CMAKE_SOURCE_DIR}/cmake/treedata/optional/${CORE_SYSTEM_NAME}/*.txt)
endif()

I don't see any issue concerning CORE_PLATFORM_NAME yet.

So, I am able to compile Kodi on ATV-cmake-generation branch (I will push latest changes on GitHub). (not tested on my Apple TV yet). But I think that there is duplicated code in windowing between iOS and tvOS that we need to modify.

phunkyfish commented 5 years ago

Did you get a chance to try and run it on your apple TV?

sy6sy2 commented 5 years ago

I would like, but once again I am stuck with this fucking no code signature found -_-' But this time, the "delete" fix don't work

phunkyfish commented 5 years ago

That happens to me sometimes too. I just delete the kodi-build dir and regenerate the project.

sy6sy2 commented 5 years ago

I will try again, thank you ;-)

sy6sy2 commented 5 years ago

Still have the issue :-(

phunkyfish commented 5 years ago

Maybe an issue with generation of the project. Will kick off a build now, is the branch updated?

sy6sy2 commented 5 years ago

Yes maybe ... I will try tomorrow to build and run the ATV branch to see if I have still the issue.

Yes the branch is up to date. There is just an issue with the bundle identifier that I will fix tomorrow

phunkyfish commented 5 years ago

Should probably also include the link to the build doc in the PR.

sy6sy2 commented 5 years ago

Is anybody have an idea on how to fix this "Tempo hack" (https://github.com/xbmc/xbmc/pull/15956/commits/f821dba3046bb4e88da84c07751ac7bcb3e041a4#r278421327) properly? Thank you!

phunkyfish commented 5 years ago

Either set CORE_PLATFORM_NAME to CORE_SYSTEM_NAME for everything except tvOS and use that or use a temp var which gets set to CORE_SYSTEM_NAME except in the case of where CORE_PLATFORM_NAME is tvOS

phunkyfish commented 5 years ago

Actually that would break raspberry pi. So all I have is the temp var approach.

phunkyfish commented 5 years ago

Branch will need a rebase as currently pvr addons don’t build as they have been branched to Matrix.

sy6sy2 commented 5 years ago

Yes there is the temp var approach, but I think Rechi wants that we not touch this part of the CmakeList file. But I will try ;-)

Yep, I will rebase now!

sy6sy2 commented 5 years ago

I force pushed the temp var approach and the branch is up to date with master.

kambala-decapitator commented 5 years ago

what if you temporarily set CORE_SYSTEM_NAME to expected value and then set it back?

if(CORE_PLATFORM_NAME STREQUAL "tvos")
  set(CORE_SYSTEM_NAME_ORIGNIAL ${CORE_SYSTEM_NAME})
  set(CORE_SYSTEM_NAME "tvos")
endif()
core_add_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/common/*.txt
                                   ${CMAKE_SOURCE_DIR}/cmake/treedata/${CORE_SYSTEM_NAME}/*.txt)
core_add_optional_subdirs_from_filelist(${CMAKE_SOURCE_DIR}/cmake/treedata/optional/common/*.txt
                                        ${CMAKE_SOURCE_DIR}/cmake/treedata/optional/${CORE_SYSTEM_NAME}/*.txt)
if(CORE_PLATFORM_NAME STREQUAL "tvos")
  set(CORE_SYSTEM_NAME ${CORE_SYSTEM_NAME_ORIGNIAL})
endif()
sy6sy2 commented 5 years ago

Yes, sounds a better alternative as the temp var approach. I will update this file. thank you.

sy6sy2 commented 5 years ago

Rechi said "This is still a hack" :-/ I guess that we need to find another solution without modifying CmakeLists.txt

phunkyfish commented 5 years ago

Ask him what he suggests?

kambala-decapitator commented 5 years ago

I think the right approach is to modify cmake/treedata/ios/subdirs.txt that it contains ${CORE_PLATFORM_NAME} where appropriate. probably it would require small modification of core_add_subdirs_from_filelist and core_add_optional_subdirs_from_filelist macros in cmake/scripts/common/Macros.cmake as well.

sy6sy2 commented 5 years ago

I thought about that actually. So I need to adapt core_add_subdirs_from_filelist and core_add_optional_subdirs_from_filelist in order to replace the var ${CORE_PLATFORM_NAME} by the actual value.

kambala-decapitator commented 5 years ago

yep. But maybe also ask Rechi on his view on the solution now, he might offer a better one.

sy6sy2 commented 5 years ago

But I cannot do something like xbmc/windowing/${CORE_PLATFORM_NAME} windowing/${CORE_PLATFORM_NAME} because with iOS this var is not set.

kambala-decapitator commented 5 years ago

then we need to set it...

or wait, there're some cmake generator expressions that can use conditions, so we can write in a single statement "if CORE_PLATFORM_NAME is set, then use it, otherwise use CORE_SYSTEM_NAME"

sy6sy2 commented 5 years ago

Another solution, but I doubt is a good one, would be to use the same sources files for iOS and tvOS. So we have only one folder in xbmc/platform/darwin/ and xbmc/windowing/ but a lot of if/else macro :-/

sy6sy2 commented 5 years ago

or wait, there're some cmake generator expressions that can use conditions, so we can write in a single statement "if CORE_PLATFORM_NAME is set, then use it, otherwise use CORE_SYSTEM_NAME"

Do you mean, using this thing in CmakeLists? But it could break raspberry no?

kambala-decapitator commented 5 years ago

no-no, in ios/subdirs.txt

kambala-decapitator commented 5 years ago

Another solution, but I doubt is a good one, would be to use the same sources files for iOS and tvOS. So we have only one folder in xbmc/platform/darwin/ and xbmc/windowing/ but a lot of if/else macro :-/

does rbpi use this approach?

sy6sy2 commented 5 years ago

Yes, bpi uses the CORE_PLATFORM_NAME var:

if(OS STREQUAL linux)
  set(CMAKE_SYSTEM_NAME Linux)
  set(CORE_SYSTEM_NAME linux)
  if(PLATFORM STREQUAL raspberry-pi)
    set(CORE_PLATFORM_NAME rbpi)
[...]

But bpi uses the same subdirectories as Linux so the issue with CmakeList does not appear :-/

kambala-decapitator commented 5 years ago

sorry, I mean in code:

So we have only one folder in xbmc/platform/darwin/ and xbmc/windowing/ but a lot of if/else macro

sy6sy2 commented 5 years ago

Hum, I don't understand how it works for rbpi because there is a folder xbmc/windowing/rbpi but not a file cmake/treedata/rbpi/subdirs.txt

sy6sy2 commented 5 years ago

Ok I understand, this is done by CmakeLists.txt in xbmc/windowing folder:

set(SOURCES GraphicContext.cpp
            OSScreenSaver.cpp
            Resolution.cpp
            WinSystem.cpp)

set(HEADERS GraphicContext.h
            OSScreenSaver.h
            Resolution.h
            WinEvents.h
            WinSystem.h
            XBMC_events.h
            VideoSync.h)

if(CORE_PLATFORM_NAME_LC STREQUAL rbpi)
  add_subdirectory(rpi)
endif()

core_add_library(windowing)

Maybe we could use the same approach?

sy6sy2 commented 5 years ago

So what I can do is:

Then we do not need to modify the main CmakeLists.txt file. What do you think?

kambala-decapitator commented 5 years ago

personally I think we should follow the rbpi approach. Could you forward your comment to Rechi to find out his opinion?

phunkyfish commented 5 years ago

Agreed, I’d say rbpi approach is probably the right one.

kambala-decapitator commented 5 years ago

created https://github.com/xbmc/xbmc/pull/16015 for the iOS audio sink change

kambala-decapitator commented 5 years ago

it seems that after our latest cmake hack build started failing...

sy6sy2 commented 5 years ago

Really? I will try tomorrow, time to sleep ;-) In any case this hack should be removed soon if Rechi is agree with the rpi approach!

phunkyfish commented 5 years ago

Rechi’s reply makes perfect sense now that I see it.

sy6sy2 commented 5 years ago

Yes! Totally agree. Now we can wait for "sub-PRs" to be merged (see https://github.com/SylvainCecchetto/xbmc/issues/52 discussion). After that, we will have the final PR (this one) with only tvOS support.