1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-30 08:24:05 +00:00

Fix building zilmar-spec with cmake with mingw

This commit is contained in:
Rosalie Wanders 2021-07-22 23:17:44 +02:00 committed by Sergey Lipskiy
parent 4a55160770
commit 1ad662092d
6 changed files with 34 additions and 17 deletions

View File

@ -135,7 +135,7 @@ set(GLideNUI_SOURCES
GLideNUI/icon.qrc
)
if(MUPENPLUSAPI_GLIDENUI)
if(MUPENPLUSAPI_GLIDENUI OR NOT MUPENPLUSAPI)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
@ -144,10 +144,16 @@ if(MUPENPLUSAPI_GLIDENUI)
set(GLIDENUI_LIBRARIES
Qt5::Widgets Qt5::Core Qt5::Gui
)
list(APPEND GLideNUI_SOURCES
GLideNUI/fullscreenresolutions_mupen64plus.cpp
)
endif(MUPENPLUSAPI_GLIDENUI)
if (MUPENPLUSAPI)
list(APPEND GLideNUI_SOURCES
GLideNUI/fullscreenresolutions_mupen64plus.cpp
)
else()
list(APPEND GLideNUI_SOURCES
GLideNUI/fullscreenresolutions_windows.cpp
)
endif()
endif()
#check if we're running on Raspberry Pi
if(EXISTS "${CMAKE_FIND_ROOT_PATH}/opt/vc/include/bcm_host.h" AND NOT MESA)
@ -208,15 +214,17 @@ else(MUPENPLUSAPI)
if(UNIX)
message(FATAL_ERROR "UNIX build requires MUPENPLUSAPI!")
endif(UNIX)
include_directories( . inc )
set(GLideN64_SOURCES_WIN
ZilmarPluginAPI.cpp
GLideNUI/Config_GLideNUI.cpp
windows/CommonAPIImpl_windows.cpp
windows/GLideN64_windows.cpp
windows/MemoryStatus_windows.cpp
common/GLFunctions.cpp
windows/ZilmarAPIImpl_windows.cpp
Graphics/OpenGLContext/windows/windows_DisplayWindow.cpp
Graphics/OpenGLContext/windows/WindowsWGL.cpp
${GLideNUI_SOURCES}
)
set(GLideN64_DLL_NAME GLideN64)
endif(MUPENPLUSAPI)
@ -253,6 +261,9 @@ if(MINGW)
add_definitions(
-DMINGW
)
if (NOT MUPENPLUSAPI)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static")
endif()
endif(MINGW)
if(WIN32)
@ -362,6 +373,11 @@ if(ANDROID)
set(FREETYPE_LIBRARIES ANDROID_FREETYPE)
else(ANDROID)
FIND_PACKAGE( Freetype REQUIRED )
# presume a qt build linked to freetype
# will be used with mingw
if (NOT MUPENPLUSAPI AND MINGW)
set(FREETYPE_LIBRARIES "")
endif()
endif(ANDROID)
include_directories( ${FREETYPE_INCLUDE_DIRS} )

View File

@ -1,6 +1,7 @@
#include <windows.h>
#include <QObject>
#include <stdio.h>
#include <math.h>
#include "FullscreenResolutions.h"
#include "../Config.h"

View File

