Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMakeList for iOS is incomplete - missing Metal. #3252

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 1 comment
Closed

CMakeList for iOS is incomplete - missing Metal. #3252

SDLBugzilla opened this issue Feb 11, 2021 · 1 comment
Milestone

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

Reported in version: 2.0.9
Reported for operating system, platform: Other, iPhone/iPod touch

Comments on the original bug report:

On 2019-05-03 10:01:37 +0000, Sev wrote:

Building for iOS using CMake will build without Metal support.

Editing CMakeList by adding:

if(SDL_VIDEO_RENDER_METAL)
    find_library(METAL Metal)
    list(APPEND EXTRA_LIBS ${METAL})
    file(GLOB RENDERER_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
    set(SOURCE_FILES ${SOURCE_FILES} ${RENDERER_SOURCES})
  endif()

And setting SDL_VIDEO_RENDER_METAL=1 for target_os == "darwin" will fix the issue - however I am not exactly sure what else is missing.

From what I understand, one needs to set a bunch of defines before compiling and it's not clear cut what defines needs to be set before compiling for each platform.

On 2019-05-03 10:15:26 +0000, Sev wrote:

Edit to CMakeList needs to go on line 1509 right before:
1509# iOS hack needed - http://code.google.com/p/ios-cmake/?

e.g

 if(SDL_VIDEO_RENDER_METAL)
    find_library(METAL Metal)
    list(APPEND EXTRA_LIBS ${METAL})
    file(GLOB RENDER_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
    set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_SOURCES})
  endif()

  1509   # iOS hack needed - http://code.google.com/p/ios-cmake/ ?
  1510   if(SDL_VIDEO)
  1511     if (IOS)
  1512       set(SDL_VIDEO_DRIVER_UIKIT 1)
  1513       file(GLOB UIKITVIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/uikit/*.m)
  1514       set(SOURCE_FILES ${SOURCE_FILES} ${UIKITVIDEO_SOURCES})
  1515     else()
  1516       CheckCOCOA()
  1517       if(VIDEO_OPENGL)
  1518         set(SDL_VIDEO_OPENGL 1)
  1519         set(SDL_VIDEO_OPENGL_CGL 1)
  1520         set(SDL_VIDEO_RENDER_OGL 1)
  1521         set(HAVE_VIDEO_OPENGL TRUE)
  1522       endif()
  1523 
  1524       if(VIDEO_OPENGLES)
  1525         set(SDL_VIDEO_OPENGL_EGL 1)
  1526         set(SDL_VIDEO_OPENGL_ES2 1)
  1527         set(SDL_VIDEO_RENDER_OGL_ES2 1)
  1528         set(HAVE_VIDEO_OPENGLES TRUE)
  1529       endif()
  1530     endif()
  1531   endif()

On 2019-05-03 10:16:36 +0000, Sev wrote:

I've noticed that there's also use of ./autoconf and configure is the idea that CMake is to replace those, or are they supposed to be complimentary?

@icculus icculus removed the bug label Nov 30, 2021
@icculus icculus added this to the 2.0.20 milestone Nov 30, 2021
@icculus
Copy link
Collaborator

icculus commented Feb 7, 2022

CMake supports Metal now, we can close this.

@icculus icculus closed this as completed Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants