JodyAndrews / SDL2_Basic_Setup

A basic setup of SDL2 ( in my case for OSX Mojave and Catalina ) that initialises and demos SDL2, SDL2 Mixer, SDL2 Image, and SDL2 TTF
58 stars 16 forks source link

Xcode Project Issue #2

Open nighthawk469 opened 3 years ago

nighthawk469 commented 3 years ago

This project builds and runs fine when I use cmake to build a makefile. When I try to run with a generated Xcode project it generates a problem. I get a Thread "EXC_BAD_ACCESS" when trying to use the OpenSans-Regular.ttf font. It looks like it might not be able to find the resources directory.

I saw this cmake page about specifying MacOS resource files in a FRAMEWORK or BUNDLE and it looks related. https://cmake.org/cmake/help/latest/prop_tgt/RESOURCE.html

Screen Shot 2021-03-31 at 9 50 18 AM

JodyAndrews commented 3 years ago

Sorry for the delay, have been AFK. I steer away from Xcode as it gives me a headache, but had a brief look and you're right..

The CMake script assumes the binary would be within the root bin folder and copies the resources folder to there, however (presumably) Xcode is building to bin/Debug ( bin/{Environment} ) etc.

CMakeLists.txt.. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

Manually copying the resources to the real bin folder would work, in the short term.

Ideally the CMake script should handle it. Did you manage to update it at your end?

nighthawk469 commented 3 years ago

Ok cool. I did not get it working, but I might try your short term solution. If I make any progress I'll report back.