@ -35,30 +35,30 @@ bool WindowsWGL::start()
hWnd = GetActiveWindow();
if ((hDC = GetDC(hWnd)) == NULL) {
MessageBox(hWnd, L"Error while getting a device context!", pluginNameW, MB_ICONERROR | MB_OK);
MessageBoxW(hWnd, L"Error while getting a device context!", pluginNameW, MB_ICONERROR | MB_OK);
return false;
}
if ((pixelFormat = ChoosePixelFormat(hDC, &pfd)) == 0) {
MessageBox(hWnd, L"Unable to find a suitable pixel format!", pluginNameW, MB_ICONERROR | MB_OK);
MessageBoxW(hWnd, L"Unable to find a suitable pixel format!", pluginNameW, MB_ICONERROR | MB_OK);
stop();
return false;
}
if ((SetPixelFormat(hDC, pixelFormat, &pfd)) == FALSE) {
MessageBox(hWnd, L"Error while setting pixel format!", pluginNameW, MB_ICONERROR | MB_OK);
MessageBoxW(hWnd, L"Error while setting pixel format!", pluginNameW, MB_ICONERROR | MB_OK);
stop();
return false;
}
if ((hRC = wglCreateContext(hDC)) == NULL) {
MessageBox(hWnd, L"Error while creating OpenGL context!", pluginNameW, MB_ICONERROR | MB_OK);
MessageBoxW(hWnd, L"Error while creating OpenGL context!", pluginNameW, MB_ICONERROR | MB_OK);
stop();
return false;
}
if ((wglMakeCurrent(hDC, hRC)) == FALSE) {
MessageBox(hWnd, L"Error while making OpenGL context current!", pluginNameW, MB_ICONERROR | MB_OK);
MessageBoxW(hWnd, L"Error while making OpenGL context current!", pluginNameW, MB_ICONERROR | MB_OK);
stop();
return false;
}

View File

@ -118,7 +118,7 @@ void DisplayWindowWindows::_changeWindow()
fullscreenMode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
if (ChangeDisplaySettings( &fullscreenMode, CDS_FULLSCREEN ) != DISP_CHANGE_SUCCESSFUL) {
MessageBox( NULL, L"Failed to change display mode", pluginNameW, MB_ICONERROR | MB_OK );
MessageBoxW( NULL, L"Failed to change display mode", pluginNameW, MB_ICONERROR | MB_OK );
return;
}

View File

@ -67,7 +67,7 @@ EXPORT int CALL osal_is_directory(const wchar_t* _name)
namelen = wcslen(DirName);
if (namelen > 0 && DirName[namelen - 1] == OSAL_DIR_SEPARATOR_CHAR)
DirName[namelen - 1] = L'\0';
return (GetFileAttributes(DirName) & FILE_ATTRIBUTE_DIRECTORY);
return (GetFileAttributesW(DirName) & FILE_ATTRIBUTE_DIRECTORY);
}
EXPORT int CALL osal_mkdirp(const wchar_t * dirpath)
@ -108,7 +108,7 @@ EXPORT int CALL osal_mkdirp(const wchar_t * dirpath)
typedef struct {
HANDLE hFind;
WIN32_FIND_DATA find_data;
WIN32_FIND_DATAW find_data;
} dir_search_info;
EXPORT void * CALL osal_search_dir_open(const wchar_t *pathname)
@ -128,7 +128,7 @@ EXPORT void * CALL osal_search_dir_open(const wchar_t *pathname)
swprintf(SearchString, MAX_PATH, L"%ls%ls*", pathname, OSAL_DIR_SEPARATOR_STR);
SearchString[MAX_PATH] = 0;
pInfo->hFind = FindFirstFile(SearchString, &pInfo->find_data);
pInfo->hFind = FindFirstFileW(SearchString, &pInfo->find_data);
return (void *) pInfo;
}
@ -142,7 +142,7 @@ EXPORT const wchar_t * CALL osal_search_dir_read_next(void * search_info)
wcscpy(last_filename, pInfo->find_data.cFileName);
if (FindNextFile(pInfo->hFind, &pInfo->find_data) == 0)
if (FindNextFileW(pInfo->hFind, &pInfo->find_data) == 0)
{
pInfo->find_data.cFileName[0] = 0;
}

View File

@ -34,7 +34,7 @@ void PluginAPI::FindPluginPath(wchar_t * _strPath)
{
if (_strPath == NULL)
return;
::GetModuleFileName((HINSTANCE)&__ImageBase, _strPath, PLUGIN_PATH_SIZE);
::GetModuleFileNameW((HINSTANCE)&__ImageBase, _strPath, PLUGIN_PATH_SIZE);
std::wstring pluginPath(_strPath);
std::replace(pluginPath.begin(), pluginPath.end(), L'\\', L'/');
std::wstring::size_type pos = pluginPath.find_last_of(L"/");