Переглянути джерело

Fix dependency detection on windows

Tobias Hieta 8 роки тому
батько
коміт
b65b1a67a1
2 змінених файлів з 48 додано та 44 видалено
  1. 9 4
      CMakeModules/DependencyConfiguration.cmake
  2. 39 40
      CMakeModules/FindMPV.cmake

+ 9 - 4
CMakeModules/DependencyConfiguration.cmake

@@ -3,19 +3,24 @@ option(DISABLE_BUNDLED_DEPS "Disable the bundled deps on certain platforms" OFF)
 
 if(APPLE AND NOT DISABLE_BUNDLED_DEPS)
   set(DEFAULT_ROOT "${CMAKE_SOURCE_DIR}/dependencies/konvergo-depends-darwin-x86_64-release")
-  set(DEPENDENCY_ROOT ${DEFAULT_ROOT} CACHE PATH "Path where the deps are located")
 endif(APPLE AND NOT DISABLE_BUNDLED_DEPS)
 
-if(DEPENDENCY_ROOT)
+if(WIN32)
+  set(DEFAULT_ROOT "${CMAKE_SOURCE_DIR}/dependencies/all-deps")
+endif(WIN32)
+
+set(DEPENDENCY_ROOT ${DEFAULT_ROOT} CACHE PATH "Path where the deps are located")
+
+if(IS_DIRECTORY ${DEPENDENCY_ROOT})
   message(STATUS "Going to use bundled deps in directory: ${DEPENDENCY_ROOT}")
   set(CMAKE_FIND_ROOT_PATH ${DEPENDENCY_ROOT})
   set(CMAKE_PREFIX_PATH ${DEPENDENCY_ROOT})
   set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig)
   set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
   include_directories(${CMAKE_FIND_ROOT_PATH}/include)
-else(DEPENDENCY_ROOT)
+else(IS_DIRECTORY ${DEPENDENCY_ROOT})
   message(STATUS "Not using bundled deps")
-endif(DEPENDENCY_ROOT)
+endif(IS_DIRECTORY ${DEPENDENCY_ROOT})
 
 find_package(Threads)
 

+ 39 - 40
CMakeModules/FindMPV.cmake

@@ -21,48 +21,47 @@ SET(_MPV_REQUIRED_VARS MPV_INCLUDE_DIR MPV_LIBRARY)
 ### MPV uses pkgconfig.
 #
 if(PKG_CONFIG_FOUND)
-    pkg_check_modules(PC_MPV QUIET mpv)
+  pkg_check_modules(PC_MPV QUIET mpv)
 endif(PKG_CONFIG_FOUND)
 
-if(PC_MPV_FOUND)
-  #
-  ### Look for the include files.
-  #
-  find_path(
-      MPV_INCLUDE_DIR
-      NAMES mpv/client.h
-      HINTS
-          ${PC_MPV_INCLUDEDIR}
-          ${PC_MPV_INCLUDE_DIRS} # Unused for MPV but anyway
-      DOC "MPV include directory"
-      )
 
-  #
-  ### Look for the libraries
-  #
-  set(_MPV_LIBRARY_NAMES mpv)
-  if(PC_MPV_LIBRARIES)
-    set(_MPV_LIBRARY_NAMES ${PC_MPV_LIBRARIES})
-  endif(PC_MPV_LIBRARIES)
+#
+### Look for the include files.
+#
+find_path(
+  MPV_INCLUDE_DIR
+  NAMES mpv/client.h
+  HINTS
+      ${PC_MPV_INCLUDEDIR}
+      ${PC_MPV_INCLUDE_DIRS} # Unused for MPV but anyway
+  DOC "MPV include directory"
+)
+
+#
+### Look for the libraries
+#
+set(_MPV_LIBRARY_NAMES mpv)
+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()
-  get_filename_component(_MPV_LIBRARY_DIR ${MPV_LIBRARY_mpv} PATH)
-  mark_as_advanced(MPV_LIBRARY)
+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()
 
-  set(MPV_LIBRARY_DIRS _MPV_LIBRARY_DIR)
-  list(REMOVE_DUPLICATES MPV_LIBRARY_DIRS)
+get_filename_component(_MPV_LIBRARY_DIR ${MPV_LIBRARY_mpv} PATH)
+mark_as_advanced(MPV_LIBRARY)
 
-endif()
+set(MPV_LIBRARY_DIRS _MPV_LIBRARY_DIR)
+list(REMOVE_DUPLICATES MPV_LIBRARY_DIRS)
 
 mark_as_advanced(MPV_INCLUDE_DIR)
 mark_as_advanced(MPV_LIBRARY_DIRS)
@@ -73,8 +72,8 @@ set(MPV_INCLUDE_DIRS ${MPV_INCLUDE_DIR})
 #
 include(FindPackageHandleStandardArgs)
 find_package_handle_standard_args(
-    MPV
-    REQUIRED_VARS ${_MPV_REQUIRED_VARS}
-    VERSION_VAR MPV_VERSION_STRING
-    )
+  MPV
+  REQUIRED_VARS ${_MPV_REQUIRED_VARS}
+  VERSION_VAR MPV_VERSION_STRING
+)