Skip to content

Commit c2cdd88

Browse files
authored
Merge pull request #142 from exstrim401/macos
macOS build support
2 parents cb0e405 + d8580d5 commit c2cdd88

File tree

27 files changed

+187
-149
lines changed

27 files changed

+187
-149
lines changed

appframework/wscript

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ def build(bld):
1818
source = [
1919
'AppSystemGroup.cpp',
2020
'../public/filesystem_init.cpp',
21-
# 'glmrendererinfo_osx.mm' [$OSXALL]
2221
]
2322

2423
if bld.env.SDL:
2524
source += [
2625
'sdlmgr.cpp'
2726
]
27+
28+
if bld.env.DEST_OS == 'darwin':
29+
source += [
30+
'glmrendererinfo_osx.mm'
31+
]
2832

2933
if bld.env.DEST_OS == 'win32':
3034
source += [

engine/wscript

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def configure(conf):
1515
if conf.options.DEDICATED:
1616
conf.define('SWDS', 1)
1717
conf.define('NO_STEAM', 1)
18+
else:
19+
if conf.env.DEST_OS == 'darwin':
20+
conf.define('HAVE_OPENAL', 1)
1821

1922
conf.env.append_unique('DEFINES',[
2023
'__USEA3D',
@@ -204,9 +207,17 @@ def build(bld):
204207

205208
if bld.env.SDL:
206209
source += [
207-
'audio/snd_dev_sdl.cpp', #[$SDL && !$OSXALL]
208210
'audio/voice_record_sdl.cpp' #[$OSXALL||$LINUXALL]
209211
]
212+
if bld.env.DEST_OS != "darwin":
213+
source += ['audio/snd_dev_sdl.cpp']
214+
215+
if bld.env.DEST_OS == 'darwin':
216+
source += [
217+
'audio/snd_dev_openal.cpp', # [$OSXALL]
218+
'audio/snd_dev_mac_audioqueue.cpp',# [$OSXALL]
219+
'audio/voice_record_mac_audioqueue.cpp', #[$OSXALL]
220+
]
210221

211222
if bld.env.DEST_OS == 'win32':
212223
source += [
@@ -352,6 +363,8 @@ def build(bld):
352363
libs += ['SSL', 'CRYPTO'] # android curl was built with openssl
353364
elif bld.env.DEST_OS == 'win32':
354365
libs += ['USER32', 'WINMM', 'WININET', 'DSOUND', 'DXGUID', 'GDI32', 'bzip2']
366+
elif bld.env.DEST_OS == 'darwin':
367+
libs += ['APPKIT', 'COREAUDIO', 'AUDIOTOOLBOX', 'SYSTEMCONFIGURATION']
355368

356369
install_path = bld.env.LIBDIR
357370

launcher/wscript

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def build(bld):
4545

4646
if bld.env.DEST_OS == 'win32':
4747
libs += ['USER32', 'OLE32', 'SHELL32']
48+
elif bld.env.DEST_OS == 'darwin':
49+
libs += ['FOUNDATION', 'APPKIT', 'IOKIT']
4850

4951
install_path = bld.env.LIBDIR
5052

mathlib/3dnow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// memdbgon must be the last include file in a .cpp file!!!
1717
#include "tier0/memdbgon.h"
1818

19-
#if !defined(COMPILER_MSVC64) && !defined(LINUX)
19+
#if !defined(COMPILER_MSVC64) && !defined(LINUX) && !defined(OSX)
2020
// Implement for 64-bit Windows if needed.
2121
// Clang hits "fatal error: error in backend:" and other errors when trying
2222
// to compile the inline assembly below. 3DNow support is highly unlikely to

public/tier0/platform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ inline T QWordSwapC( T dw )
10381038
// The typically used methods.
10391039
//-------------------------------------
10401040

1041-
#if (defined(__i386__) || defined(__amd64__) || (defined(__arm__) && defined(ANDROID))) && !defined(VALVE_LITTLE_ENDIAN)
1041+
#if (defined(__i386__) || defined(__amd64__) || defined(__arm__) || defined(__aarch64__)) && !defined(VALVE_LITTLE_ENDIAN)
10421042
#define VALVE_LITTLE_ENDIAN 1
10431043
#endif
10441044

public/togl/linuxwin/cglmtex.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ enum EGLMTexFlags
126126
kGLMTexMultisampled = 0x40, // has an RBO backing it. Cannot combine with Mipped, MippedAuto. One slice maximum, only targeting GL_TEXTURE_2D.
127127
// actually not 100% positive on the mipmapping, the RBO itself can't be mipped, but the resulting texture could
128128
// have mipmaps generated.
129-
kGLMTexDynamic = 0x80
130129
};
131130

132131
//===============================================================================
@@ -205,7 +204,6 @@ struct GLMTexLockParams
205204
// tells GLM to force re-read of the texels back from GL
206205
// i.e. "I know I stepped on those texels with a draw or blit - the GLM copy is stale"
207206
bool m_readback;
208-
bool m_readonly;
209207
};
210208

211209
struct GLMTexLockDesc
@@ -487,7 +485,7 @@ class CGLMTex
487485
int CalcSliceIndex( int face, int mip );
488486
void CalcTexelDataOffsetAndStrides( int sliceIndex, int x, int y, int z, int *offsetOut, int *yStrideOut, int *zStrideOut );
489487

490-
GLubyte *ReadTexels( GLMTexLockDesc *desc, bool readWholeSlice=true, bool readOnly=false );
488+
void ReadTexels( GLMTexLockDesc *desc, bool readWholeSlice=true );
491489
void WriteTexels( GLMTexLockDesc *desc, bool writeWholeSlice=true, bool noDataWrite=false );
492490
// last param lets us send NULL data ptr (only legal with uncompressed formats, beware)
493491
// this helps out ResetSRGB.
@@ -507,8 +505,6 @@ class CGLMTex
507505
// noWrite means send NULL for texel source addresses instead of actual data - ideal for RT's
508506

509507
GLuint m_texName; // name of this texture in the context
510-
GLuint m_pbo;
511-
GLubyte *m_mapped;
512508
GLenum m_texGLTarget;
513509
uint m_nSamplerType; // SAMPLER_2D, etc.
514510

public/togl/linuxwin/glfuncs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ GL_FUNC_VOID(OpenGL,true,glDrawArrays,(GLenum a,GLint b,GLsizei c),(a,b,c))
6363
GL_FUNC_VOID(OpenGL,true,glDrawBuffer,(GLenum a),(a))
6464
GL_FUNC_VOID(OpenGL,true,glDrawBuffers,(GLsizei a,const GLenum *b),(a,b))
6565
GL_FUNC_VOID(OpenGL,true,glDrawRangeElements,(GLenum a,GLuint b,GLuint c,GLsizei d,GLenum e,const GLvoid *f),(a,b,c,d,e,f))
66-
#ifndef OSX // 10.6/GL 2.1 compatability
66+
#if 1 //ifndef OSX // 10.6/GL 2.1 compatability
6767
GL_FUNC_VOID(OpenGL,true,glDrawRangeElementsBaseVertex,(GLenum a,GLuint b,GLuint c,GLsizei d,GLenum e,const GLvoid *f, GLenum g),(a,b,c,d,e,f,g))
6868
#endif
6969
GL_FUNC_VOID(OpenGL,true,glEnable,(GLenum a),(a))

public/togl/linuxwin/glmgr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ class GLMContext
14511451
void FlushDrawStatesNoShaders();
14521452

14531453
// drawing
1454-
#ifndef OSX
1454+
#if 1 //ifndef OSX
14551455
FORCEINLINE void DrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, uint baseVertex, CGLMBuffer *pIndexBuf );
14561456
void DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, uint baseVertex, CGLMBuffer *pIndexBuf );
14571457
#else
@@ -1911,7 +1911,7 @@ class GLMContext
19111911
CTSQueue<CGLMTex*> m_DeleteTextureQueue;
19121912
};
19131913

