| Summary: | fatal error: 'Cocoa/Cocoa.h' file not found in iOS build | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Steve Robinson <ssrobins> |
| Component: | build | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | major | ||
| Priority: | P2 | CC: | sezeroz |
| Version: | 2.0.15 | ||
| Hardware: | iPhone/iPod touch | ||
| OS: | macOS 10.15 | ||
I _think_ the fix should be like in the following patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1670,7 +1670,11 @@
message_error("SDL_FILE must be enabled to build on MacOS X")
endif()
- file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m)
+ if(IOS OR TVOS)
+ file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/ios/*.m)
+ else()
+ file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m)
+ endif()
set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES})
set(HAVE_SDL_MISC TRUE)
Yup, that's a way better fix. Verified that it worked. Thanks! (In reply to Steve Robinson from comment #2) > Yup, that's a way better fix. Verified that it worked. Thanks! Patch applied as https://hg.libsdl.org/SDL/rev/cf578732c7e7 Closing as fixed. |
When trying to build 2.0.14 from source on iOS using CMake, I get this error: SDL_sysurl.m:24:9: fatal error: 'Cocoa/Cocoa.h' file not found #import <Cocoa/Cocoa.h> Since this is using Cocoa, I don't think it's meant for iOS. So I fixed it by changing this in CMakeLists.txt: file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) To: if(NOT IOS) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/macosx/*.m) set(SOURCE_FILES ${SOURCE_FILES} ${MISC_SOURCES}) set(HAVE_SDL_MISC TRUE) endif() Environment: CMake: 3.19.2 Xcode: 12.3 macOS: 11.1