Parcourir la source

Tweak how we include the web-client from conan

Tobias Hieta il y a 8 ans
Parent
commit
dc029f5506
3 fichiers modifiés avec 21 ajouts et 10 suppressions
  1. 6 0
      CMakeLists.txt
  2. 8 7
      conanfile.py
  3. 7 3
      src/CMakeLists.txt

+ 6 - 0
CMakeLists.txt

@@ -7,6 +7,12 @@ endif()
 
 project(PlexMediaPlayer CXX C)
 
+if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+  include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
+else()
+  message(WARNING "Could not find conanbuildinfo.cmake - could be a problem! Make sure to run conan install first")
+endif()
+
 # we want this to be able to run clang-tidy
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "" FORCE)
 

+ 8 - 7
conanfile.py

@@ -3,11 +3,12 @@ import os
 
 class PlexMediaPlayer(ConanFile):
   settings = "os", "compiler", "build_type", "arch"
-  requires = (
-    "web-client-desktop/2.11.1-db2136e@plex/stable",
-    "web-client-tv/2.10.8-7d6b907@plex/stable"
-  )
+  options = {"include_desktop": [True, False]}
+  default_options = "include_desktop=True"
+  generators = "cmake"
 
-  def imports(self):
-    self.copy("*", dst="web-client/tv", src="tv")
-    self.copy("*", dst="web-client/desktop", src="desktop")
+  def requirements(self):
+    self.requires("web-client-tv/2.10.8-7d6b907@plex/stable")
+
+    if self.options.include_desktop:
+      self.requires("web-client-desktop/2.11.1-db2136e@plex/stable")

+ 7 - 3
src/CMakeLists.txt

@@ -125,11 +125,15 @@ if(APPLE)
   set(RESOURCE_ROOT Resources)
 endif()
 
-if(NOT IS_DIRECTORY ${CMAKE_BINARY_DIR}/web-client)
-  message(FATAL_ERROR "No ${CMAKE_BINARY_DIR}/web-client! Did you forget conan install?")
+if(NOT DEFINED CONAN_WEB-CLIENT-TV_ROOT)
+  message(FATAL_ERROR "Could not find the web-client! Run conan!")
+endif()
+
+add_resources(TARGET ${MAIN_TARGET} SOURCES ${CONAN_WEB-CLIENT-TV_ROOT}/tv DEST ${RESOURCE_ROOT}/web-client/tv)
+if(DEFINED CONAN_WEB-CLIENT-DESKTOP_ROOT)
+  add_resources(TARGET ${MAIN_TARGET} SOURCES ${CONAN_WEB-CLIENT-DESKTOP_ROOT}/desktop DEST ${RESOURCE_ROOT}/web-client/desktop)
 endif()
 
-add_resources(TARGET ${MAIN_TARGET} SOURCES ${CMAKE_BINARY_DIR}/web-client DEST ${RESOURCE_ROOT}/web-client)
 if(NOT APPLE)
   install(DIRECTORY ${CMAKE_BINARY_DIR}/web-client DESTINATION ${INSTALL_RESOURCE_DIR})
   install(FILES ${QTROOT}/resources/qtwebengine_devtools_resources.pak DESTINATION resources)