diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c29e52e6..39c8aadd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c21d0a55a..d8adc5ab0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -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 diff --git a/appframework/sdlmgr.cpp b/appframework/sdlmgr.cpp index bad06f1b5..dd5ee2c23 100644 --- a/appframework/sdlmgr.cpp +++ b/appframework/sdlmgr.cpp @@ -2224,7 +2224,7 @@ GLMDisplayDB *CSDLMgr::GetDisplayDB( void ) } #ifndef OSX -# include "glmdisplaydb_linuxwin.inl" +#include "glmdisplaydb_linuxwin.inl" #endif diff --git a/appframework/wscript b/appframework/wscript index 0fea261a1..f8ded3183 100755 --- a/appframework/wscript +++ b/appframework/wscript @@ -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 += [ diff --git a/filesystem/filesystem_async.cpp b/filesystem/filesystem_async.cpp index 769ed017c..493b1b705 100644 --- a/filesystem/filesystem_async.cpp +++ b/filesystem/filesystem_async.cpp @@ -659,8 +659,9 @@ 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(); @@ -668,7 +669,6 @@ void CBaseFileSystem::InitAsync() 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 @@ -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" ) ) diff --git a/scripts/build-macos-amd64.sh b/scripts/build-macos-amd64.sh new file mode 100755 index 000000000..de0e8cfd1 --- /dev/null +++ b/scripts/build-macos-amd64.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +git submodule init && git submodule update + +brew install sdl2 + +./waf configure -T debug --64bits --disable-warns $* && +./waf build diff --git a/scripts/tests-macos-amd64.sh b/scripts/tests-macos-amd64.sh new file mode 100755 index 000000000..ff4e46b27 --- /dev/null +++ b/scripts/tests-macos-amd64.sh @@ -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 diff --git a/wscript b/wscript index 7441473c2..d41481e9f 100644 --- a/wscript +++ b/wscript @@ -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', @@ -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) @@ -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 @@ -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')