Skip to content

Commit f2fa241

Browse files
committed
add macos workflow, fix filesystem_async max thread count
1 parent 231c1e1 commit f2fa241

File tree

12 files changed

+79
-45
lines changed

12 files changed

+79
-45
lines changed

.github/workflows/build.yml

+18
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,21 @@ jobs:
9191
- name: Build dedicated linux-amd64
9292
run: |
9393
scripts/build-ubuntu-amd64.sh -d
94+
95+
build-macos-amd64:
96+
runs-on: macos-latest
97+
98+
steps:
99+
- uses: actions/checkout@v2
100+
- name: Build macos-amd64
101+
run: |
102+
scripts/build-macos-amd64.sh
103+
104+
build-dedicated-macos-amd64:
105+
runs-on: macos-latest
106+
107+
steps:
108+
- uses: actions/checkout@v2
109+
- name: Build dedicated macos-amd64
110+
run: |
111+
scripts/build-macos-amd64.sh -d

.github/workflows/tests.yml

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ jobs:
2121
run: |
2222
scripts/tests-ubuntu-amd64.sh
2323
24+
tests-macos-amd64:
25+
runs-on: macos-latest
26+
27+
steps:
28+
- uses: actions/checkout@v2
29+
- name: Run tests macos-amd64
30+
run: |
31+
scripts/tests-macos-amd64.sh
32+
2433
tests-windows-i386:
2534
runs-on: windows-2019
2635

appframework/sdlmgr.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2224,7 +2224,7 @@ GLMDisplayDB *CSDLMgr::GetDisplayDB( void )
22242224
}
22252225

22262226
#ifndef OSX
2227-
# include "glmdisplaydb_linuxwin.inl"
2227+
#include "glmdisplaydb_linuxwin.inl"
22282228
#endif
22292229

22302230

appframework/wscript

+4-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ def build(bld):
2424
source += [
2525
'sdlmgr.cpp'
2626
]
27-
28-
if bld.env.DEST_OS == 'darwin':
29-
source += [
30-
'glmrendererinfo_osx.mm'
31-
]
27+
28+
if bld.env.DEST_OS == 'darwin' and bld.env.GL:
29+
source += ['glmrendererinfo_osx.mm']
30+
3231

3332
if bld.env.DEST_OS == 'win32':
3433
source += [

bitmap/ImageByteSwap.cpp

+3-11
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,7 @@ namespace ImageLoader
8888

8989
Assert( IsFormatValidForConversion( imageFormat ) );
9090

91-
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK )
92-
if ( IsPC() )
93-
{
94-
// running as a win32 tool, data is in expected order
95-
// for conversion code
96-
return;
97-
}
98-
91+
#ifdef _X360
9992
// running on 360 and converting, input data must be x86 order
10093
// swap to ensure conversion code gets valid data
10194
XGENDIANTYPE xEndian;
@@ -137,7 +130,7 @@ namespace ImageLoader
137130
{
138131
Assert( IsFormatValidForConversion( imageFormat ) );
139132

140-
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK )
133+
#ifdef _X360
141134
// It would have been nice to use the 360 D3DFORMAT bit encodings, but the codes
142135
// are different for win32, and this routine is used by a win32 library to
143136
// manipulate 360 data, so there can be no reliance on D3DFORMAT bits
@@ -201,7 +194,7 @@ namespace ImageLoader
201194
{
202195
Assert( IsFormatValidForConversion( imageFormat ) );
203196

204-
#if !defined( DX_TO_GL_ABSTRACTION ) && !defined( NO_X360_XDK )
197+
#ifdef _X360
205198
XGENDIANTYPE xEndian;
206199
switch ( imageFormat )
207200
{
@@ -256,5 +249,4 @@ namespace ImageLoader
256249
}
257250
#endif
258251
}
259-
260252
}

bitmap/imageformat.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,11 @@ int GetNumMipMapLevels( int width, int height, int depth )
288288
// Turn off warning about FOURCC formats below...
289289
#pragma warning (disable:4063)
290290

291-
#ifdef DX_TO_GL_ABSTRACTION
292291
#ifndef MAKEFOURCC
293292
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
294293
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
295294
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
296295
#endif //defined(MAKEFOURCC)
297-
#endif
298296
//-----------------------------------------------------------------------------
299297
// convert back and forth from D3D format to ImageFormat, regardless of
300298
// whether it's supported or not

