mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-02 21:11:25 +12:00
Make compile with msvc, clang and gcc on Windows
This commit is contained in:
parent
ed75bab7b2
commit
0c94606fcf
60 changed files with 519 additions and 4584 deletions
2
3rdparty/libusb/CMakeLists.txt
vendored
2
3rdparty/libusb/CMakeLists.txt
vendored
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8.4)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
project(libusb)
|
||||
|
||||
|
|
6
3rdparty/libusb/config.cmake
vendored
6
3rdparty/libusb/config.cmake
vendored
|
@ -89,7 +89,11 @@ set(PACKAGE_URL "http://www.libusb.org" CACHE INTERNAL "package url" FORCE)
|
|||
set(PACKAGE_TARNAME "libusb" CACHE INTERNAL "tarball name" FORCE)
|
||||
set(VERSION "${PACKAGE_VERSION}" CACHE INTERNAL "version" FORCE)
|
||||
|
||||
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
|
||||
if(MSVC)
|
||||
file(COPY libusb/msvc/config.h DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
else()
|
||||
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
|
||||
endif()
|
||||
message(STATUS "Generated configuration file in ${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
||||
|
||||
# for generated config.h
|
||||
|
|
25
3rdparty/libusb/libusb.cmake
vendored
25
3rdparty/libusb/libusb.cmake
vendored
|
@ -3,22 +3,6 @@ include(os.cmake)
|
|||
include(config.cmake)
|
||||
include(FindThreads)
|
||||
|
||||
set (LIBUSB_COMMON
|
||||
core.c
|
||||
descriptor.c
|
||||
io.c
|
||||
sync.c
|
||||
hotplug.c
|
||||
strerror.c
|
||||
libusb-1.0.rc
|
||||
libusb-1.0.def
|
||||
)
|
||||
|
||||
foreach(SRC IN LISTS LIBUSB_COMMON)
|
||||
list(APPEND LIBUSB_COMMON_FINAL ${LIBUSB_SOURCE_DIR}/libusb/${SRC})
|
||||
endforeach()
|
||||
|
||||
|
||||
include_directories(${LIBUSB_SOURCE_DIR}/libusb)
|
||||
include_directories(${LIBUSB_SOURCE_DIR}/libusb/os)
|
||||
|
||||
|
@ -28,7 +12,14 @@ endif()
|
|||
|
||||
add_library(usb-1.0-static
|
||||
STATIC
|
||||
${LIBUSB_COMMON_FINAL}
|
||||
libusb/libusb/core.c
|
||||
libusb/libusb/descriptor.c
|
||||
libusb/libusb/io.c
|
||||
libusb/libusb/sync.c
|
||||
libusb/libusb/hotplug.c
|
||||
libusb/libusb/strerror.c
|
||||
libusb/libusb/libusb-1.0.rc
|
||||
libusb/libusb/libusb-1.0.def
|
||||
${LIBUSB_PLATFORM}
|
||||
)
|
||||
|
||||
|
|
43
3rdparty/libusb/os.cmake
vendored
43
3rdparty/libusb/os.cmake
vendored
|
@ -5,42 +5,43 @@ if (CMAKE_USE_PTHREADS_INIT)
|
|||
set(PTHREADS_ENABLED TRUE)
|
||||
endif()
|
||||
|
||||
if (WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
if (CYGWIN)
|
||||
add_compile_definitions(PLATFORM_WINDOWS=1)
|
||||
set(OS_WINDOWS 1 CACHE INTERNAL "controls config.h macro definition" FORCE)
|
||||
set(OS_WINDOWS 1)
|
||||
|
||||
# Enable MingW support for RC language (for CMake pre-2.8)
|
||||
if (MINGW)
|
||||
set(CMAKE_RC_COMPILER_INIT windres)
|
||||
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||
endif()
|
||||
enable_language(RC)
|
||||
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
|
||||
message(STATUS "Detected cygwin")
|
||||
set(PTHREADS_ENABLED TRUE)
|
||||
set(WITHOUT_POLL_H TRUE CACHE INTERNAL "Disable using poll.h even if it's available - use windows poll instead fo cygwin's" FORCE)
|
||||
endif()
|
||||
message(STATUS "Detected Cygwin")
|
||||
set(PTHREADS_ENABLED TRUE)
|
||||
set(WITHOUT_POLL_H TRUE)
|
||||
|
||||
list(APPEND PLATFORM_SRC
|
||||
events_windows.c
|
||||
windows_usbdk.c
|
||||
windows_common.c
|
||||
windows_winusb.c
|
||||
threads_windows.c
|
||||
)
|
||||
|
||||
if (PTHREADS_ENABLED AND NOT WITHOUT_PTHREADS)
|
||||
list(APPEND PLATFORM_SRC threads_posix)
|
||||
else()
|
||||
list(APPEND PLATFORM_SRC threads_windows.c)
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
add_compile_definitions(PLATFORM_WINDOWS=1)
|
||||
set(OS_WINDOWS 1)
|
||||
set(PTHREADS_ENABLED FALSE)
|
||||
|
||||
list(APPEND PLATFORM_SRC
|
||||
events_windows.c
|
||||
windows_usbdk.c
|
||||
windows_common.c
|
||||
windows_winusb.c
|
||||
)
|
||||
|
||||
list(APPEND PLATFORM_SRC threads_windows.c)
|
||||
elseif (APPLE)
|
||||
# Apple != OSX alone
|
||||
add_compile_definitions(PLATFORM_POSIX=1 HAVE_CLOCK_GETTIME)
|
||||
set(OS_DARWIN 1 CACHE INTERNAL "controls config.h macro definition" FORCE)
|
||||
set(OS_DARWIN 1)
|
||||
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
set(PLATFORM_SRC
|
||||
darwin_usb.c
|
||||
threads_posix.c
|
||||
|
@ -77,7 +78,7 @@ elseif (UNIX)
|
|||
# Unix is for all *NIX systems including OSX
|
||||
add_compile_definitions(PLATFORM_POSIX=1 HAVE_CLOCK_GETTIME)
|
||||
if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
set(OS_LINUX 1 CACHE INTERNAL "controls config.h macro definition" FORCE)
|
||||
set(OS_LINUX 1)
|
||||
|
||||
set(PLATFORM_SRC
|
||||
linux_usbfs.c
|
||||
|
@ -108,4 +109,4 @@ set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARIES} PARENT_SCOPE)
|
|||
if (WITHOUT_PTHREADS)
|
||||
set(PTHREADS_ENABLED FALSE)
|
||||
endif()
|
||||
set(THREADS_POSIX ${PTHREADS_ENABLED} CACHE INTERNAL "use pthreads" FORCE)
|
||||
set(THREADS_POSIX ${PTHREADS_ENABLED})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue