Windows: Fix compilation woes from last commit

This commit is contained in:
Vicki Pfau 2024-03-04 21:52:25 -08:00
parent 3571b112dc
commit c541a79e95
3 changed files with 13 additions and 8 deletions

View File

@ -16,6 +16,19 @@
CXX_GUARD_START CXX_GUARD_START
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
// Require Windows 7 or newer
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#elif _WIN32_WINNT < 0x0601
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
#endif
// WinSock2 gets very angry if it's included too late
#include <winsock2.h>
#endif
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <fcntl.h> #include <fcntl.h>
@ -31,11 +44,6 @@ CXX_GUARD_START
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#ifdef _WIN32
// WinSock2 gets very angry if it's included too late
#include <winsock2.h>
#endif
#if defined(_MSC_VER) || defined(__cplusplus) #if defined(_MSC_VER) || defined(__cplusplus)
#define restrict __restrict #define restrict __restrict
#endif #endif

View File

@ -8,8 +8,6 @@
#include <mgba-util/common.h> #include <mgba-util/common.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define THREAD_ENTRY DWORD WINAPI #define THREAD_ENTRY DWORD WINAPI
typedef THREAD_ENTRY ThreadEntry(LPVOID); typedef THREAD_ENTRY ThreadEntry(LPVOID);
#define THREAD_EXIT(RES) return RES #define THREAD_EXIT(RES) return RES

View File

@ -125,7 +125,6 @@ target_link_libraries(${BINARY_NAME}-sdl ${BINARY_NAME} ${PLATFORM_LIBRARY} ${OP
if(NOT WIN32) if(NOT WIN32)
set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME}) set_target_properties(${BINARY_NAME}-sdl PROPERTIES OUTPUT_NAME ${BINARY_NAME})
else() else()
target_compile_definitions(${BINARY_NAME}-sdl PRIVATE _WIN32_WINNT=0x0600)
set_target_properties(${BINARY_NAME}-sdl PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") set_target_properties(${BINARY_NAME}-sdl PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
endif() endif()
install(TARGETS ${BINARY_NAME}-sdl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-sdl) install(TARGETS ${BINARY_NAME}-sdl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${BINARY_NAME}-sdl)