Browse Source

Make Windows builds sort-of work.

Ian Walton 3 years ago
parent
commit
924831d52b

+ 1 - 1
CMakeModules/CompleteBundleWin.cmake.in

@@ -14,7 +14,7 @@ get_filename_component(CEC_DIR @CEC_LIBRARY@ DIRECTORY)
 list(APPEND SEARCHDIRS ${CEC_DIR})
 
 fixup_bundle("${CMAKE_INSTALL_PREFIX}/JellyfinMediaPlayer.exe" "" "${SEARCHDIRS}") 
-#install(PROGRAMS ${VCREDIST_DIR}/vc_redist_2015_x64.exe DESTINATION .)
+install(PROGRAMS ${VCREDIST_DIR}/vc_redist_2015_x64.exe DESTINATION .)
 
 if(@DO_ENABLE_ANGLE_DEP@)
   message(STATUS "Deploying separate ANGLE deps")

+ 0 - 27
CMakeModules/DependencyConfiguration.cmake

@@ -26,33 +26,6 @@ if(DEPENDENCY_TOKEN)
   endif()
 endif(DEPENDENCY_TOKEN)
 
-if(WIN32)
-  message("dependencies are: ${dir}")
-  set(DEFAULT_ROOT "${dir}")
-
-  download_deps(
-    "windows-redist"
-    DIRECTORY VCREDIST_DIR
-    ARTIFACTNAME windows-redist-2015
-    ARCHSTR windows-x86_x64
-  )
-
-  option(ENABLE_ANGLE_DEP "Enable downloading and deployment of separate ANGLE deps" OFF)
-  if(ENABLE_ANGLE_DEP)
-    message(STATUS "Downloading separate ANGLE deps...")
-    foreach(angle_file libEGL.dll libGLESv2.dll d3dcompiler_47.dll)
-      download_dep_file(
-        "plexmediaplayer-angle"
-        BUILD_NUMBER 53
-        DIRECTORY angle
-        ARTIFACTNAME "plexmediaplayer-angle"
-        FILENAME ${angle_file}
-      )
-    endforeach()
-  endif()
-
-endif(WIN32)
-
 set(DEPENDENCY_ROOT ${DEFAULT_ROOT} CACHE PATH "Path where the deps are located")
 
 if(IS_DIRECTORY ${DEPENDENCY_ROOT})

+ 15 - 13
CMakeModules/FindMPV.cmake

@@ -45,20 +45,22 @@ if(PC_MPV_LIBRARIES)
   set(_MPV_LIBRARY_NAMES ${PC_MPV_LIBRARIES})
 endif(PC_MPV_LIBRARIES)
 
-foreach(l ${_MPV_LIBRARY_NAMES})
-  find_library(
-    MPV_LIBRARY_${l}
-    NAMES ${l}
-    HINTS
-      ${PC_MPV_LIBDIR}
-      ${PC_MPV_LIBRARY_DIRS} # Unused for MPV but anyway
-    PATH_SUFFIXES lib${LIB_SUFFIX}
-  )
-  list(APPEND MPV_LIBRARY ${MPV_LIBRARY_${l}})
-endforeach()
+if(NOT WIN32)
+  foreach(l ${_MPV_LIBRARY_NAMES})
+    find_library(
+      MPV_LIBRARY_${l}
+      NAMES ${l}
+      HINTS
+        ${PC_MPV_LIBDIR}
+        ${PC_MPV_LIBRARY_DIRS} # Unused for MPV but anyway
+      PATH_SUFFIXES lib${LIB_SUFFIX}
+    )
+    list(APPEND MPV_LIBRARY ${MPV_LIBRARY_${l}})
+  endforeach()
 
-get_filename_component(_MPV_LIBRARY_DIR ${MPV_LIBRARY_mpv} PATH)
-mark_as_advanced(MPV_LIBRARY)
+  get_filename_component(_MPV_LIBRARY_DIR ${MPV_LIBRARY_mpv} PATH)
+  mark_as_advanced(MPV_LIBRARY)
+endif(NOT WIN32)
 
 set(MPV_LIBRARY_DIRS _MPV_LIBRARY_DIR)
 list(REMOVE_DUPLICATES MPV_LIBRARY_DIRS)

+ 1 - 1
CMakeModules/WindowsInstaller.cmake

