diff --git a/CMakeLists.txt b/CMakeLists.txt index c277e2a10a..872cb0b740 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,7 @@ endif() # as defined above. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Binaries) -if (WIN32) +if (MSVC) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Binary) if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") @@ -536,7 +536,7 @@ if(ENABLE_EGL) endif() if(ENCODE_FRAMEDUMPS) - if(WIN32) + if(MSVC) if(_M_X86_64) set(FFMPEG_DIR Externals/FFmpeg-bin/x64) elseif(_M_ARM_64) @@ -556,7 +556,7 @@ if(ENCODE_FRAMEDUMPS) if(WIN32) # Our prebuilt binaries depend on Bcrypt set_property(TARGET FFmpeg::avutil APPEND PROPERTY - INTERFACE_LINK_LIBRARIES "Bcrypt.lib" + INTERFACE_LINK_LIBRARIES Bcrypt ) endif() else() @@ -769,8 +769,10 @@ else() message(STATUS "libsystemd not found, disabling traversal server watchdog support") endif() -if (WIN32) +if (MSVC) include_directories(Externals/WIL/include) +endif() +if (WIN32) include_directories(Externals/OpenAL/include) endif() diff --git a/Externals/hidapi/CMakeLists.txt b/Externals/hidapi/CMakeLists.txt index 210643caf0..08f0cd7780 100644 --- a/Externals/hidapi/CMakeLists.txt +++ b/Externals/hidapi/CMakeLists.txt @@ -6,8 +6,9 @@ target_include_directories(hidapi PUBLIC hidapi-src/hidapi) if(APPLE) target_sources(hidapi PRIVATE hidapi-src/mac/hid.c) -elseif(MSVC) +elseif(WIN32) target_sources(hidapi PRIVATE hidapi-src/windows/hid.c) + target_link_libraries(hidapi PUBLIC setupapi) else() find_package(LIBUDEV) if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND LIBUDEV_FOUND) diff --git a/Externals/libusb/CMakeLists.txt b/Externals/libusb/CMakeLists.txt index c91df85403..35267d0654 100644 --- a/Externals/libusb/CMakeLists.txt +++ b/Externals/libusb/CMakeLists.txt @@ -9,7 +9,7 @@ add_library(usb STATIC EXCLUDE_FROM_ALL dolphin_disable_warnings(usb) set_target_properties(usb PROPERTIES VERSION 1.0.26) -if(WIN32) +if(MSVC) target_include_directories(usb BEFORE PUBLIC libusb/libusb PRIVATE libusb/msvc) else() target_include_directories(usb @@ -31,6 +31,7 @@ if(WIN32 OR CYGWIN) libusb/libusb/os/events_windows.c ) set(PLATFORM_WINDOWS TRUE) + set(ENABLE_LOGGING TRUE) elseif(APPLE) target_sources(usb PRIVATE libusb/libusb/os/darwin_usb.c) find_library(COREFOUNDATION_LIBRARY CoreFoundation) @@ -92,7 +93,9 @@ include(CheckTypeSize) include(CheckSymbolExists) check_include_files(asm/types.h HAVE_ASM_TYPES_H) -check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) +if(NOT WIN32) + check_function_exists(clock_gettime HAVE_CLOCK_GETTIME) +endif() check_symbol_exists(EFD_CLOEXEC "sys/eventfd.h" HAVE_DECL_EFD_CLOEXEC) check_symbol_exists(EFD_NONBLOCK "sys/eventfd.h" HAVE_DECL_EFD_NONBLOCK) check_symbol_exists(TFD_CLOEXEC "sys/timerfd.h" HAVE_DECL_TFD_CLOEXEC) diff --git a/Externals/libusb/config.h.in b/Externals/libusb/config.h.in index 43e603ed25..72eb8e04a6 100644 --- a/Externals/libusb/config.h.in +++ b/Externals/libusb/config.h.in @@ -8,7 +8,7 @@ #undef ENABLE_DEBUG_LOGGING /* Define to 1 to enable message logging. */ -#undef ENABLE_LOGGING +#cmakedefine ENABLE_LOGGING 1 /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ASM_TYPES_H 1 diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index ee738ba4e3..430d5939f9 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -205,12 +205,17 @@ if (APPLE) elseif(WIN32) target_link_libraries(common PRIVATE - kernel32.lib - shlwapi.lib - winmm.lib + kernel32 + shlwapi + winmm + SetupAPI ) if (_M_X86_64) - target_link_libraries(common PRIVATE opengl32.lib) + target_link_libraries(common PRIVATE opengl32) + endif() + if(MINGW) + target_compile_definitions(common PRIVATE _WIN32_WINNT=0x0602) + target_compile_options(common PRIVATE -mxsave) endif() elseif (ANDROID) target_link_libraries(common @@ -342,6 +347,7 @@ endif() if(WIN32) target_sources(common PRIVATE HRWrap.h HRWrap.cpp) + target_link_libraries(common PUBLIC qwave) endif() if(USE_UPNP) @@ -381,7 +387,7 @@ if(UNIX) if(SYSTEMD_FOUND) target_link_libraries(traversal_server PRIVATE ${SYSTEMD_LIBRARIES}) endif() -elseif(WIN32) +elseif(MSVC) find_package(PowerShell REQUIRED) execute_process( COMMAND ${POWERSHELL_EXE} -Command "[System.Diagnostics.FileVersionInfo]::GetVersionInfo('$ENV{VCToolsRedistDir}vc_redist.x64.exe').ProductVersion" diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 6e7ff1a0bc..ea5b7a782e 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(core +add_library(core STATIC AchievementManager.cpp AchievementManager.h ActionReplay.cpp @@ -733,8 +733,7 @@ if(WIN32) target_link_libraries(core PUBLIC videod3d videod3d12 - setupapi.lib - iphlpapi.lib + setupapi ) target_compile_definitions(core PRIVATE "-D_WINSOCK_DEPRECATED_NO_WARNINGS") elseif(APPLE) diff --git a/Source/Core/DolphinNoGUI/CMakeLists.txt b/Source/Core/DolphinNoGUI/CMakeLists.txt index 566a643c89..e119bc5c4e 100644 --- a/Source/Core/DolphinNoGUI/CMakeLists.txt +++ b/Source/Core/DolphinNoGUI/CMakeLists.txt @@ -12,6 +12,7 @@ endif() if(WIN32) target_sources(dolphin-nogui PRIVATE PlatformWin32.cpp) + target_link_libraries(dolphin-nogui PRIVATE Dwmapi) endif() if(APPLE) @@ -32,6 +33,13 @@ PRIVATE cpp-optparse ) +if(WIN32) + target_link_libraries(dolphin-nogui PRIVATE d3d11) + if(NOT MSVC) + target_link_options(dolphin-nogui PRIVATE -municode) + endif() +endif() + if(APPLE) target_link_libraries(dolphin-nogui PRIVATE @@ -43,7 +51,7 @@ endif() if(WIN32) # needed for adjusting window decorations with DwmSetWindowAttribute - target_link_libraries(dolphin-nogui PRIVATE dwmapi.lib) + target_link_libraries(dolphin-nogui PRIVATE dwmapi) endif() if(MSVC) diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 1a8c84d3b1..6c2504be1f 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -19,7 +19,7 @@ message(STATUS "Found Qt version ${Qt6_VERSION}") set_property(TARGET Qt6::Core PROPERTY INTERFACE_COMPILE_FEATURES "") -add_executable(dolphin-emu +add_executable(dolphin-emu WIN32 AboutDialog.cpp AboutDialog.h CheatSearchFactoryWidget.cpp @@ -443,10 +443,13 @@ PRIVATE if (WIN32) target_link_libraries(dolphin-emu PRIVATE - gdi32.lib - shell32.lib - dwmapi.lib # Needed to set window decorations for dark theme + gdi32 + shell32 + dwmapi # Needed to set window decorations for dark theme ) + if(NOT MSVC) + target_link_options(dolphin-emu PRIVATE -municode) + endif() endif() if (MSVC) diff --git a/Source/Core/DolphinTool/CMakeLists.txt b/Source/Core/DolphinTool/CMakeLists.txt index e907fb9bbd..155a7ca630 100644 --- a/Source/Core/DolphinTool/CMakeLists.txt +++ b/Source/Core/DolphinTool/CMakeLists.txt @@ -21,6 +21,10 @@ PRIVATE fmt::fmt ) +if(WIN32 AND NOT MSVC) + target_link_options(dolphin-tool PRIVATE -municode) +endif() + if(MSVC) # Add precompiled header target_link_libraries(dolphin-tool PRIVATE use_pch) diff --git a/Source/Core/InputCommon/CMakeLists.txt b/Source/Core/InputCommon/CMakeLists.txt index 0e5612f353..d4044dc453 100644 --- a/Source/Core/InputCommon/CMakeLists.txt +++ b/Source/Core/InputCommon/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(inputcommon +add_library(inputcommon STATIC DynamicInputTextureManager.cpp DynamicInputTextureManager.h GCAdapter.cpp @@ -101,13 +101,20 @@ if(WIN32) ControllerInterface/DInput/XInputFilter.h ControllerInterface/Win32/Win32.cpp ControllerInterface/Win32/Win32.h - ControllerInterface/WGInput/WGInput.cpp - ControllerInterface/WGInput/WGInput.h ControllerInterface/XInput/XInput.cpp ControllerInterface/XInput/XInput.h ControllerInterface/ForceFeedback/ForceFeedbackDevice.cpp ControllerInterface/ForceFeedback/ForceFeedbackDevice.h ) + if(MSVC) + target_sources(inputcommon PRIVATE + ControllerInterface/WGInput/WGInput.cpp + ControllerInterface/WGInput/WGInput.h + ) + else() + target_compile_definitions(inputcommon PRIVATE WINVER=0x0602) + endif() + target_link_libraries(inputcommon PUBLIC cfgmgr32 dinput8) elseif(APPLE) target_sources(inputcommon PRIVATE ControllerInterface/Quartz/Quartz.h diff --git a/Source/Core/VideoBackends/D3D/CMakeLists.txt b/Source/Core/VideoBackends/D3D/CMakeLists.txt index ed75b29b77..ae6e4096eb 100644 --- a/Source/Core/VideoBackends/D3D/CMakeLists.txt +++ b/Source/Core/VideoBackends/D3D/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(videod3d +add_library(videod3d STATIC D3DBase.cpp D3DBase.h D3DBoundingBox.cpp diff --git a/Source/Core/WinUpdater/CMakeLists.txt b/Source/Core/WinUpdater/CMakeLists.txt index 23135d706f..a56f5d2291 100644 --- a/Source/Core/WinUpdater/CMakeLists.txt +++ b/Source/Core/WinUpdater/CMakeLists.txt @@ -12,6 +12,11 @@ target_link_libraries(winupdater PRIVATE Comctl32 ) +target_compile_definitions(winupdater PRIVATE _UNICODE UNICODE) +if(NOT MSVC) + target_link_options(winupdater PRIVATE -municode) +endif() + set_target_properties(winupdater PROPERTIES OUTPUT_NAME "Updater") if(MSVC)