1914-
#ifndef OSX
1914+
#if 1 //ifndef OSX
19151915

19161916
FORCEINLINE void GLMContext::DrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, uint baseVertex, CGLMBuffer *pIndexBuf )
19171917
{

public/togles/linuxwin/glfuncs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ GL_FUNC_VOID(OpenGL,true,glWaitSync,(GLsync a, GLbitfield b, GLuint64 c),(a,b,c)
6666
GL_FUNC_VOID(OpenGL,true,glDeleteSync,(GLsync a),(a))
6767
GL_FUNC(OpenGL,true,GLsync,glFenceSync,(GLenum a, GLbitfield b),(a,b))
6868

69-
#ifndef OSX // 10.6/GL 2.1 compatability
69+
#if 1 //ifndef OSX // 10.6/GL 2.1 compatability
7070
GL_FUNC_VOID(OpenGL,true,glDrawRangeElementsBaseVertex,(GLenum a,GLuint b,GLuint c,GLsizei d,GLenum e,const GLvoid *f, GLenum g),(a,b,c,d,e,f,g))
7171
#endif
7272
GL_FUNC_VOID(OpenGL,true,glEnable,(GLenum a),(a))

public/togles/linuxwin/glmgr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ class GLMContext
13651365
void FlushDrawStatesNoShaders();
13661366

13671367
// drawing
1368-
#ifndef OSX
1368+
#if 1 //ifndef OSX
13691369
FORCEINLINE void DrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, uint baseVertex, CGLMBuffer *pIndexBuf );
13701370
void DrawRangeElementsNonInline( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, uint baseVertex, CGLMBuffer *pIndexBuf );
13711371
#else
@@ -1815,7 +1815,7 @@ class GLMContext
18151815
CTSQueue<CGLMTex*> m_DeleteTextureQueue;
18161816
};
18171817

1818-
#ifndef OSX
1818+
#if 1 //ifndef OSX
18191819

18201820
FORCEINLINE void GLMContext::DrawRangeElements( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices, uint baseVertex, CGLMBuffer *pIndexBuf )
18211821
{

0 commit comments

Comments
 (0)