Skip to content

Commit 0262871

Browse files
committed
fix mingw ios build
1 parent ae23633 commit 0262871

File tree

10 files changed

+265
-128
lines changed

10 files changed

+265
-128
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 3.10.2)
55
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
66

77
option(XASH_DEDICATED "Enable dedicated build. Servers must choose this." OFF) # Servers must choose this
8-
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
98

109
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16.0")
1110
option(XASH_PCH "Enable PCH support." OFF)

Xcode-iOS/CSMoE-iOS.xcodeproj/project.pbxproj

Lines changed: 190 additions & 106 deletions
Large diffs are not rendered by default.

Xcode-iOS/Info.plist

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<key>CFBundleDevelopmentRegion</key>
66
<string>en</string>
77
<key>CFBundleDisplayName</key>
8-
<string>CSMoE</string>
8+
<string>柑橘CitruS</string>
99
<key>CFBundleDocumentTypes</key>
1010
<array/>
1111
<key>CFBundleExecutable</key>
@@ -26,6 +26,8 @@
2626
<string>????</string>
2727
<key>CFBundleVersion</key>
2828
<string>1.0</string>
29+
<key>NSBluetoothAlwaysUsageDescription</key>
30+
<string>CSMoE requires bluetooth permission for built-in SDL2 library.</string>
2931
<key>UIFileSharingEnabled</key>
3032
<true/>
3133
<key>UILaunchStoryboardName</key>
@@ -54,8 +56,6 @@
5456
<string>UIInterfaceOrientationPortrait</string>
5557
<string>UIInterfaceOrientationPortraitUpsideDown</string>
5658
</array>
57-
<key>NSBluetoothAlwaysUsageDescription</key>
58-
<string>CSMoE requires bluetooth permission for built-in SDL2 library.</string>
5959
<key>UISupportsDocumentBrowser</key>
6060
<true/>
6161
</dict>

cmake/mingw.toolchain.cmake

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
set(MINGW_PREFIX "/usr/local/Cellar/mingw-w64/8.0.0_3/toolchain-x86_64/mingw" CACHE PATH "MinGW path")
3+
4+
# Target system name
5+
set(CMAKE_SYSTEM_NAME Windows)
6+
7+
# Compilers and utilities
8+
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
9+
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
10+
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
11+
12+
# Croscompiler path
13+
set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${MINGW_PREFIX})
14+
15+
# This helps find_path(), otherwise it's not able to find e.g.
16+
# /usr/x86_64-w64-mingw32/share/cmake/Corrade/. I don't know why it's needed when
17+
# there is already CMAKE_FIND_ROOT_PATH, but probably related to
18+
# http://public.kitware.com/Bug/view.php?id=14337
19+
set(CMAKE_PREFIX_PATH ${MINGW_PREFIX})
20+
21+
# Find executables in root path, libraries and includes are in crosscompiler
22+
# path
23+
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
24+
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
25+
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
26+
27+
# Directories where to search for DLLs
28+
set(DLL_SEARCH_PATH
29+
${MINGW_PREFIX}/lib
30+
${MINGW_PREFIX}/bin)
31+
32+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static")
33+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")

engine/CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,10 @@ if(MINGW OR LINUX)
391391
add_definitions(-DGDB_BREAK)
392392
elseif(WIN32 AND NOT XASH_64BIT)
393393
add_definitions( -DDBGHELP ) # dbghelp crashhandler
394-
if(MINGW)
395-
target_link_libraries(${XASH_ENGINE} -luser32 -lkernel32 -lgdi32 -ldbghelp -lpsapi)
396-
endif()
394+
endif()
395+
396+
if(MINGW)
397+
target_link_libraries(${XASH_ENGINE} -luser32 -lkernel32 -lgdi32 -ldbghelp -lpsapi -lcomctl32)
397398
endif()
398399

399400
if(NOT WIN32 OR XASH_64BIT)

engine/client/vid_common.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -996,6 +996,20 @@ void Win_SetDPIAwareness( void )
996996
else MsgDev( D_NOTE, "SetDPIAwareness: Can't load user32.dll\n" );
997997
}
998998
}
999+
1000+
float WIN_GetDpiForWindow(HWND hwnd)
1001+
{
1002+
HMODULE hModule;
1003+
static UINT (__stdcall *pfnGetDpiForWindow)(HWND hwnd) = NULL;
1004+
1005+
if( ( hModule = LoadLibrary( "user32.dll" ) ) ) {
1006+
if (pfnGetDpiForWindow || (pfnGetDpiForWindow = ( UINT (__stdcall *)(HWND) )(GetProcAddress(hModule, "GetDpiForWindow")))) {
1007+
return pfnGetDpiForWindow(hwnd);
1008+
}
1009+
}
1010+
return 96.0f;
1011+
}
1012+
9991013
#endif
10001014

