Merge pull request #25614 from garbear/show-version
[xbmc.git] / cmake / scripts / darwin_embedded / ExtraTargets.cmake
blob01ab6328c54c191adea2b3817f6bb0e32e379fde
1 if(CORE_PLATFORM_NAME_LC STREQUAL tvos)
2   # top shelf extension
3   set(TOPSHELF_EXTENSION_NAME "${APP_NAME_LC}-topshelf")
4   set(TOPSHELF_BUNDLE_EXTENSION appex)
5   set(TOPSHELF_DIR "${CMAKE_SOURCE_DIR}/xbmc/platform/darwin/tvos/TopShelf")
6   # same path as the output Info.plist, taken from cmGlobalXCodeGenerator::ComputeInfoPListLocation()
7   set(ENTITLEMENTS_OUT_PATH "${CMAKE_BINARY_DIR}/CMakeFiles/${TOPSHELF_EXTENSION_NAME}.dir/TopShelf.entitlements")
9   set(SOURCES
10         ${TOPSHELF_DIR}/../../ios-common/DarwinEmbedUtils.mm
11         ${TOPSHELF_DIR}/ServiceProvider.mm
12         ${TOPSHELF_DIR}/../tvosShared.mm)
13   set(HEADERS
14         ${TOPSHELF_DIR}/../../ios-common/DarwinEmbedUtils.h
15         ${TOPSHELF_DIR}/ServiceProvider.h
16         ${TOPSHELF_DIR}/../tvosShared.h)
17   add_executable(${TOPSHELF_EXTENSION_NAME} MACOSX_BUNDLE ${SOURCES} ${HEADERS})
19   configure_file(${TOPSHELF_DIR}/TopShelf.entitlements.in ${ENTITLEMENTS_OUT_PATH} @ONLY)
20   set_target_properties(${TOPSHELF_EXTENSION_NAME} PROPERTIES BUNDLE_EXTENSION ${TOPSHELF_BUNDLE_EXTENSION}
21                                                               MACOSX_BUNDLE_INFO_PLIST ${TOPSHELF_DIR}/Info.plist.in
22                                                               XCODE_PRODUCT_TYPE com.apple.product-type.tv-app-extension
23                                                               XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH})
24   target_link_libraries(${TOPSHELF_EXTENSION_NAME} "-framework TVServices" "-framework Foundation")
26   add_custom_command(TARGET ${TOPSHELF_EXTENSION_NAME} POST_BUILD
27     COMMAND "NATIVEPREFIX=${NATIVEPREFIX}"
28             ${CMAKE_SOURCE_DIR}/tools/darwin/Support/Codesign-topshelf.command
29   )
31   add_dependencies(${APP_NAME_LC} ${TOPSHELF_EXTENSION_NAME})
32 endif()