@@ -138,7 +138,7 @@ add_custom_target(wix_install
 wix_harvest_directory("${CMAKE_INSTALL_PREFIX}" files.wxs CGROUP ProgramFilesComponentGroup DEPENDS wix_install)
 
 wix_create_installer(PMP.msi 
-                     WXS_FILES files.wxs "${PROJECT_SOURCE_DIR}/bundle/win/PMP.wxs"
+                     WXS_FILES files.wxs "${PROJECT_SOURCE_DIR}/bundle/win/JMP.wxs"
                      EXTENSIONS WixUtilExtension WixFirewallExtension
                      BASEDIR "${PROJECT_SOURCE_DIR}/bundle/win"
 )

+ 37 - 1
README.md

@@ -37,7 +37,43 @@ sudo make install
 rm -rf ~/jmp/
 ```
 
-## Building
+## Building for Windows
+
+Please install:
+ - [cmake](https://cmake.org/download/) - cmake-3.20.0-windows-x86_64.msi
+   - Add cmake to the path.
+ - [ninja](https://github.com/ninja-build/ninja/releases)
+   - Place this in the build directory.
+ - [QT](http://download.qt.io/official_releases/qt/5.9/5.9.9/qt-opensource-windows-x86-5.9.9.exe)
+   - This file is huge. You also need to make a QT account...
+   - Check "MSVC 2017 64-bit" and "Qt WebEngine".
+ - [VS2017 Build Tools](https://download.visualstudio.microsoft.com/download/pr/3e542575-929e-4297-b6c6-bef34d0ee648/639c868e1219c651793aff537a1d3b77/vs_buildtools.exe)
+   - Again this will use a lot of disk space. The installer is small though.
+ - [libmpv1](https://sourceforge.net/projects/mpv-player-windows/files/libmpv/)
+   - Place the contents in the build directory, in a subfolder called `mpv`.
+   - Move the contents of the `include` folder to an `mpv` folder inside the `include` folder.
+   - Move the `mpv-1.dll` to `mpv.dll`.
+
+You need to run these commands in git bash.
+
+```bash
+git clone https://github.com/iwalton3/jellyfin-media-player
+cd jellyfin-media-player
+mkdir build && cd build
+curl -L https://github.com/iwalton3/jellyfin-web-jmp/releases/download/jwc-1.7.0/dist.zip > dist.zip
+unzip dist.zip
+```
+
+Open the "x86_x64 Cross Tools Command Prompt for VS 2017". `cd` to the `build` directory. Run:
+
+```
+cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=C:\Qt\Qt5.9.9\5.9.9\msvc2017_64 -DMPV_INCLUDE_DIR=mpv\include -DMPV_LIBRARY=mpv\mpv.dll -DVCREDIST_DIR=C:\Qt\Qt5.9.9\vcredist -DCMAKE_INSTALL_PREFIX=output ..
+lib /def:mpv\mpv.def /out:mpv\mpv-1.lib /MACHINE:X64
+ninja
+ninja windows_package
+```
+
+## Building (Old Instructions)
 
 You need:
 

+ 3 - 0
src/input/InputRoku.cpp

@@ -20,6 +20,7 @@ using namespace qhttp::server;
 /////////////////////////////////////////////////////////////////////////////////////////
 bool InputRoku::initInput()
 {
+  /*
   m_server = new QHttpServer(this);
 
   if (!m_server->listen(QHostAddress::Any, 8060))
@@ -43,6 +44,8 @@ bool InputRoku::initInput()
   connect(m_ssdpSocket, &QUdpSocket::readyRead, this, &InputRoku::ssdpRead);
 
   return true;
+  */
+  return false; // Disable poer listen on 1900 and 8060 that requires Windows Firewall
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////

+ 13 - 2
src/player/PlayerQuickItem.cpp

@@ -91,10 +91,15 @@ bool PlayerRenderer::init()
   DwmEnableMMCSS(TRUE);
 #endif
 
-  mpv_opengl_init_params opengl_params = {
+mpv_opengl_init_params opengl_params = {
+#ifdef Q_OS_WIN32
+      get_proc_address,
+      NULL,
+#else
       .get_proc_address = get_proc_address,
       .get_proc_address_ctx = NULL,
-  };
+#endif
+};
 
   mpv_render_param params[] = {
     {MPV_RENDER_PARAM_API_TYPE, (void*)MPV_RENDER_API_TYPE_OPENGL},
@@ -162,9 +167,15 @@ void PlayerRenderer::render()
   }
 
   mpv_opengl_fbo mpv_fbo = {
+#ifdef Q_OS_WIN32
+    fbo,
+    fboSize.width(),
+    fboSize.height(),
+#else
     .fbo = fbo,
     .w = fboSize.width(),
     .h = fboSize.height(),
+#endif
   };
   int mpv_flip = flip ? -1 : 0;
   mpv_render_param params[] = {