Using XCode on macOS

Last updated: 2022-02-20

  1. Download XCode from the AppStore if you haven't already
    1. Execute the following command to install the XCode command line tools if you haven't already: sudo xcode-select --install
  2. Clone the repository. The cloning feature of XCode did't work correctly on my machine, so I cloned it from the command line: git clone --recurse-submodules -j8 https://www.github.com/bb1950328/BrickSim.git
  3. In the terminal, navigate to the cloned folder and execute ./setup_workspace.sh
  4. Install CMake. You can install the CMake GUI from here or just the command line version with brew install cmake
  5. Then you can generate the XCode project files.
    • If you have the CMake GUI, you can configure the project like this:

      1. Set the path of the directory you just cloned BrickSim into: configure CMake Project for Xcode using CMake GUI
      2. Click on "Configure" (Click on "Yes" if the question "Build directory does not exist, should I create it?" pops up: configure CMake Project for Xcode using CMake GUI
      3. Click on "Done" after setting the generator to "Xcode". After waiting a minute, the window should look like this: configure CMake Project for Xcode using CMake GUI
      4. Check the log in the lower part of the window. Warnings are OK, errors are not. When there are no errors, click the "Generate" Button.
      5. The "Open Project" Button isn't greyed out anymore, and you can click it too.
    • If you have the command line cmake, execute the following commands:

      1
      2
      3
      
      mkdir -p cmake-build
      cd cmake-build
      cmake -G Xcode ..
      

      (you have to be inside the BrickSim directory initially) Then you can open the project in Xcode.

  6. When Xcode has loaded the project, you have to switch the target to BrickSim: Xcode target selection
  7. After that, you should be able to build and run BrickSim. Happy coding!