widberg / bgfx.cmake

https://github.com/bkaradzic/bgfx.cmake. Independently maintained CMake build scripts for bgfx. Released under public domain.
https://github.com/bkaradzic/bgfx.cmake
Creative Commons Zero v1.0 Universal
286 stars 254 forks source link

Use built-in cmake support for building iOS #57

Closed JonnyPtn closed 5 years ago

JonnyPtn commented 5 years ago

Cmake Have added official support for iOS so we don't need to maintain a custom toolchain file anymore. I also Added some extra parameters required for the iOS examples to work, and some steps to copy (or symlink) resources into the output folder for a more "plug and play" experience with the examples

This does come with a caveat that the cmake version used to build iOS must be higher than the one currently set in the CMakeLists.txt (3.0, which is >5 years old now I think). I've tested and it works with the latest version distributed by homebrew (3.15.2). I was reluctant to increase the required version in the cmakelists as it's only really relevant for iOS.

The changes here also make building the examples on travis possible again, which I have added

pezcode commented 5 years ago

For symlink creation on Windows, there's a workaround by creating what's called a junction instead of a symlink. I guess CMake's create_symlink command doesn't even bother because it only works for directories.

add_custom_command( TARGET example-${ARG_NAME} COMMAND IF NOT EXIST $<TARGET_FILE_DIR:example-${ARG_NAME}>/font mklink /J $<TARGET_FILE_DIR:example-${ARG_NAME}>/font ${BGFX_DIR}/examples/runtime/font)
# ...
# the other directories

Might get messy with the if/else logic though.

JonnyPtn commented 5 years ago

Yeah the messy stuff is why I opted for just copying the files, but can change if requested