/SFML-Xcode

A Basic Makefile for Compiling an SFML Project

Primary LanguageMakefileCreative Commons Zero v1.0 UniversalCC0-1.0

SFML-Xcode

A Basic Makefile for Compiling an SFML Project

This setup targets beginning programmers who use Xcode on MacOS.

Steps:

  1. Download SFML from https://sfml-dev.org. There are two different downloads for the Mac, depending on your CPU. To find your CPU type, visit the Apple menu in the upper left corner of the display and choose "About This Mac". If the "Chip" is given as Apple M1, M2, or M3, then you have an ARM CPU (newer Macs). Otherwise you have an Intel CPU. Here are download links as of 2023-11-26. Choose the one for your "Chip".

Screenshot 2023-11-26 at 10 05 59 AM

  1. Extract the download to a place you can easily find. When I opened the download in Safari, it automatically extracts the file into my Downloads directory. You can move and/or rename the folder. Example: I placed the folder in my Home directory (Finder -> Go -> Home) and renamed it to SFML-2.6.1.

  2. Create a Project in Xcode of type "External Build System".

Screenshot 2023-11-26 at 11 07 47 AM

You should see "/usr/bin/make" for the "Build Tool" as follows. (If you don't see this, likely this tutorial is out of date.)

Screenshot 2023-11-26 at 11 08 37 AM

  1. Add my main.cpp, Makefile, and sfml.xcconfig files to your project. Change the first line of Makefile to reflect where you extracted the SFML library. (If you placed it in your Home directory with name SFML-2.6.1 you do not have to make any changes.) Edit the part of the first line after "${HOME}/".

SFML_DIR=${HOME}/SFML-2.6.1

so if you extrracted the library into your Downloads folder and did not rename, you can try changing the first line to

SFML_DIR=${HOME}/Downloads/SFML-2.6.1-macOS-clang-64-bit

for Intel CPUs, or

SFML_DIR=${HOME}/Downloads/SFML-2.6.1-macOS-clang-arm64

for ARM CPUs.

  1. Try to build it. If building was successful, you should add the executable to your project's "scheme".
Screenshot 2023-11-26 at 12 30 06 PM Screenshot 2023-11-26 at 12 31 21 PM Screenshot 2023-11-26 at 12 32 27 PM