From d7a9b56dc6367cfb9ec60489661a88b0655405a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 19 Jun 2015 17:34:01 -0700 Subject: [PATCH] Added ObjC amalgamated file. --- scripts/bgfx.lua | 22 ++++++++++++++++------ src/amalgamated.cpp | 1 - src/amalgamated.mm | 9 +++++++++ src/{renderer_mtl.cpp => renderer_mtl.mm} | 2 +- 4 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 src/amalgamated.mm rename src/{renderer_mtl.cpp => renderer_mtl.mm} (89%) diff --git a/scripts/bgfx.lua b/scripts/bgfx.lua index 28d4f766b..39fed34df 100644 --- a/scripts/bgfx.lua +++ b/scripts/bgfx.lua @@ -86,11 +86,6 @@ function bgfxProject(_name, _kind, _defines) "/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata } - configuration { "xcode4 or osx or ios*" } - files { - path.join(BGFX_DIR, "src/**.mm"), - } - configuration { "osx" } links { "Cocoa.framework", @@ -136,14 +131,29 @@ function bgfxProject(_name, _kind, _defines) path.join(BGFX_DIR, "src/renderer_d3d9.cpp"), path.join(BGFX_DIR, "src/renderer_d3d11.cpp"), path.join(BGFX_DIR, "src/renderer_d3d12.cpp"), - path.join(BGFX_DIR, "src/renderer_mtl.cpp"), path.join(BGFX_DIR, "src/renderer_null.cpp"), path.join(BGFX_DIR, "src/renderer_gl.cpp"), path.join(BGFX_DIR, "src/renderer_vk.cpp"), path.join(BGFX_DIR, "src/vertexdecl.cpp"), } + + configuration { "xcode4 or osx or ios*" } + excludes { + path.join(BGFX_DIR, "src/glcontext_eagl.mm"), + path.join(BGFX_DIR, "src/glcontext_nsgl.mm"), + path.join(BGFX_DIR, "src/renderer_mtl.mm"), + path.join(BGFX_DIR, "src/amalgamated.cpp"), + } else + configuration { "xcode4 or osx or ios*" } + files { + path.join(BGFX_DIR, "src/glcontext_eagl.mm"), + path.join(BGFX_DIR, "src/glcontext_nsgl.mm"), + path.join(BGFX_DIR, "src/renderer_mtl.mm"), + } + excludes { + path.join(BGFX_DIR, "src/amalgamated.mm"), path.join(BGFX_DIR, "src/amalgamated.cpp"), } end diff --git a/src/amalgamated.cpp b/src/amalgamated.cpp index 6c0238bdf..2a88eeab6 100644 --- a/src/amalgamated.cpp +++ b/src/amalgamated.cpp @@ -14,7 +14,6 @@ #include "renderer_d3d9.cpp" #include "renderer_d3d11.cpp" #include "renderer_d3d12.cpp" -#include "renderer_mtl.cpp" #include "renderer_null.cpp" #include "renderer_gl.cpp" #include "renderer_vk.cpp" diff --git a/src/amalgamated.mm b/src/amalgamated.mm new file mode 100644 index 000000000..6781cf9f8 --- /dev/null +++ b/src/amalgamated.mm @@ -0,0 +1,9 @@ +/* + * Copyright 2011-2015 Branimir Karadzic. All rights reserved. + * License: http://www.opensource.org/licenses/BSD-2-Clause + */ + +#include "amalgamated.cpp" +#include "glcontext_eagl.mm" +#include "glcontext_nsgl.mm" +#include "renderer_mtl.mm" diff --git a/src/renderer_mtl.cpp b/src/renderer_mtl.mm similarity index 89% rename from src/renderer_mtl.cpp rename to src/renderer_mtl.mm index feeddd00a..5318f04f6 100644 --- a/src/renderer_mtl.cpp +++ b/src/renderer_mtl.mm @@ -5,7 +5,7 @@ #include "bgfx_p.h" #if BGFX_CONFIG_RENDERER_METAL -# include "../../bgfx-ext/src/renderer_mtl.cpp" +# include "../../bgfx-ext/src/renderer_mtl.mm" #else namespace bgfx { namespace mtl