From 2cb79fef5a0d380c1ba8c185dd6f3c9455f7a6c2 Mon Sep 17 00:00:00 2001 From: k3tamina Date: Mon, 30 May 2022 22:14:59 +0200 Subject: [PATCH] MinGW fixes CMakeLists.txt * Added definition of SDL_MAIN_HANDLED to solve linking error src/dsound_compat.h * Included mmsystem.h for LPCWAVEFORMATEX struct definition src/file_find.cc * FindClose is within Win32 API src/mmx.cc * __asm keyword is restricted to MSVC --- CMakeLists.txt | 1 + src/dsound_compat.h | 1 + src/file_find.cc | 2 +- src/mmx.cc | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 549d470..3dd60d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -272,3 +272,4 @@ target_include_directories(${EXECUTABLE_NAME} PRIVATE ${ZLIB_INCLUDE_DIRS}) target_link_libraries(${EXECUTABLE_NAME} ${SDL2_LIBRARIES}) target_include_directories(${EXECUTABLE_NAME} PRIVATE ${SDL2_INCLUDE_DIRS}) +add_definitions(-DSDL_MAIN_HANDLED) diff --git a/src/dsound_compat.h b/src/dsound_compat.h index e484d60..b24a4b2 100644 --- a/src/dsound_compat.h +++ b/src/dsound_compat.h @@ -9,6 +9,7 @@ #include #include +#include #define DIRECTSOUND_VERSION 0x0300 #include diff --git a/src/file_find.cc b/src/file_find.cc index 59c3f13..5bf72de 100644 --- a/src/file_find.cc +++ b/src/file_find.cc @@ -47,7 +47,7 @@ bool fileFindNext(DirectoryFileFindData* findData) // 0x4E63CC bool findFindClose(DirectoryFileFindData* findData) { -#if defined(_MSC_VER) +#if defined(_WIN32) FindClose(findData->hFind); #else if (closedir(findData->dir) != 0) { diff --git a/src/mmx.cc b/src/mmx.cc index d469fd5..d0bda0b 100644 --- a/src/mmx.cc +++ b/src/mmx.cc @@ -13,7 +13,7 @@ bool mmxIsSupported() // TODO: There are other ways to determine MMX using FLAGS register. -#ifdef _WIN32 +#if defined (_MSC_VER) __asm { mov eax, 1