bkaradzic / bgfx

Cross-platform, graphics API agnostic, "Bring Your Own Engine/Framework" style rendering library.
https://bkaradzic.github.io/bgfx/overview.html
BSD 2-Clause "Simplified" License
14.86k stars 1.93k forks source link

Cannot build ARM64 version for iOS #905

Closed neslib closed 8 years ago

neslib commented 8 years ago

Looks like the current toolchain and makefile does not support ARM64 for iOS (which is required by Apple).

Support can be easily added to the files bx/scripts/toolchain.lua and bgfx/makefile. I have attached modifications to these files for review. arm64.zip

meiry commented 8 years ago

i also looking now for tutorials on how to build this render on iOS with no much luck please share your findings Thank!

neslib commented 8 years ago

I have had a little bit of a wrestle with this myself. I am building the iOS static libraries for a Delphi language binding I am creating.

Building should be easy on OSX:

  1. navigate to the bgfx directory
  2. enter: make ios-arm-release

However, it seems that the current version does not compile because of references to the Metal framework. To work around this:

  1. Open /bgfx/scripts/bgfx.lua and remove the line towards the end saying: path.join(BGFX_DIR, "src/renderer_mtl.mm")
  2. Open /bgfx/src/bgfx.cpp and search for "mtl::rendererCreate". It is surrounded by an #if directive. Remove the "|| BX_PLATFORM_IOS" from the directive.

With that changes a attached to my first comment, you can build the 64-bit version using: make ios-arm64-release

meiry commented 8 years ago

Thanks , done this but im getting this error now :

In file included from ../../../src/hmd_openvr.cpp:9:
../../../3rdparty/openvr/openvr_capi.h:57:59: warning: integer literal is too large to be represented in type 'long' and is subject to undefined behavior under
      C++98, interpreting as 'unsigned long'; this literal will have type 'long long' in C++11 onwards [-Wc++11-compat]
static const unsigned int k_unTrackedDeviceIndexInvalid = 4294967295;
                                                          ^
1 warning generated.
hmd_ovr.cpp
image.cpp
renderer_d3d11.cpp
renderer_d3d12.cpp
renderer_d3d9.cpp
renderer_gl.cpp
renderer_mtl.mm
../../../src/renderer_mtl.mm:2418:25: fatal error: 'MTLTextureTypeCubeArray' is unavailable: not available on iOS
                                        desc.textureType = MTLTextureTypeCubeArray;
                                                           ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLTexture.h:27:5: note: 
      'MTLTextureTypeCubeArray' has been explicitly marked unavailable here
    MTLTextureTypeCubeArray NS_AVAILABLE_MAC(10_11) = 6,
    ^
1 error generated.
make[2]: *** [../../ios-arm/obj/Release/bgfx/src/renderer_mtl.o] Error 1
neslib commented 8 years ago

Please see my comment above for a (temporary) workaround for this

bkaradzic commented 8 years ago

@neslib you should submit PR for your toolchain.lua changes.

neslib commented 8 years ago

Thanks. Added PRs for both bx toolchain and bgfx makefile. This does not fix the issue reported by meiry above (that is a separate issue).

bkaradzic commented 8 years ago

Yeah, that's SDK version. I don't have workaround about that, Apple keeps their things incompatible. Upgrading it to latest would fix it.

neslib commented 8 years ago

OK. Will do. Thanks!