Skip to content

Commit

Permalink
add macos workflow, fix filesystem_async max thread count
Browse files Browse the repository at this point in the history
  • Loading branch information
nillerusr committed Apr 24, 2023
1 parent 231c1e1 commit 0114bd7
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 30 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,21 @@ jobs:
- name: Build dedicated linux-amd64
run: |
scripts/build-ubuntu-amd64.sh -d
build-macos-amd64:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Build macos-amd64
run: |
scripts/build-macos-amd64.sh
build-dedicated-macos-amd64:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Build dedicated macos-amd64
run: |
scripts/build-macos-amd64.sh -d
9 changes: 9 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ jobs:
run: |
scripts/tests-ubuntu-amd64.sh
tests-macos-amd64:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Run tests macos-amd64
run: |
scripts/tests-macos-amd64.sh
tests-windows-i386:
runs-on: windows-2019

Expand Down
2 changes: 1 addition & 1 deletion appframework/sdlmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2224,7 +2224,7 @@ GLMDisplayDB *CSDLMgr::GetDisplayDB( void )
}

#ifndef OSX
# include "glmdisplaydb_linuxwin.inl"
#include "glmdisplaydb_linuxwin.inl"
#endif


Expand Down
9 changes: 4 additions & 5 deletions appframework/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ def build(bld):
source += [
'sdlmgr.cpp'
]

if bld.env.DEST_OS == 'darwin':
source += [
'glmrendererinfo_osx.mm'
]

if bld.env.DEST_OS == 'darwin' and bld.env.GL:
source += ['glmrendererinfo_osx.mm']


if bld.env.DEST_OS == 'win32':
source += [
Expand Down
11 changes: 5 additions & 6 deletions filesystem/filesystem_async.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,16 +659,16 @@ void CBaseFileSystem::InitAsync()
Msg( "Async I/O disabled from command line\n" );
return;
}

#ifndef UNITTESTS
if ( VCRGetMode() == VCR_Disabled )
#endif
{
// create the i/o thread pool
m_pThreadPool = CreateThreadPool();

ThreadPoolStartParams_t params;
params.iThreadPriority = 0;
params.bIOThreads = true;
params.nThreadsMax = 4; // Limit count of IO threads to a maximum of 4.
if ( IsX360() )
{
// override defaults
Expand All @@ -678,11 +678,10 @@ void CBaseFileSystem::InitAsync()
params.bUseAffinityTable = true;
params.iAffinityTable[0] = XBOX_PROCESSOR_3;
}
else if( IsPC() )
else
{
// override defaults
// maximum # of async I/O thread on PC is 2
params.nThreads = 1;
params.nThreadsMax = MIN(params.nThreads, 4); // Limit count of IO threads to a maximum of 4.
params.nStackSize = 256*1024;
}

if ( !m_pThreadPool->Start( params, "IOJob" ) )
Expand Down
8 changes: 8 additions & 0 deletions scripts/build-macos-amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh

git submodule init && git submodule update

brew install sdl2

./waf configure -T debug --64bits --disable-warns $* &&
./waf build
7 changes: 7 additions & 0 deletions scripts/tests-macos-amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

git submodule init && git submodule update
./waf configure -T release --sanitize=address,undefined --disable-warns --tests -8 --prefix=out/ $* &&
./waf install &&
cd out &&
DYLD_LIBRARY_PATH=bin/ ./unittest || exit 1
40 changes: 22 additions & 18 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,17 @@ def define_platform(conf):
conf.env.DEDICATED = conf.options.DEDICATED
conf.env.TESTS = conf.options.TESTS
conf.env.TOGLES = conf.options.TOGLES
conf.env.GL = conf.options.GL
conf.env.GL = conf.options.GL and not conf.options.TESTS and not conf.options.DEDICATED
conf.env.OPUS = conf.options.OPUS

if conf.options.DEDICATED:
conf.options.SDL = False
# conf.options.GL = False
conf.define('DEDICATED', 1)

if conf.options.GL and not conf.options.TESTS:
if conf.options.TESTS:
conf.define('UNITTESTS', 1)

if conf.options.GL:
conf.env.append_unique('DEFINES', [
'DX_TO_GL_ABSTRACTION',
'GL_GLEXT_PROTOTYPES',
Expand All @@ -177,6 +179,9 @@ def define_platform(conf):
if conf.options.TOGLES:
conf.env.append_unique('DEFINES', ['TOGLES'])

if conf.options.TESTS:
conf.define('UNITTESTS', 1)

if conf.options.SDL and not conf.options.TESTS:
conf.env.SDL = 1
conf.define('USE_SDL', 1)
Expand Down Expand Up @@ -323,6 +328,20 @@ def check_deps(conf):
for i in a:
conf.check_cc(lib = i)

if conf.env.DEST_OS == "darwin":
conf.check(lib='iconv', uselib_store='ICONV')
conf.env.FRAMEWORK_APPKIT = "AppKit"
conf.env.FRAMEWORK_IOKIT = "IOKit"
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
conf.env.FRAMEWORK_OPENGL = "OpenGL"
conf.env.FRAMEWORK_CARBON = "Carbon"
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"

if conf.options.TESTS:
return
Expand Down Expand Up @@ -361,21 +380,6 @@ def check_deps(conf):
conf.check(lib='android_support', uselib_store='ANDROID_SUPPORT')
conf.check(lib='opus', uselib_store='OPUS')

if conf.env.DEST_OS == "darwin":
conf.check(lib='iconv', uselib_store='ICONV')
conf.env.FRAMEWORK_APPKIT = "AppKit"
conf.env.FRAMEWORK_IOKIT = "IOKit"
conf.env.FRAMEWORK_FOUNDATION = "Foundation"
conf.env.FRAMEWORK_COREFOUNDATION = "CoreFoundation"
conf.env.FRAMEWORK_COREGRAPHICS = "CoreGraphics"
conf.env.FRAMEWORK_OPENGL = "OpenGL"
conf.env.FRAMEWORK_CARBON = "Carbon"
conf.env.FRAMEWORK_APPLICATIONSERVICES = "ApplicationServices"
conf.env.FRAMEWORK_CORESERVICES = "CoreServices"
conf.env.FRAMEWORK_COREAUDIO = "CoreAudio"
conf.env.FRAMEWORK_AUDIOTOOLBOX = "AudioToolbox"
conf.env.FRAMEWORK_SYSTEMCONFIGURATION = "SystemConfiguration"

if conf.env.DEST_OS == 'win32':
conf.check(lib='libz', uselib_store='ZLIB', define_name='USE_ZLIB')
# conf.check(lib='nvtc', uselib_store='NVTC')
Expand Down

0 comments on commit 0114bd7

Please sign in to comment.