filesystem/filesystem_async.cpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -659,16 +659,16 @@ void CBaseFileSystem::InitAsync()
659659
Msg( "Async I/O disabled from command line\n" );
660660
return;
661661
}
662-
662+
#ifndef UNITTESTS
663663
if ( VCRGetMode() == VCR_Disabled )
664+
#endif
664665
{
665666
// create the i/o thread pool
666667
m_pThreadPool = CreateThreadPool();
667668

668669
ThreadPoolStartParams_t params;
669670
params.iThreadPriority = 0;
670671
params.bIOThreads = true;
671-
params.nThreadsMax = 4; // Limit count of IO threads to a maximum of 4.
672672
if ( IsX360() )
673673
{
674674
// override defaults
@@ -678,11 +678,10 @@ void CBaseFileSystem::InitAsync()
678678
params.bUseAffinityTable = true;
679679
params.iAffinityTable[0] = XBOX_PROCESSOR_3;
680680
}
681-
else if( IsPC() )
681+
else
682682
{
683-
// override defaults
684-
// maximum # of async I/O thread on PC is 2
685-
params.nThreads = 1;
683+
params.nThreadsMax = MIN(params.nThreads, 4); // Limit count of IO threads to a maximum of 4.
684+
params.nStackSize = 256*1024;
686685
}
687686

688687
if ( !m_pThreadPool->Start( params, "IOJob" ) )

scripts/build-macos-amd64.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
git submodule init && git submodule update
4+
5+
brew install sdl2
6+
7+
./waf configure -T debug --64bits --disable-warns $* &&
8+
./waf build

scripts/tests-macos-amd64.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/sh
2+
3+
git submodule init && git submodule update
4+
./waf configure -T release --sanitize=address,undefined --disable-warns --tests -8 --prefix=out/ $* &&
5+
./waf install &&
6+
cd out &&
7+
DYLD_LIBRARY_PATH=bin/ ./unittest || exit 1

tier2/renderutils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "materialsystem/imaterial.h"
1313
#include "tier0/vprof.h"
1414
#include "tier0/basetypes.h"
15-
#ifndef DEDICATED
15+
#ifdef DX_TO_GL_ABSTRACTION
1616
#include "togl/rendermechanism.h"
1717
#endif
1818

utils/unittest/unittest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ bool CUnitTestApp::Create()
128128
while ((dir = readdir(d)) != NULL)
129129
{
130130
int len = strlen(dir->d_name);
131-
if( len > 2 && strcmp(dir->d_name+len-3, ".so") == 0)
131+
if( len > 2 && strcmp(dir->d_name+len-strlen(DLL_EXT_STRING), DLL_EXT_STRING) == 0)
132132
{
133133
static char path[2048];
134134
snprintf(path, sizeof(path), "tests/%s", dir->d_name);

wscript

+22-18
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,17 @@ def define_platform(conf):
159159
conf.env.DEDICATED = conf.options.DEDICATED
160160
conf.env.TESTS = conf.options.TESTS
161161
conf.env.TOGLES = conf.options.TOGLES
162-
conf.env.GL = conf.options.GL
162+
conf.env.GL = conf.options.GL and not conf.options.TESTS and not conf.options.DEDICATED
163163
conf.env.OPUS = conf.options.OPUS
164164

165165
if conf.options.DEDICATED:
166166
conf.options.SDL = False
167-
# conf.options.GL = False
168167
conf.define('DEDICATED', 1)
169168

170-
if conf.options.GL and not conf.options.TESTS:
169+
if conf.options.TESTS:
170+
conf.define('UNITTESTS', 1)
171+
172+
if conf.env.GL:
171173
conf.env.append_unique('DEFINES', [
172174
'DX_TO_GL_ABSTRACTION',
173175
'GL_GLEXT_PROTOTYPES',
@@ -177,6 +179,9 @@ def define_platform(conf):
177179
if conf.options.TOGLES:
178180
conf.env.append_unique('DEFINES', ['TOGLES'])
179181

182+
if conf.options.TESTS:
183+
conf.define('UNITTESTS', 1)
184+
180185
if conf.options.SDL and not conf.options.TESTS:
181186
conf.env.SDL = 1
182187
conf.define('USE_SDL', 1)
@@ -323,6 +328,20 @@ def check_deps(conf):
323328
for i in a:
324329
conf.check_cc(lib = i)
325330

331+
if conf.env.DEST_OS == "darwin":
332+
conf.check(lib='iconv', uselib_store='ICONV')
333+
conf.env.FRAMEWORK_APPKIT = "AppKit"
334+
conf.env.FRAMEWORK_IOKIT = "IOKit"
335+
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
336+
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
337+
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
338+
conf.env.FRAMEWORK_OPENGL = "OpenGL"
339+
conf.env.FRAMEWORK_CARBON = "Carbon"
340+
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
341+
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
342+
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
343+
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
344+
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"
326345

327346
if conf.options.TESTS:
328347
return
@@ -361,21 +380,6 @@ def check_deps(conf):
361380
conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT')
362381
conf.check(lib='opus', uselib_store='OPUS')
363382

364-
if conf.env.DEST_OS == "darwin":
365-
conf.check(lib='iconv', uselib_store='ICONV')
366-
conf.env.FRAMEWORK_APPKIT = "AppKit"
367-
conf.env.FRAMEWORK_IOKIT = "IOKit"
368-
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
369-
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
370-
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
371-
conf.env.FRAMEWORK_OPENGL = "OpenGL"
372-
conf.env.FRAMEWORK_CARBON = "Carbon"
373-
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
374-
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
375-
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
376-
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
377-
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"
378-
379383
if conf.env.DEST_OS == 'win32':
380384
conf.check(lib='libz', uselib_store='ZLIB', define_name='USE_ZLIB')
381385
# conf.check(lib='nvtc', uselib_store='NVTC')

0 commit comments

Comments
 (0)