diff options
Diffstat (limited to 'externals')
| -rw-r--r-- | externals/CMakeLists.txt | 5 | ||||
| m--------- | externals/SDL | 0 | ||||
| -rw-r--r-- | externals/libusb/CMakeLists.txt | 74 |
3 files changed, 52 insertions, 27 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index aae0baa0b..5402a532f 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -45,6 +45,11 @@ target_include_directories(microprofile INTERFACE ./microprofile) | |||
| 45 | add_library(unicorn-headers INTERFACE) | 45 | add_library(unicorn-headers INTERFACE) |
| 46 | target_include_directories(unicorn-headers INTERFACE ./unicorn/include) | 46 | target_include_directories(unicorn-headers INTERFACE ./unicorn/include) |
| 47 | 47 | ||
| 48 | # libusb | ||
| 49 | if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB) | ||
| 50 | add_subdirectory(libusb) | ||
| 51 | endif() | ||
| 52 | |||
| 48 | # SDL2 | 53 | # SDL2 |
| 49 | if (NOT SDL2_FOUND AND ENABLE_SDL2) | 54 | if (NOT SDL2_FOUND AND ENABLE_SDL2) |
| 50 | if (NOT WIN32) | 55 | if (NOT WIN32) |
diff --git a/externals/SDL b/externals/SDL | |||
| Subproject 107db2d89953ee7cc03417d43da1f26bd03aad5 | Subproject 2f248a2a31c3323ecc37c00ad5e269e347ae392 | ||
diff --git a/externals/libusb/CMakeLists.txt b/externals/libusb/CMakeLists.txt index 3ef007b40..06ce0fba7 100644 --- a/externals/libusb/CMakeLists.txt +++ b/externals/libusb/CMakeLists.txt | |||
| @@ -1,10 +1,13 @@ | |||
| 1 | if (MINGW) | 1 | set(LIBUSB_FOUND ON CACHE BOOL "libusb is present" FORCE) |
| 2 | # The MinGW toolchain for some reason doesn't work with this CMakeLists file after updating to | 2 | set(LIBUSB_VERSION "1.0.24" CACHE STRING "libusb version string" FORCE) |
| 3 | # 1.0.24, so we do it the old-fashioned way for now. We may want to move native Linux toolchains | 3 | |
| 4 | # to here, too (TODO lat9nq?). | 4 | if (MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) |
| 5 | # GNU toolchains for some reason doesn't work with the later half of this CMakeLists after | ||
| 6 | # updating to 1.0.24, so we do it the old-fashioned way for now. | ||
| 5 | 7 | ||
| 6 | set(LIBUSB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libusb") | 8 | set(LIBUSB_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/libusb") |
| 7 | set(LIBUSB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libusb") | 9 | set(LIBUSB_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/libusb") |
| 10 | |||
| 8 | # Workarounds for MSYS/MinGW | 11 | # Workarounds for MSYS/MinGW |
| 9 | if (MSYS) | 12 | if (MSYS) |
| 10 | # CMake on Windows passes `C:/`, but we need `/C/` or `/c/` to use `configure` | 13 | # CMake on Windows passes `C:/`, but we need `/C/` or `/c/` to use `configure` |
| @@ -19,36 +22,42 @@ if (MINGW) | |||
| 19 | 22 | ||
| 20 | set(LIBUSB_CONFIGURE "${LIBUSB_SRC_DIR}/configure") | 23 | set(LIBUSB_CONFIGURE "${LIBUSB_SRC_DIR}/configure") |
| 21 | set(LIBUSB_MAKEFILE "${LIBUSB_PREFIX}/Makefile") | 24 | set(LIBUSB_MAKEFILE "${LIBUSB_PREFIX}/Makefile") |
| 22 | set(LIBUSB_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll.a") | ||
| 23 | set(LIBUSB_SHARED_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll") | ||
| 24 | set(LIBUSB_SHARED_LIBRARY_DEST "${CMAKE_BINARY_DIR}/bin/libusb-1.0.dll") | ||
| 25 | 25 | ||
| 26 | # Causes "externals/libusb/libusb/libusb/os/windows_winusb.c:1427:2: error: conversion to non-scalar type requested", so cannot statically link it for now. | 26 | if (MINGW) |
| 27 | # set(LIBUSB_CFLAGS "-DGUID_DEVINTERFACE_USB_DEVICE=\\(GUID\\){0xA5DCBF10,0x6530,0x11D2,{0x90,0x1F,0x00,0xC0,0x4F,0xB9,0x51,0xED}}") | 27 | set(LIBUSB_LIBRARIES "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll.a" CACHE PATH "libusb library path" FORCE) |
| 28 | set(LIBUSB_SHARED_LIBRARY "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.dll") | ||
| 29 | set(LIBUSB_SHARED_LIBRARY_DEST "${CMAKE_BINARY_DIR}/bin/libusb-1.0.dll") | ||
| 30 | |||
| 31 | set(LIBUSB_CONFIGURE_ARGS --host=x86_64-w64-mingw32 --build=x86_64-windows) | ||
| 32 | else() | ||
| 33 | set(LIBUSB_LIBRARIES "${LIBUSB_PREFIX}/libusb/.libs/libusb-1.0.a" CACHE PATH "libusb library path" FORCE) | ||
| 34 | endif() | ||
| 35 | |||
| 36 | set(LIBUSB_INCLUDE_DIRS "${LIBUSB_SRC_DIR}/libusb" CACHE PATH "libusb headers path" FORCE) | ||
| 37 | |||
| 38 | # MINGW: causes "externals/libusb/libusb/libusb/os/windows_winusb.c:1427:2: error: conversion to non-scalar type requested", so cannot statically link it for now. | ||
| 39 | if (NOT MINGW) | ||
| 40 | set(LIBUSB_CFLAGS "-DGUID_DEVINTERFACE_USB_DEVICE=\\(GUID\\){0xA5DCBF10,0x6530,0x11D2,{0x90,0x1F,0x00,0xC0,0x4F,0xB9,0x51,0xED}}") | ||
| 41 | endif() | ||
| 28 | 42 | ||
| 29 | make_directory("${LIBUSB_PREFIX}") | 43 | make_directory("${LIBUSB_PREFIX}") |
| 30 | 44 | ||
| 31 | add_custom_command( | 45 | add_custom_command( |
| 32 | OUTPUT | 46 | OUTPUT |
| 33 | "${LIBUSB_LIBRARY}" | 47 | "${LIBUSB_LIBRARIES}" |
| 34 | COMMAND | 48 | COMMAND |
| 35 | make | 49 | make |
| 36 | WORKING_DIRECTORY | 50 | WORKING_DIRECTORY |
| 37 | "${LIBUSB_PREFIX}" | 51 | "${LIBUSB_PREFIX}" |
| 38 | ) | 52 | ) |
| 39 | 53 | ||
| 40 | # We may use this path for other GNU toolchains, so put all of the MinGW-specific stuff here | ||
| 41 | if (MINGW) | ||
| 42 | set(LIBUSB_CONFIGURE_ARGS --host=x86_64-w64-mingw32 --build=x86_64-windows) | ||
| 43 | endif() | ||
| 44 | |||
| 45 | add_custom_command( | 54 | add_custom_command( |
| 46 | OUTPUT | 55 | OUTPUT |
| 47 | "${LIBUSB_MAKEFILE}" | 56 | "${LIBUSB_MAKEFILE}" |
| 48 | COMMAND | 57 | COMMAND |
| 49 | # /bin/env | 58 | env |
| 50 | # CFLAGS="${LIBUSB_CFLAGS}" | 59 | CFLAGS="${LIBUSB_CFLAGS}" |
| 51 | /bin/sh "${LIBUSB_CONFIGURE}" | 60 | sh "${LIBUSB_CONFIGURE}" |
| 52 | ${LIBUSB_CONFIGURE_ARGS} | 61 | ${LIBUSB_CONFIGURE_ARGS} |
| 53 | --srcdir="${LIBUSB_SRC_DIR}" | 62 | --srcdir="${LIBUSB_SRC_DIR}" |
| 54 | WORKING_DIRECTORY | 63 | WORKING_DIRECTORY |
| @@ -59,7 +68,7 @@ if (MINGW) | |||
| 59 | OUTPUT | 68 | OUTPUT |
| 60 | "${LIBUSB_CONFIGURE}" | 69 | "${LIBUSB_CONFIGURE}" |
| 61 | COMMAND | 70 | COMMAND |
| 62 | /bin/sh "${LIBUSB_SRC_DIR}/bootstrap.sh" | 71 | sh "${LIBUSB_SRC_DIR}/bootstrap.sh" |
| 63 | WORKING_DIRECTORY | 72 | WORKING_DIRECTORY |
| 64 | "${LIBUSB_SRC_DIR}" | 73 | "${LIBUSB_SRC_DIR}" |
| 65 | ) | 74 | ) |
| @@ -68,19 +77,30 @@ if (MINGW) | |||
| 68 | OUTPUT | 77 | OUTPUT |
| 69 | "${LIBUSB_SHARED_LIBRARY_DEST}" | 78 | "${LIBUSB_SHARED_LIBRARY_DEST}" |
| 70 | COMMAND | 79 | COMMAND |
| 71 | /bin/cp "${LIBUSB_SHARED_LIBRARY}" "${LIBUSB_SHARED_LIBRARY_DEST}" | 80 | cp "${LIBUSB_SHARED_LIBRARY}" "${LIBUSB_SHARED_LIBRARY_DEST}" |
| 72 | ) | 81 | ) |
| 73 | 82 | ||
| 74 | add_custom_target(usb-bootstrap ALL DEPENDS "${LIBUSB_CONFIGURE}") | 83 | add_custom_target(usb-bootstrap DEPENDS "${LIBUSB_CONFIGURE}") |
| 75 | add_custom_target(usb-configure ALL DEPENDS "${LIBUSB_MAKEFILE}" usb-bootstrap) | 84 | add_custom_target(usb-configure DEPENDS "${LIBUSB_MAKEFILE}" usb-bootstrap) |
| 76 | add_custom_target(usb-build ALL DEPENDS "${LIBUSB_LIBRARY}" usb-configure) | 85 | add_custom_target(usb-build ALL DEPENDS "${LIBUSB_LIBRARIES}" usb-configure) |
| 77 | # Workaround since static linking didn't work out -- We need to copy the DLL to the bin directory | 86 | # Workaround since static linking didn't work out -- We need to copy the DLL to the bin directory |
| 78 | add_custom_target(usb-copy ALL DEPENDS "${LIBUSB_SHARED_LIBRARY_DEST}" usb-build) | 87 | add_custom_target(usb-copy ALL DEPENDS "${LIBUSB_SHARED_LIBRARY_DEST}" usb-build) |
| 79 | 88 | ||
| 80 | # Make `usb` alias to LIBUSB_LIBRARY | ||
| 81 | add_library(usb INTERFACE) | 89 | add_library(usb INTERFACE) |
| 82 | target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARY}") | 90 | add_dependencies(usb usb-copy) |
| 83 | else() # MINGW | 91 | target_link_libraries(usb INTERFACE "${LIBUSB_LIBRARIES}") |
| 92 | target_include_directories(usb INTERFACE "${LIBUSB_INCLUDE_DIRS}") | ||
| 93 | |||
| 94 | if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
| 95 | Include(FindPkgConfig) | ||
| 96 | pkg_check_modules(LIBUDEV REQUIRED libudev) | ||
| 97 | |||
| 98 | if (LIBUDEV_FOUND) | ||
| 99 | target_include_directories(usb INTERFACE "${LIBUDEV_INCLUDE_DIRS}") | ||
| 100 | target_link_libraries(usb INTERFACE "${LIBUDEV_STATIC_LIBRARIES}") | ||
| 101 | endif() | ||
| 102 | endif() | ||
| 103 | else() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") | ||
| 84 | # Ensure libusb compiles with UTF-8 encoding on MSVC | 104 | # Ensure libusb compiles with UTF-8 encoding on MSVC |
| 85 | if(MSVC) | 105 | if(MSVC) |
| 86 | add_compile_options(/utf-8) | 106 | add_compile_options(/utf-8) |
| @@ -236,4 +256,4 @@ else() # MINGW | |||
| 236 | 256 | ||
| 237 | 257 | ||
| 238 | configure_file(config.h.in config.h) | 258 | configure_file(config.h.in config.h) |
| 239 | endif() # MINGW | 259 | endif() # MINGW OR (${CMAKE_SYSTEM_NAME} MATCHES "Linux") |