10011015
/*

engine/platform/sdl/vid_sdl.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,8 @@ qboolean VID_GetDPI(float* out)
577577
SDL_GetWindowWMInfo(host.hWnd, &wmInfo);
578578
{
579579
HWND hwnd = wmInfo.info.win.window;
580-
int res = GetDpiForWindow(hwnd);
580+
float WIN_GetDpiForWindow(HWND hwnd);
581+
int res = WIN_GetDpiForWindow(hwnd);
581582
if (res)
582583
{
583584
success = true;

engine/platform/win32/ime_win32.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ static void UpdateCandidateList(const CANDIDATELIST* const src, const size_t src
154154
page_size = src->dwPageSize;
155155
}
156156

157-
// それぞれ UTF-8 に変換するためにラムダ関数用意する
157+
// ���줾�� UTF-8 �ˉ�Q���뤿��˥����v�����⤹��
158158
/*
159-
std::wstring std::unique_ptr<char[]> UTF-8 のnull 終端文字列にして変換する
160-
引数が空文字列の場合は nullptr が入る
159+
std::wstring �� std::unique_ptr<char[]> �� UTF-8 ��null �K�������Фˤ��Ɖ�Q����
160+
�������������ФΈ��Ϥ� nullptr �����
161161
*/
162162
static std::string to_utf8(const std::wstring& arg) {
163163
std::string utf8buf;
@@ -282,16 +282,16 @@ static LRESULT CALLBACK ImeWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
282282
}
283283
if (lParam & GCS_COMPSTR) {
284284

285-
/* 一段階目で IME から ワイド文字で文字列をもらってくる */
286-
/* これはバイト単位でやりとりするので、注意 */
285+
/* һ���AĿ�� IME ���� �磻�����֤������Ф���äƤ��� */
286+
/* ����ϥХ��ȅgλ�Ǥ��Ȥꤹ��Τǡ�ע�� */
287287
const DWORD compstr_length_in_byte = ImmGetCompositionStringW(hImc, GCS_COMPSTR, nullptr, 0);
288288
switch (compstr_length_in_byte) {
289289
case IMM_ERROR_NODATA:
290290
case IMM_ERROR_GENERAL:
291291
break;
292292
default:
293293
{
294-
/* バイト単位でもらってきたので、wchar_t 単位に直して、 null文字の余裕を加えてバッファを用意する */
294+
/* �Х��ȅgλ�Ǥ��äƤ����Τǡ�wchar_t �gλ��ֱ���ơ� null���֤���ԣ��Ӥ��ƥХåե������⤹�� */
295295
size_t const buf_length_in_wchar = (size_t(compstr_length_in_byte) / sizeof(wchar_t)) + 1;
296296
assert(0 < buf_length_in_wchar);
297297
std::unique_ptr<wchar_t[]> buf{ new wchar_t[buf_length_in_wchar] };
@@ -312,7 +312,7 @@ static LRESULT CALLBACK ImeWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
312312
std::wstring comp_unconveted;
313313
size_t begin = 0;
314314
size_t end = 0;
315-
// 変換済みを取り出す
315+
// ��Q�g�ߤ�ȡ�����
316316
for (end = begin; end < attribute_end; ++end) {
317317
if ((ATTR_TARGET_CONVERTED == attribute_vec[end] ||
318318
ATTR_TARGET_NOTCONVERTED == attribute_vec[end])) {
@@ -322,9 +322,9 @@ static LRESULT CALLBACK ImeWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
322322
comp_converted.push_back(buf[end]);
323323
}
324324
}
325-
// 変換済みの領域[begin,end)
325+
// ��Q�g�ߤ��I��[begin,end)
326326

327-
// 変換中の文字列を取り出す
327+
// ��Q�Ф������Ф�ȡ�����
328328
for (begin = end; end < attribute_end; ++end) {
329329
if (!(ATTR_TARGET_CONVERTED == attribute_vec[end] ||
330330
ATTR_TARGET_NOTCONVERTED == attribute_vec[end])) {
@@ -334,9 +334,9 @@ static LRESULT CALLBACK ImeWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
334334
comp_target.push_back(buf[end]);
335335
}
336336
}
337-
// 変換中の領域 [begin,end)
337+
// ��Q���I�� [begin,end)
338338

339-
// 未変換の文字列を取り出す
339+
// δ��Q�������Ф�ȡ�����
340340
for (; end < attribute_end; ++end) {
341341
comp_unconveted.push_back(buf[end]);
342342
}
@@ -353,9 +353,9 @@ static LRESULT CALLBACK ImeWndProc(HWND hWnd, UINT uMsg, WPARAM wParam,
353353
OnIMEChangeCandidates();
354354
}
355355
#if defined( UNICODE )
356-
// UNICODE 構成の時には、DefWindowProc で直接IMEに吸収させて大丈夫
356+
// UNICODE ���ɤΕr�ˤϡ�DefWindowProc ��ֱ��IME�����������ƴ��ɷ�
357357
return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
358-
// マルチバイト 構成の時には、Window サブクラスの プロシージャが処理するので、 DefSubclassProc する必要がある。
358+
// �ޥ���Х��� ���ɤΕr�ˤϡ�Window ���֥��饹�� �ץ��`���㤬�I����Τǡ� DefSubclassProc �����Ҫ�����롣
359359
#else
360360
return ::DefSubclassProc(hWnd, uMsg, wParam, lParam);
361361
#endif

game_launch/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ elseif(APPLE)
9898

9999
set(CPACK_GENERATOR "DragNDrop")
100100
set(CPACK_PACKAGE_VENDOR "MoeMod")
101-
set(CPACK_PACKAGE_FILE_NAME "CSMoE-macOS-${CMAKE_SYSTEM_PROCESSOR}")
101+
if(CMAKE_OSX_ARCHITECTURES)
102+
set(CPACK_PACKAGE_FILE_NAME "CSMoE-macOS-Universal")
103+
else()
104+
set(CPACK_PACKAGE_FILE_NAME "CSMoE-macOS-${CMAKE_SYSTEM_PROCESSOR}")
105+
endif()
102106
set(CPACK_DMG_VOLUME_NAME "CSMoE")
103107
set(CPACK_DMG_FORMAT "UDBZ") #UDRW UDBZ
104108
set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_SOURCE_DIR}/cmake/DragNDrop/background.png")

game_launch/xash_static.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include <SDL.h>
22
#include <vector>
3+
#include <algorithm>
34
#include <iterator>
45
#if _WIN32
56
#include <Windows.h>

0 commit comments

Comments
 (0)